diff --git a/README.md b/README.md index 62d245a23b..ee2fc2d5f4 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,23 @@ The theme is automatically applied when using Kindred Create. Prebuilt packages for Linux are available on the [releases page](https://github.com/anthropics/create-0070/releases). +#### Debian/Ubuntu (.deb) + +Download the `.deb` package from the releases page and install with: + +```bash +sudo dpkg -i kindred-create_*.deb +sudo apt-get install -f # Install any missing dependencies +``` + +Or install directly with apt: + +```bash +sudo apt install ./kindred-create_*.deb +``` + +After installation, launch Kindred Create from your application menu or run `kindred-create` from the terminal. + ### Building from Source Kindred Create uses the same build system as FreeCAD. Build instructions for each platform: diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 70f5d207d5..b942f71d7c 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -782,7 +782,7 @@ bool MainWindow::updateComboView(bool show) ->GetGroup("DockWindows") ->GetGroup("ComboView"); bool enable = group->GetBool("Enabled", true); - _updateDockWidget("Std_ComboView", enable, show, Qt::LeftDockWidgetArea, [](QWidget* widget) { + _updateDockWidget("Std_ComboView", enable, show, Qt::RightDockWidgetArea, [](QWidget* widget) { auto pcComboView = qobject_cast(widget); if (widget) { return widget; diff --git a/src/Gui/PreferencePacks/CMakeLists.txt b/src/Gui/PreferencePacks/CMakeLists.txt index 64f2092426..a1c78cee45 100644 --- a/src/Gui/PreferencePacks/CMakeLists.txt +++ b/src/Gui/PreferencePacks/CMakeLists.txt @@ -4,10 +4,6 @@ SET(PreferencePacks_Files SET(PreferencePacks_Directories "KindredCreate" - "FreeCAD Classic" - "Dark behave" - "FreeCAD Light" - "FreeCAD Dark" ) ADD_CUSTOM_TARGET(PreferencePacks_data ALL diff --git a/src/Gui/PreferencePacks/Dark behave/Dark behave.cfg b/src/Gui/PreferencePacks/Dark behave/Dark behave.cfg deleted file mode 100644 index 6d1906f64f..0000000000 --- a/src/Gui/PreferencePacks/Dark behave/Dark behave.cfg +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - #9b4de6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Behave-dark.qss - - - - - diff --git a/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg b/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg deleted file mode 100644 index d70940da22..0000000000 --- a/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Light Theme + Dark Background.qss - - FreeCAD Classic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #feff9e - #000000 - #000000 - #000000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Gui/PreferencePacks/FreeCAD Classic/post.FCMacro b/src/Gui/PreferencePacks/FreeCAD Classic/post.FCMacro deleted file mode 100644 index f0a0625bc9..0000000000 --- a/src/Gui/PreferencePacks/FreeCAD Classic/post.FCMacro +++ /dev/null @@ -1,8 +0,0 @@ -# Classic theme must delete any set value for the editor text so that it is calculated dynamically when needed -import FreeCAD - -editorPrefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Editor") -editorPrefs.RemInt("Text") - -appPrefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/MainWindow") -appPrefs.RemString("QtStyle") diff --git a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg deleted file mode 100644 index 3bd3e35e9e..0000000000 --- a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - Freecad Overlay.qss - FreeCAD - FreeCAD.qss - FreeCAD Dark - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #1864ab - #f8f9fa - #f8f9fa - #f8f9fa - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg deleted file mode 100644 index a67328d221..0000000000 --- a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Freecad Overlay.qss - FreeCAD - FreeCAD.qss - FreeCAD Light - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #bac8ff - #212529 - #212529 - #212529 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Gui/PreferencePacks/package.xml b/src/Gui/PreferencePacks/package.xml index eacd80cc72..57dca802be 100644 --- a/src/Gui/PreferencePacks/package.xml +++ b/src/Gui/PreferencePacks/package.xml @@ -18,33 +18,6 @@ catppuccin mocha - - FreeCAD Classic - Theme - Removes stylesheets, and applies the classic purple/gray background. Resets all colors to default - 1.0.0 - built-in - background - no stylesheet - classic theme - - - FreeCAD Light - Theme - Applies a basic light theme. - 1.0.0 - built-in - background - light - - - FreeCAD Dark - Theme - Applies a basic dark theme. - 1.0.0 - built-in - background - dark - + diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp index 6681d26694..fd1f497535 100644 --- a/src/Gui/StartupProcess.cpp +++ b/src/Gui/StartupProcess.cpp @@ -338,11 +338,8 @@ void StartupPostProcess::migrateOldTheme(const std::string& style) { auto prefPackManager = Application::Instance->prefPackManager(); - if (style == "FreeCAD Light.qss") { - prefPackManager->apply("FreeCAD Light"); - } - else if (style == "FreeCAD Dark.qss") { - prefPackManager->apply("FreeCAD Dark"); + if (style == "FreeCAD Light.qss" || style == "FreeCAD Dark.qss") { + prefPackManager->apply("KindredCreate"); } } diff --git a/src/Gui/Stylesheets/CMakeLists.txt b/src/Gui/Stylesheets/CMakeLists.txt index 104ff80ae2..c025a75b72 100644 --- a/src/Gui/Stylesheets/CMakeLists.txt +++ b/src/Gui/Stylesheets/CMakeLists.txt @@ -6,8 +6,6 @@ SET(Stylesheets_Files ) SET(Parameters_Files - "parameters/FreeCAD Dark.yaml" - "parameters/FreeCAD Light.yaml" ) SET(Overlay_Stylesheets_Files diff --git a/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml b/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml deleted file mode 100644 index c287db2fbe..0000000000 --- a/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml +++ /dev/null @@ -1,64 +0,0 @@ -3DViewBackgroundRefColor: "@BackgroundColor" -ButtonBackgroundHooverColor: "@ButtonTopBackgroundColor" -ButtonBorderColor: "@GeneralBorderColor" -ButtonBorderHooverColor: "@GeneralBorderColor" -ButtonBottomBackgroundColor: "@PrimaryColorLighten2" -ButtonTopBackgroundColor: "@PrimaryColorLighten3" -CheckedButtonBottomBackgroundColor: "darken(@ButtonBottomBackgroundColor, 5)" -CheckedButtonTopBackgroundColor: "darken(@ButtonTopBackgroundColor, 5)" -DefaultButtonBottomBackgroundColor: "blend(@ButtonBottomBackgroundColor, @AccentColor, 10)" -DefaultButtonTopBackgroundColor: "blend(@ButtonTopBackgroundColor, @AccentColor, 10)" -DefaultButtonBorderColor: "blend(@ButtonBorderColor, @AccentColor, 20)" -CheckBoxBackgroundColor: "@TextEditFieldBackgroundColor" -CheckBoxBorderColor: "@GeneralBorderColor" -DialogBackgroundColor: "@PrimaryColorLighten3" -GeneralAlternateBackgroundColor: "@PrimaryColorLighten2" -GeneralBackgroundColor: "@PrimaryColor" -GeneralBackgroundHoverColor: "@PrimaryColorLighten4" -GeneralBorderColor: "@PrimaryColorDarken5" -GeneralBorderHoverColor: "@PrimaryColorLighten6" -GeneralDisabledBackgroundColor: "@PrimaryColorDarken3" -GeneralGridLinesColor: "@PrimaryColorLighten3" -GeneralHeaderBackgroundColor: "@PrimaryColor" -GroupboxBackgroundColor: "@PrimaryColorLighten4" -GroupboxBorderColor: "lighten(@GroupboxBackgroundColor,20)" -IconsLocationFolderName: "images_classic" -InputFieldBorderRadius: "3px" -MenuBackgroundColor: "@PrimaryColorDarken4" -PrimaryColor: "#191919" -PrimaryColorDarken1: "darken(@PrimaryColor,5)" -PrimaryColorDarken2: "darken(@PrimaryColor,8)" -PrimaryColorDarken3: "darken(@PrimaryColor,15)" -PrimaryColorDarken4: "darken(@PrimaryColor,20)" -PrimaryColorDarken5: "darken(@PrimaryColor,200)" -PrimaryColorDarken6: "darken(@PrimaryColor,5890)" -PrimaryColorLighten1: "lighten(@PrimaryColor,20)" -PrimaryColorLighten2: "lighten(@PrimaryColor,40)" -PrimaryColorLighten3: "lighten(@PrimaryColor,80)" -PrimaryColorLighten4: "lighten(@PrimaryColor,100)" -PrimaryColorLighten5: "lighten(@PrimaryColor,300)" -PrimaryColorLighten6: "lighten(@PrimaryColor,5890)" -RadioButtonBackgroundColor: "@CheckBoxBackgroundColor" -RadioButtonBorderColor: "@GeneralBorderColor" -ScrollbarBackgroundColor: "@GeneralDisabledBackgroundColor" -SketcherConflictingConstraintsColor: "#fc6c6c" -SketcherEmptySketchColor: "#ffffff" -SketcherFullyConstrainedColor: "#8cff5b" -SketcherMalformedConstraintsColor: "#fc6c6c" -SketcherPartiallyRedundantConstraintsColor: "#77cbff" -SketcherRedundantConstraintsColor: "#ffa256" -SketcherSolverFailedColor: "#ff9090" -SketcherUnderConstrainedColor: "#ffffff" -StylesheetIconsColor: "white" -TabbarBackgroundColor: "@PrimaryColorDarken5" -InActiveTabBackgroundColor: "@PrimaryColorDarken2" -ActiveTabBackgroundColor: "@3DViewBackgroundRefColor" -TextDisabledColor: "darken(@TextForegroundColor,40)" -TextEditFieldBackgroundColor: "@PrimaryColor" -TextForegroundColor: "#ffffff" -TextSelectBackgroundColor: "darken(@AccentColor,100)" -TextUrlColor: "#0095ff" -ToolbarButtonsPadding: "2px" -AccentColor: "@ThemeAccentColor1" -AccentBackgroundColor: "blend(@GeneralBackgroundColor,@AccentColor,60)" -AccentHoverColor: "blend(@GeneralBackgroundHoverColor,@AccentColor,30)" diff --git a/src/Gui/Stylesheets/parameters/FreeCAD Light.yaml b/src/Gui/Stylesheets/parameters/FreeCAD Light.yaml deleted file mode 100644 index 0883a69ab4..0000000000 --- a/src/Gui/Stylesheets/parameters/FreeCAD Light.yaml +++ /dev/null @@ -1,64 +0,0 @@ -3DViewBackgroundRefColor: "@BackgroundColor" -ButtonBackgroundHooverColor: "@ButtonTopBackgroundColor" -ButtonBorderColor: "@GeneralBorderColor" -ButtonBorderHooverColor: "@GeneralBorderColor" -ButtonBottomBackgroundColor: "@PrimaryColorDarken1" -ButtonTopBackgroundColor: "@PrimaryColorLighten3" -CheckedButtonBottomBackgroundColor: "darken(@ButtonBottomBackgroundColor, 5)" -CheckedButtonTopBackgroundColor: "darken(@ButtonTopBackgroundColor, 5)" -DefaultButtonBottomBackgroundColor: "blend(@ButtonBottomBackgroundColor, @AccentColor, 5)" -DefaultButtonTopBackgroundColor: "blend(@ButtonTopBackgroundColor, @AccentColor, 5)" -DefaultButtonBorderColor: "blend(@ButtonBorderColor, @AccentColor, 40)" -CheckBoxBackgroundColor: "@TextEditFieldBackgroundColor" -CheckBoxBorderColor: "@GeneralBorderColor" -DialogBackgroundColor: "@PrimaryColorLighten3" -GeneralAlternateBackgroundColor: "@PrimaryColor" -GeneralBackgroundColor: "@PrimaryColor" -GeneralBackgroundHoverColor: "@PrimaryColorLighten5" -GeneralBorderColor: "@PrimaryColorDarken4" -GeneralBorderHoverColor: "@PrimaryColorDarken5" -GeneralDisabledBackgroundColor: "@PrimaryColorDarken3" -GeneralGridLinesColor: "@PrimaryColorDarken4" -GeneralHeaderBackgroundColor: "@PrimaryColorDarken2" -GroupboxBackgroundColor: "@PrimaryColorLighten2" -GroupboxBorderColor: "darken(@GroupboxBackgroundColor,20)" -IconsLocationFolderName: "images_classic" -InputFieldBorderRadius: "3px" -MenuBackgroundColor: "@PrimaryColorLighten1" -PrimaryColor: "#F0F0F0" -PrimaryColorDarken1: "darken(@PrimaryColor,4)" -PrimaryColorDarken2: "darken(@PrimaryColor,8)" -PrimaryColorDarken3: "darken(@PrimaryColor,10)" -PrimaryColorDarken4: "darken(@PrimaryColor,20)" -PrimaryColorDarken5: "darken(@PrimaryColor,200)" -PrimaryColorDarken6: "darken(@PrimaryColor,5890)" -PrimaryColorLighten1: "lighten(@PrimaryColor,2)" -PrimaryColorLighten2: "lighten(@PrimaryColor,3)" -PrimaryColorLighten3: "lighten(@PrimaryColor,4)" -PrimaryColorLighten4: "lighten(@PrimaryColor,5)" -PrimaryColorLighten5: "lighten(@PrimaryColor,6)" -PrimaryColorLighten6: "lighten(@PrimaryColor,7)" -RadioButtonBackgroundColor: "@CheckBoxBackgroundColor" -RadioButtonBorderColor: "@GeneralBorderColor" -ScrollbarBackgroundColor: "@GeneralDisabledBackgroundColor" -SketcherConflictingConstraintsColor: "#9d0000" -SketcherEmptySketchColor: "#000000" -SketcherFullyConstrainedColor: "#278100" -SketcherMalformedConstraintsColor: "#9d0000" -SketcherPartiallyRedundantConstraintsColor: "#005991" -SketcherRedundantConstraintsColor: "#ab4d00" -SketcherSolverFailedColor: "#9d0000" -SketcherUnderConstrainedColor: "#000000" -StylesheetIconsColor: "black" -TabbarBackgroundColor: "@PrimaryColorDarken4" -InActiveTabBackgroundColor: "@PrimaryColorDarken2" -ActiveTabBackgroundColor: "@3DViewBackgroundRefColor" -TextDisabledColor: "darken(@TabbarBackgroundColor,80)" -TextEditFieldBackgroundColor: "@PrimaryColorLighten3" -TextForegroundColor: "#000000" -TextSelectBackgroundColor: "@AccentHoverColor" -TextUrlColor: "#0061a7" -AccentColor: "@ThemeAccentColor1" -AccentBackgroundColor: "blend(@GeneralBackgroundColor,@AccentColor,60)" -AccentHoverColor: "blend(@GeneralBackgroundHoverColor,@AccentColor,30)" -ToolbarButtonsPadding: "2px" diff --git a/src/Mod/Start/Gui/ThemeSelectorWidget.cpp b/src/Mod/Start/Gui/ThemeSelectorWidget.cpp index 22cf026d21..96668509da 100644 --- a/src/Mod/Start/Gui/ThemeSelectorWidget.cpp +++ b/src/Mod/Start/Gui/ThemeSelectorWidget.cpp @@ -21,143 +21,34 @@ * * ***************************************************************************/ -#include #include #include #include -#include #include - #include "ThemeSelectorWidget.h" #include -#include -#include #include -#include - -#ifdef FC_OS_MACOSX -# include -#endif - using namespace StartGui; -static bool isSystemInDarkMode() -{ - // Auto-detect system setting and default to light mode -#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) - // https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 - const auto scheme = QGuiApplication::styleHints()->colorScheme(); - return scheme == Qt::ColorScheme::Dark; -#elif QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) - // https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 - const QPalette defaultPalette; - const auto text = defaultPalette.color(QPalette::WindowText); - const auto window = defaultPalette.color(QPalette::Window); - return text.lightness() > window.lightness(); -#else -# ifdef FC_OS_MACOSX - auto key = CFSTR("AppleInterfaceStyle"); - if (auto value = CFPreferencesCopyAppValue(key, kCFPreferencesAnyApplication)) { - // If the value is "Dark", Dark Mode is enabled - if (CFGetTypeID(value) == CFStringGetTypeID()) { - if (CFStringCompare((CFStringRef)value, CFSTR("Dark"), kCFCompareCaseInsensitive) - == kCFCompareEqualTo) { - CFRelease(value); - return true; - } - } - CFRelease(value); - } -# endif // FC_OS_MACOSX -#endif // QT_VERSION >= 6.4+ - return false; -} - - -static bool shouldHideClassicTheme() -{ - // Classic on macOS and windows 11 with qt6(.4+?) doesn't work when system - // is in dark mode and to make matter worse, on macOS there's a setting that - // changes mode depending on time of day. -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) || defined(FC_OS_MACOSX) || defined(FC_OS_WIN32) - return true; -#else - return false; -#endif -} - - ThemeSelectorWidget::ThemeSelectorWidget(QWidget* parent) : QWidget(parent) , _titleLabel {nullptr} , _descriptionLabel {nullptr} - , _buttons {nullptr, nullptr, nullptr} + , _themeButton {nullptr} { setObjectName(QLatin1String("ThemeSelectorWidget")); - if (shouldHideClassicTheme()) { - preselectThemeFromSystemSettings(); - } + applyKindredCreateTheme(); setupUi(); qApp->installEventFilter(this); } - -void ThemeSelectorWidget::setupButtons(QBoxLayout* layout) +void ThemeSelectorWidget::applyKindredCreateTheme() { - if (!layout) { - return; - } - std::map themeMap { - {Theme::Classic, tr("FreeCAD Classic")}, - {Theme::Dark, tr("FreeCAD Dark")}, - {Theme::Light, tr("FreeCAD Light")} - }; - std::map iconMap { - {Theme::Classic, QIcon(QLatin1String(":/thumbnails/Theme_thumbnail_classic.png"))}, - {Theme::Light, QIcon(QLatin1String(":/thumbnails/Theme_thumbnail_light.png"))}, - {Theme::Dark, QIcon(QLatin1String(":/thumbnails/Theme_thumbnail_dark.png"))} - }; - auto hGrp = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/MainWindow" - ); - auto styleSheetName = QString::fromStdString(hGrp->GetASCII("StyleSheet")); - for (const auto& theme : themeMap) { - auto button = gsl::owner(new QToolButton()); - - if (theme.first == Theme::Classic && shouldHideClassicTheme()) { - button->setVisible(false); - } - - button->setCheckable(true); - button->setAutoExclusive(true); - button->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonTextUnderIcon); - button->setText(theme.second); - button->setIcon(iconMap[theme.first]); - button->setIconSize(iconMap[theme.first].actualSize(QSize(256, 256))); - if (theme.first == Theme::Classic && styleSheetName.isEmpty()) { - button->setChecked(true); - } - else if (theme.first == Theme::Light - && styleSheetName.contains( - QLatin1String("FreeCAD Light"), - Qt::CaseSensitivity::CaseInsensitive - )) { - button->setChecked(true); - } - else if (theme.first == Theme::Dark - && styleSheetName.contains( - QLatin1String("FreeCAD Dark"), - Qt::CaseSensitivity::CaseInsensitive - )) { - button->setChecked(true); - } - connect(button, &QToolButton::clicked, this, [this, theme] { themeChanged(theme.first); }); - layout->addWidget(button); - _buttons[static_cast(theme.first)] = button; - } + auto prefPackManager = Gui::Application::Instance->prefPackManager(); + prefPackManager->apply("KindredCreate"); } void ThemeSelectorWidget::setupUi() @@ -169,69 +60,16 @@ void ThemeSelectorWidget::setupUi() outerLayout->addWidget(_titleLabel); outerLayout->addLayout(buttonLayout); outerLayout->addWidget(_descriptionLabel); - setupButtons(buttonLayout); + + _themeButton = gsl::owner(new QToolButton()); + _themeButton->setCheckable(true); + _themeButton->setChecked(true); + _themeButton->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonTextUnderIcon); + _themeButton->setIcon(QIcon(QLatin1String(":/thumbnails/Theme_thumbnail_dark.png"))); + _themeButton->setIconSize(_themeButton->icon().actualSize(QSize(256, 256))); + buttonLayout->addWidget(_themeButton); + retranslateUi(); - connect(_descriptionLabel, &QLabel::linkActivated, this, &ThemeSelectorWidget::onLinkActivated); -} - -void ThemeSelectorWidget::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"); -} - -void ThemeSelectorWidget::preselectThemeFromSystemSettings() -{ - auto nullStyle(""); - auto hGrp = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/MainWindow" - ); - auto styleSheetName = QString::fromStdString(hGrp->GetASCII("StyleSheet", nullStyle)); - if (styleSheetName == QString::fromStdString(nullStyle)) { - auto theme = isSystemInDarkMode() ? Theme::Dark : Theme::Light; - themeChanged(theme); - } -} - -void ThemeSelectorWidget::themeChanged(Theme newTheme) -{ - // Run the appropriate preference pack: - auto prefPackManager = Gui::Application::Instance->prefPackManager(); - switch (newTheme) { - case Theme::Classic: - prefPackManager->apply("FreeCAD Classic"); - break; - case Theme::Dark: - prefPackManager->apply("FreeCAD Dark"); - break; - case Theme::Light: - prefPackManager->apply("FreeCAD Light"); - break; - } - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/Themes" - ); - const unsigned long nonExistentColor = -1434171135; - const unsigned long defaultAccentColor = 1434171135; - unsigned long longAccentColor1 = hGrp->GetUnsigned("ThemeAccentColor1", nonExistentColor); - if (longAccentColor1 == nonExistentColor) { - hGrp->SetUnsigned("ThemeAccentColor1", defaultAccentColor); - hGrp->SetUnsigned("ThemeAccentColor2", defaultAccentColor); - hGrp->SetUnsigned("ThemeAccentColor3", defaultAccentColor); - } } bool ThemeSelectorWidget::eventFilter(QObject* object, QEvent* event) @@ -245,16 +83,8 @@ bool ThemeSelectorWidget::eventFilter(QObject* object, QEvent* event) void ThemeSelectorWidget::retranslateUi() { _titleLabel->setText(QLatin1String("

") + tr("Theme") + QLatin1String("

")); - if (Gui::Application::Instance->commandManager().getCommandByName("Std_AddonMgr")) { - _descriptionLabel->setText( - tr("Looking for more themes? You can obtain them using " - "Addon Manager.") - ); - } - else { - _descriptionLabel->hide(); - } - _buttons[static_cast(Theme::Dark)]->setText(tr("FreeCAD Dark", "Visual theme name")); - _buttons[static_cast(Theme::Light)]->setText(tr("FreeCAD Light", "Visual theme name")); - _buttons[static_cast(Theme::Classic)]->setText(tr("FreeCAD Classic", "Visual theme name")); + _descriptionLabel->setText( + tr("Kindred Create uses the Catppuccin Mocha theme.") + ); + _themeButton->setText(tr("Kindred Create", "Visual theme name")); } diff --git a/src/Mod/Start/Gui/ThemeSelectorWidget.h b/src/Mod/Start/Gui/ThemeSelectorWidget.h index 0819d34aba..ae98b7a002 100644 --- a/src/Mod/Start/Gui/ThemeSelectorWidget.h +++ b/src/Mod/Start/Gui/ThemeSelectorWidget.h @@ -25,23 +25,14 @@ #define FREECAD_START_THEMESELECTORWIDGET_H #include -#include -class QBoxLayout; class QLabel; class QToolButton; namespace StartGui { -enum class Theme -{ - Classic, - Light, - Dark -}; - -/// A widget to allow selection of the UI theme (color scheme). +/// A widget that displays the active Kindred Create theme. class ThemeSelectorWidget: public QWidget { Q_OBJECT @@ -49,19 +40,14 @@ public: explicit ThemeSelectorWidget(QWidget* parent = nullptr); bool eventFilter(QObject* object, QEvent* event) override; -protected: - void themeChanged(Theme newTheme); - private: void retranslateUi(); void setupUi(); - void setupButtons(QBoxLayout* layout); - void onLinkActivated(const QString& link); - void preselectThemeFromSystemSettings(); + void applyKindredCreateTheme(); QLabel* _titleLabel; QLabel* _descriptionLabel; - std::array _buttons; + QToolButton* _themeButton; }; } // namespace StartGui