diff --git a/.github/workflows/kubuntu.yml b/.github/workflows/kubuntu.yml index 76c701d8..971c62ae 100644 --- a/.github/workflows/kubuntu.yml +++ b/.github/workflows/kubuntu.yml @@ -31,7 +31,7 @@ jobs: libkf5coreaddons-dev libkf5iconthemes-dev gettext qt3d5-dev libkf5kcmutils-dev \ qt6-base-dev libkf6coreaddons-dev libkf6colorscheme-dev \ libkf6config-dev libkf6guiaddons-dev libkf6i18n-dev libkf6iconthemes-dev \ - libkf6windowsystem-dev libkf6kcmutils-dev libkirigami-dev + libkf6windowsystem-dev libkf6kcmutils-dev libkirigami-dev libkf6style-dev - name: Extract release tarball run: tar xvf ${{ inputs.cache-file-path }} - name: Build Darkly diff --git a/README.md b/README.md index 6dbfada9..eb27723b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This fork attempts to revive lightly with a different approach from boehs, with This means that this fork allows real changes, and not just maintainence. -![Darkly](https://github.com/user-attachments/assets/972ed626-87e3-494f-96f2-9408adee4fad) +![Darkly](https://github.com/user-attachments/assets/0d60725e-c146-4e1e-9889-fe8317d52b22) ## What changed? @@ -214,7 +214,7 @@ sudo apt-get install -y -qq cmake build-essential libkf5config-dev libkdecoratio libkf5coreaddons-dev libkf5iconthemes-dev gettext qt3d5-dev libkf5kcmutils-dev \ qt6-base-dev libkf6coreaddons-dev libkf6colorscheme-dev \ libkf6config-dev libkf6guiaddons-dev libkf6i18n-dev libkf6iconthemes-dev \ - libkf6windowsystem-dev libkf6kcmutils-dev libkirigami-dev + libkf6windowsystem-dev libkf6kcmutils-dev libkirigami-dev libkf6style-dev ``` ``` @@ -223,8 +223,6 @@ cd Darkly ./install.sh ``` ---- - #### Nixos 1. add `inputs.lightly.url = "github:Bali10050/Darkly";` to `flake.nix` diff --git a/kstyle/config/ui/darklystyleconfig.ui b/kstyle/config/ui/darklystyleconfig.ui index 2bae8f1f..84a1ccad 100644 --- a/kstyle/config/ui/darklystyleconfig.ui +++ b/kstyle/config/ui/darklystyleconfig.ui @@ -46,589 +46,905 @@ 0 - + General - - - - &Keyboard accelerators visibility: + + QLayout::SizeConstraint::SetDefaultConstraint + + + 13 + + + 6 + + + 13 + + + 13 + + + 13 + + + + + QLayout::SizeConstraint::SetMaximumSize - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - _mnemonicsMode - - - - - - - Draw toolbar item separators - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - Scrollable popup menu - - - - - - - „TabBarAltStyle” - - - - - - - Default tabbar - - - true - - - - - - - Unify konsole tab bar with header area - - - - - - - Always Hide - + + + Draw toolbar item separators + + - - When Needed - + + + Draw focus indicator in lists + + - - Always Show - + + + Draw widget shadow + + - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - + - Smaller + Scrollable popup menu - + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter + + + + + Corner radius: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 + + + + + + + + 0 + 0 + + + + px + + + 1 + + + 8 + + + 6 + + + + + + + Keyboard accelerators visibility: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 + + + + + + + + 0 + 0 + + + + + Always Hide + + + + + When Needed + + + + + Always Show + + + + + + + + + 0 + 0 + + + + W&indows' drag mode: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 + + + _windowDragMode + + + + + + + + 0 + 0 + + + + + Drag windows from titlebar only + + + + + Drag windows from titlebar, menubar and toolbars + + + + + Drag windows from all empty areas + + + + + + + + Qt::LayoutDirection::LeftToRight + + + Button Size: + + + 5 + + + + + + + + + -2 + + + 6 + + + 1 + + + 4 + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::TicksBelow + + + 2 + + + + + + + + + Smaller + + + + + + + Bigger + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + + + + + + Qt::LayoutDirection::RightToLeft + - Bigger + VERSION - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing - - - - Draw focus indicator in lists - - - - - - - -2 - - - 6 - - - 1 - - - 4 - - - Qt::Orientation::Horizontal - - - QSlider::TickPosition::TicksBelow - - - 2 - - - - - - - Draw highlight on active tab - - - - - - - Qt::LayoutDirection::LeftToRight - - - Button Size: - - - - - - - Qt::Orientation::Vertical - - - - 20 - 49 - - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - W&indows' drag mode: - - - Qt::AlignmentFlag::AlignJustify|Qt::AlignmentFlag::AlignVCenter - - - _windowDragMode - - - - - - - Use highlight color as selected tab background - - - - - - + + + + + Tabs + + + + + 10 + 0 + 311 + 338 + + + + + 10 + + + QLayout::SizeConstraint::SetMinimumSize + + + 2 + + + 4 + + + - Drag windows from titlebar only + Default tabbar - - + + true + + + + + - Drag windows from titlebar, menubar and toolbars + Old tabbar - - + + + + - Drag windows from all empty areas + „TabBarAltStyle” - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - Draw widget shadow - - - - - - - Corner radius: - - - Qt::AlignmentFlag::AlignJustify|Qt::AlignmentFlag::AlignVCenter - - - - - - - - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - Old tabbar - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - px - - - 1 - - - 8 - - - 6 - - - - - - - Center tabbar tabs - - - - + + + + + + Center tabbar tabs + + + + + + + Draw highlight on active tab + + + + + + + Unify konsole tab bar with header area + + + + + + + Use highlight color as selected tab background + + + + + + + Custom tabbar background + + + + + + + + 0 + 40 + + + + + 128 + 16777215 + + + + Tabbar background + + + + 0 + 0 + 0 + + + + + 0 + 0 + 0 + + + + true + + + + + - + Animations + + 11 + + + 6 + + + 13 + + + 13 + + + 13 + - - - false - - - A&nimations duration: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - _animationsDuration - - - - - - - false - - - ms - - - 500 - - - - - - - Enable animations - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - + + + 2 - + + + + Enable animations + + + + + + + + + false + + + A&nimations duration: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing + + + 5 + + + _animationsDuration + + + + + + + false + + + + 0 + 0 + + + + ms + + + 500 + + + + + + - + Frames - - - Transparent Dolphin view - - - - - - - Draw frame around dockable panels - - - - - - - Draw frame around page titles - - - - - - - Draw frame around KTextEdit - - - - - - - Draw frame around side panels - - - - - - - Draw a thin line to indicate focus in menus and menubars - - - - - - - This makes the selection rectangle frame rounded - - - Draw rounded frame on rubber band control - - - - - - - Custom tabbar background - - - - - - - - 128 - 16777215 - + + + 13 - - Tabbar background + + 7 - - - 0 - 0 - 0 - + + 0 - - - 0 - 0 - 0 - + + 10 - - true + + 13 - + + + + Transparent Dolphin view + + + + + + + Draw frame around dockable panels + + + + + + + Draw frame around page titles + + + + + + + Draw frame around KTextEdit + + + + + + + This makes the selection rectangle frame rounded + + + Draw rounded frame on rubber band control + + + + + + + Draw a thin line to indicate focus in menus and menubars + + + + + + + Draw frame around side panels + + + + - + Qt::Orientation::Vertical 20 - 117 + 40 - + Scrollbars - - + + 13 + + + + + 2 + + + + + Render a thin separator between the scrollbar + + + + + + + + + + 0 + 0 + + + + + No Buttons + + + + + One Button + + + + + Two Buttons + + + + + + + + Bottom arrow button t&ype: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 + + + _scrollBarAddLineButtons + + + + + + + + 0 + 0 + + + + + No Buttons + + + + + One Button + + + + + Two Buttons + + + + + + + + &Top arrow button type: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 + + + _scrollBarSubLineButtons + + + + + + - - + + + + + Transparency + + + + - + - &Top arrow button type: + Menu: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft - - _scrollBarSubLineButtons + + 5 - + - - No Buttons - + + + This changes the menu items transparency + + + 0 + + + 100 + + + 1 + + + 10 + + + 100 + + + Qt::Orientation::Horizontal + + + false + + + false + + + QSlider::TickPosition::TicksBelow + + + 10 + + - - One Button - + + + % + + + 100 + + - - - Two Buttons - - - + - + - Bottom arrow button t&ype: + Sidebars: - - _scrollBarAddLineButtons + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 - + - - No Buttons - + + + This changes the Dolphin sidebar transparency + + + 100 + + + 1 + + + 10 + + + 100 + + + 100 + + + Qt::Orientation::Horizontal + + + false + + + false + + + QSlider::TickPosition::TicksBelow + + + 10 + + - - One Button - + + + % + + + 100 + + + + + + + + Menubar: + + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + 5 + + + + + - - Two Buttons - + + + This only works on color schemes which support transparency + + + 100 + + + 100 + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::TicksBelow + + + 10 + + + + + + % + + + 100 + + + + + + + + + + + + + + 0 + 0 + + + + Transparent + + + 73 + + + + + + + + 0 + 0 + + + + Qt::LayoutDirection::LeftToRight + + + Opaque + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + 0 + + + 93 + - - + + Qt::Orientation::Vertical @@ -640,306 +956,6 @@ - - - - Render a thin separator between the scrollbar - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - Transparency - - - - - - - - - - - - - Qt::Orientation::Horizontal - - - QSizePolicy::Policy::Fixed - - - - 69 - 20 - - - - - - - - - 0 - 0 - - - - Transparent - - - - - - - Qt::Orientation::Horizontal - - - QSizePolicy::Policy::Preferred - - - - 186 - 20 - - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Opaque - - - - - - - Qt::Orientation::Horizontal - - - QSizePolicy::Policy::Fixed - - - - 91 - 20 - - - - - - - - - - - - Menu: - - - - - - - This changes the menu items transparency - - - 0 - - - 100 - - - 1 - - - 10 - - - 100 - - - Qt::Orientation::Horizontal - - - false - - - false - - - QSlider::TickPosition::TicksBelow - - - 10 - - - - - - - % - - - 100 - - - - - - - - - - - Sidebars: - - - - - - - This changes the Dolphin sidebar transparency - - - 100 - - - 1 - - - 10 - - - 100 - - - 100 - - - Qt::Orientation::Horizontal - - - false - - - false - - - QSlider::TickPosition::TicksBelow - - - 10 - - - - - - - % - - - 100 - - - - - - - - - - - Menubar: - - - - - - - This only works on color schemes which support transparency - - - 100 - - - 100 - - - Qt::Orientation::Horizontal - - - QSlider::TickPosition::TicksBelow - - - 10 - - - - - - - % - - - 100 - - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - - - - - - @@ -953,16 +969,6 @@
kcolorbutton.h
- - _tabDrawHighlight - _toolBarDrawItemSeparator - _animationsEnabled - _animationsDuration - _dockWidgetDrawFrame - _titleWidgetDrawFrame - _sidePanelDrawFrame - _menuItemDrawThinFocus - diff --git a/kstyle/darklyhelper.cpp b/kstyle/darklyhelper.cpp index 4c7d6263..db112278 100644 --- a/kstyle/darklyhelper.cpp +++ b/kstyle/darklyhelper.cpp @@ -1825,14 +1825,19 @@ qreal Helper::devicePixelRatio(const QPixmap &pixmap) const return pixmap.devicePixelRatio(); } -QPixmap Helper::coloredIcon(const QIcon &icon, const QPalette &palette, const QSize &size, QIcon::Mode mode, QIcon::State state) +QPixmap Helper::coloredIcon(const QIcon &icon, const QPalette &palette, const QSize &size, qreal devicePixelRatio, QIcon::Mode mode, QIcon::State state) { const QPalette activePalette = KIconLoader::global()->customPalette(); const bool changePalette = activePalette != palette; if (changePalette) { KIconLoader::global()->setCustomPalette(palette); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const QPixmap pixmap = icon.pixmap(size, devicePixelRatio, mode, state); +#else + Q_UNUSED(devicePixelRatio); const QPixmap pixmap = icon.pixmap(size, mode, state); +#endif if (changePalette) { if (activePalette == QPalette()) { KIconLoader::global()->resetPalette(); diff --git a/kstyle/darklyhelper.h b/kstyle/darklyhelper.h index dcd3ffba..c09f6195 100644 --- a/kstyle/darklyhelper.h +++ b/kstyle/darklyhelper.h @@ -425,7 +425,12 @@ class Helper : public QObject //* return a QRectF with the appropriate size for a rectangle with a pen stroke QRectF strokedRect(const QRect &rect, const int penWidth = PenWidth::Frame) const; - QPixmap coloredIcon(const QIcon &icon, const QPalette &palette, const QSize &size, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off); + QPixmap coloredIcon(const QIcon &icon, + const QPalette &palette, + const QSize &size, + qreal devicePixelRatio, + QIcon::Mode mode = QIcon::Normal, + QIcon::State state = QIcon::Off); protected: //* return rounded path in a given rect, with only selected corners rounded, and for a given radius diff --git a/kstyle/darklystyle.cpp b/kstyle/darklystyle.cpp index b307631c..336d62ed 100644 --- a/kstyle/darklystyle.cpp +++ b/kstyle/darklystyle.cpp @@ -1992,9 +1992,11 @@ bool Style::eventFilterCommandLinkButton(QCommandLinkButton *button, QEvent *eve if (!button->icon().isNull()) { const auto pixmapSize(button->icon().actualSize(button->iconSize())); const QRect pixmapRect(QPoint(offset.x(), button->description().isEmpty() ? (button->height() - pixmapSize.height()) / 2 : offset.y()), pixmapSize); + const qreal dpr = painter.device() ? painter.device()->devicePixelRatioF() : qApp->devicePixelRatio(); const QPixmap pixmap(_helper->coloredIcon(button->icon(), button->palette(), pixmapSize, + dpr, enabled ? QIcon::Normal : QIcon::Disabled, button->isChecked() ? QIcon::On : QIcon::Off)); drawItemPixmap(&painter, pixmapRect, Qt::AlignCenter, pixmap); @@ -4581,7 +4583,8 @@ bool Style::drawIndicatorTabClosePrimitive(const QStyleOption *option, QPainter const QSize iconSize(iconWidth, iconWidth); // get pixmap - const QPixmap pixmap(_helper->coloredIcon(icon, option->palette, iconSize, iconMode, iconState)); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap(_helper->coloredIcon(icon, option->palette, iconSize, dpr, iconMode, iconState)); // render drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap); @@ -4900,7 +4903,8 @@ bool Style::drawPushButtonLabelControl(const QStyleOption *option, QPainter *pai else iconMode = QIcon::Normal; - const auto pixmap = _helper->coloredIcon(buttonOption->icon, buttonOption->palette, iconSize, iconMode, iconState); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const auto pixmap = _helper->coloredIcon(buttonOption->icon, buttonOption->palette, iconSize, dpr, iconMode, iconState); drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); } @@ -5034,7 +5038,8 @@ bool Style::drawToolButtonLabelControl(const QStyleOption *option, QPainter *pai else iconMode = QIcon::Normal; - const QPixmap pixmap = _helper->coloredIcon(toolButtonOption->icon, toolButtonOption->palette, iconSize, iconMode, iconState); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap = _helper->coloredIcon(toolButtonOption->icon, toolButtonOption->palette, iconSize, dpr, iconMode, iconState); drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); } @@ -5079,7 +5084,8 @@ bool Style::drawCheckBoxLabelControl(const QStyleOption *option, QPainter *paint // render icon if (!buttonOption->icon.isNull()) { const QIcon::Mode mode(enabled ? QIcon::Normal : QIcon::Disabled); - const QPixmap pixmap(_helper->coloredIcon(buttonOption->icon, buttonOption->palette, buttonOption->iconSize, mode)); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap(_helper->coloredIcon(buttonOption->icon, buttonOption->palette, buttonOption->iconSize, dpr, mode)); drawItemPixmap(painter, rect, textFlags, pixmap); // adjust rect (copied from QCommonStyle) @@ -5167,7 +5173,8 @@ bool Style::drawComboBoxLabelControl(const QStyleOption *option, QPainter *paint else mode = QIcon::Normal; - const QPixmap pixmap = _helper->coloredIcon(cb->currentIcon, cb->palette, cb->iconSize, mode); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap = _helper->coloredIcon(cb->currentIcon, cb->palette, cb->iconSize, dpr, mode); auto iconRect(editRect); iconRect.setWidth(cb->iconSize.width() + 4); iconRect = alignedRect(cb->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); @@ -5443,7 +5450,8 @@ bool Style::drawMenuBarItemControl(const QStyleOption *option, QPainter *painter iconState = sunken ? QIcon::On : QIcon::Off; } - const auto pixmap = _helper->coloredIcon(menuItemOption->icon, menuItemOption->palette, iconRect.size(), iconMode, iconState); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const auto pixmap = _helper->coloredIcon(menuItemOption->icon, menuItemOption->palette, iconRect.size(), dpr, iconMode, iconState); drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); // render outline @@ -5613,8 +5621,9 @@ bool Style::drawMenuItemControl(const QStyleOption *option, QPainter *painter, c // icon state const QIcon::State iconState(sunken ? QIcon::On : QIcon::Off); - const QPixmap icon = _helper->coloredIcon(menuItemOption->icon, menuItemOption->palette, iconRect.size(), mode, iconState); - painter->drawPixmap(iconRect, icon); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap = _helper->coloredIcon(menuItemOption->icon, menuItemOption->palette, iconRect.size(), dpr, mode, iconState); + drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); } // arrow @@ -7064,7 +7073,8 @@ bool Style::drawToolBoxTabLabelControl(const QStyleOption *option, QPainter *pai iconRect = visualRect(option, iconRect); const QIcon::Mode mode(enabled ? QIcon::Normal : QIcon::Disabled); - const QPixmap pixmap(_helper->coloredIcon(toolBoxOption->icon, toolBoxOption->palette, iconRect.size(), mode)); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap(_helper->coloredIcon(toolBoxOption->icon, toolBoxOption->palette, iconRect.size(), dpr, mode)); drawItemPixmap(painter, iconRect, textFlags, pixmap); } @@ -7905,8 +7915,9 @@ bool Style::drawTitleBarComplexControl(const QStyleOptionComplex *option, QPaint } // get pixmap and render - const QPixmap pixmap = _helper->coloredIcon(icon, option->palette, iconSize, iconMode, iconState); - painter->drawPixmap(iconRect, pixmap); + const qreal dpr = painter->device() ? painter->device()->devicePixelRatioF() : qApp->devicePixelRatio(); + const QPixmap pixmap = _helper->coloredIcon(icon, option->palette, iconSize, dpr, iconMode, iconState); + drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); } return true;