Skip to content

Commit

Permalink
Merge pull request #47 from Bali10050/feature-qt6
Browse files Browse the repository at this point in the history
Feature qt6
  • Loading branch information
Bali10050 authored Nov 16, 2024
2 parents 94448c1 + 64fa9a4 commit a455a2d
Show file tree
Hide file tree
Showing 22 changed files with 931 additions and 201 deletions.
2 changes: 1 addition & 1 deletion kdecoration/lightlysizegrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ namespace Lightly
}

//_____________________________________________
void SizeGrip::sendMoveResizeEvent( QPoint position )
void SizeGrip::sendMoveResizeEvent( QPoint /*position*/ )
{

#if LIGHTLY_HAVE_X11
Expand Down
1 change: 1 addition & 0 deletions kstyle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ set(lightly_PART_SRCS
lightlystyleplugin.cpp
lightlytileset.cpp
lightlywindowmanager.cpp
lightlytoolsareamanager.cpp
)

kconfig_add_kcfg_files(lightly_PART_SRCS ../kdecoration/lightlysettings.kcfgc)
Expand Down
2 changes: 1 addition & 1 deletion kstyle/animations/lightlydialdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace Lightly
QHoverEvent *hoverEvent = static_cast<QHoverEvent*>(event);

// store position
_position = hoverEvent->pos();
_position = hoverEvent->position().toPoint();

// trigger animation if position match handle rect
updateState( _handleRect.contains( _position ) );
Expand Down
4 changes: 2 additions & 2 deletions kstyle/animations/lightlyscrollbardata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ namespace Lightly

// cast event
QHoverEvent *hoverEvent = static_cast<QHoverEvent*>(event);
QStyle::SubControl hoverControl = scrollBar->style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, hoverEvent->pos(), scrollBar);
QStyle::SubControl hoverControl = scrollBar->style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, hoverEvent->position().toPoint(), scrollBar);

// update hover state
updateAddLineArrow( hoverControl );
updateSubLineArrow( hoverControl );

// store position
_position = hoverEvent->pos();
_position = hoverEvent->position().toPoint();

}

Expand Down
4 changes: 2 additions & 2 deletions kstyle/animations/lightlytransitionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace Lightly
widgets.append( parent );

// stop at topLevel
if( parent->isTopLevel() || parent->autoFillBackground() ) break;
if( parent->isWindow() || parent->autoFillBackground() ) break;

}

Expand All @@ -241,7 +241,7 @@ namespace Lightly

}

if( parent->isTopLevel() && parent->testAttribute(Qt::WA_StyledBackground))
if( parent->isWindow() && parent->testAttribute(Qt::WA_StyledBackground))
{
QStyleOption option;
option.initFrom(parent);
Expand Down
17 changes: 15 additions & 2 deletions kstyle/config/lightlystyleconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ namespace Lightly
connect( _sidebarOpacity, &QAbstractSlider::valueChanged, this, &StyleConfig::updateChanged );
connect(_sidebarOpacity, SIGNAL(valueChanged(int)), _sidebarOpacitySpinBox, SLOT(setValue(int)));
connect(_sidebarOpacitySpinBox, SIGNAL(valueChanged(int)), _sidebarOpacity, SLOT(setValue(int)));

connect(_menuBarOpacity, &QAbstractSlider::valueChanged, this, &StyleConfig::updateChanged);
connect(_menuBarOpacity, SIGNAL(valueChanged(int)), _menuBarOpacitySpinBox, SLOT(setValue(int)));
connect(_menuBarOpacitySpinBox, SIGNAL(valueChanged(int)), _menuBarOpacity, SLOT(setValue(int)));

connect( _kTextEditDrawFrame, &QAbstractButton::toggled, this, &StyleConfig::updateChanged );
connect( _widgetDrawShadow, &QAbstractButton::toggled, this, &StyleConfig::updateChanged );
connect( _oldTabbar, &QAbstractButton::toggled, this, &StyleConfig::updateChanged );
Expand Down Expand Up @@ -96,6 +101,7 @@ namespace Lightly
StyleConfigData::setWindowDragMode( _windowDragMode->currentIndex() );
StyleConfigData::setMenuOpacity( _menuOpacity->value() );
StyleConfigData::setDolphinSidebarOpacity( _sidebarOpacity->value() );
StyleConfigData::setMenuBarOpacity(_menuBarOpacity->value());
StyleConfigData::setButtonSize( _buttonSize->value() );
StyleConfigData::setKTextEditDrawFrame( _kTextEditDrawFrame->isChecked() );
StyleConfigData::setWidgetDrawShadow( _widgetDrawShadow->isChecked() );
Expand Down Expand Up @@ -158,8 +164,11 @@ namespace Lightly
else if( _sidebarOpacity->value() != StyleConfigData::dolphinSidebarOpacity() ) {
modified = true;
_sidebarOpacitySpinBox->setValue( _sidebarOpacity->value() );
}
else if( _kTextEditDrawFrame->isChecked() != StyleConfigData::kTextEditDrawFrame() ) modified = true;
} else if (_menuBarOpacity->value() != StyleConfigData::menuBarOpacity()) {
modified = true;
_menuBarOpacitySpinBox->setValue(_menuBarOpacity->value());
} else if (_kTextEditDrawFrame->isChecked() != StyleConfigData::kTextEditDrawFrame())
modified = true;
else if( _widgetDrawShadow->isChecked() != StyleConfigData::widgetDrawShadow() ) modified = true;
else if( _oldTabbar->isChecked() != StyleConfigData::oldTabbar() ) modified = true;
else if( _tabBarAltStyle->isChecked() != StyleConfigData::tabBarAltStyle() ) modified = true;
Expand Down Expand Up @@ -194,6 +203,10 @@ namespace Lightly
_menuOpacitySpinBox->setValue( StyleConfigData::menuOpacity() );
_sidebarOpacity->setValue( StyleConfigData::dolphinSidebarOpacity() );
_sidebarOpacitySpinBox->setValue( StyleConfigData::dolphinSidebarOpacity() );

_menuBarOpacity->setValue(StyleConfigData::menuBarOpacity());
_menuBarOpacitySpinBox->setValue(StyleConfigData::menuBarOpacity());

_buttonSize->setValue( StyleConfigData::buttonSize() );
_kTextEditDrawFrame->setChecked( StyleConfigData::kTextEditDrawFrame() );
_widgetDrawShadow->setChecked( StyleConfigData::widgetDrawShadow() );
Expand Down
51 changes: 50 additions & 1 deletion kstyle/config/ui/lightlystyleconfig.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>772</width>
<height>521</height>
<height>534</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -696,6 +696,9 @@
</item>
<item>
<widget class="QSlider" name="_menuOpacity">
<property name="toolTip">
<string>This changes the menu items transparency</string>
</property>
<property name="minimum">
<number>0</number>
</property>
Expand Down Expand Up @@ -751,6 +754,9 @@
</item>
<item>
<widget class="QSlider" name="_sidebarOpacity">
<property name="toolTip">
<string>This changes the Dolphin sidebar transparency</string>
</property>
<property name="maximum">
<number>100</number>
</property>
Expand Down Expand Up @@ -795,6 +801,49 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Menubar:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="_menuBarOpacity">
<property name="toolTip">
<string>This only works on color schemes which support transparency</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_menuBarOpacitySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
Expand Down
15 changes: 8 additions & 7 deletions kstyle/lightly.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ namespace Lightly
//@}

//* metrics
enum Metrics
{
enum Metrics {

// frames
Frame_FrameWidth = 5,
//Frame_FrameRadius = 6,
// Frame_FrameRadius = 6,

// layout
Layout_TopLevelMarginWidth = 10,
Expand All @@ -56,12 +55,13 @@ namespace Lightly
LineEdit_FrameWidth = 5 + Frame_FrameWidth,

// menu items
//Menu_FrameWidth = 4,
Menu_FrameWidth = 4,
MenuItem_MarginWidth = 5,
MenuItem_MarginHeight = 3,
MenuItem_ItemSpacing = 4,
MenuItem_AcceleratorSpace = 16,
MenuButton_IndicatorWidth = 20,
MenuItem_HighlightGap = 4,

// combobox
ComboBox_FrameWidth = 5 + Frame_FrameWidth,
Expand All @@ -84,7 +84,7 @@ namespace Lightly
ToolButton_InlineIndicatorWidth = 12,

// checkboxes and radio buttons
CheckBox_Size = 16 + ( Frame_FrameWidth - 1 )*2,
CheckBox_Size = 16 + (Frame_FrameWidth - 1) * 2,
CheckBox_FocusMarginWidth = 2,
CheckBox_ItemSpacing = 4,

Expand All @@ -96,9 +96,9 @@ namespace Lightly
ScrollBar_Extend = 21,
ScrollBar_SliderWidth = 8,
ScrollBar_MinSliderHeight = 20,
ScrollBar_NoButtonHeight = (ScrollBar_Extend-ScrollBar_SliderWidth)/2,
ScrollBar_NoButtonHeight = (ScrollBar_Extend - ScrollBar_SliderWidth) / 2,
ScrollBar_SingleButtonHeight = ScrollBar_Extend,
ScrollBar_DoubleButtonHeight = 2*ScrollBar_Extend,
ScrollBar_DoubleButtonHeight = 2 * ScrollBar_Extend,

// toolbars
ToolBar_FrameWidth = 2,
Expand All @@ -107,6 +107,7 @@ namespace Lightly
ToolBar_SeparatorWidth = 8,
ToolBar_ExtensionWidth = 20,
ToolBar_ItemSpacing = 0,
ToolBar_SeparatorVerticalMargin = 2,

// progressbars
ProgressBar_BusyIndicatorSize = 14,
Expand Down
6 changes: 5 additions & 1 deletion kstyle/lightly.kcfg
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
</entry>

<entry name="ForceOpaque" type="StringList">
<default>kscreenlocker,wine,vlc,kdevelop,smplayer,virtualbox,virtualboxvm,obs,kaffeine,kate,kstars,digikam,kdenlive</default>
<default>kscreenlocker,wine,vlc,kdevelop,smplayer,virtualbox,virtualboxvm,obs,kaffeine,kstars,digikam,kdenlive</default>
</entry>

<!-- if true, move events are passed to the window manager (e.g. KWin) -->
Expand Down Expand Up @@ -250,6 +250,10 @@
<default>100</default>
</entry>

<entry name="MenuBarOpacity" type="Int">
<default>100</default>
</entry>

</group>

</kcfg>
2 changes: 1 addition & 1 deletion kstyle/lightlyframeshadow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace Lightly

// make sure that the widget is not embedded into a KHTMLView
QWidget* parent( widget->parentWidget() );
while( parent && !parent->isTopLevel() )
while( parent && !parent->isWindow() )
{
if( parent->inherits( "KHTMLView" ) ) return false;
parent = parent->parentWidget();
Expand Down
52 changes: 46 additions & 6 deletions kstyle/lightlyhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <QX11Info>
#endif

#include <QDialog>
#include <algorithm>

//#include <QDebug>
Expand All @@ -53,7 +54,7 @@ namespace Lightly
{

if ( qApp ) {
connect(qApp, &QApplication::paletteChanged, this, [=]() {
connect(qApp, &QApplication::paletteChanged, this, [this]() {
if (qApp->property("KDE_COLOR_SCHEME_PATH").isValid()) {
const auto path = qApp->property("KDE_COLOR_SCHEME_PATH").toString();
KConfig config(path, KConfig::SimpleConfig);
Expand Down Expand Up @@ -939,7 +940,7 @@ namespace Lightly
//renderBoxShadow( painter, frameRect, 0, 1, 6, alphaColor(outline.darker(120), opacity) , radius, windowActive );
//renderBoxShadow( painter, frameRect, 0, 1, 4, alphaColor(outline.darker(120), opacity) , radius, windowActive );

const qreal finalRadius ((frameRect.width()+Metrics::Frame_FrameWidth)*opacity);
const qreal finalRadius ((frameRect.width() + static_cast<qreal>(Metrics::Frame_FrameWidth)) * opacity);

QPixmap mask = QPixmap(rect.width(), rect.height());
mask.fill( Qt::transparent );
Expand Down Expand Up @@ -993,7 +994,7 @@ namespace Lightly
// focus out animation
if( mode == 2 && opacity > 0 && opacity < 1) {

const qreal finalRadius ((frameRect.width()+Metrics::Frame_FrameWidth)*opacity);
const qreal finalRadius ((frameRect.width() + static_cast<qreal>(Metrics::Frame_FrameWidth)) * opacity);

QPixmap mask = QPixmap(rect.width(), rect.height());
mask.fill( Qt::transparent );
Expand Down Expand Up @@ -1370,7 +1371,7 @@ namespace Lightly
painter->setRenderHint( QPainter::Antialiasing, true );

const QRectF baseRect( rect );
const qreal radius( 0.5*Metrics::Slider_GrooveThickness );
const qreal radius(0.5 * static_cast<qreal>(Metrics::Slider_GrooveThickness));

// content
if( color.isValid() )
Expand Down Expand Up @@ -1523,7 +1524,7 @@ namespace Lightly

int thickness = Metrics::ProgressBar_Thickness;
if( !isContent ) thickness = qMax(Metrics::ProgressBar_Thickness-2, 0);
const qreal radius( 0.5*Metrics::ProgressBar_Thickness);
const qreal radius(0.5 * static_cast<qreal>(Metrics::ProgressBar_Thickness));

// content
if( color.isValid() )
Expand Down Expand Up @@ -1552,7 +1553,7 @@ namespace Lightly
painter->setRenderHint( QPainter::Antialiasing, true );

const QRectF baseRect( rect );
const qreal radius( 0.5*Metrics::ProgressBar_Thickness );
const qreal radius(0.5 * static_cast<qreal>(Metrics::ProgressBar_Thickness));

// setup brush
QPixmap pixmap( horizontal ? 2*Metrics::ProgressBar_BusyIndicatorSize : 1, horizontal ? 1:2*Metrics::ProgressBar_BusyIndicatorSize );
Expand Down Expand Up @@ -1938,4 +1939,43 @@ namespace Lightly
}
return pixmap;
}

bool Helper::shouldDrawToolsArea(const QWidget *widget) const
{
if (!widget) {
return false;
}
static bool isAuto = false;
static QString borderSize;
if (!_cachedAutoValid) {
KConfigGroup kdecorationGroup(_config->group(QStringLiteral("org.kde.kdecoration2")));
isAuto = kdecorationGroup.readEntry("BorderSizeAuto", true);
borderSize = kdecorationGroup.readEntry("BorderSize", "Normal");
_cachedAutoValid = true;
}
if (isAuto) {
auto window = widget->window();
if (qobject_cast<const QDialog *>(widget)) {
return true;
}
if (window) {
auto handle = window->windowHandle();
if (handle) {
auto toolbar = qobject_cast<const QToolBar *>(widget);
if (toolbar) {
if (toolbar->isFloating()) {
return false;
}
}
return true;
}
} else {
return false;
}
}
if (borderSize != "None" && borderSize != "NoSides") {
return false;
}
return true;
}
}
Loading

0 comments on commit a455a2d

Please sign in to comment.