diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 7f45acfeba5ed..3101819a7011a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -23,6 +23,9 @@ endif() configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc) set(theme_dir ${CMAKE_SOURCE_DIR}/theme) +#NMC customization: needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + set(client_UI_SRCS accountsettings.ui conflictdialog.ui @@ -259,6 +262,10 @@ set(client_SRCS integration/fileactionsmodel.cpp ) +file(GLOB NMC_FILES "nmcgui/*") +set(NMC_SRCS ${NMC_FILES}) +list(APPEND client_SRCS ${NMC_SRCS}) + if (NOT DISABLE_ACCOUNT_MIGRATION) list(APPEND client_SRCS legacyaccountselectiondialog.h diff --git a/src/gui/nmcgui/nmcsettingsdialog.cpp b/src/gui/nmcgui/nmcsettingsdialog.cpp new file mode 100644 index 0000000000000..51e2e2fbabdf4 --- /dev/null +++ b/src/gui/nmcgui/nmcsettingsdialog.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "nmcsettingsdialog.h" +#include "settingsdialog.h" + +#include +#include + +namespace OCC { + +NMCSettingsDialog::NMCSettingsDialog(ownCloudGui *gui, QWidget *parent) + : SettingsDialog(gui, parent) +{ + fixAccountButton(); + fixNavigationBackground(); +} + +void NMCSettingsDialog::slotAccountAvatarChanged() +{ + fixAccountButton(); +} + +void NMCSettingsDialog::fixAccountButton() const +{ + auto *toolbar = getToolBar(); + if (!toolbar) { + return; + } + + const auto actions = toolbar->actions(); + if (actions.isEmpty()) { + return; + } +} + +void NMCSettingsDialog::fixNavigationBackground() const +{ + auto *navigationScroll = findChild(QStringLiteral("settings_navigation_scroll")); + if (!navigationScroll) { + return; + } + + navigationScroll->setAttribute(Qt::WA_StyledBackground, true); + navigationScroll->setStyleSheet(QStringLiteral( + "QScrollArea#settings_navigation_scroll {" + " background: palette(light);" + " border-radius: 10px;" + " border: none;" + " padding: 4px;" + "}" + "QScrollArea#settings_navigation_scroll > QWidget > QWidget {" + " background: transparent;" + "}" + )); + + if (navigationScroll->viewport()) { + navigationScroll->viewport()->setAutoFillBackground(false); + navigationScroll->viewport()->setStyleSheet(QStringLiteral("background: transparent;")); + } +} + +} // namespace OCC \ No newline at end of file diff --git a/src/gui/nmcgui/nmcsettingsdialog.h b/src/gui/nmcgui/nmcsettingsdialog.h new file mode 100644 index 0000000000000..e643cff949f06 --- /dev/null +++ b/src/gui/nmcgui/nmcsettingsdialog.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef MIRALL_SETTINGSDIALOGMAGENTA_H +#define MIRALL_SETTINGSDIALOGMAGENTA_H + +#include + +namespace OCC { + +/** + * @brief The NMCSettingsDialog class + * + * This class represents the settings dialog specific to the Magenta theme. + * It inherits from SettingsDialog and provides additional functionalities + * or customizations related to the Magenta theme. + * + * @ingroup gui + */ +class NMCSettingsDialog : public SettingsDialog +{ + Q_OBJECT + +public: + /** + * @brief Constructor for NMCSettingsDialog + * + * @param gui Pointer to the ownCloudGui instance. + * @param parent Pointer to the parent QWidget (default is nullptr). + */ + explicit NMCSettingsDialog(ownCloudGui *gui, QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCSettingsDialog + */ + ~NMCSettingsDialog() = default; + +public slots: + /** + * @brief Slot for handling changes in the account avatar + */ + void slotAccountAvatarChanged(); + + // NMCGuiInterface interface + +private: + /** + * @brief Fixes the appearance of the account button + */ + void fixAccountButton() const; + /** + * @brief Fixes the appearance of the navigation background + */ + void fixNavigationBackground() const; +}; + +} // namespace OCC +#endif // MIRALL_SETTINGSDIALOGMAGENTA_H diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index a4510d013e401..411ee56140009 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -21,6 +21,7 @@ #include "owncloudsetupwizard.h" #include "progressdispatcher.h" #include "settingsdialog.h" +#include "nmcgui/nmcsettingsdialog.h" #include "theme.h" #include "wheelhandler.h" #include "syncconflictsmodel.h" @@ -621,7 +622,7 @@ void ownCloudGui::slotShowGuiMessage(const QString &title, const QString &messag void ownCloudGui::slotShowSettings() { if (_settingsDialog.isNull()) { - _settingsDialog = new SettingsDialog(this); + _settingsDialog = new NMCSettingsDialog(this); _settingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); #ifdef Q_OS_MACOS diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index d6e8336f83281..e411edc83781a 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -92,14 +92,14 @@ class CurrentPageSizeStackedWidget : public QStackedWidget constexpr auto TOOLBAR_CSS = QLatin1String( "QToolBar { background: transparent; margin: 0; padding: 0; border: none; spacing: 0; } " - "QToolBar QToolButton { background: transparent; border: none; margin: 0; padding: 8px 12px; font-size: 14px; border-radius: 8px; } " + "QToolBar QToolButton { background: transparent; border: none; margin: 0 0 8px; padding: 8px 12px; font-size: 14px; border-radius: 8px; } " "QToolBar QToolBarExtension { padding: 0; } " "QToolBar QToolButton:checked { background: palette(highlight); color: palette(highlighted-text); }" ); const float buttonSizeRatio = 1.618f; // golden ratio -constexpr auto settingsDialogDefaultWidth = 950; -constexpr auto settingsDialogDefaultHeight = 500; +constexpr auto settingsDialogDefaultWidth = 1024; +constexpr auto settingsDialogDefaultHeight = 666; /** display name with two lines that is displayed in the settings * If width is bigger than 0, the string will be ellided so it does not exceed that width @@ -119,7 +119,7 @@ QString shortDisplayNameForSettings(OCC::Account *account, int width) host = fm.elidedText(host, Qt::ElideMiddle, width); user = fm.elidedText(user, Qt::ElideRight, width); } - return QStringLiteral("%1\n%2").arg(user, host); + return QStringLiteral("%1").arg(user); } } @@ -410,6 +410,7 @@ void SettingsDialog::slotAccountDisplayNameChanged() QString displayName = account->displayName(); action->setText(displayName); auto height = _toolBar->sizeHint().height(); + action->setToolTip(shortDisplayNameForSettings(account, static_cast(height * buttonSizeRatio))); action->setIconText(shortDisplayNameForSettings(account, static_cast(height * buttonSizeRatio))); } } @@ -550,7 +551,7 @@ void SettingsDialog::setupUi() setLayout(mainLayout); _toolBar = new QToolBar; - _toolBar->setIconSize(QSize(32, 32)); + _toolBar->setIconSize(QSize(24, 24)); _toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); _toolBar->setOrientation(Qt::Vertical); _toolBar->setMovable(false); diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h index e79a7e4840990..89fda7984d296 100644 --- a/src/gui/settingsdialog.h +++ b/src/gui/settingsdialog.h @@ -43,13 +43,18 @@ class SettingsDialog : public QDialog QWidget* currentPage(); + QToolBar *getToolBar() const + { + return _toolBar; + } + public slots: void showFirstPage(); void showAccount(OCC::AccountState *account); void setInitialAccount(OCC::AccountState *account); void showIssuesList(OCC::AccountState *account); void slotSwitchPage(QAction *action); - void slotAccountAvatarChanged(); + virtual void slotAccountAvatarChanged(); void slotAccountDisplayNameChanged(); signals: @@ -67,11 +72,12 @@ private slots: void accountAdded(OCC::AccountState *); void accountRemoved(OCC::AccountState *); -private: +protected: void customizeStyle(); void requestStyleUpdate(); void updateAccountAvatar(const Account *account); +private: QAction *createColorAwareAction(const QString &iconName, const QString &fileName); QAction *createActionWithIcon(const QIcon &icon, const QString &text, const QString &iconPath = QString()); diff --git a/theme/account.svg b/theme/account.svg index 8168da5fa5ee5..bde174912436d 100644 --- a/theme/account.svg +++ b/theme/account.svg @@ -1,7 +1,7 @@ - - - - - + + + icon/user_file/user/default@svg + + - + \ No newline at end of file diff --git a/theme/network.svg b/theme/network.svg index ca6455df5b41e..2f9e7bdf3cc61 100644 --- a/theme/network.svg +++ b/theme/network.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + /svg/icon/home/wifi/default + + + + \ No newline at end of file diff --git a/theme/settings.svg b/theme/settings.svg index a9c68e4067248..434caf275d458 100644 --- a/theme/settings.svg +++ b/theme/settings.svg @@ -1,7 +1,7 @@ - - - - - + + + /svg/icon/service/settings/default + + - + \ No newline at end of file