vcl/Library_vclplug_qt5.mk | 1 vcl/Library_vclplug_qt6.mk | 1 vcl/inc/qt5/QtInstanceBuilder.hxx | 2 vcl/inc/qt5/QtInstanceFrame.hxx | 28 +++ vcl/inc/qt6/QtInstanceFrame.hxx | 12 + vcl/qt5/QtInstanceBuilder.cxx | 10 - vcl/qt5/QtInstanceFrame.cxx | 41 +++++ vcl/qt6/QtInstanceFrame.cxx | 12 + writerperfect/uiconfig/ui/exportepub.ui | 230 ++++++++++++++++---------------- 9 files changed, 218 insertions(+), 119 deletions(-)
New commits: commit 17dfa97f642394f6ec583362032debaf9ea922ef Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 25 10:11:42 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 25 18:44:41 2024 +0200 tdf#130857 exportepub.ui Define frames in order Move the definition of the "customize" frame above the "metadata" one in the .ui file so that it matches the visual appearance, which makes sure that tab focus order with the Qt-based VCL plugins is correct as well for Writer's "File" -> "Export As" -> "Export as EPUB" dialog. See commit 02692566ad9fc7c3484f8581ffa0004cd4e43987 Author: Michael Weghorn <[email protected]> Date: Thu Oct 24 17:43:35 2024 +0200 tdf#130857 optnewdictionarydialog.ui: Define focusable widgets in order for more background. Change-Id: I1db418d4c6394fd8dd0db5127dbcd8e3f0dc09c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175627 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/writerperfect/uiconfig/ui/exportepub.ui b/writerperfect/uiconfig/ui/exportepub.ui index 0d7730fdd57b..3040d2d8485f 100644 --- a/writerperfect/uiconfig/ui/exportepub.ui +++ b/writerperfect/uiconfig/ui/exportepub.ui @@ -215,6 +215,121 @@ <property name="top-attach">0</property> </packing> </child> + <child> + <object class="GtkFrame" id="customize"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border-width">6</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> + <child> + <!-- n-columns=3 n-rows=2 --> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">12</property> + <property name="margin-top">6</property> + <property name="hexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> + <child> + <object class="GtkLabel" id="coverimageft"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="exportepub|coverimageft">Cover image:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">coverpath</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="coverpath"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="activates-default">True</property> + <property name="truncate-multiline">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="coverbutton"> + <property name="label" translatable="yes" context="exportepub|coverbutton">Browse...</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="mediadirft"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="exportepub|mediadirft">Media directory:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">mediadir</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="mediadir"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="activates-default">True</property> + <property name="truncate-multiline">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="mediabutton"> + <property name="label" translatable="yes" context="exportepub|mediabutton">Browse...</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">1</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="customizeft"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="exportepub|customizeft">Customize</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> <child> <object class="GtkFrame" id="metadata"> <property name="visible">True</property> @@ -388,121 +503,6 @@ <property name="top-attach">2</property> </packing> </child> - <child> - <object class="GtkFrame" id="customize"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="border-width">6</property> - <property name="label-xalign">0</property> - <property name="shadow-type">none</property> - <child> - <!-- n-columns=3 n-rows=2 --> - <object class="GtkGrid" id="grid1"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="margin-start">12</property> - <property name="margin-top">6</property> - <property name="hexpand">True</property> - <property name="row-spacing">6</property> - <property name="column-spacing">12</property> - <child> - <object class="GtkLabel" id="coverimageft"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes" context="exportepub|coverimageft">Cover image:</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">coverpath</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="coverpath"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="activates-default">True</property> - <property name="truncate-multiline">True</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="coverbutton"> - <property name="label" translatable="yes" context="exportepub|coverbutton">Browse...</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - </object> - <packing> - <property name="left-attach">2</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="mediadirft"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes" context="exportepub|mediadirft">Media directory:</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">mediadir</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="mediadir"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="activates-default">True</property> - <property name="truncate-multiline">True</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="mediabutton"> - <property name="label" translatable="yes" context="exportepub|mediabutton">Browse...</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - </object> - <packing> - <property name="left-attach">2</property> - <property name="top-attach">1</property> - </packing> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel" id="customizeft"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes" context="exportepub|customizeft">Customize</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> commit 21bf1509f2ab445c5bc46c839e89d1d6ad1c6b6d Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 25 10:08:35 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 25 18:44:34 2024 +0200 tdf#130857 qt weld: Declare support for "Export as EPUB" dialog Add .ui file of Writer's "File" -> "Export as" -> "Export as EPUB" dialog to list of files supported by QtInstanceBuilder, so that native Qt widgets are used for that dialog now when using the qt5/qt6 VCL plugins, unless environment variable SAL_VCL_QT_NO_WELDED_WIDGETS=1 is set. Change-Id: I6509dbccc3bcb8714a4cdeb23925c66057723a8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175626 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 540d7325b385..5202760e5c68 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -47,6 +47,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) u"sfx/ui/querysavedialog.ui"_ustr, u"svt/ui/printersetupdialog.ui"_ustr, u"svt/ui/restartdialog.ui"_ustr, + u"writerperfect/ui/exportepub.ui"_ustr, }; return aSupportedUIFiles.contains(rUIFile); commit 0a4ec73c23678cc1008f191a08963c331255db61 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 25 10:04:10 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 25 18:44:27 2024 +0200 tdf#130857 qt weld: Add a QtInstanceFrame Add new class QtInstanceFrame as a native Qt implementation for weld::Frame. This uses a QGroupBox as a widget, see commit e2e59d2da1aa4c9f8df62e5a072f0f2cd931781b Author: Michael Weghorn <[email protected]> Date: Fri Oct 4 10:38:32 2024 +0200 tdf#130857 qt weld: Create QGroupBox for "GtkFrame" Return an instance of it in QtInstanceBuilder::weld_frame. This is used e.g. by the "File" -> "Export as" -> "Export as EPUB" dialog in Writer. Change-Id: I099b8f38fb884881d8d8db38aa918c76f25b6d5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175625 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk index b80fefe7947c..5f3ca52b6ee7 100644 --- a/vcl/Library_vclplug_qt5.mk +++ b/vcl/Library_vclplug_qt5.mk @@ -102,6 +102,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/QtInstanceComboBox \ vcl/qt5/QtInstanceDialog \ vcl/qt5/QtInstanceEntry \ + vcl/qt5/QtInstanceFrame \ vcl/qt5/QtInstanceMessageDialog \ vcl/qt5/QtInstanceLabel \ vcl/qt5/QtInstanceTextView \ diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk index 89628d93fd93..47a11d9c09db 100644 --- a/vcl/Library_vclplug_qt6.mk +++ b/vcl/Library_vclplug_qt6.mk @@ -101,6 +101,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\ vcl/qt6/QtInstanceContainer \ vcl/qt6/QtInstanceDialog \ vcl/qt6/QtInstanceEntry \ + vcl/qt6/QtInstanceFrame \ vcl/qt6/QtInstanceLabel \ vcl/qt6/QtInstanceMessageDialog \ vcl/qt6/QtInstanceTextView \ diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx b/vcl/inc/qt5/QtInstanceBuilder.hxx index 4a5fc1d0d02a..2bae1fdca3b2 100644 --- a/vcl/inc/qt5/QtInstanceBuilder.hxx +++ b/vcl/inc/qt5/QtInstanceBuilder.hxx @@ -37,7 +37,7 @@ public: virtual std::unique_ptr<weld::Container> weld_container(const OUString&) override; virtual std::unique_ptr<weld::Box> weld_box(const OUString&) override; virtual std::unique_ptr<weld::Paned> weld_paned(const OUString&) override; - virtual std::unique_ptr<weld::Frame> weld_frame(const OUString&) override; + virtual std::unique_ptr<weld::Frame> weld_frame(const OUString& rId) override; virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const OUString&, bool bUserManagedScrolling = false) override; virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString&) override; diff --git a/vcl/inc/qt5/QtInstanceFrame.hxx b/vcl/inc/qt5/QtInstanceFrame.hxx new file mode 100644 index 000000000000..78a9dc304c8e --- /dev/null +++ b/vcl/inc/qt5/QtInstanceFrame.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtInstanceContainer.hxx" + +#include <QtWidgets/QGroupBox> + +class QtInstanceFrame : public QtInstanceContainer, public virtual weld::Frame +{ + QGroupBox* m_pGroupBox; + +public: + QtInstanceFrame(QGroupBox* pGroupBox); + + virtual void set_label(const OUString& rText) override; + virtual OUString get_label() const override; + virtual std::unique_ptr<weld::Label> weld_label_widget() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstanceFrame.hxx b/vcl/inc/qt6/QtInstanceFrame.hxx new file mode 100644 index 000000000000..70b53ba816b5 --- /dev/null +++ b/vcl/inc/qt6/QtInstanceFrame.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceFrame.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 9e76483c9bed..540d7325b385 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -15,6 +15,7 @@ #include <QtInstanceCheckButton.hxx> #include <QtInstanceComboBox.hxx> #include <QtInstanceEntry.hxx> +#include <QtInstanceFrame.hxx> #include <QtInstanceLabel.hxx> #include <QtInstanceMessageDialog.hxx> #include <QtInstanceTextView.hxx> @@ -105,10 +106,12 @@ std::unique_ptr<weld::Paned> QtInstanceBuilder::weld_paned(const OUString&) return nullptr; } -std::unique_ptr<weld::Frame> QtInstanceBuilder::weld_frame(const OUString&) +std::unique_ptr<weld::Frame> QtInstanceBuilder::weld_frame(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QGroupBox* pGroupBox = m_xBuilder->get<QGroupBox>(rId); + std::unique_ptr<weld::Frame> xRet(pGroupBox ? std::make_unique<QtInstanceFrame>(pGroupBox) + : nullptr); + return xRet; } std::unique_ptr<weld::ScrolledWindow> QtInstanceBuilder::weld_scrolled_window(const OUString&, bool) diff --git a/vcl/qt5/QtInstanceFrame.cxx b/vcl/qt5/QtInstanceFrame.cxx new file mode 100644 index 000000000000..94ebc831d80f --- /dev/null +++ b/vcl/qt5/QtInstanceFrame.cxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <QtInstanceFrame.hxx> + +#include <vcl/qt/QtUtils.hxx> + +QtInstanceFrame::QtInstanceFrame(QGroupBox* pGroupBox) + : QtInstanceContainer(pGroupBox) +{ +} + +void QtInstanceFrame::set_label(const OUString& rText) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pGroupBox->setTitle(toQString(rText)); }); +} + +OUString QtInstanceFrame::get_label() const +{ + SolarMutexGuard g; + + OUString sLabel; + GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pGroupBox->title()); }); + + return sLabel; +} + +std::unique_ptr<weld::Label> QtInstanceFrame::weld_label_widget() const +{ + assert(false && "Not implemented yet"); + return nullptr; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt6/QtInstanceFrame.cxx b/vcl/qt6/QtInstanceFrame.cxx new file mode 100644 index 000000000000..a620a15ca58b --- /dev/null +++ b/vcl/qt6/QtInstanceFrame.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceFrame.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
