Gui: Add information about custom themes to settings

Fixes: #14929
This commit is contained in:
Kacper Donat
2024-06-29 22:30:32 +02:00
parent b6e301714d
commit 45dc70c51f
3 changed files with 46 additions and 10 deletions

View File

@@ -31,6 +31,7 @@
# include <QFileDialog>
# include <QLocale>
# include <QMessageBox>
# include <QString>
# include <algorithm>
# include <boost/filesystem.hpp>
#endif
@@ -40,6 +41,7 @@
#include <Base/UnitsApi.h>
#include <Gui/Document.h>
#include <Gui/Command.h>
#include <Gui/Action.h>
#include <Gui/Application.h>
@@ -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<int>(&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 {

View File

@@ -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);

View File

@@ -235,14 +235,29 @@ dot/period will always be printed.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="moreThemesLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Looking for more themes? You can obtain them using &lt;a href=&quot;freecad:Std_AddonMgr&quot;&gt;Addon Manager&lt;/a&gt;.</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="iconSizeLabel">
<property name="text">
<string>Size of toolbar icons:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="toolbarIconSize">
<property name="toolTip">
<string>Choose your preference for toolbar icon size. You can adjust
@@ -250,14 +265,14 @@ this according to your screen size or personal taste</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="treeModeLabel">
<property name="text">
<string>Tree view and Property view mode:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="treeMode">
<property name="toolTip">
<string>Customize how tree view is shown in the panel (restart required).
@@ -267,14 +282,14 @@ this according to your screen size or personal taste</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="recentFileListLabel">
<property name="text">
<string>Size of recent file list:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="Gui::PrefSpinBox" name="RecentFiles">
<property name="toolTip">
<string>How many files should be listed in recent files list</string>
@@ -290,7 +305,7 @@ this according to your screen size or personal taste</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QCheckBox" name="tiledBackground">
<property name="toolTip">
<string>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.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="Gui::PrefCheckBox" name="EnableCursorBlinking">
<property name="toolTip">
<string>The text cursor will be blinking</string>
@@ -320,7 +335,7 @@ See the FreeCAD Wiki for details about the image.</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="Gui::PrefCheckBox" name="SplashScreen">
<property name="toolTip">
<string>A Splash screen is a small loading window that is shown
@@ -341,7 +356,7 @@ display the splash screen</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="Gui::PrefCheckBox" name="ActivateOverlay">
<property name="toolTip">
<string>Activate overlay handling of dock windows</string>