[krita] /: Remove the lock, collapse and hide option for dock titlebars
Boudewijn Rempt
null at kde.org
Sat Mar 31 11:06:40 UTC 2018
Git commit b662043a20633d3bc52f9b178171a26ef9be532e by Boudewijn Rempt.
Committed on 31/03/2018 at 11:06.
Pushed by rempt into branch 'master'.
Remove the lock, collapse and hide option for dock titlebars
On asking around, it seems that even Krita power users were not
using these options. New users to Krita seemed unable to grasp this
functionality altogether. And we were always having trouble managing
the locked and collapsed state of dockers.
Note that not having a custom titlebar widget also makes it impossible
to keep having an option to remove the titlebars altogether, which was
another way to force the dockers to stay in one place.
A side-effect is that on macOS, floating dockers are resizable now.
BUG:385238
CCBUG:392538
CCMAIL:kimageshop at kde.org
M +0 -1 krita/krita4.xmlgui
M +1 -13 krita/kritamenu.action
M +1 -58 libs/ui/KisMainWindow.cpp
M +0 -5 libs/ui/KisMainWindow.h
M +0 -5 libs/ui/KisViewManager.cpp
M +0 -10 libs/ui/kis_config.cc
M +0 -3 libs/ui/kis_config.h
M +0 -1 libs/ui/widgets/kis_workspace_chooser.cpp
M +0 -2 libs/widgets/CMakeLists.txt
D +0 -379 libs/widgets/KoDockWidgetTitleBar.cpp
D +0 -67 libs/widgets/KoDockWidgetTitleBar.h
D +0 -114 libs/widgets/KoDockWidgetTitleBarButton.cpp
D +0 -55 libs/widgets/KoDockWidgetTitleBarButton.h
D +0 -72 libs/widgets/KoDockWidgetTitleBar_p.h
M +0 -5 libs/widgets/KoToolBoxDocker.cpp
M +0 -3 libs/widgets/KoToolDocker.cpp
M +0 -12 libs/widgets/kritawidgets.qrc
D +- -- libs/widgets/pics/dark_docker_close.png
D +- -- libs/widgets/pics/dark_docker_collapse_a.png
D +- -- libs/widgets/pics/dark_docker_collapse_b.png
D +- -- libs/widgets/pics/dark_docker_float.png
D +- -- libs/widgets/pics/dark_docker_lock_a.png
D +- -- libs/widgets/pics/dark_docker_lock_b.png
D +- -- libs/widgets/pics/light_docker_close.png
D +- -- libs/widgets/pics/light_docker_collapse_a.png
D +- -- libs/widgets/pics/light_docker_collapse_b.png
D +- -- libs/widgets/pics/light_docker_float.png
D +- -- libs/widgets/pics/light_docker_lock_a.png
D +- -- libs/widgets/pics/light_docker_lock_b.png
https://commits.kde.org/krita/b662043a20633d3bc52f9b178171a26ef9be532e
diff --git a/krita/krita4.xmlgui b/krita/krita4.xmlgui
index 1e8ec064285..dee8eed6760 100644
--- a/krita/krita4.xmlgui
+++ b/krita/krita4.xmlgui
@@ -328,7 +328,6 @@ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 http://www.kde.org
<Merge name="StandardToolBarMenuHandler" />
<Separator/>
<Action name="view_toggledockers"/>
- <Action name="view_toggledockertitlebars"/>
<Action name="settings_dockers_menu"/>
<Separator/>
<Action name="theme_menu"/>
diff --git a/krita/kritamenu.action b/krita/kritamenu.action
index 651b3d5a0e4..52016187386 100644
--- a/krita/kritamenu.action
+++ b/krita/kritamenu.action
@@ -147,7 +147,7 @@
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
- </Action>
+ </Action>
<Action name="save_incremental_version">
<icon></icon>
<text>Save Incremental &Version</text>
@@ -1565,18 +1565,6 @@
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
- <Action name="view_toggledockertitlebars">
- <icon></icon>
- <text>Sho&w Docker Titlebars</text>
- <whatsThis></whatsThis>
- <toolTip>Show Docker Titlebars</toolTip>
- <iconText>Show Docker Titlebars</iconText>
- <activationFlags>0</activationFlags>
- <activationConditions>0</activationConditions>
- <shortcut></shortcut>
- <isCheckable>true</isCheckable>
- <statusTip></statusTip>
- </Action>
<Action name="options_configure_toolbars">
<icon>configure</icon>
<text>Configure Tool&bars...</text>
diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp
index 8e9af7c43fa..adcbfe7d7a8 100644
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@ -85,7 +85,6 @@
#include <kwindowconfig.h>
#include "KoDockFactoryBase.h"
-#include "KoDockWidgetTitleBar.h"
#include "KoDocumentInfoDlg.h"
#include "KoDocumentInfo.h"
#include "KoFileDialog.h"
@@ -1489,35 +1488,20 @@ bool KisMainWindow::restoreWorkspace(KisWorkspaceResource *workspace)
{
QByteArray state = workspace->dockerState();
QByteArray oldState = saveState();
- const bool showTitlebars = KisConfig().showDockerTitleBars();
// needed because otherwise the layout isn't correctly restored in some situations
Q_FOREACH (QDockWidget *dock, dockWidgets()) {
- dock->setProperty("Locked", false); // Unlock invisible dockers
dock->toggleViewAction()->setEnabled(true);
dock->hide();
- dock->titleBarWidget()->setVisible(showTitlebars);
}
bool success = KXmlGuiWindow::restoreState(state);
if (!success) {
KXmlGuiWindow::restoreState(oldState);
- Q_FOREACH (QDockWidget *dock, dockWidgets()) {
- if (dock->titleBarWidget()) {
- dock->titleBarWidget()->setVisible(showTitlebars || dock->isFloating());
- }
- }
return false;
}
- Q_FOREACH (QDockWidget *dock, dockWidgets()) {
- if (dock->titleBarWidget()) {
- const bool isCollapsed = (dock->widget() && dock->widget()->isHidden()) || !dock->widget();
- dock->titleBarWidget()->setVisible(showTitlebars || (dock->isFloating() && isCollapsed));
- }
- }
-
if (activeKisView()) {
activeKisView()->resourceProvider()->notifyLoadingWorkspace(workspace);
}
@@ -1851,16 +1835,7 @@ QDockWidget* KisMainWindow::createDockWidget(KoDockFactoryBase* factory)
return 0;
}
- KoDockWidgetTitleBar *titleBar = dynamic_cast<KoDockWidgetTitleBar*>(dockWidget->titleBarWidget());
-
- // Check if the dock widget is supposed to be collapsible
- if (!dockWidget->titleBarWidget()) {
- titleBar = new KoDockWidgetTitleBar(dockWidget);
- dockWidget->setTitleBarWidget(titleBar);
- titleBar->setCollapsable(factory->isCollapsable());
- }
- titleBar->setFont(KoDockRegistry::dockFont());
-
+ dockWidget->setFont(KoDockRegistry::dockFont());
dockWidget->setObjectName(factory->id());
dockWidget->setParent(this);
@@ -1896,20 +1871,6 @@ QDockWidget* KisMainWindow::createDockWidget(KoDockFactoryBase* factory)
if (!visible) {
dockWidget->hide();
}
- bool collapsed = factory->defaultCollapsed();
-
- bool locked = false;
- group = KSharedConfig::openConfig()->group("krita").group("DockWidget " + factory->id());
- collapsed = group.readEntry("Collapsed", collapsed);
- locked = group.readEntry("Locked", locked);
-
- //dbgKrita << "docker" << factory->id() << dockWidget << "collapsed" << collapsed << "locked" << locked << "titlebar" << titleBar;
-
- if (titleBar && collapsed)
- titleBar->setCollapsed(true);
-
- if (titleBar && locked)
- titleBar->setLocked(true);
d->dockWidgetsMap.insert(factory->id(), dockWidget);
}
@@ -2382,16 +2343,11 @@ void KisMainWindow::createActions()
d->themeManager->registerThemeActions(actionCollection());
connect(d->themeManager, SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged()));
-
d->toggleDockers = actionManager->createAction("view_toggledockers");
cfg.showDockers(true);
d->toggleDockers->setChecked(true);
connect(d->toggleDockers, SIGNAL(toggled(bool)), SLOT(toggleDockersVisibility(bool)));
- d->toggleDockerTitleBars = actionManager->createAction("view_toggledockertitlebars");
- d->toggleDockerTitleBars->setChecked(cfg.showDockerTitleBars());
- connect(d->toggleDockerTitleBars, SIGNAL(toggled(bool)), SLOT(showDockerTitleBars(bool)));
-
actionCollection()->addAction("settings_dockers_menu", d->dockWidgetMenu);
actionCollection()->addAction("window", d->windowMenu);
@@ -2489,19 +2445,6 @@ void KisMainWindow::showManual()
QDesktopServices::openUrl(QUrl("https://docs.krita.org"));
}
-void KisMainWindow::showDockerTitleBars(bool show)
-{
- Q_FOREACH (QDockWidget *dock, dockWidgets()) {
- if (dock->titleBarWidget()) {
- const bool isCollapsed = (dock->widget() && dock->widget()->isHidden()) || !dock->widget();
- dock->titleBarWidget()->setVisible(show || (dock->isFloating() && isCollapsed));
- }
- }
-
- KisConfig cfg;
- cfg.setShowDockerTitleBars(show);
-}
-
void KisMainWindow::moveEvent(QMoveEvent *e)
{
if (qApp->desktop()->screenNumber(this) != qApp->desktop()->screenNumber(e->oldPos())) {
diff --git a/libs/ui/KisMainWindow.h b/libs/ui/KisMainWindow.h
index 05e6a4e44c4..e3f05a135ba 100644
--- a/libs/ui/KisMainWindow.h
+++ b/libs/ui/KisMainWindow.h
@@ -316,11 +316,6 @@ private Q_SLOTS:
*/
void viewFullscreen(bool fullScreen);
- /**
- * Toggle docker titlebars on/off.
- */
- void showDockerTitleBars(bool show);
-
/**
* Reload file
*/
diff --git a/libs/ui/KisViewManager.cpp b/libs/ui/KisViewManager.cpp
index 86738f2a055..72235703c1b 100644
--- a/libs/ui/KisViewManager.cpp
+++ b/libs/ui/KisViewManager.cpp
@@ -60,7 +60,6 @@
#include <KoCanvasController.h>
#include <KoCompositeOp.h>
#include <KoDockRegistry.h>
-#include <KoDockWidgetTitleBar.h>
#include <KoProperties.h>
#include <KoResourceItemChooserSync.h>
#include <KoSelection.h>
@@ -1266,10 +1265,6 @@ void KisViewManager::updateIcons()
QList<QDockWidget*> dockers = mainWindow()->dockWidgets();
Q_FOREACH (QDockWidget* dock, dockers) {
dbgKrita << "name " << dock->objectName();
- KoDockWidgetTitleBar* titlebar = dynamic_cast<KoDockWidgetTitleBar*>(dock->titleBarWidget());
- if (titlebar) {
- titlebar->updateIcons();
- }
QObjectList objects;
objects.append(dock);
diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc
index cb5d5e25fb9..7050854cab1 100644
--- a/libs/ui/kis_config.cc
+++ b/libs/ui/kis_config.cc
@@ -1186,16 +1186,6 @@ void KisConfig::setHideDockersFullscreen(const bool value) const
m_cfg.writeEntry("hideDockersFullScreen", value);
}
-bool KisConfig::showDockerTitleBars(bool defaultValue) const
-{
- return (defaultValue ? true : m_cfg.readEntry("showDockerTitleBars", true));
-}
-
-void KisConfig::setShowDockerTitleBars(const bool value) const
-{
- m_cfg.writeEntry("showDockerTitleBars", value);
-}
-
bool KisConfig::showDockers(bool defaultValue) const
{
return (defaultValue ? true : m_cfg.readEntry("showDockers", true));
diff --git a/libs/ui/kis_config.h b/libs/ui/kis_config.h
index 7d66e6e93e4..e2ef81bf6fd 100644
--- a/libs/ui/kis_config.h
+++ b/libs/ui/kis_config.h
@@ -310,9 +310,6 @@ public:
bool hideDockersFullscreen(bool defaultValue = false) const;
void setHideDockersFullscreen(const bool value) const;
- bool showDockerTitleBars(bool defaultValue = false) const;
- void setShowDockerTitleBars(const bool value) const;
-
bool showDockers(bool defaultValue = false) const;
void setShowDockers(const bool value) const;
diff --git a/libs/ui/widgets/kis_workspace_chooser.cpp b/libs/ui/widgets/kis_workspace_chooser.cpp
index d9a74e5f479..aa474ef75e1 100644
--- a/libs/ui/widgets/kis_workspace_chooser.cpp
+++ b/libs/ui/widgets/kis_workspace_chooser.cpp
@@ -29,7 +29,6 @@
#include <KoResourceItemChooser.h>
#include <KoResourceServerAdapter.h>
-#include <KoDockWidgetTitleBar.h>
#include <KisMainWindow.h>
#include <resources/KoResource.h>
diff --git a/libs/widgets/CMakeLists.txt b/libs/widgets/CMakeLists.txt
index 5113dde0667..b57f46e8476 100644
--- a/libs/widgets/CMakeLists.txt
+++ b/libs/widgets/CMakeLists.txt
@@ -49,8 +49,6 @@ set(kritawidgets_LIB_SRCS
KoLineStyleSelector.cpp
KoLineStyleItemDelegate.cpp
KoLineStyleModel.cpp
- KoDockWidgetTitleBar.cpp
- KoDockWidgetTitleBarButton.cpp
KoResourceFiltering.cpp
KoResourceModelBase.cpp
KoTitledTabWidget.cpp
diff --git a/libs/widgets/KoDockWidgetTitleBar.cpp b/libs/widgets/KoDockWidgetTitleBar.cpp
deleted file mode 100644
index c5ce2ead362..00000000000
--- a/libs/widgets/KoDockWidgetTitleBar.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-/* This file is part of the KDE project
- Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink at kde.org>
- Copyright (C) 2007 Thomas Zander <zander at kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "KoDockWidgetTitleBar.h"
-#include "KoDockWidgetTitleBar_p.h"
-#include "KoDockWidgetTitleBarButton.h"
-
-#include <KoIcon.h>
-#include <kis_icon_utils.h>
-
-#include <WidgetsDebug.h>
-#include <klocalizedstring.h>
-
-#include <QAbstractButton>
-#include <QAction>
-#include <QLabel>
-#include <QLayout>
-#include <QStyle>
-#include <QStylePainter>
-#include <QStyleOptionFrame>
-
-static inline bool hasFeature(const QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature)
-{
- return (dockwidget->features() & feature) == feature;
-}
-
-KoDockWidgetTitleBar::KoDockWidgetTitleBar(QDockWidget* dockWidget)
- : QWidget(dockWidget), d(new Private(this))
-{
- QDockWidget *q = dockWidget;
-
- d->floatIcon = kisIcon("docker_float");
- d->floatButton = new KoDockWidgetTitleBarButton(this);
- d->floatButton->setIcon(d->floatIcon);
- connect(d->floatButton, SIGNAL(clicked()), SLOT(toggleFloating()));
- d->floatButton->setVisible(true);
- d->floatButton->setToolTip(i18nc("@info:tooltip", "Float Docker"));
- d->floatButton->setStyleSheet("border: 0");
-
- d->removeIcon = kisIcon("docker_close");
- d->closeButton = new KoDockWidgetTitleBarButton(this);
- d->closeButton->setIcon(d->removeIcon);
- connect(d->closeButton, SIGNAL(clicked()), q, SLOT(close()));
- d->closeButton->setVisible(true);
- d->closeButton->setToolTip(i18nc("@info:tooltip", "Close Docker"));
- d->closeButton->setStyleSheet("border: 0"); // border makes the header busy looking (appears on some OSs)
-
- d->openIcon = kisIcon("docker_collapse_a");
- d->closeIcon = kisIcon("docker_collapse_b");
- d->collapseButton = new KoDockWidgetTitleBarButton(this);
- d->collapseButton->setIcon(d->openIcon);
- connect(d->collapseButton, SIGNAL(clicked()), SLOT(toggleCollapsed()));
- d->collapseButton->setVisible(true);
- d->collapsable = true;
- d->collapseButton->setToolTip(i18nc("@info:tooltip", "Collapse Docker"));
- d->collapseButton->setStyleSheet("border: 0");
-
- d->lockIcon = kisIcon("docker_lock_a");
- d->lockButton = new KoDockWidgetTitleBarButton(this);
- d->lockButton->setCheckable(true);
- d->lockButton->setIcon(d->lockIcon);
- connect(d->lockButton, SIGNAL(toggled(bool)), SLOT(setLocked(bool)));
- d->lockButton->setVisible(true);
- d->lockable = true;
- d->lockButton->setToolTip(i18nc("@info:tooltip", "Lock Docker"));
- d->lockButton->setStyleSheet("border: 0");
-
- connect(dockWidget, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), SLOT(featuresChanged(QDockWidget::DockWidgetFeatures)));
- connect(dockWidget, SIGNAL(topLevelChanged(bool)), SLOT(topLevelChanged(bool)));
-
- d->featuresChanged(0);
-}
-
-KoDockWidgetTitleBar::~KoDockWidgetTitleBar()
-{
- delete d;
-}
-
-QSize KoDockWidgetTitleBar::minimumSizeHint() const
-{
- return sizeHint();
-}
-
-QSize KoDockWidgetTitleBar::sizeHint() const
-{
- if (isHidden()) {
- return QSize(0, 0);
- }
-
- QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
-
- int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
- int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q);
-
- // get size of buttons...
- QSize closeSize(0, 0);
- if (d->closeButton && hasFeature(q, QDockWidget::DockWidgetClosable)) {
- closeSize = d->closeButton->sizeHint();
- }
-
- QSize floatSize(0, 0);
- if (d->floatButton && hasFeature(q, QDockWidget::DockWidgetFloatable)) {
- floatSize = d->floatButton->sizeHint();
- }
-
- QSize hideSize(0, 0);
- if (d->collapseButton && d->collapsable) {
- hideSize = d->collapseButton->sizeHint();
- }
-
- QSize lockSize(0, 0);
- if (d->lockButton && d->lockable) {
- lockSize = d->lockButton->sizeHint();
- }
-
- int buttonHeight = qMax(qMax(qMax(closeSize.height(), floatSize.height()), hideSize.height()), lockSize.height()) + 2;
- int buttonWidth = closeSize.width() + floatSize.width() + hideSize.width() + lockSize.width();
-
- int height = buttonHeight;
- if (d->textVisibilityMode == FullTextAlwaysVisible) {
- // get font size
- QFontMetrics titleFontMetrics = q->fontMetrics();
- int fontHeight = titleFontMetrics.lineSpacing() + 2 * mw;
-
- height = qMax(height, fontHeight);
- }
-
- /*
- * Calculate the width of title and add to the total width of the docker window when collapsed.
- */
- const int titleWidth =
- (d->textVisibilityMode == FullTextAlwaysVisible) ? (q->fontMetrics().width(q->windowTitle()) + 2*mw) :
- 0;
-
- if (d->preCollapsedWidth > 0) {
- return QSize(d->preCollapsedWidth, height);
- }
- else {
- if (d->textVisibilityMode == FullTextAlwaysVisible) {
- return QSize(buttonWidth /*+ height*/ + 2*mw + 2*fw + titleWidth, height);
- }
- else {
- if (q->widget()) {
- return QSize(qMin(q->widget()->minimumSizeHint().width(), buttonWidth), height);
- }
- else {
- return QSize(buttonWidth, height);
- }
- }
- }
-}
-
-void KoDockWidgetTitleBar::paintEvent(QPaintEvent*)
-{
- QStylePainter p(this);
-
- QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
-
- int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) : 0;
- int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
-
- QStyleOptionDockWidget titleOpt;
- titleOpt.initFrom(q);
-
- QSize collapseButtonSize(0,0);
- if (d->collapsable && d->collapseButton->isVisible()) {
- collapseButtonSize = d->collapseButton->size();
- }
-
- QSize lockButtonSize(0,0);
- if (d->lockable && d->lockButton->isVisible()) {
- lockButtonSize = d->lockButton->size();
- }
-
- titleOpt.rect = QRect(QPoint(fw + mw + collapseButtonSize.width() + lockButtonSize.width(), 0),
- QSize(geometry().width() - (fw * 2) - mw - collapseButtonSize.width() - lockButtonSize.width(), geometry().height()));
- titleOpt.title = q->windowTitle();
- titleOpt.closable = hasFeature(q, QDockWidget::DockWidgetClosable);
- titleOpt.floatable = hasFeature(q, QDockWidget::DockWidgetFloatable);
- p.drawControl(QStyle::CE_DockWidgetTitle, titleOpt);
-}
-
-void KoDockWidgetTitleBar::resizeEvent(QResizeEvent*)
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
-
- int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) : 0;
-
- QStyleOptionDockWidget opt;
- opt.initFrom(q);
- opt.rect = QRect(QPoint(fw, fw), QSize(geometry().width() - (fw * 2), geometry().height() - (fw * 2)));
- opt.title = q->windowTitle();
- opt.closable = hasFeature(q, QDockWidget::DockWidgetClosable);
- opt.floatable = hasFeature(q, QDockWidget::DockWidgetFloatable);
-
- QRect floatRect = q->style()->subElementRect(QStyle::SE_DockWidgetFloatButton, &opt, q);
- if (!floatRect.isNull())
- d->floatButton->setGeometry(floatRect);
-
- QRect closeRect = q->style()->subElementRect(QStyle::SE_DockWidgetCloseButton, &opt, q);
- if (!closeRect.isNull())
- d->closeButton->setGeometry(closeRect);
-
- int top = fw;
- if (!floatRect.isNull())
- top = floatRect.y();
- else if (!closeRect.isNull())
- top = closeRect.y();
-
- QSize size = d->collapseButton->size();
- if (!closeRect.isNull()) {
- size = d->closeButton->size();
- } else if (!floatRect.isNull()) {
- size = d->floatButton->size();
- }
- QRect collapseRect = QRect(QPoint(fw, top), size);
- d->collapseButton->setGeometry(collapseRect);
-
- size = d->lockButton->size();
-
- if (!closeRect.isNull()) {
- size = d->closeButton->size();
- } else if (!floatRect.isNull()) {
- size = d->floatButton->size();
- }
-
- const QSize lockRectSize = size;
-
- if (q->isFloating() || (width() < (closeRect.width() + lockRectSize.width()) + 50)) {
- d->collapsable = false;
- d->collapseButton->setVisible(false);
- d->lockButton->setVisible(false);
- d->lockable = false;
- } else {
- d->collapsable = d->collapsableSet;
- d->collapseButton->setVisible(d->collapsableSet);
- d->lockButton->setVisible(true);
- d->lockable = true;
- }
-
- int offset = 0;
-
- if (d->collapsable) {
- offset = collapseRect.width();
- }
- QRect lockRect = QRect(QPoint(fw + 2 + offset, top), lockRectSize);
- d->lockButton->setGeometry(lockRect);
-}
-
-void KoDockWidgetTitleBar::setCollapsed(bool collapsed)
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
- if (q && q->widget() && q->widget()->isHidden() != collapsed)
- d->toggleCollapsed();
-}
-
-void KoDockWidgetTitleBar::setLocked(bool locked)
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
-
- d->locked = locked;
- d->lockButton->blockSignals(true);
- d->lockButton->setChecked(locked);
- d->lockButton->blockSignals(false);
-
- //qDebug() << "setlocked" << q << d->locked << locked;
-
- if (locked) {
- d->features = q->features();
- q->setFeatures(QDockWidget::NoDockWidgetFeatures);
- }
- else {
- q->setFeatures(d->features);
- }
-
- q->toggleViewAction()->setEnabled(!locked);
- d->closeButton->setEnabled(!locked);
- d->floatButton->setEnabled(!locked);
- d->collapseButton->setEnabled(!locked);
-
- d->updateIcons();
- q->setProperty("Locked", locked);
- resizeEvent(0);
-}
-
-
-void KoDockWidgetTitleBar::setCollapsable(bool collapsable)
-{
- d->collapsableSet = collapsable;
- d->collapsable = collapsable;
- d->collapseButton->setVisible(collapsable);
-}
-
-void KoDockWidgetTitleBar::setTextVisibilityMode(TextVisibilityMode textVisibilityMode)
-{
- d->textVisibilityMode = textVisibilityMode;
-}
-
-void KoDockWidgetTitleBar::updateIcons()
-{
- d->updateIcons();
-}
-
-void KoDockWidgetTitleBar::Private::toggleFloating()
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(thePublic->parentWidget());
-
- q->setFloating(!q->isFloating());
- updateIcons();
-}
-
-void KoDockWidgetTitleBar::Private::topLevelChanged(bool topLevel)
-{
- lockButton->setEnabled(!topLevel);
- updateIcons();
-}
-
-void KoDockWidgetTitleBar::Private::toggleCollapsed()
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(thePublic->parentWidget());
- if (q == 0) // there does not *have* to be anything on the dockwidget.
- return;
-
- preCollapsedWidth = q->widget()->isHidden() ? -1 : thePublic->width();
- q->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); // will be overwritten again next
- if (q->widget()) {
- q->widget()->setVisible(q->widget()->isHidden());
- collapseButton->setIcon(q->widget()->isHidden() ? kisIcon("docker_collapse_b") : kisIcon("docker_collapse_a"));
- }
-}
-
-void KoDockWidgetTitleBar::Private::featuresChanged(QDockWidget::DockWidgetFeatures)
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(thePublic->parentWidget());
-
- closeButton->setVisible(hasFeature(q, QDockWidget::DockWidgetClosable));
- floatButton->setVisible(hasFeature(q, QDockWidget::DockWidgetFloatable));
-
- thePublic->resizeEvent(0);
-}
-
-
-void KoDockWidgetTitleBar::Private::updateIcons()
-{
- QDockWidget *q = qobject_cast<QDockWidget*>(thePublic->parentWidget());
-
- lockIcon = (!locked) ? kisIcon("docker_lock_a") : kisIcon("docker_lock_b");
- lockButton->setIcon(lockIcon);
-
- // this method gets called when switching themes, so update all of the themed icons now
- floatButton->setIcon(kisIcon("docker_float"));
- closeButton->setIcon(kisIcon("docker_close"));
-
- if (q->widget()) {
- collapseButton->setIcon(q->widget()->isHidden() ? kisIcon("docker_collapse_b") : kisIcon("docker_collapse_a"));
- }
- thePublic->resizeEvent(0);
-
-}
-
-//have to include this because of Q_PRIVATE_SLOT
-#include "moc_KoDockWidgetTitleBar.cpp"
diff --git a/libs/widgets/KoDockWidgetTitleBar.h b/libs/widgets/KoDockWidgetTitleBar.h
deleted file mode 100644
index 7471f3371ad..00000000000
--- a/libs/widgets/KoDockWidgetTitleBar.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This file is part of the KDE project
- Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink at kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-#ifndef KODOCKWIDGETTITLEBAR_H_
-#define KODOCKWIDGETTITLEBAR_H_
-
-#include "kritawidgets_export.h"
-#include <QDockWidget>
-
-/**
- * @short A custom title bar for dock widgets.
- *
- * Allow customization such as collapsible, or hidden text.
- *
- * @see KoDockWidgetTitleBarButton
- */
-class KRITAWIDGETS_EXPORT KoDockWidgetTitleBar : public QWidget
-{
- Q_OBJECT
-public:
- explicit KoDockWidgetTitleBar(QDockWidget *dockWidget);
- ~KoDockWidgetTitleBar() override;
-
- QSize minimumSizeHint() const override; ///< reimplemented from QWidget
- QSize sizeHint() const override; ///< reimplemented from QWidget
-
- enum TextVisibilityMode {TextCanBeInvisible, FullTextAlwaysVisible};
- /// Define whether the minimal width should ensure that the full text is visible.
- /// textVisibilityMode is FullTextAlwaysVisible by default
- void setTextVisibilityMode(TextVisibilityMode textVisibilityMode);
-
- void updateIcons();
-
-public Q_SLOTS:
- void setCollapsed(bool collapsed);
- void setLocked(bool locked);
- void setCollapsable(bool collapsable);
-
-protected:
- void paintEvent(QPaintEvent* event) override; ///< reimplemented from QWidget
- void resizeEvent(QResizeEvent* event) override; ///< reimplemented from QWidget
-private:
- Q_PRIVATE_SLOT(d, void toggleFloating())
- Q_PRIVATE_SLOT(d, void toggleCollapsed())
- Q_PRIVATE_SLOT(d, void topLevelChanged(bool topLevel))
- Q_PRIVATE_SLOT(d, void featuresChanged(QDockWidget::DockWidgetFeatures))
-
- class Private;
- Private * const d;
-};
-
-#endif // KODOCKWIDGETTITLEBAR_H_
diff --git a/libs/widgets/KoDockWidgetTitleBarButton.cpp b/libs/widgets/KoDockWidgetTitleBarButton.cpp
deleted file mode 100644
index 8ffc6ad451f..00000000000
--- a/libs/widgets/KoDockWidgetTitleBarButton.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/* This file is part of the KDE project
- Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink at kde.org>
- Copyright (C) 2007 Thomas Zander <zander at kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "KoDockWidgetTitleBarButton.h"
-
-#include <WidgetsDebug.h>
-
-#include <QAbstractButton>
-#include <QAction>
-#include <QLabel>
-#include <QLayout>
-#include <QStyle>
-#include <QStylePainter>
-#include <QStyleOptionFrame>
-
-class Q_DECL_HIDDEN KoDockWidgetTitleBarButton::Private
-{
-public:
- Private() : styleSize(0, 0), iconSize(0) {}
- QSize styleSize;
- int iconSize;
-};
-
-KoDockWidgetTitleBarButton::KoDockWidgetTitleBarButton(QWidget *parent)
- : QAbstractButton(parent), d(new Private())
-{
- setFocusPolicy(Qt::NoFocus);
-}
-
-KoDockWidgetTitleBarButton::~KoDockWidgetTitleBarButton()
-{
- delete d;
-}
-
-QSize KoDockWidgetTitleBarButton::sizeHint() const
-{
- ensurePolished();
-
- const int margin = style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
- if (icon().isNull()) {
- return QSize(18, 18);
- }
-
- int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
- if (iconSize != d->iconSize) {
- const_cast<KoDockWidgetTitleBarButton*>(this)->d->iconSize = iconSize;
- const QPixmap pm = icon().pixmap(iconSize);
- const_cast<KoDockWidgetTitleBarButton*>(this)->d->styleSize = QSize(pm.width() + margin, pm.height() + margin);
- }
- return d->styleSize;
-}
-
-QSize KoDockWidgetTitleBarButton::minimumSizeHint() const
-{
- return sizeHint();
-}
-
-// redraw the button when the mouse enters or leaves it
-void KoDockWidgetTitleBarButton::enterEvent(QEvent *event)
-{
- if (isEnabled())
- update();
- QAbstractButton::enterEvent(event);
-}
-
-void KoDockWidgetTitleBarButton::leaveEvent(QEvent *event)
-{
- if (isEnabled())
- update();
- QAbstractButton::leaveEvent(event);
-}
-
-void KoDockWidgetTitleBarButton::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
-
- QStyleOptionToolButton opt;
- opt.initFrom(this);
- opt.state |= QStyle::State_AutoRaise;
-
- if (isEnabled() && underMouse() && !isChecked() && !isDown())
- opt.state |= QStyle::State_Raised;
- if (isChecked())
- opt.state |= QStyle::State_On;
- if (isDown())
- opt.state |= QStyle::State_Sunken;
- style()->drawPrimitive(QStyle::PE_PanelButtonTool, &opt, &p, this);
-
- opt.icon = icon();
- opt.subControls = 0;
- opt.activeSubControls = 0;
- opt.features = QStyleOptionToolButton::None;
- opt.arrowType = Qt::NoArrow;
- int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
- opt.iconSize = QSize(size, size);
- style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this);
-}
diff --git a/libs/widgets/KoDockWidgetTitleBarButton.h b/libs/widgets/KoDockWidgetTitleBarButton.h
deleted file mode 100644
index 19753277ec1..00000000000
--- a/libs/widgets/KoDockWidgetTitleBarButton.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This file is part of the KDE project
- Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink at kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-#ifndef KODOCKWIDGETTITLEBARBUTTON_H_
-#define KODOCKWIDGETTITLEBARBUTTON_H_
-
-#include "kritawidgets_export.h"
-#include <QAbstractButton>
-
-class QEvent;
-class QPaintEvent;
-
-/**
- * @short A custom title bar button for dock widgets.
- *
- * Used in KoDockWidgetTitleBar but can be also used for similar
- * purposes inside other parents.
- */
-class KRITAWIDGETS_EXPORT KoDockWidgetTitleBarButton : public QAbstractButton
-{
- Q_OBJECT
-
-public:
- explicit KoDockWidgetTitleBarButton(QWidget *parent = 0);
- ~KoDockWidgetTitleBarButton() override;
-
- QSize sizeHint() const override; ///< reimplemented from QWidget
- QSize minimumSizeHint() const override; ///< reimplemented from QWidget
-
-protected:
- void enterEvent(QEvent *event) override;
- void leaveEvent(QEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
-
-private:
- class Private;
- Private * const d;
-};
-
-#endif // KODOCKWIDGETTITLEBARBUTTON_H_
diff --git a/libs/widgets/KoDockWidgetTitleBar_p.h b/libs/widgets/KoDockWidgetTitleBar_p.h
deleted file mode 100644
index f61c0b1a6f9..00000000000
--- a/libs/widgets/KoDockWidgetTitleBar_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* This file is part of the KDE project
- Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink at kde.org>
- Copyright (C) 2007 Thomas Zander <zander at kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-#ifndef KoDockWidgetTitleBar_p_h
-#define KoDockWidgetTitleBar_p_h
-
-#include "KoDockWidgetTitleBar.h"
-#include "KoDockWidgetTitleBarButton.h"
-
-#include <KoIcon.h>
-
-#include <WidgetsDebug.h>
-
-#include <QAbstractButton>
-#include <QAction>
-#include <QLabel>
-#include <QLayout>
-#include <QStyle>
-#include <QStylePainter>
-#include <QStyleOptionFrame>
-
-class Q_DECL_HIDDEN KoDockWidgetTitleBar::Private
-{
-public:
- Private(KoDockWidgetTitleBar* thePublic)
- : thePublic(thePublic),
- collapsable(true),
- collapsableSet(true),
- lockable(true),
- textVisibilityMode(KoDockWidgetTitleBar::FullTextAlwaysVisible),
- preCollapsedWidth(-1),
- locked(false)
- {
- }
-
- KoDockWidgetTitleBar* thePublic;
- QIcon openIcon, closeIcon, lockIcon, floatIcon, removeIcon; // close/open are for collapsing
- QAbstractButton* closeButton;
- QAbstractButton* floatButton;
- QAbstractButton* collapseButton;
- bool collapsable;
- bool collapsableSet;
- QAbstractButton* lockButton;
- bool lockable;
- KoDockWidgetTitleBar::TextVisibilityMode textVisibilityMode;
- int preCollapsedWidth;
- bool locked;
- QDockWidget::DockWidgetFeatures features;
-
- void toggleFloating();
- void toggleCollapsed();
- void topLevelChanged(bool topLevel);
- void featuresChanged(QDockWidget::DockWidgetFeatures features);
- void updateIcons();
-};
-#endif
diff --git a/libs/widgets/KoToolBoxDocker.cpp b/libs/widgets/KoToolBoxDocker.cpp
index 6bce92143e4..bda83fc88ac 100644
--- a/libs/widgets/KoToolBoxDocker.cpp
+++ b/libs/widgets/KoToolBoxDocker.cpp
@@ -22,7 +22,6 @@
#include "KoToolBoxDocker_p.h"
#include "KoToolBox_p.h"
#include "KoToolBoxScrollArea_p.h"
-#include <KoDockWidgetTitleBar.h>
#include <klocalizedstring.h>
@@ -38,10 +37,6 @@ KoToolBoxDocker::KoToolBoxDocker(KoToolBox *toolBox)
this, SLOT(updateToolBoxOrientation(Qt::DockWidgetArea)));
connect(this, SIGNAL(topLevelChanged(bool)),
this, SLOT(updateFloating(bool)));
- KoDockWidgetTitleBar* titleBar = new KoDockWidgetTitleBar(this);
- titleBar->setTextVisibilityMode(KoDockWidgetTitleBar::TextCanBeInvisible);
- titleBar->setToolTip(i18n("Tools"));
- setTitleBarWidget(titleBar);
}
void KoToolBoxDocker::setCanvas(KoCanvasBase *canvas)
diff --git a/libs/widgets/KoToolDocker.cpp b/libs/widgets/KoToolDocker.cpp
index 75fa20551e3..c6fe02aaa28 100644
--- a/libs/widgets/KoToolDocker.cpp
+++ b/libs/widgets/KoToolDocker.cpp
@@ -21,8 +21,6 @@
*/
#include "KoToolDocker.h"
-#include <KoDockWidgetTitleBarButton.h>
-#include <KoDockWidgetTitleBar.h>
#include <KoIcon.h>
#include <klocalizedstring.h>
@@ -200,7 +198,6 @@ KoToolDocker::KoToolDocker(QWidget *parent)
d->tabbed = cfg.readEntry("TabbedMode", false);
setFeatures(DockWidgetMovable|DockWidgetFloatable);
- setTitleBarWidget(new KoDockWidgetTitleBar(this));
connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea )), this, SLOT(locationChanged(Qt::DockWidgetArea)));
diff --git a/libs/widgets/kritawidgets.qrc b/libs/widgets/kritawidgets.qrc
index 66c4405c0e2..94fe80bed2c 100644
--- a/libs/widgets/kritawidgets.qrc
+++ b/libs/widgets/kritawidgets.qrc
@@ -1,18 +1,6 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
- <file>pics/dark_docker_close.png</file>
- <file>pics/dark_docker_collapse_a.png</file>
- <file>pics/dark_docker_collapse_b.png</file>
- <file>pics/dark_docker_float.png</file>
- <file>pics/dark_docker_lock_a.png</file>
- <file>pics/dark_docker_lock_b.png</file>
- <file>pics/light_docker_close.png</file>
- <file>pics/light_docker_collapse_a.png</file>
- <file>pics/light_docker_collapse_b.png</file>
- <file>pics/light_docker_float.png</file>
- <file>pics/light_docker_lock_a.png</file>
- <file>pics/light_docker_lock_b.png</file>
<file>pics/zoom-draw.png</file>
<file>pics/zoom-pixels.png</file>
<file>pics/zoom-select.png</file>
diff --git a/libs/widgets/pics/dark_docker_close.png b/libs/widgets/pics/dark_docker_close.png
deleted file mode 100644
index cd12fad5c93..00000000000
Binary files a/libs/widgets/pics/dark_docker_close.png and /dev/null differ
diff --git a/libs/widgets/pics/dark_docker_collapse_a.png b/libs/widgets/pics/dark_docker_collapse_a.png
deleted file mode 100644
index e106ef3f779..00000000000
Binary files a/libs/widgets/pics/dark_docker_collapse_a.png and /dev/null differ
diff --git a/libs/widgets/pics/dark_docker_collapse_b.png b/libs/widgets/pics/dark_docker_collapse_b.png
deleted file mode 100644
index 5fbc2cb1c39..00000000000
Binary files a/libs/widgets/pics/dark_docker_collapse_b.png and /dev/null differ
diff --git a/libs/widgets/pics/dark_docker_float.png b/libs/widgets/pics/dark_docker_float.png
deleted file mode 100644
index 7caee5e87a0..00000000000
Binary files a/libs/widgets/pics/dark_docker_float.png and /dev/null differ
diff --git a/libs/widgets/pics/dark_docker_lock_a.png b/libs/widgets/pics/dark_docker_lock_a.png
deleted file mode 100644
index 1c0b4e4c812..00000000000
Binary files a/libs/widgets/pics/dark_docker_lock_a.png and /dev/null differ
diff --git a/libs/widgets/pics/dark_docker_lock_b.png b/libs/widgets/pics/dark_docker_lock_b.png
deleted file mode 100644
index 04545de8515..00000000000
Binary files a/libs/widgets/pics/dark_docker_lock_b.png and /dev/null differ
diff --git a/libs/widgets/pics/light_docker_close.png b/libs/widgets/pics/light_docker_close.png
deleted file mode 100644
index 1398f259314..00000000000
Binary files a/libs/widgets/pics/light_docker_close.png and /dev/null differ
diff --git a/libs/widgets/pics/light_docker_collapse_a.png b/libs/widgets/pics/light_docker_collapse_a.png
deleted file mode 100644
index 354cd05e4f0..00000000000
Binary files a/libs/widgets/pics/light_docker_collapse_a.png and /dev/null differ
diff --git a/libs/widgets/pics/light_docker_collapse_b.png b/libs/widgets/pics/light_docker_collapse_b.png
deleted file mode 100644
index 14894a51309..00000000000
Binary files a/libs/widgets/pics/light_docker_collapse_b.png and /dev/null differ
diff --git a/libs/widgets/pics/light_docker_float.png b/libs/widgets/pics/light_docker_float.png
deleted file mode 100644
index 0a77f98ec71..00000000000
Binary files a/libs/widgets/pics/light_docker_float.png and /dev/null differ
diff --git a/libs/widgets/pics/light_docker_lock_a.png b/libs/widgets/pics/light_docker_lock_a.png
deleted file mode 100644
index 03b0c2ded10..00000000000
Binary files a/libs/widgets/pics/light_docker_lock_a.png and /dev/null differ
diff --git a/libs/widgets/pics/light_docker_lock_b.png b/libs/widgets/pics/light_docker_lock_b.png
deleted file mode 100644
index bbc3e8f3617..00000000000
Binary files a/libs/widgets/pics/light_docker_lock_b.png and /dev/null differ
More information about the kimageshop
mailing list