View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017432 | Scribus | User Interface | public | 2025-02-28 10:13 | 2025-11-20 07:29 |
| Reporter | ale | Assigned To | nitramr | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | assigned | Resolution | open | ||
| Product Version | 1.7.1.svn | ||||
| Summary | 0017432: Getting Qt-Advanced-Docking-System to work correctly with tiling window managers | ||||
| Description | on my computer, with dwm, once a palette is made floating: - it does not behave well - the only way to dock it again is to remove the scribus settings. i got to test scribus with sway in x11 mode and it's somehow ok, but also not really good. one difference is that sway shows a title on top of the floating palette, dwm never add a title bar (but shows it when it's there, like in the older scribus palettes). i have to do some further tests, but it seems that we need to find a way to add the title bar and to correctly the palette as floating. my first tests with the ADS demo programs show the same issues as in scribus. | ||||
| Tags | No tags attached. | ||||
| Patch | No | ||||
|
|
I replaced the Qt-Advanced-Docking System with KDDockWidgets. Steps 1. Download KDDockWidgets from https://github.com/KDAB/KDDockWidgets 2. Put the root folder into scribus -> third_party 3. Check if the root folders name is "KDDockWidgets" 4. Apply the fix below If you want to test it under Wayland modify the main_nix.cpp in scribus folder Remove the following code: ``` #if !defined(Q_OS_MACOS) qputenv("QT_QPA_PLATFORM", "xcb"); #endif if (QApplication::platformName() == "wayland") { QString errHdr = QObject::tr("Fatal Error"); QString errMsg = QObject::tr("Scribus does not support the Wayland platform. Use XWayland to run Scribus on Wayland. Scribus will close now."); if (app.useGUI) { QMessageBox::critical(nullptr, errHdr, errMsg); } else { std::cout << errHdr.toStdString() << std::endl; std::cout << "-------------" << std::endl; std::cout << errMsg.toStdString() << std::endl; } return EXIT_FAILURE; } ``` kddock_2025-10-31_01.patch (47,965 bytes)
Index: CMakeLists_Dependencies.cmake
===================================================================
--- CMakeLists_Dependencies.cmake (Revision 27098)
+++ CMakeLists_Dependencies.cmake (Arbeitskopie)
@@ -317,7 +317,3 @@
message("Harfbuzz subset library Found OK")
set (HAVE_HARFBUZZ_SUBSET ON)
endif()
-
-#if(WANT_QTADS)
- set(HAVE_QTADS ON)
-#endif()
Index: config.h.cmake
===================================================================
--- config.h.cmake (Revision 27098)
+++ config.h.cmake (Arbeitskopie)
@@ -14,7 +14,6 @@
#cmakedefine BUILD_MAC_BUNDLE
#cmakedefine DLL_USE_NATIVE_API 1
#cmakedefine GMAGICK_FOUND 1
-#cmakedefine HAVE_QTADS 1
#cmakedefine HAVE_BOOST 1
#cmakedefine HAVE_CAIRO 1
#cmakedefine HAVE_CUPS 1
Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt (Revision 27098)
+++ scribus/CMakeLists.txt (Arbeitskopie)
@@ -59,11 +59,10 @@
set_property(SOURCE third_party/fparser/file.hh PROPERTY SKIP_AUTOGEN ON)
set_property(SOURCE third_party/fparser/fparser.hh PROPERTY SKIP_AUTOGEN ON)
-#if(WANT_QTADS)
- MESSAGE(STATUS "Qt Advanced Docking System included")
- link_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/Qt-Advanced-Docking-System)
-#endif()
+MESSAGE(STATUS "KDDock System included")
+link_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/KDDockWidgets)
+
link_directories(
${CMAKE_CURRENT_BINARY_DIR}/third_party/wpg
${CMAKE_CURRENT_BINARY_DIR}/third_party/pgf
@@ -292,9 +291,7 @@
${SCRIBUS_RTF_LIB}
)
-#if(WANT_QTADS)
- target_link_libraries(${EXE_NAME} PUBLIC qt6advanceddocking)
-#endif()
+target_link_libraries(${EXE_NAME} PUBLIC KDAB::kddockwidgets)
if(WITH_TESTS)
target_link_libraries(${EXE_NAME} PRIVATE
Index: scribus/manager/dock_manager.cpp
===================================================================
--- scribus/manager/dock_manager.cpp (Revision 27098)
+++ scribus/manager/dock_manager.cpp (Arbeitskopie)
@@ -26,12 +26,12 @@
#include "dock_manager.h"
#include <QMenu>
-#include "third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h"
#include "ui/docks/dock_centralwidget.h"
#include "iconmanager.h"
#include "prefsmanager.h"
#include "scribusapp.h"
+#include "scribus.h"
#include "ui/aligndistribute.h"
#include "ui/bookmarkpalette.h"
#include "ui/contentpalette.h"
@@ -44,7 +44,9 @@
#include "ui/symbolpalette.h"
#include "undogui.h"
+#include <kddockwidgets/LayoutSaver.h>
+
/* ********************************************************************************* *
*
* Constructor + Setup
@@ -51,31 +53,29 @@
*
* ********************************************************************************* */
-DockManager::DockManager(QWidget *parent)
- : CDockManager(parent)
+DockManager::DockManager(ScribusMainWindow *mainwindow)
+ : QObject(mainwindow)
{
- dockCenter = new DockCentralWidget();
- auto *areaCenter = CDockManager::setCentralWidget(dockCenter);
- areaCenter->setAllowedAreas(LeftDockWidgetArea | RightDockWidgetArea);
+ dockCenter = new DockCentralWidget();
+ m_mainwindow = mainwindow;
+ m_mainwindow->setPersistentCentralWidget(dockCenter);
- setStyleSheet(""); // reset style sheet to use custom icons
-
connect( ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()) );
}
void DockManager::setupDocks()
{
- pagePalette = new PagePalette((QWidget *) this->parent());
- contentPalette = new ContentPalette(this);
- propertiesPalette = new PropertiesPalette(this);
- outlinePalette = new OutlinePalette(this);
- layerPalette = new LayerPalette(this);
- inlinePalette = new InlinePalette(this);
+ pagePalette = new PagePalette();
+ contentPalette = new ContentPalette();
+ propertiesPalette = new PropertiesPalette();
+ outlinePalette = new OutlinePalette();
+ layerPalette = new LayerPalette();
+ inlinePalette = new InlinePalette();
alignDistributePalette = new AlignDistributePalette();
- scrapbookPalette = new Biblio(this);
- bookPalette = new BookPalette(this);
- undoPalette = new UndoPalette(this);
- symbolPalette = new SymbolPalette(this);
+ scrapbookPalette = new Biblio();
+ bookPalette = new BookPalette();
+ undoPalette = new UndoPalette();
+ symbolPalette = new SymbolPalette();
// Apply common configuration for each palette
configureDock(pagePalette);
@@ -111,38 +111,16 @@
void DockManager::initWorkspaces()
{
createDefaultWorkspace();
-// restoreWorkspaceFromPrefs();
}
-void DockManager::removeAllDockWidgets()
-{
- QMap<QString, CDockWidget *> map = dockWidgetsMap();
- foreach (QString key, map.keys())
- removeDockWidget(map.value(key));
-}
-void DockManager::hideAllDocks()
-{
- foreach (CDockWidget *dock, this->dockWidgets())
- {
- if(dock->isCentralWidget())
- continue;
- dock->closeDockWidget();
- }
-
- foreach (CFloatingDockContainer *dockContainer, this->floatingWidgets())
- {
- dockContainer->close();
- }
-}
-
void DockManager::toggleDocksVisibility()
{
- QString perspective = "_allpaletteshidden";
+ QString perspective = "e494294a-65b4-4ca5-a018-1fe741dbd1c3";
- if(perspectiveNames().contains(perspective))
+ if(m_perspectives.contains(perspective))
{
- openPerspective(perspective);
+ loadPerspective(perspective);
removePerspective(perspective);
m_dockTemporaryHidden = false;
}
@@ -149,11 +127,8 @@
else
{
addPerspective(perspective);
- hideAllDocks();
+ emit hideAllDocks();
m_dockTemporaryHidden = true;
-
-// qDebug() << Q_FUNC_INFO << this->dockWidgets();
-// qDebug() << Q_FUNC_INFO << this->floatingWidgets();
}
}
@@ -163,79 +138,57 @@
return m_dockTemporaryHidden;
}
-CDockAreaWidget *DockManager::addDockFromPlugin(CDockWidget *dock, bool closed)
+DockPanelBase *DockManager::addDockFromPlugin(DockPanelBase *dock, bool closed)
{
- CDockAreaWidget *a = addDockWidget(RightDockWidgetArea, dock, dockCenter->dockAreaWidget());
- dock->toggleView(!closed);
- updateIcon(dock);
configureDock(dock);
- return a;
+
+ m_mainwindow->addDockWidget(dock, KDDockWidgets::Location_OnLeft);
+
+ if (closed)
+ dock->close();
+ else
+ dock->open();
+
+ return dock;
}
void DockManager::restoreWorkspaceFromPrefs()
{
- QByteArray ba = PrefsManager::instance().appPrefs.uiPrefs.adsDockState;
+ QByteArray ba = QByteArray::fromHex(PrefsManager::instance().appPrefs.uiPrefs.adsDockState);
if(ba.isEmpty())
return;
- this->restoreState(ba);
+ KDDockWidgets::RestoreOptions options = KDDockWidgets::RestoreOption_None;
+
+ KDDockWidgets::LayoutSaver saver(options);
+ saver.restoreLayout(ba);
}
void DockManager::saveWorkspaceToPrefs()
{
- PrefsManager::instance().appPrefs.uiPrefs.adsDockState = this->saveState();
+ KDDockWidgets::LayoutSaver saver;
+ QByteArray data = saver.serializeLayout();
+
+ PrefsManager::instance().appPrefs.uiPrefs.adsDockState = data.toHex();
}
void DockManager::iconSetChange()
{
- // Update all icons of each docked CDockContainer
- updateIcons(this->dockWidgets());
- // Update all icons of each floating CFloatingDockContainer
- foreach (CFloatingDockContainer *dockContainer, this->floatingWidgets())
- updateIcons(dockContainer->dockWidgets());
}
void DockManager::restoreHiddenWorkspace()
{
- if (m_dockTemporaryHidden)
+ if (hasTemporaryHiddenDocks())
toggleDocksVisibility();
}
-void DockManager::updateIcons(QList<CDockWidget *> dockWidgets)
+void DockManager::configureDock(DockPanelBase *dock)
{
- foreach (CDockWidget *dock, dockWidgets)
- updateIcon(dock);
+ connect(this, &DockManager::hideAllDocks, dock, &DockPanelBase::close);
}
-void DockManager::updateIcon(CDockWidget *dockWidget)
-{
- IconManager &iconManager = IconManager::instance();
-
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonClose)->setIcon(iconManager.loadIcon("close", 12));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonUndock)->setIcon(iconManager.loadIcon("dock-float", 16));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonTabsMenu)->setIcon(iconManager.loadIcon("menu-down", 16));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonAutoHide)->setIcon(iconManager.loadIcon("dock-auto-hide", 16));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonMinimize)->setIcon(iconManager.loadIcon("dock-minimize", 16));
-
- for (auto tabCloseButton : dockWidget->dockAreaWidget()->findChildren<QAbstractButton*>("tabCloseButton"))
- tabCloseButton->setIcon(iconManager.loadIcon("close", 12));
-}
-
-void DockManager::configureDock(CDockWidget *dock)
-{
- /*
- * MinimumSizeHintFromContent
- * MinimumSizeHintFromDockWidgetMinimumSize
- * MinimumSizeHintFromContentMinimumSize
- */
-
- dock->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidgetMinimumSize);
- dock->setMinimumWidth(dock->widget()->minimumSizeHint().width());
- connect( dock, &CDockWidget::viewToggled, this, &DockManager::restoreHiddenWorkspace);
-}
-
void DockManager::createDefaultWorkspace()
{
/************************************************************
@@ -257,56 +210,75 @@
*
*************************************************************/
- auto *areaCenter = dockCenter->dockAreaWidget();
+ const QSize m_preferredSize(QSize(290, 0));
+ KDDockWidgets::InitialOption hiddenPalette(KDDockWidgets::InitialVisibilityOption::StartHidden, m_preferredSize);
+ KDDockWidgets::InitialOption visiblePalette(KDDockWidgets::InitialVisibilityOption::StartVisible, m_preferredSize);
+ KDDockWidgets::InitialOption passivePalette(KDDockWidgets::InitialVisibilityOption::PreserveCurrentTab, m_preferredSize);
// Left
- auto *areaLeft = addDockWidget(LeftDockWidgetArea, pagePalette, areaCenter);
- addDockWidgetTabToArea(outlinePalette, areaLeft);
+ m_mainwindow->addDockWidget(pagePalette, KDDockWidgets::Location_OnLeft, nullptr, visiblePalette);
+ pagePalette->addDockWidgetAsTab(outlinePalette, hiddenPalette);
- // Left Center
- auto *areaCenterLeft = addDockWidget(LeftDockWidgetArea, inlinePalette, areaCenter);
- addDockWidgetTabToArea(scrapbookPalette, areaCenterLeft);
- addDockWidgetTabToArea(bookPalette, areaCenterLeft);
- addDockWidgetTabToArea(symbolPalette, areaCenterLeft);
+ // Left Center
+ // Workaround: inline palette acts as a main container for the other palettes, we have to show it so that it is docked.
+ m_mainwindow->addDockWidget(inlinePalette, KDDockWidgets::Location_OnRight, pagePalette, visiblePalette);
+ inlinePalette->addDockWidgetAsTab(scrapbookPalette, hiddenPalette);
+ inlinePalette->addDockWidgetAsTab(bookPalette, hiddenPalette);
+ inlinePalette->addDockWidgetAsTab(symbolPalette, hiddenPalette);
// Left Bottom
- auto *areaLeftBottom = addDockWidget(BottomDockWidgetArea, layerPalette, areaLeft);
- addDockWidgetTabToArea(alignDistributePalette, areaLeftBottom);
- addDockWidgetTabToArea(undoPalette, areaLeftBottom);
+ m_mainwindow->addDockWidget(alignDistributePalette, KDDockWidgets::Location_OnBottom, pagePalette, visiblePalette);
+ alignDistributePalette->addDockWidgetAsTab(layerPalette, hiddenPalette);
+ alignDistributePalette->addDockWidgetAsTab(undoPalette, hiddenPalette);
- // Right Panel
- auto *areaRight = addDockWidget(RightDockWidgetArea, propertiesPalette, areaCenter);
- addDockWidget(CenterDockWidgetArea, contentPalette, areaRight);
+ // Right
+ m_mainwindow->addDockWidget(propertiesPalette, KDDockWidgets::Location_OnRight, nullptr, visiblePalette);
+ propertiesPalette->addDockWidgetAsTab(contentPalette, passivePalette);
- // Top Panel
- // auto * areaTop = addDockWidget(TopDockWidgetArea, dockToolProperties);
- // areaTop->setAllowedAreas(NoDockWidgetArea);
- // areaTop->setDockAreaFlag(CDockAreaWidget::HideSingleWidgetTitleBar, true);
+ // Workaround: we have to hide inline palette manually.
+ inlinePalette->close();
- // Resizing area height of left and bottom-left
- int heightL = areaLeft->height();
- setSplitterSizes(areaLeft, {heightL * 3 / 4, heightL * 1 / 4});
+ // Set active palettes
+ // alignDistributePalette->setAsCurrentTab();
+ // pagePalette->setAsCurrentTab();
+ // propertiesPalette->setAsCurrentTab();
- // Resizing area width of left, center-left, center and right
- int widthCL = areaCenter->width();
- int panelWidth = 290;
- setSplitterSizes(areaCenter, {panelWidth, panelWidth, widthCL - 3 * panelWidth, panelWidth});
+ // Save Scribus Default
+ addPerspective("Default");
+ restoreWorkspaceFromPrefs();
- // hide panels that are not visible in default workspace
- inlinePalette->closeDockWidget();
- scrapbookPalette->closeDockWidget();
- bookPalette->closeDockWidget();
- symbolPalette->closeDockWidget();
- layerPalette->closeDockWidget();
- undoPalette->closeDockWidget();
- outlinePalette->closeDockWidget();
+ // Save Users Preference
+ addPerspective("Current");
- // active palettes
- areaLeft->setCurrentDockWidget(pagePalette);
- areaRight->setCurrentDockWidget(propertiesPalette);
- areaLeftBottom->setCurrentDockWidget(alignDistributePalette);
+}
- // add perspective for a later usage, like reset workspace to default.
- this->addPerspective("Default");
+
+void DockManager::addPerspective(const QString name)
+{
+ if (m_perspectives.contains(name))
+ return;
+
+ KDDockWidgets::LayoutSaver saver;
+ m_perspectives.insert(name, saver.serializeLayout());
}
+
+void DockManager::removePerspective(const QString name)
+{
+ if (m_perspectives.contains(name))
+ m_perspectives.remove(name);
+}
+
+void DockManager::loadPerspective(const QString name)
+{
+ KDDockWidgets::LayoutSaver saver;
+ saver.restoreLayout(perspectiveByName(name));
+}
+
+QByteArray DockManager::perspectiveByName(const QString name)
+{
+ if (!m_perspectives.contains(name))
+ return QByteArray();
+
+ return m_perspectives.value(name);
+}
Index: scribus/manager/dock_manager.h
===================================================================
--- scribus/manager/dock_manager.h (Revision 27098)
+++ scribus/manager/dock_manager.h (Arbeitskopie)
@@ -28,10 +28,9 @@
#include "prefscontext.h"
#include "scribusapi.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockManager.h"
+#include "ui/docks/dock_panelbase.h"
+#include <kddockwidgets/DockWidget.h>
-using namespace ads;
-
class ScribusMainWindow;
class PagePalette;
class OutlinePalette;
@@ -46,36 +45,36 @@
class SymbolPalette;
class DockCentralWidget;
-class SCRIBUS_API DockManager : public CDockManager
+class SCRIBUS_API DockManager : public QObject
{
Q_OBJECT
public:
- DockManager(QWidget *parent);
+ DockManager(ScribusMainWindow *mainwindow);
void setCentralWidget(QWidget *widget);
void setupDocks();
+
/**
* @brief Creates all preconfigured workspaces as perspectives.
*/
void initWorkspaces();
+
/**
- * @brief Removes all dock widgets including docks added by plugins.
- */
- void removeAllDockWidgets();
- /**
- * @brief Hides all docked and floating dock containers.
- */
- void hideAllDocks();
- /**
* @brief Toggles the temporary visibility of all docks.
*/
void toggleDocksVisibility();
+
+ void addPerspective(const QString name);
+ void removePerspective(const QString name);
+ void loadPerspective(const QString name);
+
/**
* @brief Returns true if all docks are temporary hidden.
* @return
*/
bool hasTemporaryHiddenDocks();
+
/**
* @brief Adds a dock widget to dock manager. Useful for docks that are not initialized by dock manager, e.g. from plugins.
* @param dock
@@ -82,7 +81,8 @@
* @param closed
* @return
*/
- CDockAreaWidget *addDockFromPlugin(CDockWidget *dock, bool closed = true);
+ DockPanelBase *addDockFromPlugin(DockPanelBase *dock, bool closed = true);
+ QByteArray perspectiveByName(const QString name);
PagePalette *pagePalette {nullptr};
OutlinePalette *outlinePalette {nullptr};
@@ -114,23 +114,20 @@
protected:
DockCentralWidget *dockCenter {nullptr};
+ ScribusMainWindow * m_mainwindow {nullptr};
bool m_dockTemporaryHidden {false};
- QMap<CDockWidget *, bool> m_temporaryHiddenDocks;
+ QMap<QString, QByteArray> m_perspectives;
- /**
- * @brief Refreshes all icons of a dock. Needed for icon set or GUI changes.
- * @param dockWidgets
- */
- void updateIcons(QList<CDockWidget *> dockWidgets);
- void updateIcon(CDockWidget * dockWidget);
+ void configureDock(DockPanelBase *dock);
- void configureDock(CDockWidget *dock);
-
/**
* @brief Creates a default workspace as perspective.
*/
void createDefaultWorkspace();
+signals:
+ void hideAllDocks();
+
};
#endif // DOCK_MANAGER_H
Index: scribus/plugins/shapes/shapepalette.cpp
===================================================================
--- scribus/plugins/shapes/shapepalette.cpp (Revision 27098)
+++ scribus/plugins/shapes/shapepalette.cpp (Arbeitskopie)
@@ -32,7 +32,6 @@
#include "scribusXml.h"
#include "selection.h"
#include "shapepalette.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h"
#include "ui/scmessagebox.h"
#include "util.h"
#include "util_math.h"
@@ -280,7 +279,7 @@
}
}
-ShapePalette::ShapePalette(QWidget *parent) : DockPanelBase("Shap", "panel-custom-shapes", parent)
+ShapePalette::ShapePalette() : DockPanelBase("Shap", "panel-custom-shapes")
{
setMinimumSize( QSize( 220, 240 ) );
setObjectName(QString::fromLocal8Bit("Shap"));
Index: scribus/plugins/shapes/shapepalette.h
===================================================================
--- scribus/plugins/shapes/shapepalette.h (Revision 27098)
+++ scribus/plugins/shapes/shapepalette.h (Arbeitskopie)
@@ -91,7 +91,7 @@
Q_OBJECT
public:
- ShapePalette(QWidget *parent);
+ ShapePalette();
~ShapePalette() {};
void writeToPrefs();
Index: scribus/plugins/shapes/shapeplugin.cpp
===================================================================
--- scribus/plugins/shapes/shapeplugin.cpp (Revision 27098)
+++ scribus/plugins/shapes/shapeplugin.cpp (Arbeitskopie)
@@ -73,19 +73,10 @@
languageChange();
m_actions.insert("shapeShowPalette", new ScrAction(fullTrName(), QKeySequence(), this));
- // Use this if menu action is checkable
- // m_actions["shapeShowPalette"]->setToggleAction(true);
- // m_actions["shapeShowPalette"]->setChecked(false);
- // connect(m_actions["shapeShowPalette"], SIGNAL(toggled(bool)), sc_palette, SLOT(toggleView(bool)));
- // connect(sc_palette, SIGNAL(viewToggled(bool)), m_actions["shapeShowPalette"], SLOT(setChecked(bool)));
+ sc_palette->setToggleViewAction(m_actions["shapeShowPalette"]);
- // Use this if menu action is not checkable
- connect(m_actions["shapeShowPalette"], SIGNAL(triggered()), sc_palette, SLOT(toggleView()));
-
mw->scrMenuMgr->addMenuItemStringAfter("shapeShowPalette", "toolsInline", "Windows");
mw->scrMenuMgr->addMenuItemStringsToMenuBar("Windows", m_actions);
-
- // For some reason we can't call addDockWidget(...) directly. If we do so Scribus crashes.
mw->dockManager->addDockFromPlugin(sc_palette, false);
}
@@ -112,7 +103,7 @@
bool ShapePlugin::initPlugin()
{
- sc_palette = new ShapePalette(ScCore->primaryMainWindow());
+ sc_palette = new ShapePalette();
sc_palette->startup();
sc_palette->readFromPrefs();
return true;
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (Revision 27098)
+++ scribus/scribus.cpp (Arbeitskopie)
@@ -247,8 +247,6 @@
#include "util.h"
#include "util_file.h"
#include "util_formats.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h"
-#include "third_party/Qt-Advanced-Docking-System/src/IconProvider.h"
#ifdef HAVE_SVNVERSION
#include "svnversion.h"
@@ -268,7 +266,6 @@
#include "sclimits.h"
using namespace std;
-using namespace ads;
bool previewDinUse;
bool printDinUse;
@@ -275,6 +272,7 @@
extern bool emergencyActivated;
ScribusMainWindow::ScribusMainWindow() :
+ MainWindow("scribusmainwindow", KDDockWidgets::MainWindowOptions {KDDockWidgets::MainWindowOption_HasCentralWidget}, nullptr),
m_prefsManager(PrefsManager::instance()),
m_widgetManager(WidgetManager::instance())
{
@@ -292,37 +290,6 @@
*/
int ScribusMainWindow::initScMW(bool primaryMainWindow)
{
- // Documentation: https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/blob/master/doc/user-guide.md
- CDockManager::setConfigFlag(CDockManager::AlwaysShowTabs, false);
- CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetIcon, true);
- CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetTitle, true);
- CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, false);
- CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
- CDockManager::setConfigFlag(CDockManager::TabCloseButtonIsToolButton, true);
- CDockManager::setConfigFlag(CDockManager::AllTabsHaveCloseButton, false);
-// CDockManager::setConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true);
- CDockManager::setConfigFlag(CDockManager::DockAreaHasCloseButton, false);
- CDockManager::setConfigFlag(CDockManager::DockAreaHasUndockButton, false);
- CDockManager::setConfigFlag(CDockManager::DockAreaHideDisabledButtons, true);
- CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
- CDockManager::setConfigFlag(CDockManager::DisableTabTextEliding, true);
- CDockManager::setConfigFlag(CDockManager::ShowTabTextOnlyForActiveTab, !m_prefsManager.appPrefs.uiPrefs.showLabelsOfInactiveTabs);
-
- // Documentation: https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/blob/master/doc/user-guide.md#auto-hide-configuration-flags
- CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
-// CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideShowOnMouseOver, false);
-// CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock, true);
-// CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideButtonTogglesArea, true);
- CDockManager::setAutoHideConfigFlag(CDockManager::DockAreaHasAutoHideButton, true);
-
- IconManager &iconmanager = IconManager::instance();
- CDockManager::iconProvider().registerCustomIcon(TabCloseIcon, iconmanager.loadIcon("close", 12));
- CDockManager::iconProvider().registerCustomIcon(DockAreaCloseIcon, iconmanager.loadIcon("close", 12));
- CDockManager::iconProvider().registerCustomIcon(DockAreaMenuIcon, iconmanager.loadIcon("menu-down", 16));
- CDockManager::iconProvider().registerCustomIcon(DockAreaUndockIcon, iconmanager.loadIcon("dock-float", 16));
- CDockManager::iconProvider().registerCustomIcon(AutoHideIcon, iconmanager.loadIcon("dock-auto-hide", 16));
- CDockManager::iconProvider().registerCustomIcon(DockAreaMinimizeIcon, iconmanager.loadIcon("dock-minimize", 16));
-
int retVal=0;
//qsrand(1234);
QByteArray stylesheet;
@@ -607,7 +574,7 @@
stylesheet.replace("___tb_menu_arrow___", tba);
}
- dockManager->setStyleSheet(stylesheet); // style sheet should be enabled when theme manager is implemented to handle color palettes in css file.
+// dockManager->setStyleSheet(stylesheet); // style sheet should be enabled when theme manager is implemented to handle color palettes in css file.
layerMenu->setStyleSheet(stylesheet);
unitSwitcher->setStyleSheet(stylesheet);
@@ -1906,13 +1873,6 @@
// Save GUI state
dockManager->saveWorkspaceToPrefs();
- // We need to remove all docks from the DockManager to prevent a memory leak
- // in case a plugin has added a dock in the DockManager and is simply deleted
- // on cleanup before it is removed from the DockManager.
- // Removed Docks are not deleted directly.
- dockManager->removeAllDockWidgets();
-
-
// Clean up plugins, THEN save prefs to disk
ScCore->pluginManager->cleanupPlugins();
if (!m_prefsManager.appPrefs.scrapbookPrefs.persistentScrapbook)
@@ -7609,7 +7569,7 @@
{
if (!HaveDoc)
return;
- m_pagePaletteWasClosed = pagePalette->isClosed();
+ m_pagePaletteWasClosed = pagePalette->isHidden();
QString mpName;
if (temp.isEmpty())
mpName = doc->currentPage()->masterPageName();
@@ -7642,12 +7602,12 @@
view->saveViewState();
pagePalette->startMasterPageMode(mpName);
- if (pagePalette->isClosed())
+ if (pagePalette->isHidden())
{
- auto* area = pagePalette->dockAreaWidget();
- auto* dockWidget = area->currentDockWidget();
- scrActions["toolsPages"]->setChecked(true);
- area->setCurrentDockWidget(dockWidget);
+ // auto* area = pagePalette->dockAreaWidget();
+ // auto* dockWidget = area->currentDockWidget();
+ // scrActions["toolsPages"]->setChecked(true);
+ // area->setCurrentDockWidget(dockWidget);
}
appModeHelper->setMasterPageEditMode(true, doc);
}
Index: scribus/scribus.h
===================================================================
--- scribus/scribus.h (Revision 27098)
+++ scribus/scribus.h (Arbeitskopie)
@@ -61,7 +61,11 @@
#include "styleoptions.h"
#include "ui/customfdialog.h"
#include "ui/scmessagebox.h"
+//#include "third_party/KDDockWidgets/src/core/MainWindow.h"
+#include <kddockwidgets/MainWindow.h>
+#include <kddockwidgets/DockWidget.h>
+
class ActionManager;
class AlignDistributePalette;
class AppModeHelper;
@@ -126,7 +130,7 @@
* and statusbar. For the main view, an instance of class ScribusView is
* created which creates your view.
*/
-class SCRIBUS_API ScribusMainWindow : public QMainWindow, public UndoObject
+class SCRIBUS_API ScribusMainWindow : public KDDockWidgets::QtWidgets::MainWindow, public UndoObject
{
Q_OBJECT
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp (Revision 27098)
+++ scribus/scribuscore.cpp (Arbeitskopie)
@@ -51,6 +51,9 @@
//extern ScribusQApp* ScQApp;
+//#include "third_party/KDDockWidgets/src/Config.h"
+#include <kddockwidgets/Config.h>
+
ScribusCore::ScribusCore() : defaultEngine(ScColorMgmtEngineFactory::createDefaultEngine()),
m_iconManager(IconManager::instance()),
m_prefsManager(PrefsManager::instance())
@@ -94,6 +97,24 @@
int ScribusCore::startGUI(bool showSplash, bool showFontInfo, bool showProfileInfo, const QString& newGuiLanguage)
{
+
+ // Initialize GUI
+ KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
+
+ // Custom Widget Factory
+ //KDDockWidgets::Config::self().setViewFactory(new CustomWidgetFactory());
+
+ // https://github.com/KDAB/KDDockWidgets/blob/2.0/src/Config.h
+ auto flags = KDDockWidgets::Config::self().flags();
+ // flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;
+ // flags |= KDDockWidgets::Config::Flag_ShowButtonsOnTabBarIfTitleBarHidden;
+ flags |= KDDockWidgets::Config::Flag_AllowSwitchingTabsViaMenu;
+ flags |= KDDockWidgets::Config::Flag_AutoHideSupport;
+ flags |= KDDockWidgets::Config::Flag_TabsHaveCloseButton;
+ flags |= KDDockWidgets::Config::Flag_AllowReorderTabs;
+ KDDockWidgets::Config::self().setFlags(flags);
+
+
auto* scribus = new ScribusMainWindow();
Q_CHECK_PTR(scribus);
if (!scribus)
@@ -135,8 +156,8 @@
{
if (PrefsManager::instance().appPrefs.uiPrefs.showStartupDialog && usingGUI())
scribus->startUpDialog();
- else
- scribus->setFocus();
+ // else
+ // scribus->setFocus();
}
}
else if (subsRet == QMessageBox::Help)
Index: scribus/third_party/CMakeLists.txt
===================================================================
--- scribus/third_party/CMakeLists.txt (Revision 27098)
+++ scribus/third_party/CMakeLists.txt (Arbeitskopie)
@@ -1,6 +1,4 @@
-#if(WANT_QTADS)
-add_subdirectory(Qt-Advanced-Docking-System)
-#endif()
+add_subdirectory(KDDockWidgets)
if(HAVE_OSG)
add_subdirectory(prc)
Index: scribus/ui/aligndistribute.cpp
===================================================================
--- scribus/ui/aligndistribute.cpp (Revision 27098)
+++ scribus/ui/aligndistribute.cpp (Arbeitskopie)
@@ -65,10 +65,9 @@
// =============================
-AlignDistributePalette::AlignDistributePalette(QWidget* parent) : DockPanelBase("AlignDistributePalette", "panel-align-distribute", parent)
+AlignDistributePalette::AlignDistributePalette() : DockPanelBase("AlignDistributePalette", "panel-align-distribute")
{
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
- setObjectName("AlignDistributePalette");
ad = new AlignDistribute(this);
setWidget(ad);
@@ -113,6 +112,7 @@
void AlignDistributePalette::languageChange()
{
ad->retranslateUi(this);
+ setWindowTitle( tr("Align and Distribute"));
referenceGuideTooltipTemplate = tr("Align relative to a guide%1");
Index: scribus/ui/aligndistribute.h
===================================================================
--- scribus/ui/aligndistribute.h (Revision 27098)
+++ scribus/ui/aligndistribute.h (Arbeitskopie)
@@ -67,7 +67,7 @@
Q_OBJECT
public:
- AlignDistributePalette( QWidget* parent = nullptr);
+ AlignDistributePalette();
~AlignDistributePalette() = default;
virtual void setDoc( ScribusDoc* newDoc );
Index: scribus/ui/bookmarkpalette.cpp
===================================================================
--- scribus/ui/bookmarkpalette.cpp (Revision 27098)
+++ scribus/ui/bookmarkpalette.cpp (Arbeitskopie)
@@ -25,7 +25,7 @@
#include "bookmarkpalette.h"
-BookPalette::BookPalette(QWidget* parent) : DockPanelBase( "Books", "panel-bookmarks", parent )
+BookPalette::BookPalette() : DockPanelBase( "Books", "panel-bookmarks")
{
setObjectName(QString::fromLocal8Bit("Books"));
setMinimumSize( QSize(220, 240) );
Index: scribus/ui/bookmarkpalette.h
===================================================================
--- scribus/ui/bookmarkpalette.h (Revision 27098)
+++ scribus/ui/bookmarkpalette.h (Arbeitskopie)
@@ -50,7 +50,7 @@
\param parent Parent Window
\retval None
*/
- BookPalette(QWidget* parent);
+ BookPalette();
~BookPalette() {};
BookmarkView *BView;
Index: scribus/ui/contentpalette.cpp
===================================================================
--- scribus/ui/contentpalette.cpp (Revision 27098)
+++ scribus/ui/contentpalette.cpp (Arbeitskopie)
@@ -25,8 +25,7 @@
#include "styles/paragraphstyle.h"
#include "styles/charstyle.h"
-ContentPalette::ContentPalette(QWidget *parent) :
- DockPanelBase("ContentPalette", "panel-content-properties", parent)
+ContentPalette::ContentPalette() : DockPanelBase("ContentPalette", "panel-content-properties")
{
setObjectName(QString::fromLocal8Bit("ContentPalette"));
@@ -34,7 +33,7 @@
f.setPointSize(f.pointSize()-1);
setFont(f);
- stackedWidget = new StackedContainer(this);
+ stackedWidget = new StackedContainer(this);
defaultPal = new ContentPalette_Default(this);
stackedWidget->addWidget(defaultPal);
@@ -276,7 +275,7 @@
updatePanelTitle();
}
updateGeometry();
- DockPanelBase::update();
+ DockPanelBase::update();
}
void ContentPalette::unitChange()
@@ -319,7 +318,7 @@
languageChange();
return;
}
- DockPanelBase::changeEvent(e);
+ DockPanelBase::changeEvent(e);
}
void ContentPalette::updatePanelTitle()
@@ -364,7 +363,7 @@
void ContentPalette::update(const ParagraphStyle& style)
{
- textPal->updateParagraphStyle(style);
+ textPal->updateParagraphStyle(style);
}
void ContentPalette::update(const CharStyle& style)
@@ -378,7 +377,7 @@
void ContentPalette::updateTextStyles()
{
- textPal->updateTextStyles();
+ textPal->updateTextStyles();
}
void ContentPalette::updateTextAlignment(int i)
Index: scribus/ui/contentpalette.h
===================================================================
--- scribus/ui/contentpalette.h (Revision 27098)
+++ scribus/ui/contentpalette.h (Arbeitskopie)
@@ -8,9 +8,9 @@
#define CONTENTPALETTE_H
#include "scribusapi.h"
-#include "docks/dock_panelbase.h"
+#include "docks/dock_panelbase.h"
#include "scguardedptr.h"
-#include "widgets/stacked_container.h"
+#include "widgets/stacked_container.h"
class QStackedWidget;
@@ -29,12 +29,12 @@
class ParagraphStyle;
class CharStyle;
-class SCRIBUS_API ContentPalette : public DockPanelBase
+class SCRIBUS_API ContentPalette : public DockPanelBase
{
Q_OBJECT
public:
- ContentPalette(QWidget* parent);
+ ContentPalette();
~ContentPalette() {}
void updateColorList();
@@ -75,7 +75,7 @@
double m_unitRatio {1.0};
int m_unitIndex {0};
- StackedContainer* stackedWidget {nullptr};
+ StackedContainer* stackedWidget {nullptr};
ContentPalette_Default* defaultPal {nullptr};
PropertiesPalette_Group* groupPal {nullptr};
PropertiesPalette_Image* imagePal {nullptr};
Index: scribus/ui/docks/dock_centralwidget.cpp
===================================================================
--- scribus/ui/docks/dock_centralwidget.cpp (Revision 27098)
+++ scribus/ui/docks/dock_centralwidget.cpp (Arbeitskopie)
@@ -18,11 +18,17 @@
***************************************************************************/
#include "dock_centralwidget.h"
-DockCentralWidget::DockCentralWidget(QWidget *parent)
- : ads::CDockWidget(QString(), parent)
+DockCentralWidget::DockCentralWidget() : QWidget(nullptr)
{
setObjectName(QString::fromLocal8Bit("DockCentralWidget"));
- setFeature(ads::CDockWidget::NoTab, true);
- setFeature(ads::CDockWidget::DockWidgetFloatable, false);
+ layoutWidget = new QHBoxLayout();
+ layoutWidget->setSpacing(0);
+ layoutWidget->setContentsMargins(0, 0, 0, 0);
+ setLayout(layoutWidget);
}
+
+void DockCentralWidget::setWidget(QWidget *widget)
+{
+ layoutWidget->addWidget(widget);
+}
Index: scribus/ui/docks/dock_centralwidget.h
===================================================================
--- scribus/ui/docks/dock_centralwidget.h (Revision 27098)
+++ scribus/ui/docks/dock_centralwidget.h (Arbeitskopie)
@@ -20,14 +20,20 @@
#ifndef DOCK_CENTRALWIDGET_H
#define DOCK_CENTRALWIDGET_H
-#include "third_party/Qt-Advanced-Docking-System/src/DockWidget.h"
+#include <QWidget>
+#include <QHBoxLayout>
-class DockCentralWidget : public ads::CDockWidget
+class DockCentralWidget : public QWidget
{
Q_OBJECT
public:
- explicit DockCentralWidget(QWidget *parent = nullptr);
+ explicit DockCentralWidget();
+ void setWidget(QWidget *widget);
+
+private:
+ QHBoxLayout *layoutWidget;
+
};
#endif // DOCK_CENTRALWIDGET_H
Index: scribus/ui/docks/dock_panelbase.cpp
===================================================================
--- scribus/ui/docks/dock_panelbase.cpp (Revision 27098)
+++ scribus/ui/docks/dock_panelbase.cpp (Arbeitskopie)
@@ -20,6 +20,8 @@
#include "dock_panelbase.h"
#include <QApplication>
+#include <QScrollArea>
+#include <QScrollBar>
#include "iconmanager.h"
#include "prefscontext.h"
@@ -27,25 +29,15 @@
#include "prefsmanager.h"
#include "scribusapp.h"
-DockPanelBase::DockPanelBase(const QString &title, QString iconName, QWidget *parent)
- : CDockWidget(title, parent)
+DockPanelBase::DockPanelBase(const QString &title, QString iconName, KDDockWidgets::DockWidgetOptions options)
+ : KDDockWidgets::QtWidgets::DockWidget(title, options)
{
- /*if (PrefsManager::instance().appPrefs.uiPrefs.useSmallWidgets) {
- setStyleSheet(" QToolButton { margin: 1px; padding: 0px; font-size: 10px; } \
- QToolButton:pressed { padding-top: 2px; padding-left: 2px } \
- QPushButton { margin: 1px; padding: 0px; font-size: 10px; } \
- QPushButton:pressed { padding-top: 2px; padding-left: 2px } \
- QRadioButton, QComboBox, QLineEdit \
- QListView, QLabel { margin:1px; padding: 0px; font-size: 10px; } \
- QCheckBox, QSpinBox, QDoubleSpinBox \
- { margin:1px; padding: 0px; font-size: 10px; } \
- QTabWidget, QTabBar, QTableView, QGroupBox, QTreeView \
- { font-size: 10px ; } \
- QToolBox::tab { font-size: 10px; padding: 0px; margin: 0px; } \
- ");
- }*/
-
m_iconName = iconName;
+ m_scrollArea = new QScrollArea;
+ m_scrollArea->setFrameShape(QFrame::NoFrame);
+ m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ KDDockWidgets::QtWidgets::DockWidget::setWidget(m_scrollArea);
iconSetChange();
@@ -55,8 +47,8 @@
connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
}
-DockPanelBase::DockPanelBase(const QString &title, QWidget *parent)
- : DockPanelBase(title, QString(), parent){}
+DockPanelBase::DockPanelBase(const QString &title, KDDockWidgets::DockWidgetOptions options)
+ : DockPanelBase(title, QString(), options){}
void DockPanelBase::setPrefsContext(const QString &context)
{
@@ -69,6 +61,27 @@
m_palettePrefs = nullptr;
}
+void DockPanelBase::updateScrollAreaMinSize()
+{
+ if (!widget())
+ return;
+
+ int contentWidth = widget()->minimumSizeHint().width();
+ int frameWidth = m_scrollArea->frameWidth() * 2;
+ int scrollBarWidth = m_scrollArea->verticalScrollBar()->sizeHint().width();
+
+ m_scrollArea->setMinimumWidth(contentWidth + frameWidth + scrollBarWidth);
+}
+
+bool DockPanelBase::eventFilter(QObject *watched, QEvent *event)
+{
+ if (watched == widget() && event->type() == QEvent::Resize)
+ updateScrollAreaMinSize();
+
+ return QWidget::eventFilter(watched, event);
+
+}
+
void DockPanelBase::startup()
{
setFontSize();
@@ -97,3 +110,32 @@
}
}
+
+void DockPanelBase::setToggleViewAction(ScrAction *action)
+{
+ action->setCheckable(true);
+
+ connect( action, &ScrAction::toggled, toggleAction(), &QAction::setChecked);
+ connect( toggleAction(), &QAction::toggled, action, &ScrAction::setChecked);
+}
+
+void DockPanelBase::setWindowTitle(const QString &title)
+{
+ KDDockWidgets::QtWidgets::DockWidget::setWindowTitle(title);
+ setTitle( title );
+}
+
+void DockPanelBase::setWidget(QWidget *widget)
+{
+// widget->adjustSize();
+ widget->installEventFilter(this);
+ m_scrollArea->setWidget(widget);
+ m_scrollArea->setWidgetResizable(true);
+
+ updateScrollAreaMinSize();
+}
+
+QWidget *DockPanelBase::widget() const
+{
+ return m_scrollArea->widget();
+}
Index: scribus/ui/docks/dock_panelbase.h
===================================================================
--- scribus/ui/docks/dock_panelbase.h (Revision 27098)
+++ scribus/ui/docks/dock_panelbase.h (Arbeitskopie)
@@ -21,32 +21,41 @@
#define DOCK_PANELBASE_H
#include "scribusapi.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockWidget.h"
-using namespace ads;
+#include "scraction.h"
+#include <kddockwidgets/DockWidget.h>
+#include <QScrollArea>
class PrefsContext;
-class SCRIBUS_API DockPanelBase : public CDockWidget
+class SCRIBUS_API DockPanelBase : public KDDockWidgets::QtWidgets::DockWidget
{
Q_OBJECT
public:
- DockPanelBase(const QString &title, QWidget *parent = 0);
- DockPanelBase(const QString &title, QString iconName, QWidget *parent = 0);
+ DockPanelBase(const QString &title, KDDockWidgets::DockWidgetOptions options = KDDockWidgets::DockWidgetOption_None);
+ DockPanelBase(const QString &title, QString iconName, KDDockWidgets::DockWidgetOptions options = KDDockWidgets::DockWidgetOption_None);
void startup();
+ void setWindowTitle(const QString& title) override;
+ void setWidget(QWidget *widget);
+ QWidget *widget() const;
public slots:
virtual void setFontSize();
void iconSetChange();
+ void setToggleViewAction(ScrAction *action);
protected:
/** @brief Set the Preferences context to be used for storage of startup visibility and position and size */
virtual void setPrefsContext(const QString &context);
+ void updateScrollAreaMinSize();
+ bool eventFilter(QObject *watched, QEvent *event) override;
PrefsContext *m_palettePrefs {nullptr};
QString m_prefsContextName;
QString m_iconName;
+ QScrollArea *m_scrollArea;
+
};
#endif // DOCK_PANELBASE_H
Index: scribus/ui/inlinepalette.cpp
===================================================================
--- scribus/ui/inlinepalette.cpp (Revision 27098)
+++ scribus/ui/inlinepalette.cpp (Arbeitskopie)
@@ -101,7 +101,7 @@
clearSelection();
}
-InlinePalette::InlinePalette( QWidget* parent) : DockPanelBase("Inline", "panel-inline-items", parent)
+InlinePalette::InlinePalette() : DockPanelBase("Inline", "panel-inline-items")
{
setContentsMargins(3, 3, 3, 3);
setMinimumSize( QSize( 220, 240 ) );
Index: scribus/ui/inlinepalette.h
===================================================================
--- scribus/ui/inlinepalette.h (Revision 27098)
+++ scribus/ui/inlinepalette.h (Arbeitskopie)
@@ -72,7 +72,7 @@
Q_OBJECT
public:
- InlinePalette(QWidget* parent);
+ InlinePalette();
~InlinePalette() {};
void setMainWindow(ScribusMainWindow *mw);
Index: scribus/ui/layers.cpp
===================================================================
--- scribus/ui/layers.cpp (Revision 27098)
+++ scribus/ui/layers.cpp (Arbeitskopie)
@@ -42,7 +42,7 @@
#include "docks/dock_panelbase.h"
#include "undomanager.h"
-LayerPalette::LayerPalette(QWidget* parent) : DockPanelBase("Layers", "panel-layers", parent)
+LayerPalette::LayerPalette() : DockPanelBase("Layers", "panel-layers")
{
setObjectName(QString::fromLocal8Bit("Layers"));
setMinimumSize( QSize(220, 240) );
Index: scribus/ui/layers.h
===================================================================
--- scribus/ui/layers.h (Revision 27098)
+++ scribus/ui/layers.h (Arbeitskopie)
@@ -34,7 +34,7 @@
Q_OBJECT
public:
- LayerPalette(QWidget* parent);
+ LayerPalette();
~LayerPalette() {};
void installEventFilter(QObject *);
Index: scribus/ui/outlinepalette.cpp
===================================================================
--- scribus/ui/outlinepalette.cpp (Revision 27098)
+++ scribus/ui/outlinepalette.cpp (Arbeitskopie)
@@ -431,7 +431,7 @@
return true;
}
-OutlinePalette::OutlinePalette( QWidget* parent) : DockPanelBase("Tree", "panel-outline", parent)
+OutlinePalette::OutlinePalette() : DockPanelBase("Tree", "panel-outline")
{
// resize( 220, 240 );
setMinimumSize( QSize( 220, 240 ) );
@@ -481,9 +481,9 @@
connect(filterEdit, SIGNAL(textChanged(QString)), this, SLOT(filterTree(QString)));
// connect(filterShortcut, SIGNAL(activated()), filterEdit, SLOT(setFocus()));
connect(reportDisplay, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotDoubleClick(QTreeWidgetItem*,int)));
- connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(rebuildTree()));
+ connect(this, SIGNAL(isOpenChanged(bool)), this, SLOT(rebuildTree(bool)));
+ connect(this, SIGNAL(isCurrentTabChanged(bool)), this, SLOT(rebuildTree(bool)));
-
}
void OutlinePalette::setMainWindow(ScribusMainWindow *mw)
@@ -509,16 +509,9 @@
clearPalette();
}
-void OutlinePalette::toggleView(bool visible)
+void OutlinePalette::rebuildTree(bool isActive)
{
- DockPanelBase::toggleView(visible);
- rebuildTree();
-}
-
-
-void OutlinePalette::rebuildTree()
-{
- if (this->isVisible() && (currDoc != nullptr))
+ if (isActive)
BuildTree();
}
Index: scribus/ui/outlinepalette.h
===================================================================
--- scribus/ui/outlinepalette.h (Revision 27098)
+++ scribus/ui/outlinepalette.h (Arbeitskopie)
@@ -60,7 +60,7 @@
Q_OBJECT
public:
- OutlinePalette( QWidget* parent );
+ OutlinePalette();
void setMainWindow(ScribusMainWindow *mw);
void setDoc(ScribusDoc *);
@@ -77,7 +77,6 @@
void iconSetChange();
void languageChange();
void slotShowSelect(int pageNr, PageItem *pageItem);
- void toggleView(bool);
void slotRightClick(QPoint point);
void setActiveLayer(int layerID);
void setLayerVisible(int layerID);
@@ -96,7 +95,7 @@
void slotMultiSelect();
void slotSelect(QTreeWidgetItem* ite, int col);
void slotDoubleClick(QTreeWidgetItem* ite, int col);
- void rebuildTree();
+ void rebuildTree(bool);
protected:
void changeEvent(QEvent *e) override;
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp (Revision 27098)
+++ scribus/ui/pagepalette.cpp (Arbeitskopie)
@@ -21,7 +21,7 @@
#include "scribusdoc.h"
#include "scribusview.h"
-PagePalette::PagePalette(QWidget *parent) : DockPanelBase("PagePalette", "panel-page", parent)
+PagePalette::PagePalette() : DockPanelBase("PagePalette", "panel-page")
{
m_scMW = nullptr;//(ScribusMainWindow*) parent;
m_view = nullptr;
@@ -210,7 +210,7 @@
}
// Set focus to page palette or focus may be set to wrong document window
- this->setFocus();
+ //this->setFocus();
stackedWidget->setCurrentIndex(1);
setWindowTitle( tr( "Manage Masterpages" ) );
}
@@ -220,7 +220,7 @@
if (this->stackedWidget()->currentIndex() > 0)
{
// Set focus to page palette or focus may be set to wrong document window
- this->setFocus();
+ //this->setFocus();
this->stackedWidget()->setCurrentIndex(0);
}
Index: scribus/ui/pagepalette.h
===================================================================
--- scribus/ui/pagepalette.h (Revision 27098)
+++ scribus/ui/pagepalette.h (Arbeitskopie)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
- PagePalette(QWidget *parent);
+ PagePalette();
~PagePalette() {};
QWidget* currentWidget();
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp (Revision 27098)
+++ scribus/ui/propertiespalette.cpp (Arbeitskopie)
@@ -45,7 +45,7 @@
#include "selection.h"
#include "undomanager.h"
-PropertiesPalette::PropertiesPalette(QWidget *parent) : DockPanelBase("PropertiesPalette", "panel-frame-properties", parent)
+PropertiesPalette::PropertiesPalette() : DockPanelBase("PropertiesPalette", "panel-frame-properties")
{
undoManager = UndoManager::instance();
Index: scribus/ui/propertiespalette.h
===================================================================
--- scribus/ui/propertiespalette.h (Revision 27098)
+++ scribus/ui/propertiespalette.h (Arbeitskopie)
@@ -55,7 +55,7 @@
Q_OBJECT
public:
- PropertiesPalette(QWidget* parent);
+ PropertiesPalette();
~PropertiesPalette() {}
void endPatchAdd();
Index: scribus/ui/scrapbookpalette.cpp
===================================================================
--- scribus/ui/scrapbookpalette.cpp (Revision 27098)
+++ scribus/ui/scrapbookpalette.cpp (Arbeitskopie)
@@ -740,7 +740,7 @@
}
/* This is the main Dialog-Class for the Scrapbook */
-Biblio::Biblio(QWidget* parent) : DockPanelBase("Sclib", "panel-scrapbook", parent)
+Biblio::Biblio() : DockPanelBase("Sclib", "panel-scrapbook")
{
setObjectName(QString::fromLocal8Bit("Sclib"));
setMinimumSize( QSize(220, 240) );
Index: scribus/ui/scrapbookpalette.h
===================================================================
--- scribus/ui/scrapbookpalette.h (Revision 27098)
+++ scribus/ui/scrapbookpalette.h (Arbeitskopie)
@@ -73,7 +73,7 @@
Q_OBJECT
public:
- Biblio( QWidget* parent);
+ Biblio();
~Biblio() {};
void changeEvent(QEvent *e) override;
Index: scribus/ui/symbolpalette.cpp
===================================================================
--- scribus/ui/symbolpalette.cpp (Revision 27098)
+++ scribus/ui/symbolpalette.cpp (Arbeitskopie)
@@ -150,7 +150,7 @@
clearSelection();
}
-SymbolPalette::SymbolPalette( QWidget* parent) : DockPanelBase("Symb", "panel-symbols", parent)
+SymbolPalette::SymbolPalette() : DockPanelBase("Symb", "panel-symbols")
{
setContentsMargins(3, 3, 3, 3);
setMinimumSize( QSize( 220, 240 ) );
Index: scribus/ui/symbolpalette.h
===================================================================
--- scribus/ui/symbolpalette.h (Revision 27098)
+++ scribus/ui/symbolpalette.h (Arbeitskopie)
@@ -76,7 +76,7 @@
Q_OBJECT
public:
- SymbolPalette(QWidget* parent);
+ SymbolPalette();
~SymbolPalette() {};
void setMainWindow(ScribusMainWindow *mw);
Index: scribus/undogui.cpp
===================================================================
--- scribus/undogui.cpp (Revision 27098)
+++ scribus/undogui.cpp (Arbeitskopie)
@@ -38,7 +38,7 @@
#include "undogui.h"
-UndoGui::UndoGui(QWidget* parent, const char* name) : DockPanelBase(name, "panel-action-history", parent)
+UndoGui::UndoGui(QWidget* parent, const char* name) : DockPanelBase(name, "panel-action-history")
{
languageChange();
}
|
|
|
|
|
|
patch applied and it works! i can now dock and undock the windows at will and it behaves (mostly...) correctly. (sometimes the default width is a bit wild, but for a start it's more than good!) only issue, after a make install, i got bin/scribus: error while loading shared libraries: libkddockwidgets-qt6.so.3: cannot open shared object file: No such file or directory which I could solve with export LD_LIBRARY_PATH=/home/ale/bin/build/scribus-tmp/lib/ I guess that something is missing in the cmake file... |
|
|
Here's a screenshot: |
|
|
Versus: |
|
|
It works, but there's some spacing issues that means it takes up a lot more space and I don't understand that white space left of the document window. It cannot be shrunk completely and it shouldn't be there in the first place. I added these CMake options and its ok locating the lib (first one making the difference but we don't need examples, docs or other frontends: -DKDDockWidgets_STATIC=true \ -DKDDockWidgets_EXAMPLES=false \ -DKDDockWidgets_DOCS=false \ -DKDDockWidgets_FRONTENDS='qtwidgets' \ |
|
|
Thanks for the feedback. I will check how I can improve it. |
|
|
Yes, addingset(KDDockWidgets_STATIC ON) set(KDDockWidgets_EXAMPLES OFF) set(KDDockWidgets_DOCS OFF) set(KDDockWidgets_FRONTENDS "qtwidgets") in CMakeLists_Dependencies.cmake, where WANT_QTADS was, makes is runnable : - ) And this is how it looks like on my laptop, on a fresh install! Some width are a bit too much : - ) |
|
|
A few more things: - In the default setup (when creating the new configs), the tabs are not created correctly: somehow, it shows all the tab titles in the title bar. - When there are multiple tabs, the title of the current tab is repeated in the a docking are title bar (in the screenshot above it's the duplicated "Properties" title) - In the screenshot I'm attaching here, there is a gray area on the right of the left docked panes. That's the minimum I can shrink it. And I don't seem to be able to remove it. -> Ok, I discovered what it is: when hiding the last palette that was in a tabbed area, the tabbed area is not removed and there is no way to add other palettes to that area or to remove it. Until one shows again that palette in that area and instead of closing it, first makes it floating (or move it to a different area) - I have now a crash: start Scribus with fresh settings, don't create a new document, and double click on the "Custom shapes" panel that is docked on the left side: crash. (Custom shapes, should probably not be docked by default, but hidden... but that's a different issue : - ) (I can correctly double click, as an example, "Arrange pages") - If I make "Custom shapes" floating and close it, and restart Scribus, then, I have a "Custom pages" floating and one "ghost" "Custom pages" behind the panels docked to the left. But I guess that there are more issues with the "Custom pages" panel: see screenshot : - ) |
|
|
I updated the patch and fixed a couple of small issues. The UI style is controlled by custom widgets from ScKDDockViewFactory and ScribusProxyStyle. The style overrides some OS specific settings, like spaces, alignments and colors and applies only to KDDock widgets. I tested it under Ubuntu (Fusion) and MacOS. Windows is untested yet. Steps 1. Download KDDockWidgets from https://github.com/KDAB/KDDockWidgets 2. Put the root folder into scribus -> third_party 3. Check if the root folders name is "KDDockWidgets" 4. Add additional files from zip 5. Apply the fix below 6. remove ADS folder (optional) kddock_2025-11-19_01.patch (88,153 bytes)
Index: CMakeLists_Dependencies.cmake
===================================================================
--- CMakeLists_Dependencies.cmake (Revision 27132)
+++ CMakeLists_Dependencies.cmake (Arbeitskopie)
@@ -318,6 +318,9 @@
set (HAVE_HARFBUZZ_SUBSET ON)
endif()
-#if(WANT_QTADS)
- set(HAVE_QTADS ON)
-#endif()
+
+# KDDockWidget
+set(KDDockWidgets_STATIC OFF) # must be dynamic to support docks in Scribus plugins
+set(KDDockWidgets_EXAMPLES OFF)
+set(KDDockWidgets_DOCS OFF)
+set(KDDockWidgets_FRONTENDS "qtwidgets")
Index: config.h.cmake
===================================================================
--- config.h.cmake (Revision 27132)
+++ config.h.cmake (Arbeitskopie)
@@ -14,7 +14,6 @@
#cmakedefine BUILD_MAC_BUNDLE
#cmakedefine DLL_USE_NATIVE_API 1
#cmakedefine GMAGICK_FOUND 1
-#cmakedefine HAVE_QTADS 1
#cmakedefine HAVE_BOOST 1
#cmakedefine HAVE_CAIRO 1
#cmakedefine HAVE_CUPS 1
Index: resources/iconsets/1_7_0/1_7_0.xml
===================================================================
--- resources/iconsets/1_7_0/1_7_0.xml (Revision 27132)
+++ resources/iconsets/1_7_0/1_7_0.xml (Arbeitskopie)
@@ -595,7 +595,9 @@
<icon id="close" file="16/action-close.svg" />
<icon id="dock-auto-hide" file="16/action-pin.svg" />
<icon id="dock-float" file="16/action-window-float.svg" />
+ <icon id="dock-maximize" file="16/action-maximize.svg" />
<icon id="dock-minimize" file="16/action-minimize.svg" />
+ <icon id="dock-unauto-hide" file="16/action-unpin.svg" />
<icon id="menu-down" file="16/action-menu-down.svg" />
<!-- Panels -->
Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt (Revision 27132)
+++ scribus/CMakeLists.txt (Arbeitskopie)
@@ -59,11 +59,10 @@
set_property(SOURCE third_party/fparser/file.hh PROPERTY SKIP_AUTOGEN ON)
set_property(SOURCE third_party/fparser/fparser.hh PROPERTY SKIP_AUTOGEN ON)
-#if(WANT_QTADS)
- MESSAGE(STATUS "Qt Advanced Docking System included")
- link_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/Qt-Advanced-Docking-System)
-#endif()
+MESSAGE(STATUS "KDDock System included")
+link_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/KDDockWidgets)
+
link_directories(
${CMAKE_CURRENT_BINARY_DIR}/third_party/wpg
${CMAKE_CURRENT_BINARY_DIR}/third_party/pgf
@@ -292,9 +291,7 @@
${SCRIBUS_RTF_LIB}
)
-#if(WANT_QTADS)
- target_link_libraries(${EXE_NAME} PUBLIC qt6advanceddocking)
-#endif()
+target_link_libraries(${EXE_NAME} PUBLIC KDAB::kddockwidgets)
if(WITH_TESTS)
target_link_libraries(${EXE_NAME} PRIVATE
Index: scribus/CMakeLists_Sources.txt
===================================================================
--- scribus/CMakeLists_Sources.txt (Revision 27132)
+++ scribus/CMakeLists_Sources.txt (Arbeitskopie)
@@ -565,6 +565,8 @@
ui/delegates/sclistitemdelegate.cpp
ui/docks/dock_centralwidget.cpp
ui/docks/dock_panelbase.cpp
+ ui/factories/sckddockviewfactory.cpp
+ ui/factories/scribusproxystyle.cpp
ui/widgets/color_button.cpp
ui/widgets/combo_blendmode.cpp
ui/widgets/combo_linestyle.cpp
Index: scribus/manager/dock_manager.cpp
===================================================================
--- scribus/manager/dock_manager.cpp (Revision 27132)
+++ scribus/manager/dock_manager.cpp (Arbeitskopie)
@@ -26,15 +26,16 @@
#include "dock_manager.h"
#include <QMenu>
-#include "third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h"
-#include "ui/docks/dock_centralwidget.h"
#include "iconmanager.h"
#include "prefsmanager.h"
+#include "scribus.h"
#include "scribusapp.h"
+#include "scribuscore.h"
#include "ui/aligndistribute.h"
#include "ui/bookmarkpalette.h"
#include "ui/contentpalette.h"
+#include "ui/docks/dock_centralwidget.h"
#include "ui/inlinepalette.h"
#include "ui/layers.h"
#include "ui/outlinepalette.h"
@@ -44,6 +45,8 @@
#include "ui/symbolpalette.h"
#include "undogui.h"
+#include <kddockwidgets/DockWidget.h>
+#include <kddockwidgets/LayoutSaver.h>
/* ********************************************************************************* *
*
@@ -51,38 +54,45 @@
*
* ********************************************************************************* */
-DockManager::DockManager(QWidget *parent)
- : CDockManager(parent)
+DockManager* DockManager::m_instance = nullptr;
+
+DockManager &DockManager::instance()
{
- dockCenter = new DockCentralWidget();
- auto *areaCenter = CDockManager::setCentralWidget(dockCenter);
- areaCenter->setAllowedAreas(LeftDockWidgetArea | RightDockWidgetArea);
+ static DockManager m_instance;
+ return m_instance;
+}
- setStyleSheet(""); // reset style sheet to use custom icons
+void DockManager::setMainWindow(ScribusMainWindow *mainwindow)
+{
+ m_mainwindow = mainwindow;
+ m_mainwindow->setPersistentCentralWidget(dockCenter);
+}
- connect( ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()) );
+DockManager::DockManager(QObject *parent) : QObject(parent)
+{
+ dockCenter = new DockCentralWidget();
}
void DockManager::setupDocks()
{
- pagePalette = new PagePalette((QWidget *) this->parent());
- contentPalette = new ContentPalette(this);
- propertiesPalette = new PropertiesPalette(this);
- outlinePalette = new OutlinePalette(this);
- layerPalette = new LayerPalette(this);
- inlinePalette = new InlinePalette(this);
+ pagePalette = new PagePalette();
+ contentPalette = new ContentPalette();
+ propertiesPalette = new PropertiesPalette();
+ outlinePalette = new OutlinePalette();
+ layerPalette = new LayerPalette();
+ inlinePalette = new InlinePalette();
alignDistributePalette = new AlignDistributePalette();
- scrapbookPalette = new Biblio(this);
- bookPalette = new BookPalette(this);
- undoPalette = new UndoPalette(this);
- symbolPalette = new SymbolPalette(this);
+ scrapbookPalette = new Biblio();
+ bookPalette = new BookPalette();
+ undoPalette = new UndoPalette();
+ symbolPalette = new SymbolPalette();
// Apply common configuration for each palette
configureDock(pagePalette);
configureDock(contentPalette);
configureDock(propertiesPalette);
+ configureDock(outlinePalette);
configureDock(layerPalette);
- configureDock(pagePalette);
configureDock(inlinePalette);
configureDock(alignDistributePalette);
configureDock(scrapbookPalette);
@@ -90,11 +100,6 @@
configureDock(undoPalette);
configureDock(symbolPalette);
- // Panel ToolProperties
- // PanelToolProperties * panelTest = new PanelToolProperties();
- // dockToolProperties->setWidget(panelTest);
- // dockToolProperties->setFeature(ads::CDockWidget::NoTab, true);
-
}
void DockManager::setCentralWidget(QWidget *widget)
@@ -111,38 +116,16 @@
void DockManager::initWorkspaces()
{
createDefaultWorkspace();
-// restoreWorkspaceFromPrefs();
}
-void DockManager::removeAllDockWidgets()
-{
- QMap<QString, CDockWidget *> map = dockWidgetsMap();
- foreach (QString key, map.keys())
- removeDockWidget(map.value(key));
-}
-void DockManager::hideAllDocks()
-{
- foreach (CDockWidget *dock, this->dockWidgets())
- {
- if(dock->isCentralWidget())
- continue;
- dock->closeDockWidget();
- }
-
- foreach (CFloatingDockContainer *dockContainer, this->floatingWidgets())
- {
- dockContainer->close();
- }
-}
-
void DockManager::toggleDocksVisibility()
{
- QString perspective = "_allpaletteshidden";
+ QString perspective = "e494294a-65b4-4ca5-a018-1fe741dbd1c3";
- if(perspectiveNames().contains(perspective))
+ if(m_perspectives.contains(perspective))
{
- openPerspective(perspective);
+ loadPerspective(perspective);
removePerspective(perspective);
m_dockTemporaryHidden = false;
}
@@ -149,93 +132,66 @@
else
{
addPerspective(perspective);
- hideAllDocks();
+ emit hideAllDocks();
m_dockTemporaryHidden = true;
-
-// qDebug() << Q_FUNC_INFO << this->dockWidgets();
-// qDebug() << Q_FUNC_INFO << this->floatingWidgets();
}
}
+void DockManager::refreshAllDocks()
+{
+ QListIterator<DockPanelBase*> iter(m_docks);
+ while(iter.hasNext()){
+ DockPanelBase *dock = iter.next();
+ // Update label visibility
+ dock->setLabelVis();
+ }
+}
+
bool DockManager::hasTemporaryHiddenDocks()
{
return m_dockTemporaryHidden;
}
-CDockAreaWidget *DockManager::addDockFromPlugin(CDockWidget *dock, bool closed)
+void DockManager::addDockFromPlugin(DockPanelBase *dock, bool closed)
{
- CDockAreaWidget *a = addDockWidget(RightDockWidgetArea, dock, dockCenter->dockAreaWidget());
- dock->toggleView(!closed);
- updateIcon(dock);
+ if (!m_mainwindow)
+ return;
+
+ const QSize m_preferredSize(QSize(290, 0));
+ KDDockWidgets::InitialOption option = closed ?
+ KDDockWidgets::InitialOption(KDDockWidgets::InitialVisibilityOption::StartHidden, m_preferredSize) :
+ KDDockWidgets::InitialOption(KDDockWidgets::InitialVisibilityOption::PreserveCurrentTab, m_preferredSize);
+
+ m_mainwindow->addDockWidget(dock, KDDockWidgets::Location_OnLeft, nullptr, option);
+
configureDock(dock);
- return a;
}
void DockManager::restoreWorkspaceFromPrefs()
{
- QByteArray ba = PrefsManager::instance().appPrefs.uiPrefs.adsDockState;
-
- if(ba.isEmpty())
- return;
-
- this->restoreState(ba);
+ loadPerspective(QByteArray::fromHex(PrefsManager::instance().appPrefs.uiPrefs.mainWinState));
}
void DockManager::saveWorkspaceToPrefs()
{
- PrefsManager::instance().appPrefs.uiPrefs.adsDockState = this->saveState();
+ PrefsManager::instance().appPrefs.uiPrefs.mainWinState = perspectiveFromUi().toHex();
}
-void DockManager::iconSetChange()
-{
- // Update all icons of each docked CDockContainer
- updateIcons(this->dockWidgets());
-
- // Update all icons of each floating CFloatingDockContainer
- foreach (CFloatingDockContainer *dockContainer, this->floatingWidgets())
- updateIcons(dockContainer->dockWidgets());
-}
-
void DockManager::restoreHiddenWorkspace()
{
- if (m_dockTemporaryHidden)
+ if (hasTemporaryHiddenDocks())
toggleDocksVisibility();
}
-void DockManager::updateIcons(QList<CDockWidget *> dockWidgets)
+void DockManager::configureDock(DockPanelBase *dock)
{
- foreach (CDockWidget *dock, dockWidgets)
- updateIcon(dock);
-}
+ if(!m_docks.contains(dock))
+ m_docks.append(dock);
-void DockManager::updateIcon(CDockWidget *dockWidget)
-{
- IconManager &iconManager = IconManager::instance();
-
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonClose)->setIcon(iconManager.loadIcon("close", 12));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonUndock)->setIcon(iconManager.loadIcon("dock-float", 16));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonTabsMenu)->setIcon(iconManager.loadIcon("menu-down", 16));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonAutoHide)->setIcon(iconManager.loadIcon("dock-auto-hide", 16));
- dockWidget->dockAreaWidget()->titleBarButton(ads::TitleBarButtonMinimize)->setIcon(iconManager.loadIcon("dock-minimize", 16));
-
- for (auto tabCloseButton : dockWidget->dockAreaWidget()->findChildren<QAbstractButton*>("tabCloseButton"))
- tabCloseButton->setIcon(iconManager.loadIcon("close", 12));
+ connect(this, &DockManager::hideAllDocks, dock, &DockPanelBase::close);
}
-void DockManager::configureDock(CDockWidget *dock)
-{
- /*
- * MinimumSizeHintFromContent
- * MinimumSizeHintFromDockWidgetMinimumSize
- * MinimumSizeHintFromContentMinimumSize
- */
-
- dock->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidgetMinimumSize);
- dock->setMinimumWidth(dock->widget()->minimumSizeHint().width());
- connect( dock, &CDockWidget::viewToggled, this, &DockManager::restoreHiddenWorkspace);
-}
-
void DockManager::createDefaultWorkspace()
{
/************************************************************
@@ -257,56 +213,92 @@
*
*************************************************************/
- auto *areaCenter = dockCenter->dockAreaWidget();
+ if (!m_mainwindow)
+ return;
+ const QSize m_preferredSize(QSize(290, 0));
+ KDDockWidgets::InitialOption hiddenPalette(KDDockWidgets::InitialVisibilityOption::StartHidden, m_preferredSize);
+ KDDockWidgets::InitialOption visiblePalette(KDDockWidgets::InitialVisibilityOption::StartVisible, m_preferredSize);
+ KDDockWidgets::InitialOption unfocussedPalette(KDDockWidgets::InitialVisibilityOption::PreserveCurrentTab, m_preferredSize);
+
// Left
- auto *areaLeft = addDockWidget(LeftDockWidgetArea, pagePalette, areaCenter);
- addDockWidgetTabToArea(outlinePalette, areaLeft);
+ m_mainwindow->addDockWidget(pagePalette, KDDockWidgets::Location_OnLeft, nullptr, visiblePalette);
+ pagePalette->addDockWidgetAsTab(outlinePalette, hiddenPalette);
- // Left Center
- auto *areaCenterLeft = addDockWidget(LeftDockWidgetArea, inlinePalette, areaCenter);
- addDockWidgetTabToArea(scrapbookPalette, areaCenterLeft);
- addDockWidgetTabToArea(bookPalette, areaCenterLeft);
- addDockWidgetTabToArea(symbolPalette, areaCenterLeft);
+ // Left Center
+ // Workaround: inline palette acts as a main container for the other palettes, we have to show it so that it is docked.
+ m_mainwindow->addDockWidget(inlinePalette, KDDockWidgets::Location_OnRight, pagePalette, visiblePalette);
+ inlinePalette->addDockWidgetAsTab(scrapbookPalette, hiddenPalette);
+ inlinePalette->addDockWidgetAsTab(bookPalette, hiddenPalette);
+ inlinePalette->addDockWidgetAsTab(symbolPalette, hiddenPalette);
+ // Workaround: we have to hide inline palette manually.
+ inlinePalette->close();
// Left Bottom
- auto *areaLeftBottom = addDockWidget(BottomDockWidgetArea, layerPalette, areaLeft);
- addDockWidgetTabToArea(alignDistributePalette, areaLeftBottom);
- addDockWidgetTabToArea(undoPalette, areaLeftBottom);
+ m_mainwindow->addDockWidget(alignDistributePalette, KDDockWidgets::Location_OnBottom, pagePalette, visiblePalette);
+ alignDistributePalette->addDockWidgetAsTab(layerPalette, hiddenPalette);
+ alignDistributePalette->addDockWidgetAsTab(undoPalette, hiddenPalette);
- // Right Panel
- auto *areaRight = addDockWidget(RightDockWidgetArea, propertiesPalette, areaCenter);
- addDockWidget(CenterDockWidgetArea, contentPalette, areaRight);
+ // Right
+ m_mainwindow->addDockWidget(propertiesPalette, KDDockWidgets::Location_OnRight, nullptr, visiblePalette);
+ propertiesPalette->addDockWidgetAsTab(contentPalette, unfocussedPalette);
- // Top Panel
- // auto * areaTop = addDockWidget(TopDockWidgetArea, dockToolProperties);
- // areaTop->setAllowedAreas(NoDockWidgetArea);
- // areaTop->setDockAreaFlag(CDockAreaWidget::HideSingleWidgetTitleBar, true);
- // Resizing area height of left and bottom-left
- int heightL = areaLeft->height();
- setSplitterSizes(areaLeft, {heightL * 3 / 4, heightL * 1 / 4});
+ // Set active palettes
+ // alignDistributePalette->setAsCurrentTab();
+ // pagePalette->setAsCurrentTab();
+ // propertiesPalette->setAsCurrentTab();
- // Resizing area width of left, center-left, center and right
- int widthCL = areaCenter->width();
- int panelWidth = 290;
- setSplitterSizes(areaCenter, {panelWidth, panelWidth, widthCL - 3 * panelWidth, panelWidth});
+ // Save Scribus Default
+ addPerspective("Default");
+ restoreWorkspaceFromPrefs();
- // hide panels that are not visible in default workspace
- inlinePalette->closeDockWidget();
- scrapbookPalette->closeDockWidget();
- bookPalette->closeDockWidget();
- symbolPalette->closeDockWidget();
- layerPalette->closeDockWidget();
- undoPalette->closeDockWidget();
- outlinePalette->closeDockWidget();
+ // Save Users Preference
+ addPerspective("Current");
- // active palettes
- areaLeft->setCurrentDockWidget(pagePalette);
- areaRight->setCurrentDockWidget(propertiesPalette);
- areaLeftBottom->setCurrentDockWidget(alignDistributePalette);
+}
- // add perspective for a later usage, like reset workspace to default.
- this->addPerspective("Default");
+void DockManager::addPerspective(const QString name)
+{
+ if (m_perspectives.contains(name))
+ return;
+
+ m_perspectives.insert(name, perspectiveFromUi());
}
+
+void DockManager::removePerspective(const QString name)
+{
+ if (m_perspectives.contains(name))
+ m_perspectives.remove(name);
+}
+
+void DockManager::loadPerspective(const QString name)
+{
+ loadPerspective(perspectiveByName(name));
+}
+
+void DockManager::loadPerspective(const QByteArray byte)
+{
+ if(byte.isEmpty())
+ return;
+
+ KDDockWidgets::RestoreOptions options = KDDockWidgets::RestoreOption_None;
+ KDDockWidgets::LayoutSaver saver(options);
+ saver.restoreLayout(byte);
+}
+
+QByteArray DockManager::perspectiveByName(const QString name)
+{
+ if (!m_perspectives.contains(name))
+ return QByteArray();
+
+ return m_perspectives.value(name);
+}
+
+QByteArray DockManager::perspectiveFromUi()
+{
+ KDDockWidgets::RestoreOptions options = KDDockWidgets::RestoreOption_None;
+ KDDockWidgets::LayoutSaver saver(options);
+ return saver.serializeLayout();
+}
Index: scribus/manager/dock_manager.h
===================================================================
--- scribus/manager/dock_manager.h (Revision 27132)
+++ scribus/manager/dock_manager.h (Arbeitskopie)
@@ -28,10 +28,8 @@
#include "prefscontext.h"
#include "scribusapi.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockManager.h"
+#include "ui/docks/dock_panelbase.h"
-using namespace ads;
-
class ScribusMainWindow;
class PagePalette;
class OutlinePalette;
@@ -46,36 +44,43 @@
class SymbolPalette;
class DockCentralWidget;
-class SCRIBUS_API DockManager : public CDockManager
+class SCRIBUS_API DockManager : public QObject
{
Q_OBJECT
public:
- DockManager(QWidget *parent);
+ DockManager(DockManager const&) = delete;
+ void operator=(DockManager const&) = delete;
+ static DockManager &instance();
+ void setMainWindow(ScribusMainWindow *mainwindow);
void setCentralWidget(QWidget *widget);
void setupDocks();
+
/**
* @brief Creates all preconfigured workspaces as perspectives.
*/
void initWorkspaces();
+
/**
- * @brief Removes all dock widgets including docks added by plugins.
- */
- void removeAllDockWidgets();
- /**
- * @brief Hides all docked and floating dock containers.
- */
- void hideAllDocks();
- /**
* @brief Toggles the temporary visibility of all docks.
*/
void toggleDocksVisibility();
+
+ void refreshAllDocks();
+
+ void addPerspective(const QString name);
+ void removePerspective(const QString name);
+ void loadPerspective(const QString name);
+ void loadPerspective(const QByteArray byte);
+
+
/**
* @brief Returns true if all docks are temporary hidden.
* @return
*/
bool hasTemporaryHiddenDocks();
+
/**
* @brief Adds a dock widget to dock manager. Useful for docks that are not initialized by dock manager, e.g. from plugins.
* @param dock
@@ -82,7 +87,7 @@
* @param closed
* @return
*/
- CDockAreaWidget *addDockFromPlugin(CDockWidget *dock, bool closed = true);
+ void addDockFromPlugin(DockPanelBase *dock, bool closed = true);
PagePalette *pagePalette {nullptr};
OutlinePalette *outlinePalette {nullptr};
@@ -101,12 +106,12 @@
* @brief Restore current workspace from local preferences file
*/
void restoreWorkspaceFromPrefs();
+
/**
* @brief Save current workspace to local preferences file
*/
void saveWorkspaceToPrefs();
- void iconSetChange();
/**
* @brief Show all hidden dock palettes if temporary hidden.
*/
@@ -113,18 +118,20 @@
void restoreHiddenWorkspace();
protected:
+ DockManager(QObject *parent = nullptr);
+ ~DockManager() = default;
+
DockCentralWidget *dockCenter {nullptr};
+ ScribusMainWindow * m_mainwindow {nullptr};
bool m_dockTemporaryHidden {false};
- QMap<CDockWidget *, bool> m_temporaryHiddenDocks;
+ QMap<QString, QByteArray> m_perspectives;
+ static DockManager* m_instance;
+ QList<DockPanelBase*> m_docks;
- /**
- * @brief Refreshes all icons of a dock. Needed for icon set or GUI changes.
- * @param dockWidgets
- */
- void updateIcons(QList<CDockWidget *> dockWidgets);
- void updateIcon(CDockWidget * dockWidget);
+ QByteArray perspectiveByName(const QString name);
+ QByteArray perspectiveFromUi();
- void configureDock(CDockWidget *dock);
+ void configureDock(DockPanelBase *dock);
/**
* @brief Creates a default workspace as perspective.
@@ -131,6 +138,9 @@
*/
void createDefaultWorkspace();
+signals:
+ void hideAllDocks();
+
};
#endif // DOCK_MANAGER_H
Index: scribus/plugins/shapes/shapepalette.cpp
===================================================================
--- scribus/plugins/shapes/shapepalette.cpp (Revision 27132)
+++ scribus/plugins/shapes/shapepalette.cpp (Arbeitskopie)
@@ -32,7 +32,6 @@
#include "scribusXml.h"
#include "selection.h"
#include "shapepalette.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h"
#include "ui/scmessagebox.h"
#include "util.h"
#include "util_math.h"
@@ -280,13 +279,14 @@
}
}
-ShapePalette::ShapePalette(QWidget *parent) : DockPanelBase("Shap", "panel-custom-shapes", parent)
+ShapePalette::ShapePalette() : DockPanelBase("Shap", "panel-custom-shapes")
{
setMinimumSize( QSize( 220, 240 ) );
- setObjectName(QString::fromLocal8Bit("Shap"));
+
+ //setObjectName(QString::fromLocal8Bit("Shap"));
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
- containerWidget = new QWidget(this);
- vLayout = new QVBoxLayout( containerWidget );
+
+ vLayout = new QVBoxLayout();
vLayout->setSpacing(3);
vLayout->setContentsMargins(3, 3, 3, 3);
buttonLayout = new QHBoxLayout;
@@ -293,7 +293,7 @@
buttonLayout->setSpacing(6);
buttonLayout->setContentsMargins(0, 0, 0, 0);
- importButton = new QToolButton(this);
+ importButton = new QToolButton();
importButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
importButton->setIcon(IconManager::instance().loadIcon("document-open"));
importButton->setIconSize(QSize(16, 16));
@@ -302,7 +302,7 @@
QSpacerItem* spacer = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
buttonLayout->addItem( spacer );
- closeButton = new QToolButton(this);
+ closeButton = new QToolButton();
closeButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
closeButton->setIcon(IconManager::instance().loadIcon("close"));
closeButton->setIconSize(QSize(16, 16));
@@ -309,8 +309,12 @@
buttonLayout->addWidget( closeButton );
vLayout->addLayout( buttonLayout );
- Frame3 = new QToolBox( this );
+ Frame3 = new QToolBox();
vLayout->addWidget(Frame3);
+
+ containerWidget = new QWidget();
+ containerWidget->setLayout(vLayout);
+
setWidget(containerWidget);
unsetDoc();
Index: scribus/plugins/shapes/shapepalette.h
===================================================================
--- scribus/plugins/shapes/shapepalette.h (Revision 27132)
+++ scribus/plugins/shapes/shapepalette.h (Arbeitskopie)
@@ -40,7 +40,6 @@
#include "pluginapi.h"
-//#include "ui/scdockpalette.h"
#include "ui/docks/dock_panelbase.h"
#include "ui/sclistwidgetdelegate.h"
#include "fpointarray.h"
@@ -91,7 +90,7 @@
Q_OBJECT
public:
- ShapePalette(QWidget *parent);
+ ShapePalette();
~ShapePalette() {};
void writeToPrefs();
Index: scribus/plugins/shapes/shapeplugin.cpp
===================================================================
--- scribus/plugins/shapes/shapeplugin.cpp (Revision 27132)
+++ scribus/plugins/shapes/shapeplugin.cpp (Arbeitskopie)
@@ -25,13 +25,14 @@
#include <QWidget>
#include <QString>
+#include "scraction.h"
+#include "scribus.h"
+#include "scribusapp.h"
#include "scribuscore.h"
-#include "scribusapp.h"
+#include "shapepalette.h"
#include "shapeplugin.h"
-#include "scraction.h"
#include "ui/scmwmenumanager.h"
-
int shapeplugin_getPluginAPIVersion()
{
return PLUGIN_API_VERSION;
@@ -51,13 +52,6 @@
delete plug;
}
-ShapePlugin::ShapePlugin()
-{
- sc_palette = nullptr;
-}
-
-ShapePlugin::~ShapePlugin() {};
-
void ShapePlugin::languageChange()
{
if (sc_palette)
@@ -69,25 +63,15 @@
if (!sc_palette)
return;
- sc_palette->setMainWindow(mw);
+ sc_palette->setMainWindow(mw);
languageChange();
m_actions.insert("shapeShowPalette", new ScrAction(fullTrName(), QKeySequence(), this));
+ sc_palette->setToggleViewAction(m_actions["shapeShowPalette"]);
- // Use this if menu action is checkable
- // m_actions["shapeShowPalette"]->setToggleAction(true);
- // m_actions["shapeShowPalette"]->setChecked(false);
- // connect(m_actions["shapeShowPalette"], SIGNAL(toggled(bool)), sc_palette, SLOT(toggleView(bool)));
- // connect(sc_palette, SIGNAL(viewToggled(bool)), m_actions["shapeShowPalette"], SLOT(setChecked(bool)));
-
- // Use this if menu action is not checkable
- connect(m_actions["shapeShowPalette"], SIGNAL(triggered()), sc_palette, SLOT(toggleView()));
-
mw->scrMenuMgr->addMenuItemStringAfter("shapeShowPalette", "toolsInline", "Windows");
mw->scrMenuMgr->addMenuItemStringsToMenuBar("Windows", m_actions);
- // For some reason we can't call addDockWidget(...) directly. If we do so Scribus crashes.
- mw->dockManager->addDockFromPlugin(sc_palette, false);
-
+ DockManager::instance().addDockFromPlugin(sc_palette, false);
}
QString ShapePlugin::fullTrName() const
@@ -112,7 +96,7 @@
bool ShapePlugin::initPlugin()
{
- sc_palette = new ShapePalette(ScCore->primaryMainWindow());
+ sc_palette = new ShapePalette();
sc_palette->startup();
sc_palette->readFromPrefs();
return true;
Index: scribus/plugins/shapes/shapeplugin.h
===================================================================
--- scribus/plugins/shapes/shapeplugin.h (Revision 27132)
+++ scribus/plugins/shapes/shapeplugin.h (Arbeitskopie)
@@ -24,8 +24,8 @@
public:
// Standard plugin implementation
- ShapePlugin();
- virtual ~ShapePlugin();
+ ShapePlugin() {};
+ virtual ~ShapePlugin() {};
bool initPlugin() override;
bool cleanupPlugin() override;
QString fullTrName() const override;
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp (Revision 27132)
+++ scribus/prefsmanager.cpp (Arbeitskopie)
@@ -169,11 +169,11 @@
#endif
/** Set Default window position and size to sane default values which should work on every screen */
const QScreen* s = QGuiApplication::primaryScreen();
- appPrefs.uiPrefs.mainWinSettings.width = s->availableGeometry().width() * (4.0 / 5.0);
- appPrefs.uiPrefs.mainWinSettings.height = s->availableGeometry().height() * (4.0 / 5.0);
- appPrefs.uiPrefs.mainWinSettings.xPosition = (s->availableGeometry().width() - appPrefs.uiPrefs.mainWinSettings.width) / 2;
- appPrefs.uiPrefs.mainWinSettings.yPosition = (s->availableGeometry().height() - appPrefs.uiPrefs.mainWinSettings.height) / 2;
- appPrefs.uiPrefs.mainWinSettings.maximized = false;
+ // appPrefs.uiPrefs.mainWinSettings.width = s->availableGeometry().width() * (4.0 / 5.0);
+ // appPrefs.uiPrefs.mainWinSettings.height = s->availableGeometry().height() * (4.0 / 5.0);
+ // appPrefs.uiPrefs.mainWinSettings.xPosition = (s->availableGeometry().width() - appPrefs.uiPrefs.mainWinSettings.width) / 2;
+ // appPrefs.uiPrefs.mainWinSettings.yPosition = (s->availableGeometry().height() - appPrefs.uiPrefs.mainWinSettings.height) / 2;
+ // appPrefs.uiPrefs.mainWinSettings.maximized = false;
appPrefs.uiPrefs.mainWinState = QByteArray();
appPrefs.uiPrefs.RecentDocs.clear();
appPrefs.uiPrefs.recentDocCount = 5;
@@ -963,7 +963,6 @@
appPrefs.uiPrefs.language = "en_GB"; // If we get here, Houston, we have a problem!
}
appPrefs.uiPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate", "").toLatin1());
- appPrefs.uiPrefs.adsDockState = QByteArray::fromBase64(userprefsContext->get("ads_dockstate", "").toLatin1());
//continue here...
//Prefs."blah blah" =...
}
@@ -984,17 +983,17 @@
// The caller is responsible for ensuring we aren't called under those
// conditions.
Q_ASSERT(!emergencyActivated);
- int currentScreen = ScCore->primaryMainWindow()->getScreenNumber();
- int currentScreenXPos = 0;
- int currentScreenYPos = 0;
- ScCore->primaryMainWindow()->getScreenPosition(currentScreenXPos, currentScreenYPos);
- appPrefs.uiPrefs.mainWinSettings.xPosition = ScCore->primaryMainWindow()->pos().x() - currentScreenXPos;
- appPrefs.uiPrefs.mainWinSettings.yPosition = ScCore->primaryMainWindow()->pos().y() - currentScreenYPos;
- appPrefs.uiPrefs.mainWinSettings.width = ScCore->primaryMainWindow()->size().width();
- appPrefs.uiPrefs.mainWinSettings.height = ScCore->primaryMainWindow()->size().height();
- appPrefs.uiPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized();
- appPrefs.uiPrefs.mainWinSettings.screenNumber = currentScreen;
- appPrefs.uiPrefs.mainWinState = ScCore->primaryMainWindow()->saveState();
+ // int currentScreen = ScCore->primaryMainWindow()->getScreenNumber();
+ // int currentScreenXPos = 0;
+ // int currentScreenYPos = 0;
+ // ScCore->primaryMainWindow()->getScreenPosition(currentScreenXPos, currentScreenYPos);
+ // appPrefs.uiPrefs.mainWinSettings.xPosition = ScCore->primaryMainWindow()->pos().x() - currentScreenXPos;
+ // appPrefs.uiPrefs.mainWinSettings.yPosition = ScCore->primaryMainWindow()->pos().y() - currentScreenYPos;
+ // appPrefs.uiPrefs.mainWinSettings.width = ScCore->primaryMainWindow()->size().width();
+ // appPrefs.uiPrefs.mainWinSettings.height = ScCore->primaryMainWindow()->size().height();
+ // appPrefs.uiPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized();
+ // appPrefs.uiPrefs.mainWinSettings.screenNumber = currentScreen;
+ // appPrefs.uiPrefs.mainWinState = ScCore->primaryMainWindow()->saveState();
appPrefs.uiPrefs.RecentDocs.clear();
uint max = qMin(appPrefs.uiPrefs.recentDocCount, ScCore->primaryMainWindow()->m_recentDocsList.count());
for (uint m = 0; m < max; ++m)
@@ -1018,7 +1017,6 @@
{
userprefsContext->set("gui_language", appPrefs.uiPrefs.language);
userprefsContext->set("mainwinstate", QString::fromLatin1(appPrefs.uiPrefs.mainWinState.toBase64()));
- userprefsContext->set("ads_dockstate", QString::fromLatin1(appPrefs.uiPrefs.adsDockState.toBase64()));
//continue here...
//Prefs."blah blah" =...
}
@@ -1606,14 +1604,14 @@
dcOperatorTools.setAttribute("RotationConstrainAngle", ScCLocale::toQStringC(appPrefs.opToolPrefs.constrain));
elem.appendChild(dcOperatorTools);
- QDomElement dcMainWindow = docu.createElement("MainWindow");
- dcMainWindow.setAttribute("XPosition", appPrefs.uiPrefs.mainWinSettings.xPosition);
- dcMainWindow.setAttribute("YPosition", appPrefs.uiPrefs.mainWinSettings.yPosition);
- dcMainWindow.setAttribute("Width", appPrefs.uiPrefs.mainWinSettings.width);
- dcMainWindow.setAttribute("Height", appPrefs.uiPrefs.mainWinSettings.height);
- dcMainWindow.setAttribute("Maximized", static_cast<int>(appPrefs.uiPrefs.mainWinSettings.maximized));
- dcMainWindow.setAttribute("ScreenNumber", appPrefs.uiPrefs.mainWinSettings.screenNumber);
- elem.appendChild(dcMainWindow);
+ // QDomElement dcMainWindow = docu.createElement("MainWindow");
+ // dcMainWindow.setAttribute("XPosition", appPrefs.uiPrefs.mainWinSettings.xPosition);
+ // dcMainWindow.setAttribute("YPosition", appPrefs.uiPrefs.mainWinSettings.yPosition);
+ // dcMainWindow.setAttribute("Width", appPrefs.uiPrefs.mainWinSettings.width);
+ // dcMainWindow.setAttribute("Height", appPrefs.uiPrefs.mainWinSettings.height);
+ // dcMainWindow.setAttribute("Maximized", static_cast<int>(appPrefs.uiPrefs.mainWinSettings.maximized));
+ // dcMainWindow.setAttribute("ScreenNumber", appPrefs.uiPrefs.mainWinSettings.screenNumber);
+ // elem.appendChild(dcMainWindow);
QDomElement dcScrapbook = docu.createElement("ScrapBook");
dcScrapbook.setAttribute("CopyToScrapbook", static_cast<int>(appPrefs.scrapbookPrefs.doCopyToScrapbook));
@@ -2329,47 +2327,47 @@
appPrefs.opToolPrefs.constrain = ScCLocale::toDoubleC(dc.attribute("RotationConstrainAngle"), 15.0);
}
- if (dc.tagName() == "MainWindow")
- {
- appPrefs.uiPrefs.mainWinSettings.xPosition = dc.attribute("XPosition", "0").toInt();
- appPrefs.uiPrefs.mainWinSettings.yPosition = dc.attribute("YPosition", "0").toInt();
- appPrefs.uiPrefs.mainWinSettings.width = dc.attribute("Width", "640").toInt();
- appPrefs.uiPrefs.mainWinSettings.height = dc.attribute("Height", "480").toInt();
- appPrefs.uiPrefs.mainWinSettings.maximized = static_cast<bool>(dc.attribute("Maximized", "0").toInt());
- appPrefs.uiPrefs.mainWinSettings.screenNumber = dc.attribute("ScreenNumber", "0").toInt();
- int minX = 0;
- int minY = 0;
-#ifdef Q_OS_MACOS
- // on Mac you're dead if the titlebar is not on screen
- minY = 22;
-#endif
- if (QGuiApplication::screens().count() == 1)
- {
- if (appPrefs.uiPrefs.mainWinSettings.xPosition < minX )
- appPrefs.uiPrefs.mainWinSettings.xPosition = minX;
- if (appPrefs.uiPrefs.mainWinSettings.yPosition < minY)
- appPrefs.uiPrefs.mainWinSettings.yPosition = minY;
- }
- int minWidth = 0;
- int minHeight = 0;
- const QScreen* s = QGuiApplication::screens().at(qMin(appPrefs.uiPrefs.mainWinSettings.screenNumber, QGuiApplication::screens().count() - 1));
- int maxWidth = s->availableSize().width();
- int maxHeight = s->availableSize().height();
- if (appPrefs.uiPrefs.mainWinSettings.width > maxWidth)
- appPrefs.uiPrefs.mainWinSettings.width = maxWidth;
- if (appPrefs.uiPrefs.mainWinSettings.width < minWidth)
- appPrefs.uiPrefs.mainWinSettings.width = minWidth;
- if (appPrefs.uiPrefs.mainWinSettings.height > maxHeight)
- appPrefs.uiPrefs.mainWinSettings.height = maxHeight;
- if (appPrefs.uiPrefs.mainWinSettings.height < minHeight)
- appPrefs.uiPrefs.mainWinSettings.height = minHeight;
- int maxX = s->availableSize().width() - minWidth;
- int maxY = s->availableSize().height() - minHeight;
- if (appPrefs.uiPrefs.mainWinSettings.xPosition >= maxX)
- appPrefs.uiPrefs.mainWinSettings.xPosition = maxX;
- if (appPrefs.uiPrefs.mainWinSettings.yPosition >= maxY)
- appPrefs.uiPrefs.mainWinSettings.yPosition = maxY;
- }
+// if (dc.tagName() == "MainWindow")
+// {
+// appPrefs.uiPrefs.mainWinSettings.xPosition = dc.attribute("XPosition", "0").toInt();
+// appPrefs.uiPrefs.mainWinSettings.yPosition = dc.attribute("YPosition", "0").toInt();
+// appPrefs.uiPrefs.mainWinSettings.width = dc.attribute("Width", "640").toInt();
+// appPrefs.uiPrefs.mainWinSettings.height = dc.attribute("Height", "480").toInt();
+// appPrefs.uiPrefs.mainWinSettings.maximized = static_cast<bool>(dc.attribute("Maximized", "0").toInt());
+// appPrefs.uiPrefs.mainWinSettings.screenNumber = dc.attribute("ScreenNumber", "0").toInt();
+// int minX = 0;
+// int minY = 0;
+// #ifdef Q_OS_MACOS
+// // on Mac you're dead if the titlebar is not on screen
+// minY = 22;
+// #endif
+// if (QGuiApplication::screens().count() == 1)
+// {
+// if (appPrefs.uiPrefs.mainWinSettings.xPosition < minX )
+// appPrefs.uiPrefs.mainWinSettings.xPosition = minX;
+// if (appPrefs.uiPrefs.mainWinSettings.yPosition < minY)
+// appPrefs.uiPrefs.mainWinSettings.yPosition = minY;
+// }
+// int minWidth = 0;
+// int minHeight = 0;
+// const QScreen* s = QGuiApplication::screens().at(qMin(appPrefs.uiPrefs.mainWinSettings.screenNumber, QGuiApplication::screens().count() - 1));
+// int maxWidth = s->availableSize().width();
+// int maxHeight = s->availableSize().height();
+// if (appPrefs.uiPrefs.mainWinSettings.width > maxWidth)
+// appPrefs.uiPrefs.mainWinSettings.width = maxWidth;
+// if (appPrefs.uiPrefs.mainWinSettings.width < minWidth)
+// appPrefs.uiPrefs.mainWinSettings.width = minWidth;
+// if (appPrefs.uiPrefs.mainWinSettings.height > maxHeight)
+// appPrefs.uiPrefs.mainWinSettings.height = maxHeight;
+// if (appPrefs.uiPrefs.mainWinSettings.height < minHeight)
+// appPrefs.uiPrefs.mainWinSettings.height = minHeight;
+// int maxX = s->availableSize().width() - minWidth;
+// int maxY = s->availableSize().height() - minHeight;
+// if (appPrefs.uiPrefs.mainWinSettings.xPosition >= maxX)
+// appPrefs.uiPrefs.mainWinSettings.xPosition = maxX;
+// if (appPrefs.uiPrefs.mainWinSettings.yPosition >= maxY)
+// appPrefs.uiPrefs.mainWinSettings.yPosition = maxY;
+// }
if (dc.tagName() == "ScrapBook")
{
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h (Revision 27132)
+++ scribus/prefsstructs.h (Arbeitskopie)
@@ -94,17 +94,17 @@
}
};
-struct WindowPrefs
-{
- int xPosition {0};
- int yPosition {0};
- int width {800};
- int height {600};
- bool visible {true};
- bool docked {false};
- bool maximized {false};
- int screenNumber {0};
-};
+// struct WindowPrefs
+// {
+// int xPosition {0};
+// int yPosition {0};
+// int width {800};
+// int height {600};
+// bool visible {true};
+// bool docked {false};
+// bool maximized {false};
+// int screenNumber {0};
+// };
struct tabPrefs
{
@@ -134,9 +134,8 @@
bool stickyTools {false}; //! Whether a user's tool section remains after use or the normal tool is reselected
bool grayscaleIcons {false}; //! Show icons in toolbars as grayscale
QString iconSet; //! Icon set name
- WindowPrefs mainWinSettings;
+ // WindowPrefs mainWinSettings;
QByteArray mainWinState;
- QByteArray adsDockState;
};
//Paths
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (Revision 27132)
+++ scribus/scribus.cpp (Arbeitskopie)
@@ -239,6 +239,7 @@
#include "ui/tabmanager.h"
#include "ui/transformdialog.h"
#include "ui/viewtoolbar.h"
+#include "ui/factories/scribusproxystyle.h"
#include "undogui.h"
#include "undomanager.h"
#include "undostate.h"
@@ -247,8 +248,6 @@
#include "util.h"
#include "util_file.h"
#include "util_formats.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockAreaWidget.h"
-#include "third_party/Qt-Advanced-Docking-System/src/IconProvider.h"
#ifdef HAVE_SVNVERSION
#include "svnversion.h"
@@ -268,13 +267,18 @@
#include "sclimits.h"
using namespace std;
-using namespace ads;
bool previewDinUse;
bool printDinUse;
extern bool emergencyActivated;
-ScribusMainWindow::ScribusMainWindow() :
+// MainWindowOptions see: https://github.com/KDAB/KDDockWidgets/blob/main/src/KDDockWidgets.h
+
+ScribusMainWindow::ScribusMainWindow() : MainWindow("scribusmainwindow",
+ KDDockWidgets::MainWindowOptions {
+ KDDockWidgets::MainWindowOption_HasCentralWidget |
+ KDDockWidgets::MainWindowOption_CentralWidgetGetsAllExtraSpace
+ }, nullptr),
m_prefsManager(PrefsManager::instance()),
m_widgetManager(WidgetManager::instance())
{
@@ -292,37 +296,6 @@
*/
int ScribusMainWindow::initScMW(bool primaryMainWindow)
{
- // Documentation: https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/blob/master/doc/user-guide.md
- CDockManager::setConfigFlag(CDockManager::AlwaysShowTabs, false);
- CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetIcon, true);
- CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetTitle, true);
- CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, false);
- CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
- CDockManager::setConfigFlag(CDockManager::TabCloseButtonIsToolButton, true);
- CDockManager::setConfigFlag(CDockManager::AllTabsHaveCloseButton, false);
-// CDockManager::setConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true);
- CDockManager::setConfigFlag(CDockManager::DockAreaHasCloseButton, false);
- CDockManager::setConfigFlag(CDockManager::DockAreaHasUndockButton, false);
- CDockManager::setConfigFlag(CDockManager::DockAreaHideDisabledButtons, true);
- CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
- CDockManager::setConfigFlag(CDockManager::DisableTabTextEliding, true);
- CDockManager::setConfigFlag(CDockManager::ShowTabTextOnlyForActiveTab, !m_prefsManager.appPrefs.uiPrefs.showLabelsOfInactiveTabs);
-
- // Documentation: https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/blob/master/doc/user-guide.md#auto-hide-configuration-flags
- CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
-// CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideShowOnMouseOver, false);
-// CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock, true);
-// CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideButtonTogglesArea, true);
- CDockManager::setAutoHideConfigFlag(CDockManager::DockAreaHasAutoHideButton, true);
-
- IconManager &iconmanager = IconManager::instance();
- CDockManager::iconProvider().registerCustomIcon(TabCloseIcon, iconmanager.loadIcon("close", 12));
- CDockManager::iconProvider().registerCustomIcon(DockAreaCloseIcon, iconmanager.loadIcon("close", 12));
- CDockManager::iconProvider().registerCustomIcon(DockAreaMenuIcon, iconmanager.loadIcon("menu-down", 16));
- CDockManager::iconProvider().registerCustomIcon(DockAreaUndockIcon, iconmanager.loadIcon("dock-float", 16));
- CDockManager::iconProvider().registerCustomIcon(AutoHideIcon, iconmanager.loadIcon("dock-auto-hide", 16));
- CDockManager::iconProvider().registerCustomIcon(DockAreaMinimizeIcon, iconmanager.loadIcon("dock-minimize", 16));
-
int retVal=0;
//qsrand(1234);
QByteArray stylesheet;
@@ -362,7 +335,7 @@
appModeHelper = new AppModeHelper();
appModeHelper->setup(actionManager, &scrActions, &scrRecentFileActions, &scrWindowsActions, &scrScrapActions, &scrLayersActions, &scrRecentPasteActions);
scrMenuMgr = new ScMWMenuManager(menuBar(), actionManager);
- dockManager = new DockManager(this);
+ DockManager::instance().setMainWindow(this);
m_formatsManager = FormatsManager::instance();
m_objectSpecificUndo = false;
@@ -399,7 +372,7 @@
if (primaryMainWindow)
ScCore->setSplashStatus( tr("Initializing Workspaces") );
initPalettes();
- dockManager->initWorkspaces();
+ // dockManager->initWorkspaces();
viewToolBar->previewQualitySwitcher->setCurrentIndex(m_prefsManager.appPrefs.itemToolPrefs.imageLowResType);
if (primaryMainWindow)
@@ -455,19 +428,20 @@
appModeHelper->setStartupActionsEnabled(false);
ScQApp->changeLabelVisibility(m_prefsManager.appPrefs.uiPrefs.showLabels);
+ DockManager::instance().refreshAllDocks();
setStyleSheet();
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
- connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, [this]()
- {
- emit ScQApp->iconSetChanged();
- // THIS IS A WORKAROUND!
- // It seems like once a widget has a custom style it doesn't redraw automatically with dark or light theme.
- // If we set the style sheet again it forces a redrawing with the current theme.
- setStyleSheet();
- });
-#endif
+// #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+// connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, [this]()
+// {
+// emit ScQApp->iconSetChanged();
+// // THIS IS A WORKAROUND!
+// // It seems like once a widget has a custom style it doesn't redraw automatically with dark or light theme.
+// // If we set the style sheet again it forces a redrawing with the current theme.
+// setStyleSheet();
+// });
+// #endif
return retVal;
}
@@ -496,28 +470,9 @@
m_prefsManager.appPrefs.verifierPrefs.curCheckProfile = CommonStrings::PDF_1_4;
}
- const WindowPrefs& mainWinSettings = m_prefsManager.appPrefs.uiPrefs.mainWinSettings;
- QWindow* w = windowHandle();
- QList<QScreen*> screens = QGuiApplication::screens();
- QScreen* s = nullptr;
- if (w != nullptr)
- {
- s = screens.at(qMin(mainWinSettings.screenNumber, QGuiApplication::screens().count() - 1));
- windowHandle()->setScreen(s);
- }
- else
- s = QGuiApplication::primaryScreen();
- QRect r(0, 0, 0, 0);
- if (s != nullptr)
- r = s->geometry();
- move(r.left() + abs(mainWinSettings.xPosition), r.top() + abs(mainWinSettings.yPosition));
- resize(mainWinSettings.width, mainWinSettings.height);
+ // We have to load the workspace after the MainWindow is shown
+ DockManager::instance().initWorkspaces();
- if (mainWinSettings.maximized)
- this->setWindowState((this->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowMaximized);
-
- if (!m_prefsManager.appPrefs.uiPrefs.mainWinState.isEmpty())
- restoreState(m_prefsManager.appPrefs.uiPrefs.mainWinState);
}
int ScribusMainWindow::getScreenNumber() const
@@ -607,8 +562,6 @@
stylesheet.replace("___tb_menu_arrow___", tba);
}
- dockManager->setStyleSheet(stylesheet); // style sheet should be enabled when theme manager is implemented to handle color palettes in css file.
-
layerMenu->setStyleSheet(stylesheet);
unitSwitcher->setStyleSheet(stylesheet);
zoomDefaultToolbarButton->setStyleSheet(stylesheet);
@@ -694,15 +647,15 @@
//CB TODO hide the publicly available members of some palettes
// these must be filtered too as they take control of the palettes events
- dockManager->setupDocks();
+ DockManager::instance().setupDocks();
// Outliner
- outlinePalette = dockManager->outlinePalette;
+ outlinePalette = DockManager::instance().outlinePalette;
outlinePalette->setMainWindow(this);
outlinePalette->setToggleViewAction(scrActions["toolsOutline"]);
// Frame Properties
- propertiesPalette = dockManager->propertiesPalette;
+ propertiesPalette = DockManager::instance().propertiesPalette;
propertiesPalette->setMainWindow(this);
propertiesPalette->setToggleViewAction(scrActions["toolsProperties"]);
emit UpdateRequest(reqDefFontListUpdate);
@@ -709,7 +662,7 @@
propertiesPalette->installEventFilter(this);
// Content Properties
- contentPalette = dockManager->contentPalette;
+ contentPalette = DockManager::instance().contentPalette;
contentPalette->setMainWindow(this);
contentPalette->setToggleViewAction(scrActions["toolsContent"]);
contentPalette->installEventFilter(this);
@@ -725,12 +678,12 @@
charPalette = new CharSelect(this);
// Layer
- layerPalette = dockManager->layerPalette;
+ layerPalette = DockManager::instance().layerPalette;
layerPalette->setToggleViewAction(scrActions["toolsLayers"]);
layerPalette->installEventFilter(this);
// Scrapbook
- scrapbookPalette = dockManager->scrapbookPalette;
+ scrapbookPalette = DockManager::instance().scrapbookPalette;
scrapbookPalette->setToggleViewAction(scrActions["toolsScrapbook"]);
connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString)));
connect( scrapbookPalette, SIGNAL(scrapbookListChanged()), this, SLOT(rebuildScrapbookMenu()));
@@ -737,13 +690,13 @@
scrapbookPalette->installEventFilter(this);
// Pages
- pagePalette = dockManager->pagePalette;
+ pagePalette = DockManager::instance().pagePalette;
pagePalette->setMainWindow(this);
pagePalette->setToggleViewAction(scrActions["toolsPages"]);
pagePalette->installEventFilter(this);
// Bookmark
- bookmarkPalette = dockManager->bookPalette;
+ bookmarkPalette = DockManager::instance().bookPalette;
bookmarkPalette->setToggleViewAction(scrActions["toolsBookmarks"]);
bookmarkPalette->installEventFilter(this);
@@ -772,13 +725,13 @@
documentLogViewer->hide();
// Align & Distribute
- alignDistributePalette = dockManager->alignDistributePalette;
+ alignDistributePalette = DockManager::instance().alignDistributePalette;
alignDistributePalette->setToggleViewAction(scrActions["toolsAlignDistribute"]);
connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh()));
alignDistributePalette->installEventFilter(this);
// Symbols
- symbolPalette = dockManager->symbolPalette;
+ symbolPalette = DockManager::instance().symbolPalette;
symbolPalette->setMainWindow(this);
symbolPalette->setToggleViewAction(scrActions["toolsSymbols"]);
connect(symbolPalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString)));
@@ -787,7 +740,7 @@
symbolPalette->installEventFilter(this);
// Inline Elements
- inlinePalette = dockManager->inlinePalette;
+ inlinePalette = DockManager::instance().inlinePalette;
inlinePalette->setMainWindow(this);
inlinePalette->setToggleViewAction(scrActions["toolsInline"]);
connect(inlinePalette, SIGNAL(startEdit(int)), this, SLOT(editInlineStart(int)));
@@ -796,7 +749,7 @@
inlinePalette->installEventFilter(this);
// Undo
- undoPalette = dockManager->undoPalette;
+ undoPalette = DockManager::instance().undoPalette;
undoPalette->setToggleViewAction(scrActions["toolsActionHistory"]);
undoPalette->installEventFilter(this);
m_undoManager->registerGui(undoPalette);
@@ -905,8 +858,8 @@
}
else
mdiArea->setViewMode(QMdiArea::SubWindowView);
- //setCentralWidget(mdiArea);
- dockManager->setCentralWidget(mdiArea);
+
+ DockManager::instance().setCentralWidget(mdiArea);
}
void ScribusMainWindow::initMenuBar()
@@ -1901,18 +1854,11 @@
pdfToolBar->connectPrefsSlot(false);
// if palettes are temporary hidden restore them before saving the workspace
- dockManager->restoreHiddenWorkspace();
+ DockManager::instance().restoreHiddenWorkspace();
// Save GUI state
- dockManager->saveWorkspaceToPrefs();
+ DockManager::instance().saveWorkspaceToPrefs();
- // We need to remove all docks from the DockManager to prevent a memory leak
- // in case a plugin has added a dock in the DockManager and is simply deleted
- // on cleanup before it is removed from the DockManager.
- // Removed Docks are not deleted directly.
- dockManager->removeAllDockWidgets();
-
-
// Clean up plugins, THEN save prefs to disk
ScCore->pluginManager->cleanupPlugins();
if (!m_prefsManager.appPrefs.scrapbookPrefs.persistentScrapbook)
@@ -5471,7 +5417,7 @@
void ScribusMainWindow::ToggleAllPalettes()
{
- dockManager->toggleDocksVisibility();
+ DockManager::instance().toggleDocksVisibility();
if (m_palettesStatus[PAL_ALL])
{
@@ -6489,37 +6435,19 @@
QString newUIStylePalette = m_prefsManager.appPrefs.uiPrefs.stylePalette;
if (oldPrefs.uiPrefs.stylePalette != newUIStylePalette)
{
- forceStyleUpdate = true;
if (newUIStylePalette == "dark")
- {
- QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Dark);
-#if (defined Q_OS_LINUX)
- QPalette pal(QColor(49, 49, 49));
- QApplication::setPalette(pal);
-#endif
- }
+ ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Dark);
else if (newUIStylePalette == "light")
- {
- QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light);
-#if (defined Q_OS_LINUX)
- QPalette pal(QColor(239, 239, 239));
- QApplication::setPalette(pal);
-#endif
- }
+ ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Light);
else
- {
- QApplication::styleHints()->unsetColorScheme();
-#if (defined Q_OS_LINUX)
- QApplication::setPalette(this->style()->standardPalette());
-#endif
+ ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::System);
}
- }
#endif
bool forceIconUpdate = false;
QString newUIStyle = m_prefsManager.guiStyle();
- if (oldPrefs.uiPrefs.style != newUIStyle || forceStyleUpdate == true)
+ if (oldPrefs.uiPrefs.style != newUIStyle)
{
forceIconUpdate = true;
@@ -6527,11 +6455,11 @@
if (!newUIStyle.isEmpty())
styleName = newUIStyle;
- QStyle * newStyle = QStyleFactory::create(styleName);
- if (newStyle)
- QApplication::setStyle(newStyle);
- else
- m_prefsManager.appPrefs.uiPrefs.style = oldPrefs.uiPrefs.style;
+ ScribusProxyStyle::instance()->setBaseStyleName(styleName);
+ // if (scStyle)
+ // ScQApp->setStyle(scStyle);
+ // else
+ // m_prefsManager.appPrefs.uiPrefs.style = oldPrefs.uiPrefs.style;
}
if (useDefaultScratchColor)
@@ -6543,6 +6471,7 @@
ScQApp->changeIconSet(newIconSet);
ScQApp->changeLabelVisibility(m_prefsManager.appPrefs.uiPrefs.showLabels);
+ DockManager::instance().refreshAllDocks();
int newUIFontSize = m_prefsManager.guiFontSize();
if (oldPrefs.uiPrefs.applicationFontSize != newUIFontSize)
@@ -6712,9 +6641,6 @@
nsEditor->startup();
symbolPalette->startup();
- // try to load custom layout from preferences
- dockManager->restoreWorkspaceFromPrefs();
-
// init the toolbars
fileToolBar->initVisibility();
editToolBar->initVisibility();
@@ -7609,7 +7535,7 @@
{
if (!HaveDoc)
return;
- m_pagePaletteWasClosed = pagePalette->isClosed();
+ m_pagePaletteWasClosed = pagePalette->isHidden();
QString mpName;
if (temp.isEmpty())
mpName = doc->currentPage()->masterPageName();
@@ -7642,13 +7568,9 @@
view->saveViewState();
pagePalette->startMasterPageMode(mpName);
- if (pagePalette->isClosed())
- {
- auto* area = pagePalette->dockAreaWidget();
- auto* dockWidget = area->currentDockWidget();
- scrActions["toolsPages"]->setChecked(true);
- area->setCurrentDockWidget(dockWidget);
- }
+ if (pagePalette->isHidden())
+ scrActions["toolsPages"]->triggered(true);
+
appModeHelper->setMasterPageEditMode(true, doc);
}
Index: scribus/scribus.css
===================================================================
--- scribus/scribus.css (Revision 27132)
+++ scribus/scribus.css (Arbeitskopie)
@@ -45,184 +45,3 @@
QComboBox#unitSwitcher::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }
ScToolBar QToolButton::menu-indicator { image: url(___tb_menu_arrow___); }
-
-
-/*
- * Dock Container
- */
-ads--CDockContainerWidget {
- background: palette(mid);
-}
-ads--CDockContainerWidget > QSplitter{
- padding: 1 0 1 0;
-}
-
-ads--CDockContainerWidget ads--CDockSplitter::handle {
- background: none;
- height: 2px;
-}
-
-/*
-* Dock Area
-*/
-
-ads--CDockAreaWidget {
- background: none;
- border: none;
- /*border: 1px solid white;*/
-}
-
-ads--CDockAreaWidget #tabsMenuButton::menu-indicator {
- image: none;
-}
-
-/*
-* Dock Area Title bar
-*/
-
-ads--CDockAreaTitleBar
-{
- background: palette(mid);
- min-height: 24px;
- /* border-bottom: 1px solid palette(window); */
-}
-
-/* Container of all tabs */
-ads--CDockAreaTabBar #tabsContainerWidget
-{
- background: palette(mid);
- /* border-bottom: 1px solid palette(window); */
-}
-
-/*
-* Tab
-*/
-ads--CDockWidgetTab {
- background: none;
- /*border-color: palette(light);
- border-style: solid;
- border-width: 0 1px 0 0;*/
- padding: 0px;
- border:none;
-}
-
-ads--CDockWidgetTab[activeTab="false"]
-{
- background: none;
- border-right: 1px solid palette(window);
- /* border-bottom: 1px solid palette(window); */
-}
-
-ads--CDockWidgetTab[activeTab="true"] {
- background: palette(window);
-}
-
-ads--CDockWidgetTab QLabel {
- color: palette(foreground);
-}
-
-ads--CDockWidgetTab[activeTab="true"] QLabel {
- color: palette(foreground);
-}
-
-ads--CDockWidgetTab[activeTab="false"] QLabel {
- color: palette(foreground)
-}
-
-
-/*
-* Dock Widget
-*/
-
-ads--CDockWidget {
- background: none;
- border: none;
- /*border-color: palette(light);
- border-style: solid;
- border-width: 1px 0 0 0;*/
-}
-
-ads--CTitleBarButton {
- padding: 0px 0px;
-}
-
-QScrollArea#dockWidgetScrollArea {
- padding: 0px;
- border: none;
-}
-
-/*
-* Buttons
-*/
-
-#tabCloseButton {
-
- margin-top: 2px;
- padding:0px;
- background: none;
- border: none;
- border-radius: 2px;
-/* qproperty-icon: url(:/ads/images/close-button.svg),
- url(:/ads/images/close-button-disabled.svg) disabled;*/
- qproperty-iconSize: 16px;
- width: 16px;
- height: 16px;
-}
-
-#tabCloseButton:hover {
- border: 1px solid rgba(0, 0, 0, 32);
- background: rgba(0, 0, 0, 16);
-}
-
-#tabCloseButton:pressed {
- background: rgba(0, 0, 0, 32);
-}
-
-#tabsMenuButton {
- /*qproperty-icon: url(:/ads/images/tabs-menu-button.svg);
- qproperty-iconSize: 16px;*/
-}
-
-#dockAreaCloseButton {
- /*qproperty-icon: url(:/ads/images/close-button.svg),
- url(:/ads/images/close-button-disabled.svg) disabled;*/
- qproperty-iconSize: 16px;
-}
-
-#detachGroupButton {
- /*qproperty-icon: url(:/ads/images/detach-button.svg),
- url(:/ads/images/detach-button-disabled.svg) disabled;*/
- qproperty-iconSize: 16px;
-}
-
-/*
-* Floating Widget
-*/
-
-ads--CFloatingWidgetTitleBar {
- background: palette(midlight);
- /*qproperty-maximizeIcon: url(:/ads/images/maximize-button.svg);
- qproperty-normalIcon: url(:/ads/images/restore-button.svg);*/
-}
-
-
-#floatingTitleCloseButton, #floatingTitleMaximizeButton {
- qproperty-iconSize: 16px;
- border: none;
- margin: 3px;
-}
-
-
-#floatingTitleCloseButton {
- /*qproperty-icon: url(:/ads/images/close-button.svg);*/
- qproperty-iconSize: 16px;
-}
-
-#floatingTitleCloseButton:hover {
- background: rgba(0, 0, 0, 24);
- border: none;
-}
-
-#floatingTitleCloseButton:pressed {
- background: rgba(0, 0, 0, 48);
-}
Index: scribus/scribus.h
===================================================================
--- scribus/scribus.h (Revision 27132)
+++ scribus/scribus.h (Arbeitskopie)
@@ -61,7 +61,11 @@
#include "styleoptions.h"
#include "ui/customfdialog.h"
#include "ui/scmessagebox.h"
+//#include "third_party/KDDockWidgets/src/core/MainWindow.h"
+#include <kddockwidgets/MainWindow.h>
+#include <kddockwidgets/DockWidget.h>
+
class ActionManager;
class AlignDistributePalette;
class AppModeHelper;
@@ -72,7 +76,6 @@
class CheckDocument;
class ColorCombo;
class ContentPalette;
-class DockManager;
class DocumentLogManager;
class DocumentLogViewer;
class DownloadsPalette;
@@ -126,7 +129,7 @@
* and statusbar. For the main view, an instance of class ScribusView is
* created which creates your view.
*/
-class SCRIBUS_API ScribusMainWindow : public QMainWindow, public UndoObject
+class SCRIBUS_API ScribusMainWindow : public KDDockWidgets::QtWidgets::MainWindow, public UndoObject
{
Q_OBJECT
@@ -230,8 +233,6 @@
/** \brief private doc for managing default patterns. */
ScribusDoc* m_doc {nullptr};
- DockManager * dockManager {nullptr};
-
QProgressBar* mainWindowProgressBar {nullptr};
ScrSpinBox* zoomSpinBox {nullptr}; //zoom spinbox at bottom of view
PageSelector* pageSelector {nullptr}; //Page selector at bottom of view
Index: scribus/scribusapp.cpp
===================================================================
--- scribus/scribusapp.cpp (Revision 27132)
+++ scribus/scribusapp.cpp (Arbeitskopie)
@@ -693,23 +693,32 @@
bool ScribusQApp::event(QEvent *event)
{
- switch (event->type())
+ switch (event->type())
{
case QEvent::FileOpen:
+ {
+ QString filename = static_cast<QFileOpenEvent*>(event)->file();
+ if(m_ScCore && m_ScCore->initialized())
{
- QString filename = static_cast<QFileOpenEvent*>(event)->file();
- if(m_ScCore && m_ScCore->initialized())
- {
- ScribusMainWindow* mw = m_ScCore->primaryMainWindow();
- mw->loadDoc(filename);
- }
- else
- {
- m_filesToLoad.append(filename);
- }
- return true;
+ ScribusMainWindow* mw = m_ScCore->primaryMainWindow();
+ mw->loadDoc(filename);
}
+ else
+ {
+ m_filesToLoad.append(filename);
+ }
+ return true;
+ }
+ case QEvent::ApplicationPaletteChange:
+ {
+ IconManager &im = IconManager::instance();
+ im.rebuildCache();
+ emit iconSetChanged();
+ }
+ break;
default:
- return QApplication::event(event);
+ break;
}
+
+ return QApplication::event(event);
}
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp (Revision 27132)
+++ scribus/scribuscore.cpp (Arbeitskopie)
@@ -48,9 +48,14 @@
#include "undomanager.h"
#include "util_debug.h"
#include "util_ghostscript.h"
+#include "ui/factories/scribusproxystyle.h"
+#include "ui/factories/sckddockviewfactory.h"
//extern ScribusQApp* ScQApp;
+//#include "third_party/KDDockWidgets/src/Config.h"
+#include <kddockwidgets/Config.h>
+
ScribusCore::ScribusCore() : defaultEngine(ScColorMgmtEngineFactory::createDefaultEngine()),
m_iconManager(IconManager::instance()),
m_prefsManager(PrefsManager::instance())
@@ -94,6 +99,24 @@
int ScribusCore::startGUI(bool showSplash, bool showFontInfo, bool showProfileInfo, const QString& newGuiLanguage)
{
+
+ // Initialize GUI
+ KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
+
+ // https://github.com/KDAB/KDDockWidgets/blob/2.0/src/Config.h
+ auto flags = KDDockWidgets::Config::self().flags();
+ // flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;
+ // flags |= KDDockWidgets::Config::Flag_ShowButtonsOnTabBarIfTitleBarHidden;
+ // flags |= KDDockWidgets::Config::Flag_AllowSwitchingTabsViaMenu;
+ flags |= KDDockWidgets::Config::Flag_AutoHideSupport;
+ flags |= KDDockWidgets::Config::Flag_AllowReorderTabs;
+
+ // flags |= KDDockWidgets::Config::Flag_TabsHaveCloseButton;
+ flags |= KDDockWidgets::Config::Flag_CloseOnlyCurrentTab;
+
+ KDDockWidgets::Config::self().setFlags(flags);
+
+
auto* scribus = new ScribusMainWindow();
Q_CHECK_PTR(scribus);
if (!scribus)
@@ -135,8 +158,8 @@
{
if (PrefsManager::instance().appPrefs.uiPrefs.showStartupDialog && usingGUI())
scribus->startUpDialog();
- else
- scribus->setFocus();
+ // else
+ // scribus->setFocus();
}
}
else if (subsRet == QMessageBox::Help)
@@ -179,45 +202,43 @@
// This is a very basic implemenation of the UI theme palette.
// If necessary implement platform specific theme configurations here.
+ // Custom Widget Factory for KDDockWidgets
+ KDDockWidgets::Config::self().setViewFactory(new ScKDDockViewFactory());
+
+ // Configure GUI
+ const QString& prefsUiStyle = m_prefsManager.appPrefs.uiPrefs.style;
+ QString qtStyle = nullptr;
+ if (prefsUiStyle.length() > 0)
+ {
+ QStringList availableStyles = QStyleFactory::keys();
+ if (availableStyles.contains(prefsUiStyle))
+ qtStyle = prefsUiStyle;
+ else
+ m_prefsManager.appPrefs.uiPrefs.style.clear();
+ }
+
+ ScribusProxyStyle* scStyle = new ScribusProxyStyle(qtStyle);
+ scStyle->setParent(qApp);
+
// Apply different palette only if the system UI palette is different.
#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "dark" && QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light)
{
- QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Dark);
-
- // https://bugreports.qt.io/browse/QTBUG-132929
-#if (defined Q_OS_LINUX)
- QPalette pal(QColor(49, 49, 49));
- QApplication::setPalette(pal);
-#endif
+ scStyle->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Dark);
m_SplashScreen->setPixmap(m_iconManager.splashScreen());
}
else if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "light" && QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark)
{
- QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light);
-
- // https://bugreports.qt.io/browse/QTBUG-132929
-#if (defined Q_OS_LINUX)
- QPalette pal(QColor(239, 239, 239));
- QApplication::setPalette(pal);
-#endif
+ scStyle->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Light);
m_SplashScreen->setPixmap(m_iconManager.splashScreen());
}
+ else
+ scStyle->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::System);
#endif
- // Configure GUI
- const QString& prefsUiStyle = m_prefsManager.appPrefs.uiPrefs.style;
- if (prefsUiStyle.length() > 0)
- {
- QStyle* qtStyle = nullptr;
- QStringList availableStyles = QStyleFactory::keys();
- if (availableStyles.contains(prefsUiStyle))
- qtStyle = QStyleFactory::create(prefsUiStyle);
- if (qtStyle)
- QApplication::setStyle(qtStyle);
- else
- m_prefsManager.appPrefs.uiPrefs.style.clear();
- }
+ qApp->setStyle(scStyle);
+ qApp->installEventFilter(scStyle);
+
QFont apf = QApplication::font();
apf.setPointSize(m_prefsManager.appPrefs.uiPrefs.applicationFontSize);
QApplication::setFont(apf);
Index: scribus/third_party/CMakeLists.txt
===================================================================
--- scribus/third_party/CMakeLists.txt (Revision 27132)
+++ scribus/third_party/CMakeLists.txt (Arbeitskopie)
@@ -1,6 +1,4 @@
-#if(WANT_QTADS)
-add_subdirectory(Qt-Advanced-Docking-System)
-#endif()
+add_subdirectory(KDDockWidgets)
if(HAVE_OSG)
add_subdirectory(prc)
Index: scribus/ui/aligndistribute.cpp
===================================================================
--- scribus/ui/aligndistribute.cpp (Revision 27132)
+++ scribus/ui/aligndistribute.cpp (Arbeitskopie)
@@ -65,10 +65,9 @@
// =============================
-AlignDistributePalette::AlignDistributePalette(QWidget* parent) : DockPanelBase("AlignDistributePalette", "panel-align-distribute", parent)
+AlignDistributePalette::AlignDistributePalette() : DockPanelBase("AlignDistributePalette", "panel-align-distribute")
{
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
- setObjectName("AlignDistributePalette");
ad = new AlignDistribute(this);
setWidget(ad);
@@ -92,7 +91,7 @@
resize( QSize(100, 100).expandedTo(minimumSizeHint()) );
languageChange();
- init();
+ setup();
setDoc(nullptr);
connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
@@ -113,6 +112,7 @@
void AlignDistributePalette::languageChange()
{
ad->retranslateUi(this);
+ setWindowTitle( tr("Align and Distribute"));
referenceGuideTooltipTemplate = tr("Align relative to a guide%1");
@@ -173,7 +173,7 @@
ad->distributeByDistanceLabel->setLabelVisibility(v);
}
-void AlignDistributePalette::init()
+void AlignDistributePalette::setup()
{
undoManager = UndoManager::instance();
Index: scribus/ui/aligndistribute.h
===================================================================
--- scribus/ui/aligndistribute.h (Revision 27132)
+++ scribus/ui/aligndistribute.h (Arbeitskopie)
@@ -67,7 +67,7 @@
Q_OBJECT
public:
- AlignDistributePalette( QWidget* parent = nullptr);
+ AlignDistributePalette();
~AlignDistributePalette() = default;
virtual void setDoc( ScribusDoc* newDoc );
@@ -121,7 +121,7 @@
void alignMethodChanged(int);
private:
- void init();
+ void setup();
void enableGuideButtons();
UndoManager *undoManager { nullptr };
Index: scribus/ui/bookmarkpalette.cpp
===================================================================
--- scribus/ui/bookmarkpalette.cpp (Revision 27132)
+++ scribus/ui/bookmarkpalette.cpp (Arbeitskopie)
@@ -25,7 +25,7 @@
#include "bookmarkpalette.h"
-BookPalette::BookPalette(QWidget* parent) : DockPanelBase( "Books", "panel-bookmarks", parent )
+BookPalette::BookPalette() : DockPanelBase( "Books", "panel-bookmarks")
{
setObjectName(QString::fromLocal8Bit("Books"));
setMinimumSize( QSize(220, 240) );
Index: scribus/ui/bookmarkpalette.h
===================================================================
--- scribus/ui/bookmarkpalette.h (Revision 27132)
+++ scribus/ui/bookmarkpalette.h (Arbeitskopie)
@@ -50,7 +50,7 @@
\param parent Parent Window
\retval None
*/
- BookPalette(QWidget* parent);
+ BookPalette();
~BookPalette() {};
BookmarkView *BView;
Index: scribus/ui/contentpalette.cpp
===================================================================
--- scribus/ui/contentpalette.cpp (Revision 27132)
+++ scribus/ui/contentpalette.cpp (Arbeitskopie)
@@ -25,8 +25,7 @@
#include "styles/paragraphstyle.h"
#include "styles/charstyle.h"
-ContentPalette::ContentPalette(QWidget *parent) :
- DockPanelBase("ContentPalette", "panel-content-properties", parent)
+ContentPalette::ContentPalette() : DockPanelBase("ContentPalette", "panel-content-properties")
{
setObjectName(QString::fromLocal8Bit("ContentPalette"));
@@ -34,7 +33,7 @@
f.setPointSize(f.pointSize()-1);
setFont(f);
- stackedWidget = new StackedContainer(this);
+ stackedWidget = new StackedContainer(this);
defaultPal = new ContentPalette_Default(this);
stackedWidget->addWidget(defaultPal);
@@ -276,7 +275,7 @@
updatePanelTitle();
}
updateGeometry();
- DockPanelBase::update();
+ DockPanelBase::update();
}
void ContentPalette::unitChange()
@@ -319,7 +318,7 @@
languageChange();
return;
}
- DockPanelBase::changeEvent(e);
+ DockPanelBase::changeEvent(e);
}
void ContentPalette::updatePanelTitle()
@@ -364,7 +363,7 @@
void ContentPalette::update(const ParagraphStyle& style)
{
- textPal->updateParagraphStyle(style);
+ textPal->updateParagraphStyle(style);
}
void ContentPalette::update(const CharStyle& style)
@@ -378,7 +377,7 @@
void ContentPalette::updateTextStyles()
{
- textPal->updateTextStyles();
+ textPal->updateTextStyles();
}
void ContentPalette::updateTextAlignment(int i)
Index: scribus/ui/contentpalette.h
===================================================================
--- scribus/ui/contentpalette.h (Revision 27132)
+++ scribus/ui/contentpalette.h (Arbeitskopie)
@@ -8,9 +8,9 @@
#define CONTENTPALETTE_H
#include "scribusapi.h"
-#include "docks/dock_panelbase.h"
+#include "docks/dock_panelbase.h"
#include "scguardedptr.h"
-#include "widgets/stacked_container.h"
+#include "widgets/stacked_container.h"
class QStackedWidget;
@@ -29,12 +29,12 @@
class ParagraphStyle;
class CharStyle;
-class SCRIBUS_API ContentPalette : public DockPanelBase
+class SCRIBUS_API ContentPalette : public DockPanelBase
{
Q_OBJECT
public:
- ContentPalette(QWidget* parent);
+ ContentPalette();
~ContentPalette() {}
void updateColorList();
@@ -75,7 +75,7 @@
double m_unitRatio {1.0};
int m_unitIndex {0};
- StackedContainer* stackedWidget {nullptr};
+ StackedContainer* stackedWidget {nullptr};
ContentPalette_Default* defaultPal {nullptr};
PropertiesPalette_Group* groupPal {nullptr};
PropertiesPalette_Image* imagePal {nullptr};
Index: scribus/ui/docks/dock_centralwidget.cpp
===================================================================
--- scribus/ui/docks/dock_centralwidget.cpp (Revision 27132)
+++ scribus/ui/docks/dock_centralwidget.cpp (Arbeitskopie)
@@ -18,11 +18,17 @@
***************************************************************************/
#include "dock_centralwidget.h"
-DockCentralWidget::DockCentralWidget(QWidget *parent)
- : ads::CDockWidget(QString(), parent)
+DockCentralWidget::DockCentralWidget() : QWidget(nullptr)
{
setObjectName(QString::fromLocal8Bit("DockCentralWidget"));
- setFeature(ads::CDockWidget::NoTab, true);
- setFeature(ads::CDockWidget::DockWidgetFloatable, false);
+ layoutWidget = new QHBoxLayout();
+ layoutWidget->setSpacing(0);
+ layoutWidget->setContentsMargins(0, 0, 0, 0);
+ setLayout(layoutWidget);
}
+
+void DockCentralWidget::setWidget(QWidget *widget)
+{
+ layoutWidget->addWidget(widget);
+}
Index: scribus/ui/docks/dock_centralwidget.h
===================================================================
--- scribus/ui/docks/dock_centralwidget.h (Revision 27132)
+++ scribus/ui/docks/dock_centralwidget.h (Arbeitskopie)
@@ -20,14 +20,20 @@
#ifndef DOCK_CENTRALWIDGET_H
#define DOCK_CENTRALWIDGET_H
-#include "third_party/Qt-Advanced-Docking-System/src/DockWidget.h"
+#include <QWidget>
+#include <QHBoxLayout>
-class DockCentralWidget : public ads::CDockWidget
+class DockCentralWidget : public QWidget
{
Q_OBJECT
public:
- explicit DockCentralWidget(QWidget *parent = nullptr);
+ explicit DockCentralWidget();
+ void setWidget(QWidget *widget);
+
+private:
+ QHBoxLayout *layoutWidget;
+
};
#endif // DOCK_CENTRALWIDGET_H
Index: scribus/ui/docks/dock_panelbase.cpp
===================================================================
--- scribus/ui/docks/dock_panelbase.cpp (Revision 27132)
+++ scribus/ui/docks/dock_panelbase.cpp (Arbeitskopie)
@@ -20,6 +20,8 @@
#include "dock_panelbase.h"
#include <QApplication>
+#include <QScrollBar>
+#include <QTabBar>
#include "iconmanager.h"
#include "prefscontext.h"
@@ -26,26 +28,22 @@
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scribusapp.h"
+#include "scribuscore.h"
+#include "scribus.h"
-DockPanelBase::DockPanelBase(const QString &title, QString iconName, QWidget *parent)
- : CDockWidget(title, parent)
+#include <kddockwidgets/core/Stack.h>
+
+// LayoutSaverOption see: https://github.com/KDAB/KDDockWidgets/blob/main/src/KDDockWidgets.h
+
+DockPanelBase::DockPanelBase(const QString &title, QString iconName, KDDockWidgets::DockWidgetOptions options)
+ : KDDockWidgets::QtWidgets::DockWidget(title, options, {KDDockWidgets::LayoutSaverOption::None})
{
- /*if (PrefsManager::instance().appPrefs.uiPrefs.useSmallWidgets) {
- setStyleSheet(" QToolButton { margin: 1px; padding: 0px; font-size: 10px; } \
- QToolButton:pressed { padding-top: 2px; padding-left: 2px } \
- QPushButton { margin: 1px; padding: 0px; font-size: 10px; } \
- QPushButton:pressed { padding-top: 2px; padding-left: 2px } \
- QRadioButton, QComboBox, QLineEdit \
- QListView, QLabel { margin:1px; padding: 0px; font-size: 10px; } \
- QCheckBox, QSpinBox, QDoubleSpinBox \
- { margin:1px; padding: 0px; font-size: 10px; } \
- QTabWidget, QTabBar, QTableView, QGroupBox, QTreeView \
- { font-size: 10px ; } \
- QToolBox::tab { font-size: 10px; padding: 0px; margin: 0px; } \
- ");
- }*/
-
m_iconName = iconName;
+ m_scrollArea = new QScrollArea;
+ m_scrollArea->setFrameShape(QFrame::NoFrame);
+ m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ KDDockWidgets::QtWidgets::DockWidget::setWidget(m_scrollArea);
iconSetChange();
@@ -53,10 +51,14 @@
setObjectName(title);
connect(&PrefsManager::instance(), SIGNAL(prefsChanged()), this, SLOT(setFontSize()));
connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
+ // We need all 3 signals to change the visibility of the palette title
+ connect(this, &KDDockWidgets::QtWidgets::DockWidget::isCurrentTabChanged, this, &DockPanelBase::setLabelVisibility);
+ connect(this, &KDDockWidgets::QtWidgets::DockWidget::isOpenChanged, this, &DockPanelBase::setLabelVis);
+ connect(this, &KDDockWidgets::QtWidgets::DockWidget::isFloatingChanged, this, &DockPanelBase::setLabelVis);
}
-DockPanelBase::DockPanelBase(const QString &title, QWidget *parent)
- : DockPanelBase(title, QString(), parent){}
+DockPanelBase::DockPanelBase(const QString &title, KDDockWidgets::DockWidgetOptions options)
+ : DockPanelBase(title, QString(), options){}
void DockPanelBase::setPrefsContext(const QString &context)
{
@@ -69,6 +71,27 @@
m_palettePrefs = nullptr;
}
+void DockPanelBase::updateScrollAreaMinSize()
+{
+ if (!widget())
+ return;
+
+ int contentWidth = widget()->minimumSizeHint().width();
+ int frameWidth = m_scrollArea->frameWidth() * 2;
+ int scrollBarWidth = m_scrollArea->verticalScrollBar()->sizeHint().width();
+
+ m_scrollArea->setMinimumWidth(contentWidth + frameWidth + scrollBarWidth);
+}
+
+bool DockPanelBase::eventFilter(QObject *watched, QEvent *event)
+{
+ if (watched == widget() && event->type() == QEvent::Resize)
+ updateScrollAreaMinSize();
+
+ return QWidget::eventFilter(watched, event);
+
+}
+
void DockPanelBase::startup()
{
setFontSize();
@@ -87,13 +110,89 @@
if(m_iconName.isEmpty())
{
- setWindowIcon(iconManager.loadPixmap("app-icon"));
+ setWindowIcon(iconManager.loadIcon("app-icon"));
setIcon(QIcon());
}
else
{
- setWindowIcon(iconManager.loadPixmap(m_iconName));
- setIcon(iconManager.loadPixmap(m_iconName));
+ setWindowIcon(iconManager.loadIcon(m_iconName));
+ setIcon(iconManager.loadIcon(m_iconName));
}
}
+
+void DockPanelBase::setToggleViewAction(ScrAction *action)
+{
+ // # Classic toggle behavior
+ // action->setCheckable(true);
+ // connect( action, &ScrAction::toggled, toggleAction(), &QAction::setChecked);
+ // connect( toggleAction(), &QAction::toggled, action, &ScrAction::setChecked);
+
+
+ // # Activate dock behavior
+ action->setCheckable(false);
+ connect(action, &QAction::triggered, this, [action, this]()
+ {
+ // restore hidden workspace
+ DockManager::instance().restoreHiddenWorkspace();
+ open();
+ setAsCurrentTab();
+
+ });
+}
+
+void DockPanelBase::setLabelVisibility(bool visible)
+{
+ KDDockWidgets::Core::DockWidget *dock = this->asDockWidgetController();
+
+ if (!dock)
+ return;
+
+ bool noLabel = !PrefsManager::instance().appPrefs.uiPrefs.showLabelsOfInactiveTabs;
+
+ // inactive Tab in tabbed group
+ if (noLabel && dock->isTabbed() && !visible)
+ setTitle( QString() );
+ else
+ setTitle( m_title );
+}
+
+void DockPanelBase::setLabelVis()
+{
+ KDDockWidgets::Core::DockWidget *dock = this->asDockWidgetController();
+
+ if (!dock)
+ return;
+
+ bool noLabel = !PrefsManager::instance().appPrefs.uiPrefs.showLabelsOfInactiveTabs;
+
+ // inactive Tab in tabbed group
+ if (noLabel && dock->isTabbed() && !dock->isCurrentTab())
+ setTitle( QString() );
+ else
+ setTitle( m_title );
+
+}
+
+void DockPanelBase::setWindowTitle(const QString &title)
+{
+ KDDockWidgets::QtWidgets::DockWidget::setWindowTitle(title);
+ m_title = title;
+ if (!this->title().isEmpty())
+ setTitle( title );
+}
+
+void DockPanelBase::setWidget(QWidget *widget)
+{
+ widget->adjustSize();
+ widget->installEventFilter(this);
+ m_scrollArea->setWidget(widget);
+ m_scrollArea->setWidgetResizable(true);
+
+ updateScrollAreaMinSize();
+}
+
+QWidget *DockPanelBase::widget() const
+{
+ return m_scrollArea->widget();
+}
Index: scribus/ui/docks/dock_panelbase.h
===================================================================
--- scribus/ui/docks/dock_panelbase.h (Revision 27132)
+++ scribus/ui/docks/dock_panelbase.h (Arbeitskopie)
@@ -21,32 +21,44 @@
#define DOCK_PANELBASE_H
#include "scribusapi.h"
-#include "third_party/Qt-Advanced-Docking-System/src/DockWidget.h"
-using namespace ads;
+#include "scraction.h"
+#include <kddockwidgets/DockWidget.h>
+#include <QScrollArea>
class PrefsContext;
-class SCRIBUS_API DockPanelBase : public CDockWidget
+class SCRIBUS_API DockPanelBase : public KDDockWidgets::QtWidgets::DockWidget
{
Q_OBJECT
public:
- DockPanelBase(const QString &title, QWidget *parent = 0);
- DockPanelBase(const QString &title, QString iconName, QWidget *parent = 0);
+ DockPanelBase(const QString &title, KDDockWidgets::DockWidgetOptions options = KDDockWidgets::DockWidgetOption_None);
+ DockPanelBase(const QString &title, QString iconName, KDDockWidgets::DockWidgetOptions options = KDDockWidgets::DockWidgetOption_None);
void startup();
+ void setWindowTitle(const QString& title) override;
+ void setWidget(QWidget *widget);
+ QWidget *widget() const;
public slots:
virtual void setFontSize();
void iconSetChange();
+ void setToggleViewAction(ScrAction *action);
+ void setLabelVisibility(bool visible);
+ void setLabelVis();
protected:
/** @brief Set the Preferences context to be used for storage of startup visibility and position and size */
virtual void setPrefsContext(const QString &context);
+ void updateScrollAreaMinSize();
+ bool eventFilter(QObject *watched, QEvent *event) override;
PrefsContext *m_palettePrefs {nullptr};
QString m_prefsContextName;
QString m_iconName;
+ QScrollArea *m_scrollArea;
+ QString m_title;
+
};
#endif // DOCK_PANELBASE_H
Index: scribus/ui/inlinepalette.cpp
===================================================================
--- scribus/ui/inlinepalette.cpp (Revision 27132)
+++ scribus/ui/inlinepalette.cpp (Arbeitskopie)
@@ -101,7 +101,7 @@
clearSelection();
}
-InlinePalette::InlinePalette( QWidget* parent) : DockPanelBase("Inline", "panel-inline-items", parent)
+InlinePalette::InlinePalette() : DockPanelBase("Inline", "panel-inline-items")
{
setContentsMargins(3, 3, 3, 3);
setMinimumSize( QSize( 220, 240 ) );
Index: scribus/ui/inlinepalette.h
===================================================================
--- scribus/ui/inlinepalette.h (Revision 27132)
+++ scribus/ui/inlinepalette.h (Arbeitskopie)
@@ -72,7 +72,7 @@
Q_OBJECT
public:
- InlinePalette(QWidget* parent);
+ InlinePalette();
~InlinePalette() {};
void setMainWindow(ScribusMainWindow *mw);
Index: scribus/ui/layers.cpp
===================================================================
--- scribus/ui/layers.cpp (Revision 27132)
+++ scribus/ui/layers.cpp (Arbeitskopie)
@@ -42,7 +42,7 @@
#include "docks/dock_panelbase.h"
#include "undomanager.h"
-LayerPalette::LayerPalette(QWidget* parent) : DockPanelBase("Layers", "panel-layers", parent)
+LayerPalette::LayerPalette() : DockPanelBase("Layers", "panel-layers")
{
setObjectName(QString::fromLocal8Bit("Layers"));
setMinimumSize( QSize(220, 240) );
Index: scribus/ui/layers.h
===================================================================
--- scribus/ui/layers.h (Revision 27132)
+++ scribus/ui/layers.h (Arbeitskopie)
@@ -34,7 +34,7 @@
Q_OBJECT
public:
- LayerPalette(QWidget* parent);
+ LayerPalette();
~LayerPalette() {};
void installEventFilter(QObject *);
Index: scribus/ui/outlinepalette.cpp
===================================================================
--- scribus/ui/outlinepalette.cpp (Revision 27132)
+++ scribus/ui/outlinepalette.cpp (Arbeitskopie)
@@ -431,7 +431,7 @@
return true;
}
-OutlinePalette::OutlinePalette( QWidget* parent) : DockPanelBase("Tree", "panel-outline", parent)
+OutlinePalette::OutlinePalette() : DockPanelBase("Tree", "panel-outline")
{
// resize( 220, 240 );
setMinimumSize( QSize( 220, 240 ) );
@@ -481,9 +481,9 @@
connect(filterEdit, SIGNAL(textChanged(QString)), this, SLOT(filterTree(QString)));
// connect(filterShortcut, SIGNAL(activated()), filterEdit, SLOT(setFocus()));
connect(reportDisplay, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotDoubleClick(QTreeWidgetItem*,int)));
- connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(rebuildTree()));
+ connect(this, SIGNAL(isOpenChanged(bool)), this, SLOT(rebuildTree(bool)));
+ connect(this, SIGNAL(isCurrentTabChanged(bool)), this, SLOT(rebuildTree(bool)));
-
}
void OutlinePalette::setMainWindow(ScribusMainWindow *mw)
@@ -509,16 +509,9 @@
clearPalette();
}
-void OutlinePalette::toggleView(bool visible)
+void OutlinePalette::rebuildTree(bool isActive)
{
- DockPanelBase::toggleView(visible);
- rebuildTree();
-}
-
-
-void OutlinePalette::rebuildTree()
-{
- if (this->isVisible() && (currDoc != nullptr))
+ if (isActive)
BuildTree();
}
Index: scribus/ui/outlinepalette.h
===================================================================
--- scribus/ui/outlinepalette.h (Revision 27132)
+++ scribus/ui/outlinepalette.h (Arbeitskopie)
@@ -60,7 +60,7 @@
Q_OBJECT
public:
- OutlinePalette( QWidget* parent );
+ OutlinePalette();
void setMainWindow(ScribusMainWindow *mw);
void setDoc(ScribusDoc *);
@@ -77,7 +77,6 @@
void iconSetChange();
void languageChange();
void slotShowSelect(int pageNr, PageItem *pageItem);
- void toggleView(bool);
void slotRightClick(QPoint point);
void setActiveLayer(int layerID);
void setLayerVisible(int layerID);
@@ -96,7 +95,7 @@
void slotMultiSelect();
void slotSelect(QTreeWidgetItem* ite, int col);
void slotDoubleClick(QTreeWidgetItem* ite, int col);
- void rebuildTree();
+ void rebuildTree(bool);
protected:
void changeEvent(QEvent *e) override;
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp (Revision 27132)
+++ scribus/ui/pagepalette.cpp (Arbeitskopie)
@@ -21,7 +21,7 @@
#include "scribusdoc.h"
#include "scribusview.h"
-PagePalette::PagePalette(QWidget *parent) : DockPanelBase("PagePalette", "panel-page", parent)
+PagePalette::PagePalette() : DockPanelBase("PagePalette", "panel-page")
{
m_scMW = nullptr;//(ScribusMainWindow*) parent;
m_view = nullptr;
@@ -210,7 +210,7 @@
}
// Set focus to page palette or focus may be set to wrong document window
- this->setFocus();
+ //this->setFocus();
stackedWidget->setCurrentIndex(1);
setWindowTitle( tr( "Manage Masterpages" ) );
}
@@ -220,7 +220,7 @@
if (this->stackedWidget()->currentIndex() > 0)
{
// Set focus to page palette or focus may be set to wrong document window
- this->setFocus();
+ //this->setFocus();
this->stackedWidget()->setCurrentIndex(0);
}
Index: scribus/ui/pagepalette.h
===================================================================
--- scribus/ui/pagepalette.h (Revision 27132)
+++ scribus/ui/pagepalette.h (Arbeitskopie)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
- PagePalette(QWidget *parent);
+ PagePalette();
~PagePalette() {};
QWidget* currentWidget();
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp (Revision 27132)
+++ scribus/ui/propertiespalette.cpp (Arbeitskopie)
@@ -45,11 +45,11 @@
#include "selection.h"
#include "undomanager.h"
-PropertiesPalette::PropertiesPalette(QWidget *parent) : DockPanelBase("PropertiesPalette", "panel-frame-properties", parent)
+PropertiesPalette::PropertiesPalette() : DockPanelBase("PropertiesPalette", "panel-frame-properties")
{
undoManager = UndoManager::instance();
- setObjectName(QString::fromLocal8Bit("PropertiesPalette"));
+ // setObjectName(QString::fromLocal8Bit("PropertiesPalette"));
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
// XZY
Index: scribus/ui/propertiespalette.h
===================================================================
--- scribus/ui/propertiespalette.h (Revision 27132)
+++ scribus/ui/propertiespalette.h (Arbeitskopie)
@@ -55,7 +55,7 @@
Q_OBJECT
public:
- PropertiesPalette(QWidget* parent);
+ PropertiesPalette();
~PropertiesPalette() {}
void endPatchAdd();
Index: scribus/ui/scrapbookpalette.cpp
===================================================================
--- scribus/ui/scrapbookpalette.cpp (Revision 27132)
+++ scribus/ui/scrapbookpalette.cpp (Arbeitskopie)
@@ -740,7 +740,7 @@
}
/* This is the main Dialog-Class for the Scrapbook */
-Biblio::Biblio(QWidget* parent) : DockPanelBase("Sclib", "panel-scrapbook", parent)
+Biblio::Biblio() : DockPanelBase("Sclib", "panel-scrapbook")
{
setObjectName(QString::fromLocal8Bit("Sclib"));
setMinimumSize( QSize(220, 240) );
Index: scribus/ui/scrapbookpalette.h
===================================================================
--- scribus/ui/scrapbookpalette.h (Revision 27132)
+++ scribus/ui/scrapbookpalette.h (Arbeitskopie)
@@ -73,7 +73,7 @@
Q_OBJECT
public:
- Biblio( QWidget* parent);
+ Biblio();
~Biblio() {};
void changeEvent(QEvent *e) override;
Index: scribus/ui/symbolpalette.cpp
===================================================================
--- scribus/ui/symbolpalette.cpp (Revision 27132)
+++ scribus/ui/symbolpalette.cpp (Arbeitskopie)
@@ -150,7 +150,7 @@
clearSelection();
}
-SymbolPalette::SymbolPalette( QWidget* parent) : DockPanelBase("Symb", "panel-symbols", parent)
+SymbolPalette::SymbolPalette() : DockPanelBase("Symb", "panel-symbols")
{
setContentsMargins(3, 3, 3, 3);
setMinimumSize( QSize( 220, 240 ) );
Index: scribus/ui/symbolpalette.h
===================================================================
--- scribus/ui/symbolpalette.h (Revision 27132)
+++ scribus/ui/symbolpalette.h (Arbeitskopie)
@@ -76,7 +76,7 @@
Q_OBJECT
public:
- SymbolPalette(QWidget* parent);
+ SymbolPalette();
~SymbolPalette() {};
void setMainWindow(ScribusMainWindow *mw);
Index: scribus/undogui.cpp
===================================================================
--- scribus/undogui.cpp (Revision 27132)
+++ scribus/undogui.cpp (Arbeitskopie)
@@ -38,7 +38,7 @@
#include "undogui.h"
-UndoGui::UndoGui(QWidget* parent, const char* name) : DockPanelBase(name, "panel-action-history", parent)
+UndoGui::UndoGui(QWidget* parent, const char* name) : DockPanelBase(name, "panel-action-history")
{
languageChange();
}
|
|
|
Few more notes. KDDockWidgets MainWindow already saves the window geometry and position together with the dock panel workspace in "mainwinstate" in the prefs file. So I commented out all previous code to save this information. If you want to reset the dock panel layout, you can delete the "mainwinstate" in prefs file. Next, "Show Labels on Inactive Palette Tabs" in preferences has no function anymore, because I decided to remove the label of grouped docks. I kept the setting in case we want to have back the labels. At the moment, it is possible to group all panels into one dock. Good for small screens. :) And I could not find the reason why the docks from plugins are broken. The only solution for now is to link KDDock as dynamic library. |
|
|
On my computer it still does not run "correctly" with the dynamic library. I need to set `export LD_LIBRARY_PATH=~/bin/build/scribus-tmp/lib/` to get Scribus to launch. (oops, I see that I wrote the same when testing the previous version : - ) |
|
|
Now "Custom Shapes" seem to be working correctly! Thanks. From the points mentioned above, the properties palette still has a "useless" top title that shows the current active tab... And now the tabs are not left aligned... But it |
|
|
@ale something is wrong with the tab style. The tabs are centered by purpose, but they should look like in my screenshot. It is possible to hide the additional title bar via configuration. I thought it could be nice to have a title bar that relates to the selected tab. The pin and close button relates to the selected tab, too. Please, can you just remove a line of code to see if the style applies correctly? In my tests, it was enough to override the proxy style in the custom title bar widget only. third_party/KDDockWidgets/src/qtwidgets/view/TabBar.cpp
TabBar::TabBar(Core::TabBar *controller, QWidget *parent)
: View(controller, Core::ViewType::TabBar, parent)
, TabBarViewInterface(controller)
, d(new Private(controller))
{
setShape(Config::self().tabsAtBottom() ? QTabBar::RoundedSouth : QTabBar::RoundedNorth);
// setStyle(proxyStyle()); <-- this line
}
|
|
|
On the one side, I think I prefer having left aligned tabs. If I'm correct, on Mac there are widgets that are centered, but on my system and in "my" Scribus everything is left aligned. Removing the setStyle() mentioned above indeed shows the tabs as icons only, like in your screenshots. Personally, I would suggest adding two options for hiding the title bar and displaying the tabs as icons, when there are multiple tabs in a panel. But, as far as I understand it, the pin and close buttons are only available in the title bar... This might be an issue if the user hides the title bar. Not sure what KDDock provides there. And the user On the other side, I don't really like how the existing option "Show labels of inactive palette tabs" works, when it's not enabled. Too much "Unruhe" for little to none (or even negative) gain. (If I need more information about the tab, it's when I'm selecting one, among the inactive ones, I normally recognize the active one by its content...) I would suggest to remove that option. Two cosmetics things: - When first starting Scribus (with new configs), the "Custom Shapes" window is attached to the right of the of the left stack of panels. Way too slim. I'm not sure that it should be shown at all by default. And it should probably not be attached (there) by default. - The View toolbar gets "automatically" reactivated when restarting Scribus. (I hide it, restart Scribus, it's there again) All this having been said, working with this tab system feels smooth, once I got used to the incredible amount of choices for the docking areas : - ) Good work! |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2025-02-28 10:13 | ale | New Issue | |
| 2025-10-31 20:45 | nitramr | Note Added: 0053156 | |
| 2025-10-31 20:45 | nitramr | File Added: kddock_2025-10-31_01.patch | |
| 2025-10-31 20:46 | nitramr | Note Added: 0053157 | |
| 2025-10-31 20:46 | nitramr | File Added: kddock.png | |
| 2025-10-31 20:46 | nitramr | Note Edited: 0053156 | |
| 2025-11-01 08:43 | ale | Note Added: 0053161 | |
| 2025-11-01 12:40 | cbradney | Note Added: 0053162 | |
| 2025-11-01 12:40 | cbradney | File Added: image.png | |
| 2025-11-01 12:40 | cbradney | Note Added: 0053163 | |
| 2025-11-01 12:40 | cbradney | File Added: image-2.png | |
| 2025-11-01 12:42 | cbradney | Note Added: 0053164 | |
| 2025-11-01 12:56 | nitramr | Note Added: 0053165 | |
| 2025-11-01 13:36 | ale | Note Edited: 0053161 | |
| 2025-11-01 14:31 | ale | Note Added: 0053166 | |
| 2025-11-01 14:31 | ale | File Added: dock-laptop.png | |
| 2025-11-01 15:49 | ale | Note Edited: 0053166 | |
| 2025-11-01 16:26 | ale | Note Added: 0053167 | |
| 2025-11-01 16:26 | ale | File Added: custom-shapes.png | |
| 2025-11-01 16:26 | ale | File Added: gray-area.png | |
| 2025-11-13 21:39 | nitramr | Assigned To | => nitramr |
| 2025-11-13 21:39 | nitramr | Status | new => assigned |
| 2025-11-19 16:16 | nitramr | Note Added: 0053279 | |
| 2025-11-19 16:16 | nitramr | File Added: files.zip | |
| 2025-11-19 16:16 | nitramr | File Added: kddock_2025-11-19_01.patch | |
| 2025-11-19 16:29 | nitramr | Note Added: 0053280 | |
| 2025-11-19 16:29 | nitramr | File Added: dock_group.png | |
| 2025-11-19 20:56 | ale | Note Added: 0053281 | |
| 2025-11-19 20:57 | ale | Note Edited: 0053281 | |
| 2025-11-19 21:11 | ale | Note Added: 0053282 | |
| 2025-11-19 21:11 | ale | File Added: properties.png | |
| 2025-11-19 21:36 | nitramr | Note Added: 0053283 | |
| 2025-11-20 07:29 | ale | Note Added: 0053286 |