parent
3ba0dda80f
commit
1718cc9bdb
@ -1,20 +0,0 @@
|
||||
commit 2283f5ee3c344fc62a74e41a127e3eee53fb2c37
|
||||
Author: Tsu Jan <tsujan2000@gmail.com>
|
||||
Date: Mon Feb 12 13:10:02 2018 +0330
|
||||
|
||||
Fix icon colorizing at startup
|
||||
|
||||
Fixes https://github.com/lxde/lxqt/issues/1445.
|
||||
|
||||
diff --git a/src/lxqtplatformtheme.cpp b/src/lxqtplatformtheme.cpp
|
||||
index 83786f0..8291eab 100644
|
||||
--- a/src/lxqtplatformtheme.cpp
|
||||
+++ b/src/lxqtplatformtheme.cpp
|
||||
@@ -315,6 +315,7 @@ QVariant LXQtPlatformTheme::themeHint(ThemeHint hint) const {
|
||||
|
||||
QIconEngine *LXQtPlatformTheme::createIconEngine(const QString &iconName) const
|
||||
{
|
||||
+ XdgIconLoader::instance()->setFollowColorScheme(iconFollowColorScheme_);
|
||||
return new XdgIconLoaderEngine(iconName);
|
||||
}
|
||||
|
@ -1,80 +0,0 @@
|
||||
From c78433c32c327d09507976a7b5cecff87c224252 Mon Sep 17 00:00:00 2001
|
||||
From: Palo Kisa <palo.kisa@gmail.com>
|
||||
Date: Tue, 13 Feb 2018 10:01:10 +0100
|
||||
Subject: [PATCH] lxqtplatformtheme: Initialize "folowColorScheme" once
|
||||
|
||||
---
|
||||
src/lxqtplatformtheme.cpp | 18 +++++++++++++-----
|
||||
src/lxqtplatformtheme.h | 4 +++-
|
||||
2 files changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lxqtplatformtheme.cpp b/src/lxqtplatformtheme.cpp
|
||||
index 8291eab..467cf07 100644
|
||||
--- a/src/lxqtplatformtheme.cpp
|
||||
+++ b/src/lxqtplatformtheme.cpp
|
||||
@@ -52,13 +52,20 @@ LXQtPlatformTheme::LXQtPlatformTheme():
|
||||
iconFollowColorScheme_(true)
|
||||
, settingsWatcher_(NULL)
|
||||
{
|
||||
- // When the plugin is loaded, it seems that the app is not yet running and
|
||||
+ loadSettings();
|
||||
+ // Note: When the plugin is loaded, it seems that the app is not yet running and
|
||||
// QThread environment is not completely set up. So creating filesystem watcher
|
||||
// does not work since it uses QSocketNotifier internally which can only be
|
||||
// created within QThread thread. So let's schedule a idle handler to initialize
|
||||
// the watcher in the main event loop.
|
||||
- loadSettings();
|
||||
- QTimer::singleShot(0, this, SLOT(initWatch()));
|
||||
+
|
||||
+ // Note2: the QTimer::singleShot with also needs a QThread environment
|
||||
+ // (there is a workaround in qtcore for the 0-timer with the old SLOT notation)
|
||||
+
|
||||
+ // TODO: use the "PointerToMemberFunction" overloads of invokeMethod(), but they
|
||||
+ // are available from Qt v5.10
|
||||
+ //QMetaObject::ivokeMethod(this, &LXQtPlatformTheme::lazyInit, Qt::QueuedConnection);
|
||||
+ QMetaObject::invokeMethod(this, "lazyInit", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
LXQtPlatformTheme::~LXQtPlatformTheme() {
|
||||
@@ -66,11 +73,13 @@ LXQtPlatformTheme::~LXQtPlatformTheme() {
|
||||
delete settingsWatcher_;
|
||||
}
|
||||
|
||||
-void LXQtPlatformTheme::initWatch()
|
||||
+void LXQtPlatformTheme::lazyInit()
|
||||
{
|
||||
settingsWatcher_ = new QFileSystemWatcher();
|
||||
settingsWatcher_->addPath(settingsFile_);
|
||||
connect(settingsWatcher_, &QFileSystemWatcher::fileChanged, this, &LXQtPlatformTheme::onSettingsChanged);
|
||||
+
|
||||
+ XdgIconLoader::instance()->setFollowColorScheme(iconFollowColorScheme_);
|
||||
}
|
||||
|
||||
void LXQtPlatformTheme::loadSettings() {
|
||||
@@ -315,7 +324,6 @@ QVariant LXQtPlatformTheme::themeHint(ThemeHint hint) const {
|
||||
|
||||
QIconEngine *LXQtPlatformTheme::createIconEngine(const QString &iconName) const
|
||||
{
|
||||
- XdgIconLoader::instance()->setFollowColorScheme(iconFollowColorScheme_);
|
||||
return new XdgIconLoaderEngine(iconName);
|
||||
}
|
||||
|
||||
diff --git a/src/lxqtplatformtheme.h b/src/lxqtplatformtheme.h
|
||||
index 3c07c46..d0e7b6e 100644
|
||||
--- a/src/lxqtplatformtheme.h
|
||||
+++ b/src/lxqtplatformtheme.h
|
||||
@@ -78,11 +78,13 @@ class Q_GUI_EXPORT LXQtPlatformTheme : public QObject, public QPlatformTheme {
|
||||
|
||||
// virtual QString standardButtonText(int button) const;
|
||||
|
||||
+public Q_SLOTS:
|
||||
+ void lazyInit();
|
||||
+
|
||||
private:
|
||||
void loadSettings();
|
||||
|
||||
private Q_SLOTS:
|
||||
- void initWatch();
|
||||
void onSettingsChanged();
|
||||
|
||||
private:
|
@ -1,119 +0,0 @@
|
||||
Description: Remember the view mode
|
||||
Since the LXQt file dialog has richer modes than the Qt file dialog does, it
|
||||
is better to remember the user's choice on closing the dialog, as is the case
|
||||
in KDE.
|
||||
Author: Tsu Jan <tsujan2000@gmail.com>
|
||||
Origin: backport
|
||||
Bug: https://github.com/lxde/lxqt/issues/1358
|
||||
Applied-Upstream: commit:dfa18ac
|
||||
Last-Update: 2018-02-05
|
||||
--- a/src/lxqtfiledialoghelper.cpp
|
||||
+++ b/src/lxqtfiledialoghelper.cpp
|
||||
@@ -12,6 +12,9 @@
|
||||
|
||||
static std::unique_ptr<Fm::LibFmQt> libfmQtContext_;
|
||||
|
||||
+inline static const QString viewModeToString(Fm::FolderView::ViewMode value);
|
||||
+inline static Fm::FolderView::ViewMode viewModeFromString(const QString& str);
|
||||
+
|
||||
LXQtFileDialogHelper::LXQtFileDialogHelper() {
|
||||
if(!libfmQtContext_) {
|
||||
// initialize libfm-qt only once
|
||||
@@ -53,6 +56,8 @@ bool LXQtFileDialogHelper::show(Qt::Wind
|
||||
// https://github.com/KDE/plasma-integration/blob/master/src/platformtheme/kdeplatformfiledialoghelper.cpp
|
||||
dlg_->windowHandle()->setTransientParent(parent);
|
||||
|
||||
+ applyOptions();
|
||||
+
|
||||
loadSettings();
|
||||
// central positioning with respect to the parent window
|
||||
if(parent && parent->isVisible()) {
|
||||
@@ -60,8 +65,6 @@ bool LXQtFileDialogHelper::show(Qt::Wind
|
||||
parent->y() + (parent->height() - dlg_->height()) / 2);
|
||||
}
|
||||
|
||||
- applyOptions();
|
||||
-
|
||||
// NOTE: the timer here is required as a workaround borrowed from KDE. Without this, the dialog UI will be blocked.
|
||||
// QFileDialog calls our platform plugin to show our own native file dialog instead of showing its widget.
|
||||
// However, it still creates a hidden dialog internally, and then make it modal.
|
||||
@@ -139,8 +142,6 @@ void LXQtFileDialogHelper::applyOptions(
|
||||
}
|
||||
|
||||
dlg_->setFilter(opt->filter());
|
||||
- dlg_->setViewMode(opt->viewMode() == QFileDialogOptions::Detail ? Fm::FolderView::DetailedListMode
|
||||
- : Fm::FolderView::CompactMode);
|
||||
dlg_->setFileMode(QFileDialog::FileMode(opt->fileMode()));
|
||||
dlg_->setAcceptMode(QFileDialog::AcceptMode(opt->acceptMode())); // also sets a default label for accept button
|
||||
// bool useDefaultNameFilters() const;
|
||||
@@ -191,12 +192,56 @@ void LXQtFileDialogHelper::applyOptions(
|
||||
// QStringList supportedSchemes() const;
|
||||
}
|
||||
|
||||
+static const QString viewModeToString(Fm::FolderView::ViewMode value) {
|
||||
+ QString ret;
|
||||
+ switch(value) {
|
||||
+ case Fm::FolderView::DetailedListMode:
|
||||
+ default:
|
||||
+ ret = QLatin1String("Detailed");
|
||||
+ break;
|
||||
+ case Fm::FolderView::CompactMode:
|
||||
+ ret = QLatin1String("Compact");
|
||||
+ break;
|
||||
+ case Fm::FolderView::IconMode:
|
||||
+ ret = QLatin1String("Icon");
|
||||
+ break;
|
||||
+ case Fm::FolderView::ThumbnailMode:
|
||||
+ ret = QLatin1String("Thumbnail");
|
||||
+ break;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+Fm::FolderView::ViewMode viewModeFromString(const QString& str) {
|
||||
+ Fm::FolderView::ViewMode ret;
|
||||
+ if(str == QLatin1String("Detailed")) {
|
||||
+ ret = Fm::FolderView::DetailedListMode;
|
||||
+ }
|
||||
+ else if(str == QLatin1String("Compact")) {
|
||||
+ ret = Fm::FolderView::CompactMode;
|
||||
+ }
|
||||
+ else if(str == QLatin1String("Icon")) {
|
||||
+ ret = Fm::FolderView::IconMode;
|
||||
+ }
|
||||
+ else if(str == QLatin1String("Thumbnail")) {
|
||||
+ ret = Fm::FolderView::ThumbnailMode;
|
||||
+ }
|
||||
+ else {
|
||||
+ ret = Fm::FolderView::DetailedListMode;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
void LXQtFileDialogHelper::loadSettings() {
|
||||
QSettings settings(QSettings::UserScope, "lxqt", "filedialog");
|
||||
settings.beginGroup ("Sizes");
|
||||
dlg_->resize(settings.value("WindowSize", QSize(700, 500)).toSize());
|
||||
dlg_->setSplitterPos(settings.value("SplitterPos", 200).toInt());
|
||||
settings.endGroup();
|
||||
+
|
||||
+ settings.beginGroup ("View");
|
||||
+ dlg_->setViewMode(viewModeFromString(settings.value("Mode", "Detailed").toString()));
|
||||
+ settings.endGroup();
|
||||
}
|
||||
|
||||
void LXQtFileDialogHelper::saveSettings() {
|
||||
@@ -211,6 +256,13 @@ void LXQtFileDialogHelper::saveSettings(
|
||||
settings.setValue("SplitterPos", splitterPos);
|
||||
}
|
||||
settings.endGroup();
|
||||
+
|
||||
+ settings.beginGroup ("View");
|
||||
+ QString mode = viewModeToString(dlg_->viewMode());
|
||||
+ if(settings.value("Mode") != mode) {
|
||||
+ settings.setValue("Mode", mode);
|
||||
+ }
|
||||
+ settings.endGroup();
|
||||
}
|
||||
|
||||
/*
|
@ -1,5 +0,0 @@
|
||||
colorizing-at-startup.patch
|
||||
lxqtplatformtheme-follow-color-scheme.patch
|
||||
|
||||
# Ubuntu-specific patches
|
||||
remember-view-mode.patch
|
Loading…
Reference in new issue