Commit c281bf82 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Apply full screen color scheme also to window decoration

Makes use of the KDE_COLOR_SCHEME_PATH property that has KWin apply a given color scheme to the decoration.
Ensures there's no ugly white borders on the otherwise dark confirmation dialogs.

Differential Revision: https://phabricator.kde.org/D7994
parent daf56207
...@@ -64,6 +64,7 @@ struct GvCorePrivate ...@@ -64,6 +64,7 @@ struct GvCorePrivate
HistoryModel* mRecentFoldersModel; HistoryModel* mRecentFoldersModel;
RecentFilesModel* mRecentFilesModel; RecentFilesModel* mRecentFilesModel;
QPalette mPalettes[4]; QPalette mPalettes[4];
QString mFullScreenPaletteName;
bool showSaveAsDialog(const QUrl &url, QUrl* outUrl, QByteArray* format) bool showSaveAsDialog(const QUrl &url, QUrl* outUrl, QByteArray* format)
{ {
...@@ -128,14 +129,16 @@ struct GvCorePrivate ...@@ -128,14 +129,16 @@ struct GvCorePrivate
QString name = GwenviewConfig::fullScreenColorScheme(); QString name = GwenviewConfig::fullScreenColorScheme();
if (name.isEmpty()) { if (name.isEmpty()) {
// Default color scheme // Default color scheme
QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, "color-schemes/fullscreen.colors"); mFullScreenPaletteName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "color-schemes/fullscreen.colors");
config = KSharedConfig::openConfig(path); config = KSharedConfig::openConfig(mFullScreenPaletteName);
} else if (name.contains('/')) { } else if (name.contains('/')) {
// Full path to a .colors file // Full path to a .colors file
config = KSharedConfig::openConfig(name); mFullScreenPaletteName = name;
config = KSharedConfig::openConfig(mFullScreenPaletteName);
} else { } else {
// Standard KDE color scheme // Standard KDE color scheme
config = KSharedConfig::openConfig(QString("color-schemes/%1.colors").arg(name), KConfig::FullConfig, QStandardPaths::AppDataLocation); mFullScreenPaletteName = QString("color-schemes/%1.colors").arg(name);
config = KSharedConfig::openConfig(mFullScreenPaletteName, KConfig::FullConfig, QStandardPaths::AppDataLocation);
} }
mPalettes[GvCore::FullScreenPalette] = KColorScheme::createApplicationPalette(config); mPalettes[GvCore::FullScreenPalette] = KColorScheme::createApplicationPalette(config);
...@@ -375,4 +378,9 @@ QPalette GvCore::palette(GvCore::PaletteType type) const ...@@ -375,4 +378,9 @@ QPalette GvCore::palette(GvCore::PaletteType type) const
return d->mPalettes[type]; return d->mPalettes[type];
} }
QString GvCore::fullScreenPaletteName() const
{
return d->mFullScreenPaletteName;
}
} // namespace } // namespace
...@@ -33,6 +33,7 @@ class QUrl; ...@@ -33,6 +33,7 @@ class QUrl;
class QAbstractItemModel; class QAbstractItemModel;
class QPalette; class QPalette;
class QString;
namespace Gwenview namespace Gwenview
{ {
...@@ -65,6 +66,7 @@ public: ...@@ -65,6 +66,7 @@ public:
void addUrlToRecentFiles(const QUrl &); void addUrlToRecentFiles(const QUrl &);
QPalette palette(PaletteType type) const; QPalette palette(PaletteType type) const;
QString fullScreenPaletteName() const;
public Q_SLOTS: public Q_SLOTS:
void saveAll(); void saveAll();
......
...@@ -1278,7 +1278,9 @@ void MainWindow::toggleFullScreen(bool checked) ...@@ -1278,7 +1278,9 @@ void MainWindow::toggleFullScreen(bool checked)
menuBar()->hide(); menuBar()->hide();
toolBar()->hide(); toolBar()->hide();
qApp->setProperty("KDE_COLOR_SCHEME_PATH", d->mGvCore->fullScreenPaletteName());
QApplication::setPalette(d->mGvCore->palette(GvCore::FullScreenPalette)); QApplication::setPalette(d->mGvCore->palette(GvCore::FullScreenPalette));
d->mFullScreenContent->setFullScreenMode(true); d->mFullScreenContent->setFullScreenMode(true);
d->mBrowseMainPage->setFullScreenMode(true); d->mBrowseMainPage->setFullScreenMode(true);
d->mViewMainPage->setFullScreenMode(true); d->mViewMainPage->setFullScreenMode(true);
...@@ -1293,7 +1295,9 @@ void MainWindow::toggleFullScreen(bool checked) ...@@ -1293,7 +1295,9 @@ void MainWindow::toggleFullScreen(bool checked)
setAutoSaveSettings(); setAutoSaveSettings();
// Back to normal // Back to normal
qApp->setProperty("KDE_COLOR_SCHEME_PATH", QVariant());
QApplication::setPalette(d->mGvCore->palette(GvCore::NormalPalette)); QApplication::setPalette(d->mGvCore->palette(GvCore::NormalPalette));
d->mFullScreenContent->setFullScreenMode(false); d->mFullScreenContent->setFullScreenMode(false);
d->mBrowseMainPage->setFullScreenMode(false); d->mBrowseMainPage->setFullScreenMode(false);
d->mViewMainPage->setFullScreenMode(false); d->mViewMainPage->setFullScreenMode(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment