Skip to content

Commit

Permalink
Move setting option to a cmake variable.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila <hello@camila.codes>
  • Loading branch information
Camila committed Jul 24, 2023
1 parent 7d31b8e commit 41117a8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NEXTCLOUD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ option( DO_NOT_USE_PROXY "Do not use system wide proxy, instead always do a dire

## Theming options
set(NEXTCLOUD_BACKGROUND_COLOR "#0082c9" CACHE STRING "Default Nextcloud background color")
set( NEXTCLOUD_SETTINGS_WIDGET_VISIBLE ON )
set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR ${NEXTCLOUD_BACKGROUND_COLOR} CACHE STRING "Hex color of the wizard header background")
set( APPLICATION_WIZARD_HEADER_TITLE_COLOR "#ffffff" CACHE STRING "Hex color of the text in the wizard header")
option( APPLICATION_WIZARD_USE_CUSTOM_LOGO "Use the logo from ':/client/theme/colored/wizard_logo.(png|svg)' else the default application icon is used" ON )


#
## Windows Shell Extensions & MSI - IMPORTANT: Generate new GUIDs for custom builds with "guidgen" or "uuidgen"
#
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#cmakedefine LINUX_APPLICATION_ID "@LINUX_APPLICATION_ID@"
#cmakedefine APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "@APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR@"
#cmakedefine NEXTCLOUD_BACKGROUND_COLOR "@NEXTCLOUD_BACKGROUND_COLOR@"
#cmakedefine NEXTCLOUD_SETTINGS_WIDGET_VISIBLE "@NEXTCLOUD_SETTINGS_WIDGET_VISIBLE@"
#cmakedefine APPLICATION_WIZARD_HEADER_TITLE_COLOR "@APPLICATION_WIZARD_HEADER_TITLE_COLOR@"
#cmakedefine APPLICATION_WIZARD_USE_CUSTOM_LOGO "@APPLICATION_WIZARD_USE_CUSTOM_LOGO@"
#cmakedefine APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@"
Expand Down
10 changes: 5 additions & 5 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ GeneralSettings::GeneralSettings(QWidget *parent)
{
_ui->setupUi(this);

const auto settingsWidgetVisible = ConfigFile().isNcSettingsWidgetsVisible();
const auto settingsWidgetVisible = OCC::Theme::instance()->isSettingsWidgetsVisible();
_ui->callNotificationsCheckBox->setVisible(settingsWidgetVisible);
_ui->newExternalStorage->setVisible(settingsWidgetVisible);
_ui->showInExplorerNavigationPaneCheckBox->setVisible(settingsWidgetVisible);
Expand Down Expand Up @@ -279,7 +279,7 @@ void GeneralSettings::slotUpdateInfo()
if (ConfigFile().skipUpdateCheck() || !updater) {
// updater disabled on compile
_ui->updatesGroupBox->setVisible(false);
const auto settingsWidgetVisible = ConfigFile().isNcSettingsWidgetsVisible();
const auto settingsWidgetVisible = OCC::Theme::instance()->isSettingsWidgetsVisible();
_ui->restartButton->setVisible(settingsWidgetVisible);
_ui->updateButton->setVisible(settingsWidgetVisible);
return;
Expand Down Expand Up @@ -509,9 +509,9 @@ void GeneralSettings::customizeStyle()
slotUpdateInfo();
#else
_ui->updatesGroupBox->setVisible(false);
const auto widgetVisible = ConfigFile().isWidgetVisible();
_ui->restartButton->setVisible(widgetVisible);
_ui->updateButton->setVisible(widgetVisible);
const auto settingsWidgetVisible = OCC::Theme::instance()->isSettingsWidgetsVisible();
_ui->restartButton->setVisible(settingsWidgetVisible);
_ui->updateButton->setVisible(settingsWidgetVisible);
#endif
}

Expand Down
4 changes: 0 additions & 4 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,4 @@ void ConfigFile::setMacFileProviderModuleEnabled(const bool moduleEnabled)
settings.setValue(QLatin1String(macFileProviderModuleEnabledC), moduleEnabled);
}

bool ConfigFile::isNcSettingsWidgetsVisible() const
{
return _isNcSettingWidgetsVisible;
}
}
2 changes: 0 additions & 2 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
[[nodiscard]] bool showConfigBackupWarning() const;

bool exists();
bool isNcSettingsWidgetsVisible() const;

[[nodiscard]] QString defaultConnection() const;

Expand Down Expand Up @@ -245,7 +244,6 @@ class OWNCLOUDSYNC_EXPORT ConfigFile

static QString _confDir;
static QString _discoveredLegacyConfigPath;
bool _isNcSettingWidgetsVisible = true;
};
}
#endif // CONFIGFILE_H
5 changes: 5 additions & 0 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,11 @@ bool Theme::enforceVirtualFilesSyncFolder() const
return ENFORCE_VIRTUAL_FILES_SYNC_FOLDER && vfsMode != OCC::Vfs::Off;
}

bool Theme::isSettingsWidgetsVisible() const
{
return NEXTCLOUD_SETTINGS_WIDGET_VISIBLE;
}

QColor Theme::defaultColor()
{
return QColor{NEXTCLOUD_BACKGROUND_COLOR};
Expand Down
8 changes: 8 additions & 0 deletions src/libsync/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,13 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject

[[nodiscard]] bool enforceVirtualFilesSyncFolder() const;

/**
* @brief Whether to show certain widgets in the settings dialog.
*
* By default, the widgets are shown unless set otherwise via NEXTCLOUD_SETTINGS_WIDGET_VISIBLE
*/
bool isSettingsWidgetsVisible() const;

static QColor defaultColor();

static constexpr const char *themePrefix = ":/client/theme/";
Expand Down Expand Up @@ -644,6 +651,7 @@ public slots:
bool _forceOverrideServerUrl = false;
bool _isVfsEnabled = false;
bool _startLoginFlowAutomatically = false;
bool _isSettingWidgetsVisible = true;

#ifndef TOKEN_AUTH_ONLY
mutable QHash<QString, QIcon> _iconCache;
Expand Down

0 comments on commit 41117a8

Please sign in to comment.