aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-16 09:46:48 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-16 09:46:48 +0200
commitb936bccd9d0d7f50f37c078b7aad9e75ee9fc981 (patch)
tree8387c8cbce8c4924a71fa34d7df124f8593a0e94
parentBookmarks manager bugfixes (diff)
downloadsmolbote-b936bccd9d0d7f50f37c078b7aad9e75ee9fc981.tar.xz
Add Plasma option to cmake that turns on KF5 blur window effect
-rw-r--r--CMakeLists.txt7
-rw-r--r--linux/makepkg/PKGBUILD3
-rw-r--r--src/CMakeLists.txt10
-rw-r--r--src/mainwindow/mainwindow.cpp10
4 files changed, 29 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb86ce6..a4f64d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,12 +9,19 @@ option(CompilerWarnings "Compiler warnings" ON)
option(QtDeprecatedWarnings "Qt deprecated warnings" ON)
option(UseLibCpp "Use libc++ over stdlibc++ (requires clang)" OFF)
option(Tests "Enable/disable some basic autotests" ON)
+option(Plasma "Enable some fancy effects on Plasma" OFF)
# Libraries
find_package(Qt5 COMPONENTS Core Widgets Concurrent REQUIRED)
find_package(Qt5 5.10.1 COMPONENTS WebEngineWidgets REQUIRED)
find_package(Boost COMPONENTS program_options REQUIRED)
+if(Plasma)
+ find_package(ECM 1.6.0 REQUIRED NO_MODULE)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+ find_package(KF5 "5.6.0" COMPONENTS WindowSystem REQUIRED)
+endif(Plasma)
+
# Global C++ settings
set(CMAKE_CXX_STANDARD 17)
diff --git a/linux/makepkg/PKGBUILD b/linux/makepkg/PKGBUILD
index b088409..d3010f2 100644
--- a/linux/makepkg/PKGBUILD
+++ b/linux/makepkg/PKGBUILD
@@ -68,6 +68,9 @@ build() {
# Flavour, also requires clang
#_cmake_options="$_cmake_options -DUseLibCpp=On"
+ # Flavour: add some KF5 effects
+ _cmake_options="$_cmake_options -DPlasma=On"
+
# Build System
# Flavour: I use ninja, but you can comment this out, or set your own
# flavour. Don't forget to change the Build and Install though!
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0c6876d..cf66a53 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -58,7 +58,15 @@ target_link_libraries(poi
about
addressbar
configuration
- bookmarks downloads web)
+ bookmarks downloads web
+)
+
+if(Plasma)
+ target_link_libraries(poi KF5::WindowSystem)
+ target_compile_definitions(poi
+ PRIVATE PLASMA_BLUR # give the main window a translucent background and blur
+ )
+endif(Plasma)
target_compile_definitions(poi
PRIVATE QTBUG_65223_WORKAROUND
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 6558c65..b2c79cc 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -30,6 +30,10 @@
#include <QJsonArray>
#include "browser.h"
+#ifdef PLASMA_BLUR
+#include <KWindowEffects>
+#endif
+
MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
: QMainWindow(parent)
, mdiArea(new QMdiArea(this))
@@ -37,6 +41,11 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
Q_ASSERT(config);
m_config = config;
+#ifdef PLASMA_BLUR
+ setAttribute(Qt::WA_TranslucentBackground, true);
+ KWindowEffects::enableBlurBehind(this->winId(), true);
+#endif
+
// create UI
setWindowTitle(QString::fromStdString(config->value<std::string>("mainwindow.title").value()));
resize(config->value<int>("mainwindow.width").value(), config->value<int>("mainwindow.height").value());
@@ -55,6 +64,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
addressBar = new AddressBar(config->section("addressbar"), this);
navigationToolBar->addWidget(addressBar);
+ mdiArea->setBackground(Qt::NoBrush);
setCentralWidget(mdiArea);
mdiArea->setFocus();