Skip to content

Commit

Permalink
Merge pull request #130 from chiyuki0325/master
Browse files Browse the repository at this point in the history
Port to Plasma 6
  • Loading branch information
kupiqu authored Mar 28, 2024
2 parents c81306b + 007d7b9 commit 256238a
Show file tree
Hide file tree
Showing 18 changed files with 414 additions and 564 deletions.
151 changes: 82 additions & 69 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

project(sierrabreezeenhanced)
set(PROJECT_VERSION "1.3.3")
set(PROJECT_VERSION_MAJOR 0)
Expand All @@ -8,118 +7,132 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
include(WriteBasicConfigVersionFile)
include(FeatureSummary)

find_package(ECM 0.0.9 REQUIRED NO_MODULE)
set(QT_MAJOR_VERSION 6)
set(QT_MIN_VERSION "6.6.0")
set(KF6_MIN_VERSION "6.0.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.82")

find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}
${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDEInstallDirs6)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(GenerateExportHeader)
include(KDEClangFormat)
# include(GtkUpdateIconCache)

find_package(KDecoration2 REQUIRED)

if(NOT WIN32 AND NOT APPLE)
find_package(KF6KCMUtils ${KF6_MIN_VERSION})
set_package_properties(
KF6KCMUtils PROPERTIES
TYPE REQUIRED
DESCRIPTION "Helps create configuration modules"
PURPOSE
"KCMUtils used for the configuration modules or the decoration and Qt Style"
)
endif()

# old stuff
add_definitions(-DTRANSLATION_DOMAIN="breeze_kwin_deco")

find_package(KF5 REQUIRED COMPONENTS CoreAddons GuiAddons ConfigWidgets WindowSystem I18n IconThemes)
find_package(Qt5 CONFIG REQUIRED COMPONENTS DBus)
find_package(
KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS IconThemes CoreAddons GuiAddons
ConfigWidgets WindowSystem I18n)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED
COMPONENTS Widgets DBus)
find_package(Qt6 REQUIRED COMPONENTS Core5Compat)

### XCB
# XCB
find_package(XCB COMPONENTS XCB)
set_package_properties(XCB PROPERTIES
set_package_properties(
XCB PROPERTIES
DESCRIPTION "X protocol C-language Binding"
URL "https://xcb.freedesktop.org/"
TYPE OPTIONAL
PURPOSE "Required to pass style properties to native Windows on X11 Platform"
)
PURPOSE "Required to pass style properties to native Windows on X11 Platform")

if(UNIX AND NOT APPLE)

set(BREEZE_HAVE_X11 ${XCB_XCB_FOUND})
if (XCB_XCB_FOUND)
find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras)
endif()

else()

set(BREEZE_HAVE_X11 FALSE)

endif()

################# configuration #################
configure_file(config-breeze.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-breeze.h )
# ################ configuration #################
configure_file(config-breeze.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-breeze.h)

################# includes #################
# ################ includes #################
add_subdirectory(libbreezecommon)

################# newt target #################
### plugin classes
# ################ newt target #################
# plugin classes
set(sierrabreezeenhanced_SRCS
breezebutton.cpp
breezedecoration.cpp
breezeexceptionlist.cpp
breezesettingsprovider.cpp
breezesizegrip.cpp)
breezebutton.cpp breezedecoration.cpp breezeexceptionlist.cpp
breezesettingsprovider.cpp breezesizegrip.cpp)

kconfig_add_kcfg_files(sierrabreezeenhanced_SRCS breezesettings.kcfgc)

### config classes
### they are kept separately because they might move in a separate library in the future
# config classes they are kept separately because they might move in a separate
# library in the future
set(sierrabreezeenhanced_config_SRCS
config/breezeconfigwidget.cpp
config/breezedetectwidget.cpp
config/breezeexceptiondialog.cpp
config/breezeexceptionlistwidget.cpp
config/breezeexceptionmodel.cpp
config/breezeitemmodel.cpp
)
config/breezeconfigwidget.cpp config/breezedetectwidget.cpp
config/breezeexceptiondialog.cpp config/breezeexceptionlistwidget.cpp
config/breezeexceptionmodel.cpp config/breezeitemmodel.cpp)

set(sierrabreezeenhanced_config_PART_FORMS
config/ui/breezeconfigurationui.ui
config/ui/breezedetectwidget.ui
config/ui/breezeexceptiondialog.ui
config/ui/breezeexceptionlistwidget.ui
)

ki18n_wrap_ui(sierrabreezeenhanced_config_PART_FORMS_HEADERS ${sierrabreezeenhanced_config_PART_FORMS})

### build library
add_library(sierrabreezeenhanced MODULE
${sierrabreezeenhanced_SRCS}
${sierrabreezeenhanced_config_SRCS}
${sierrabreezeenhanced_config_PART_FORMS_HEADERS})

target_link_libraries(sierrabreezeenhanced
PUBLIC
Qt5::Core
Qt5::Gui
Qt5::DBus
PRIVATE
sierrabreezeenhancedcommon5
KDecoration2::KDecoration
KF5::ConfigCore
KF5::CoreAddons
KF5::ConfigWidgets
KF5::GuiAddons
KF5::I18n
KF5::IconThemes
KF5::WindowSystem)
config/ui/breezeconfigurationui.ui
config/ui/breezeexceptiondialog.ui config/ui/breezeexceptionlistwidget.ui)

ki18n_wrap_ui(sierrabreezeenhanced_config_PART_FORMS_HEADERS
${sierrabreezeenhanced_config_PART_FORMS})

# build library
add_library(
sierrabreezeenhanced MODULE
${sierrabreezeenhanced_SRCS} ${sierrabreezeenhanced_config_SRCS}
${sierrabreezeenhanced_config_PART_FORMS_HEADERS})

target_link_libraries(
sierrabreezeenhanced
PUBLIC Qt6::Core Qt6::Gui Qt6::DBus Qt6::Core5Compat
PRIVATE sierrabreezeenhancedcommon6
KDecoration2::KDecoration
KF6::IconThemes
KF6::ConfigCore
KF6::CoreAddons
KF6::ConfigWidgets
KF6::GuiAddons
KF6::I18n
KF6::KCMUtils
KF6::WindowSystem)

if(BREEZE_HAVE_X11)
target_link_libraries(sierrabreezeenhanced
PUBLIC
Qt5::X11Extras
XCB::XCB)
target_link_libraries(sierrabreezeenhanced PUBLIC Qt6::GuiPrivate XCB::XCB)
endif()

install(TARGETS sierrabreezeenhanced
DESTINATION ${KDE_INSTALL_PLUGINDIR}/${KDECORATION_PLUGIN_DIR})
# install(FILES config/sierrabreezeenhancedconfig.desktop DESTINATION
# ${SERVICES_INSTALL_DIR})
kcmutils_generate_desktop_file(sierrabreezeenhanced)

# install(TARGETS breezedecoration DESTINATION
# ${PLUGIN_INSTALL_DIR}/org.kde.kdecoration2) install(FILES
# config/breezedecorationconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR})

install(TARGETS sierrabreezeenhanced DESTINATION ${PLUGIN_INSTALL_DIR}/org.kde.kdecoration2)
install(FILES config/sierrabreezeenhancedconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR})
# install(TARGETS breezedecoration DESTINATION ${PLUGIN_INSTALL_DIR}/org.kde.kdecoration2)
# install(FILES config/breezedecorationconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR})
add_subdirectory(config)
48 changes: 24 additions & 24 deletions breezebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ namespace Breeze
setIconSize(QSize( height, height ));

// connections
connect(decoration->client().toStrongRef().data(), SIGNAL(iconChanged(QIcon)), this, SLOT(update()));
connect(decoration->settings().data(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure);
connect(decoration->client(), SIGNAL(iconChanged(QIcon)), this, SLOT(update()));
connect(decoration->settings().get(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure);
connect( this, &KDecoration2::DecorationButton::hoveredChanged, this, &Button::updateAnimationState );

if (decoration->objectName() == "applet-window-buttons") {
Expand Down Expand Up @@ -92,32 +92,32 @@ namespace Breeze
{

case DecorationButtonType::Close:
b->setVisible( d->client().toStrongRef().data()->isCloseable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client()->isCloseable() );
QObject::connect(d->client(), &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Maximize:
b->setVisible( d->client().toStrongRef().data()->isMaximizeable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client()->isMaximizeable() );
QObject::connect(d->client(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Minimize:
b->setVisible( d->client().toStrongRef().data()->isMinimizeable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client()->isMinimizeable() );
QObject::connect(d->client(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::ContextHelp:
b->setVisible( d->client().toStrongRef().data()->providesContextHelp() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client()->providesContextHelp() );
QObject::connect(d->client(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Shade:
b->setVisible( d->client().toStrongRef().data()->isShadeable() );
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible );
b->setVisible( d->client()->isShadeable() );
QObject::connect(d->client(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible );
break;

case DecorationButtonType::Menu:
QObject::connect(d->client().toStrongRef().data(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); });
QObject::connect(d->client(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); });
break;

default: break;
Expand Down Expand Up @@ -154,17 +154,17 @@ namespace Breeze
painter->translate( 0.1*width, 0.1*width );
if (auto deco = qobject_cast<Decoration*>(decoration())) {
const QPalette activePalette = KIconLoader::global()->customPalette();
QPalette palette = decoration()->client().toStrongRef().data()->palette();
palette.setColor(QPalette::Foreground, deco->fontColor());
QPalette palette = decoration()->client()->palette();
palette.setColor(QPalette::WindowText, deco->fontColor());
KIconLoader::global()->setCustomPalette(palette);
decoration()->client().toStrongRef().data()->icon().paint(painter, iconRect.toRect());
decoration()->client()->icon().paint(painter, iconRect.toRect());
if (activePalette == QPalette()) {
KIconLoader::global()->resetPalette();
} else {
KIconLoader::global()->setCustomPalette(palette);
}
} else {
decoration()->client().toStrongRef().data()->icon().paint(painter, iconRect.toRect());
decoration()->client()->icon().paint(painter, iconRect.toRect());
}

} else {
Expand Down Expand Up @@ -656,7 +656,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool inactiveWindow( d && !d->client()->isActive() );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );

QColor darkSymbolColor( ( inactiveWindow && isMatchTitleBarColor ) ? QColor(81, 102, 107) : QColor(34, 45, 50) );
Expand Down Expand Up @@ -1065,7 +1065,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool inactiveWindow( d && !d->client()->isActive() );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );

QColor darkSymbolColor( ( inactiveWindow && isMatchTitleBarColor ) ? QColor(81, 102, 107) : QColor(34, 45, 50) );
Expand Down Expand Up @@ -1492,7 +1492,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool inactiveWindow( d && !d->client()->isActive() );
bool useActiveButtonStyle( d && d->internalSettings()->buttonStyle() == 5 );
bool useInactiveButtonStyle( d && d->internalSettings()->buttonStyle() == 6 );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );
Expand Down Expand Up @@ -1989,7 +1989,7 @@ namespace Breeze
painter->translate( 4, 4 );
}

bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool inactiveWindow( d && !d->client()->isActive() );
bool useActiveButtonStyle( d && d->internalSettings()->buttonStyle() == 8 );
bool useInactiveButtonStyle( d && d->internalSettings()->buttonStyle() == 9 );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );
Expand Down Expand Up @@ -2497,7 +2497,7 @@ namespace Breeze

auto d = qobject_cast<Decoration*>( decoration() );

bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool inactiveWindow( d && !d->client()->isActive() );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );

QColor darkSymbolColor( ( inactiveWindow && isMatchTitleBarColor ) ? QColor(81, 102, 107) : QColor(34, 45, 50) );
Expand Down Expand Up @@ -2832,7 +2832,7 @@ namespace Breeze

auto d = qobject_cast<Decoration*>( decoration() );

bool inactiveWindow( d && !d->client().toStrongRef().data()->isActive() );
bool inactiveWindow( d && !d->client()->isActive() );
bool isMatchTitleBarColor( d && d->internalSettings()->matchColorForTitleBar() );

QColor darkSymbolColor( ( inactiveWindow && isMatchTitleBarColor ) ? QColor(81, 102, 107) : QColor(34, 45, 50) );
Expand Down Expand Up @@ -3943,7 +3943,7 @@ namespace Breeze

}

auto c = d->client().toStrongRef().data();
auto c = d->client();
if( isPressed() ) {

if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground );
Expand Down
Loading

0 comments on commit 256238a

Please sign in to comment.