Skip to content

Commit

Permalink
Upgraded to 6.0 (for Plasma 6)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujan committed Mar 17, 2024
1 parent add552e commit b3de585
Show file tree
Hide file tree
Showing 31 changed files with 299 additions and 285 deletions.
76 changes: 43 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(breezeenhanced)
set(PROJECT_VERSION "5.27.0")
set(PROJECT_VERSION_MAJOR 5)
set(PROJECT_VERSION "6.0.0")
set(PROJECT_VERSION_MAJOR 6)

include(WriteBasicConfigVersionFile)
include(FeatureSummary)
set(QT_MIN_VERSION "6.6.0")
set(KF6_MIN_VERSION "6.0.0")

find_package(ECM 0.0.9 REQUIRED NO_MODULE)
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(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.102.0")

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

find_package(KDecoration2 REQUIRED)

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"
)

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


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

################# includes #################
add_subdirectory(libbreezecommon)
Expand All @@ -41,50 +46,55 @@ add_subdirectory(libbreezecommon)
set(breezeenhanced_SRCS
breezebutton.cpp
breezedecoration.cpp
breezeexceptionlist.cpp
breezesettingsprovider.cpp)

kconfig_add_kcfg_files(breezeenhanced_SRCS breezesettings.kcfgc)

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

set(breezeenhanced_config_PART_FORMS
ki18n_wrap_ui(breezeenhanced_config_SRCS
config/ui/breezeconfigurationui.ui
config/ui/breezeexceptiondialog.ui
config/ui/breezeexceptionlistwidget.ui
)

ki18n_wrap_ui(breezeenhanced_config_PART_FORMS_HEADERS ${breezeenhanced_config_PART_FORMS})
add_library(breezeenhanced_STATIC STATIC ${breezeenhanced_config_SRCS})
# Needed to link this static lib to shared libs
set_property(TARGET breezeenhanced_STATIC PROPERTY POSITION_INDEPENDENT_CODE ON)
kconfig_add_kcfg_files(breezeenhanced_STATIC breezesettings.kcfgc)
target_link_libraries(breezeenhanced_STATIC
PUBLIC
Qt6::Core
Qt6::Gui
Qt6::Widgets
Qt6::DBus
KDecoration2::KDecoration
PRIVATE
KF6::I18n
KF6::WindowSystem
KF6::KCMUtils
)

### build library
add_library(breezeenhanced MODULE
${breezeenhanced_SRCS}
${breezeenhanced_config_SRCS}
${breezeenhanced_config_PART_FORMS_HEADERS})

target_link_libraries(breezeenhanced
PUBLIC
Qt::Core
Qt::Gui
Qt::DBus
PRIVATE
breezeenhancedcommon5
KDecoration2::KDecoration
KF5::ConfigCore
KF5::CoreAddons
KF5::ConfigWidgets
KF5::GuiAddons
KF5::I18n
KF5::WindowSystem)

install(TARGETS breezeenhanced DESTINATION ${KDE_INSTALL_PLUGINDIR}/org.kde.kdecoration2)
install(FILES config/breezeenhancedconfig.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR})
breezeenhancedcommon6
breezeenhanced_STATIC
KF6::GuiAddons
KF6::I18n
KF6::WindowSystem
KF6::KCMUtils)


install(TARGETS breezeenhanced DESTINATION ${KDE_INSTALL_PLUGINDIR}/${KDECORATION_PLUGIN_DIR})

add_subdirectory(config)
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
V6.0
---------
* Bumped the version to 6.0 and imported some changes from Breeze 6.0.2.

V5.27
---------
* Bumped the version to 5.27 and imported useful changes from breeze-5.27.2.
Expand Down
4 changes: 0 additions & 4 deletions Messages.sh

This file was deleted.

2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Latest version:

24 Mar 2023, V5.27
17 Mar 2024, V6.0

See "ChangeLog" for changes.
8 changes: 3 additions & 5 deletions breeze.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ifndef breeze_h
#define breeze_h

/*
* Copyright 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
*
Expand All @@ -21,10 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "breezesettings.h"

#include <QSharedPointer>
#include <QList>
#include <QSharedPointer>

namespace Breeze
{
Expand Down Expand Up @@ -70,4 +69,3 @@ namespace Breeze
};
}

#endif
7 changes: 1 addition & 6 deletions breeze.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
"KPlugin": {
"Description": "Window decoration using the Breeze visual style for the Plasma Desktop",
"EnabledByDefault": true,
"Id": "org.kde.breezeenhanced",
"Name": "BreezeEnhanced",
"ServiceTypes": [
"org.kde.kdecoration2"
]
},
"X-KDE-ConfigModule": "kcm_breezeenhanced",
"org.kde.kdecoration2": {
"blur": true,
"defaultTheme": "BreezeEnhanced",
"kcmodule": true,
"recommendedBorderSize": "None"
}
}
45 changes: 22 additions & 23 deletions breezebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@
*/
#include "breezebutton.h"

#include <KDecoration2/DecoratedClient>
#include <KColorUtils>
#include <KDecoration2/DecoratedClient>
//#include <KIconLoader>

#include <QPainter>
#include <QVariantAnimation>
#include <QPainterPath>
#include <QVariantAnimation>

namespace Breeze
{

using KDecoration2::ColorRole;
using KDecoration2::ColorGroup;
using KDecoration2::ColorRole;
using KDecoration2::DecorationButtonType;


Expand All @@ -58,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 );

reconfigure();
Expand All @@ -82,37 +81,37 @@ namespace Breeze
if (auto d = qobject_cast<Decoration*>(decoration))
{
Button *b = new Button(type, d, parent);
const auto c = d->client().toStrongRef();
const auto c = d->client();
switch( type )
{

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

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

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

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

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

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

default: break;
Expand Down Expand Up @@ -146,7 +145,7 @@ namespace Breeze
{

const QRectF iconRect( geometry().topLeft(), m_iconSize );
const auto c = decoration()->client().toStrongRef();
const auto c = decoration()->client();
/*if (auto deco = qobject_cast<Decoration*>(decoration())) {
const QPalette activePalette = KIconLoader::global()->customPalette();
QPalette palette = c->palette();
Expand Down Expand Up @@ -182,7 +181,7 @@ namespace Breeze
/*
scale painter so that its window matches QRect( -1, -1, 20, 20 )
this makes all further rendering and scaling simpler
all further rendering is preformed inside QRect( 0, 0, 18, 18 )
all further rendering is performed inside QRect( 0, 0, 18, 18 )
*/
painter->translate( geometry().topLeft() );

Expand All @@ -194,7 +193,7 @@ namespace Breeze
const QColor backgroundColor( this->backgroundColor() );

auto d = qobject_cast<Decoration*>( decoration() );
bool isInactive(d && !d->client().toStrongRef().data()->isActive()
bool isInactive(d && !d->client()->isActive()
&& !isHovered() && !isPressed()
&& m_animation->state() != QAbstractAnimation::Running);
QColor inactiveCol(Qt::gray);
Expand Down Expand Up @@ -807,7 +806,7 @@ namespace Breeze
auto d = qobject_cast<Decoration*>( decoration() );
if(!d || d->internalSettings()->macOSButtons()) {
QColor col;
if (d && !d->client().toStrongRef()->isActive()
if (d && !d->client()->isActive()
&& !isHovered() && !isPressed()
&& m_animation->state() != QAbstractAnimation::Running)
{
Expand Down Expand Up @@ -1001,7 +1000,7 @@ namespace Breeze
}
}
else {
auto c = d->client().toStrongRef();
auto c = d->client();
if( isPressed() ) {

if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground );
Expand Down
9 changes: 4 additions & 5 deletions breezebutton.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ifndef BREEZE_BUTTONS_H
#define BREEZE_BUTTONS_H

/*
* Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
* Copyright 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
Expand All @@ -21,8 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <KDecoration2/DecorationButton>

#pragma once

#include "breezedecoration.h"
#include <KDecoration2/DecorationButton>

#include <QHash>
#include <QImage>
Expand Down Expand Up @@ -135,4 +135,3 @@ namespace Breeze

} // namespace

#endif
Loading

0 comments on commit b3de585

Please sign in to comment.