From 3e0fb8fc1386ff47dfc078e5eab8f9427776acd7 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 29 Jun 2024 22:30:32 +0200 Subject: [PATCH] Gui: Add information about custom themes to settings Fixes: #14929 --- .../PreferencePages/DlgSettingsGeneral.cpp | 20 +++++++++++ src/Gui/PreferencePages/DlgSettingsGeneral.h | 1 + src/Gui/PreferencePages/DlgSettingsGeneral.ui | 35 +++++++++++++------ 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp index d1e1cfd232..9030ecd9e2 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -31,6 +31,7 @@ # include # include # include +# include # include # include #endif @@ -40,6 +41,7 @@ #include #include +#include #include #include @@ -83,6 +85,7 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent ) connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked); connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack); connect(ui->themesCombobox, qOverload(&QComboBox::activated), this, &DlgSettingsGeneral::onThemeChanged); + connect(ui->moreThemesLabel, &QLabel::linkActivated, this, &DlgSettingsGeneral::onLinkActivated); ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs")); connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked); @@ -728,6 +731,23 @@ void DlgSettingsGeneral::onThemeChanged(int index) { themeChanged = true; } +void DlgSettingsGeneral::onLinkActivated(const QString& link) +{ + auto const addonManagerLink = QStringLiteral("freecad:Std_AddonMgr"); + + if (link != addonManagerLink) { + return; + } + + // Set the user preferences to include only preference packs. + // This is a quick and dirty way to open Addon Manager with only themes. + auto pref = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Addons"); + pref->SetInt("PackageTypeSelection", 3); // 3 stands for Preference Packs + pref->SetInt("StatusSelection", 0); // 0 stands for any installation status + + Gui::Application::Instance->commandManager().runCommandByName("Std_AddonMgr"); +} + /////////////////////////////////////////////////////////// namespace { diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.h b/src/Gui/PreferencePages/DlgSettingsGeneral.h index cde07059f3..0779117c5e 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.h +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.h @@ -70,6 +70,7 @@ protected Q_SLOTS: void onManagePreferencePacksClicked(); void onImportConfigClicked(); void onThemeChanged(int index); + void onLinkActivated(const QString& link); public Q_SLOTS: void onUnitSystemIndexChanged(int index); diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.ui b/src/Gui/PreferencePages/DlgSettingsGeneral.ui index 182340488d..5fda837424 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.ui +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.ui @@ -235,14 +235,29 @@ dot/period will always be printed. - + + + + + 8 + + + + Looking for more themes? You can obtain them using <a href="freecad:Std_AddonMgr">Addon Manager</a>. + + + Qt::RichText + + + + Size of toolbar icons: - + Choose your preference for toolbar icon size. You can adjust @@ -250,14 +265,14 @@ this according to your screen size or personal taste - + Tree view and Property view mode: - + Customize how tree view is shown in the panel (restart required). @@ -267,14 +282,14 @@ this according to your screen size or personal taste - + Size of recent file list: - + How many files should be listed in recent files list @@ -290,7 +305,7 @@ this according to your screen size or personal taste - + Background of the main window (when no document is opened) will consist of tiles of a special image. @@ -301,7 +316,7 @@ See the FreeCAD Wiki for details about the image. - + The text cursor will be blinking @@ -320,7 +335,7 @@ See the FreeCAD Wiki for details about the image. - + A Splash screen is a small loading window that is shown @@ -341,7 +356,7 @@ display the splash screen - + Activate overlay handling of dock windows