diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp
index 8da5626..4f70db2 100644
--- a/src/FloatingDockContainer.cpp
+++ b/src/FloatingDockContainer.cpp
@@ -635,7 +635,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
{
// KDE doesn't seem to fire MoveEvents while moving windows, so for now no native titlebar for everything using KWin.
QString window_manager = internal::windowManager().toUpper().split(" ")[0];
- bool native_window = window_manager != "KWIN";
+ native_window = window_manager != "KWIN";
}
if (native_window)
diff --git a/src/ads.qrc b/src/ads.qrc
index 0c9f4e6..a29a542 100644
--- a/src/ads.qrc
+++ b/src/ads.qrc
@@ -10,5 +10,9 @@
images/tabs-menu-button.svg
images/detach-button.svg
images/detach-button-disabled.svg
+ images/maximize-button.svg
+ images/maximize-button-focused.svg
+ images/restore-button.svg
+ images/restore-button-focused.svg
diff --git a/src/linux/FloatingWidgetTitleBar.cpp b/src/linux/FloatingWidgetTitleBar.cpp
index fa1ae5b..8546748 100644
--- a/src/linux/FloatingWidgetTitleBar.cpp
+++ b/src/linux/FloatingWidgetTitleBar.cpp
@@ -60,6 +60,9 @@ struct FloatingWidgetTitleBarPrivate
tMaximizeButton* MaximizeButton = nullptr;
CFloatingDockContainer *FloatingWidget = nullptr;
eDragState DragState = DraggingInactive;
+ QIcon MaximizeIcon;
+ QIcon NormalIcon;
+ bool Maximized = false;
FloatingWidgetTitleBarPrivate(CFloatingWidgetTitleBar *_public) :
_this(_public)
@@ -133,6 +136,15 @@ CFloatingWidgetTitleBar::CFloatingWidgetTitleBar(CFloatingDockContainer *parent)
{
d->FloatingWidget = parent;
d->createLayout();
+
+ auto normalPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarNormalButton, 0, d->MaximizeButton);
+ d->NormalIcon.addPixmap(normalPixmap, QIcon::Normal);
+ d->NormalIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
+
+ auto maxPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarMaxButton, 0, d->MaximizeButton);
+ d->MaximizeIcon.addPixmap(maxPixmap, QIcon::Normal);
+ d->MaximizeIcon.addPixmap(internal::createTransparentPixmap(maxPixmap, 0.25), QIcon::Disabled);
+ setMaximizedIcon(d->Maximized);
}
//============================================================================
@@ -230,22 +242,52 @@ void CFloatingWidgetTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
//============================================================================
void CFloatingWidgetTitleBar::setMaximizedIcon(bool maximized)
{
+ d->Maximized = maximized;
if (maximized)
{
- QIcon normalIcon;
- auto normalPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarNormalButton, 0, d->MaximizeButton);
- normalIcon.addPixmap(normalPixmap, QIcon::Normal);
- normalIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
- d->MaximizeButton->setIcon(normalIcon);
+ d->MaximizeButton->setIcon(d->NormalIcon);
}
else
{
- QIcon MaxIcon;
- auto maxPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarMaxButton, 0, d->MaximizeButton);
- MaxIcon.addPixmap(maxPixmap, QIcon::Normal);
- MaxIcon.addPixmap(internal::createTransparentPixmap(maxPixmap, 0.25), QIcon::Disabled);
- d->MaximizeButton->setIcon(MaxIcon);
+ d->MaximizeButton->setIcon(d->MaximizeIcon);
}
}
+
+//============================================================================
+void CFloatingWidgetTitleBar::setMaximizeIcon(const QIcon& Icon)
+{
+ d->MaximizeIcon = Icon;
+ if (d->Maximized)
+ {
+ setMaximizedIcon(d->Maximized);
+ }
+}
+
+
+//============================================================================
+void CFloatingWidgetTitleBar::setNormalIcon(const QIcon& Icon)
+{
+ d->NormalIcon = Icon;
+ if (!d->Maximized)
+ {
+ setMaximizedIcon(d->Maximized);
+ }
+}
+
+
+//============================================================================
+QIcon CFloatingWidgetTitleBar::maximizeIcon() const
+{
+ return d->MaximizeIcon;
+}
+
+
+//============================================================================
+QIcon CFloatingWidgetTitleBar::normalIcon() const
+{
+ return d->NormalIcon;
+}
+
+
} // namespace ads
diff --git a/src/linux/FloatingWidgetTitleBar.h b/src/linux/FloatingWidgetTitleBar.h
index ec44cb3..ad6904f 100644
--- a/src/linux/FloatingWidgetTitleBar.h
+++ b/src/linux/FloatingWidgetTitleBar.h
@@ -30,6 +30,7 @@
// INCLUDES
//============================================================================
#include
+#include
namespace ads
{
@@ -48,6 +49,8 @@ struct FloatingWidgetTitleBarPrivate;
class CFloatingWidgetTitleBar : public QFrame
{
Q_OBJECT
+ Q_PROPERTY(QIcon maximizeIcon READ maximizeIcon WRITE setMaximizeIcon)
+ Q_PROPERTY(QIcon normalIcon READ normalIcon WRITE setNormalIcon)
private:
FloatingWidgetTitleBarPrivate *d; ///< private data (pimpl)
@@ -57,6 +60,11 @@ protected:
virtual void mouseMoveEvent(QMouseEvent *ev) override;
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void setMaximizeIcon(const QIcon& Icon);
+ QIcon maximizeIcon() const;
+ void setNormalIcon(const QIcon& Icon);
+ QIcon normalIcon() const;
+
public:
using Super = QWidget;
explicit CFloatingWidgetTitleBar(CFloatingDockContainer *parent = nullptr);
diff --git a/src/stylesheets/default_linux.css b/src/stylesheets/default_linux.css
index 56b950e..51e52ac 100644
--- a/src/stylesheets/default_linux.css
+++ b/src/stylesheets/default_linux.css
@@ -92,13 +92,25 @@ QScrollArea#dockWidgetScrollArea {
qproperty-iconSize: 16px;
}
-#floatingTitleCloseButton {
- qproperty-icon: url(:/ads/images/close-button.svg);
+
+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);
+}
+
#floatingTitleCloseButton:hover {
background: rgba(0, 0, 0, 24);
border: none;
diff --git a/src/stylesheets/focus_highlighting_linux.css b/src/stylesheets/focus_highlighting_linux.css
index 3f1b393..8e2332a 100644
--- a/src/stylesheets/focus_highlighting_linux.css
+++ b/src/stylesheets/focus_highlighting_linux.css
@@ -129,42 +129,63 @@ ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar {
}
+ads--CFloatingWidgetTitleBar {
+ background: palette(midlight);
+ qproperty-maximizeIcon: url(:/ads/images/maximize-button.svg);
+ qproperty-normalIcon: url(:/ads/images/restore-button.svg);
+}
+
ads--CFloatingDockContainer[isActiveWindow="true"] ads--CFloatingWidgetTitleBar {
background: palette(highlight);
+ qproperty-maximizeIcon: url(:/ads/images/maximize-button-focused.svg);
+ qproperty-normalIcon: url(:/ads/images/restore-button-focused.svg);
}
ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleLabel {
- color: palette(light);
+ color: palette(light);
}
-#floatingTitleCloseButton {
- qproperty-icon: url(:/ads/images/close-button.svg);
+#floatingTitleCloseButton, #floatingTitleMaximizeButton {
qproperty-iconSize: 16px;
border: none;
margin: 3px;
}
-#floatingTitleCloseButton:hover {
+
+#floatingTitleCloseButton {
+ qproperty-icon: url(:/ads/images/close-button.svg);
+}
+
+
+#floatingTitleCloseButton:hover, #floatingTitleMaximizeButton:hover {
background: rgba(0, 0, 0, 24);
border: none;
}
-#floatingTitleCloseButton:pressed {
+
+#floatingTitleCloseButton:pressed, #floatingTitleMaximizeButton:pressed {
background: rgba(0, 0, 0, 48);
}
+ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleMaximizeButton {
+ qproperty-iconSize: 16px;
+}
+
+
ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleCloseButton {
qproperty-icon: url(:/ads/images/close-button-focused.svg);
qproperty-iconSize: 16px;
}
-ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleCloseButton:hover {
+ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleCloseButton:hover,
+ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleMaximizeButton:hover {
background: rgba(255, 255, 255, 48);
}
-ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleCloseButton:pressed {
+ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleCloseButton:pressed,
+ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleMaximizeButton:pressed {
background: rgba(255, 255, 255, 92);
}