diff --git a/CMakeLists.txt b/CMakeLists.txt index 27102a6f0e7cd..2434776e7b040 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,9 @@ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES) set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(NMC_RCC_FILE "nmctheme_v1.rcc") +configure_file(${CMAKE_SOURCE_DIR}/${NMC_RCC_FILE} "${BIN_OUTPUT_DIRECTORY}/${NMC_RCC_FILE}" COPYONLY) + include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake) set(QT_VERSION_MAJOR "6") @@ -341,6 +344,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) if(BUILD_OWNCLOUD_OSX_BUNDLE) install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/) configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY) + install(FILES nmctheme_v1.rcc DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/) elseif(BUILD_CLIENT) install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} ) configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY) diff --git a/nmctheme_v1.rcc b/nmctheme_v1.rcc new file mode 100644 index 0000000000000..1e673f886e4f5 Binary files /dev/null and b/nmctheme_v1.rcc differ diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 9660bfb7ee7f2..0402a9c1a26c2 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -3,6 +3,9 @@ find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick Qui find_package(KF6Archive REQUIRED) find_package(KF6GuiAddons) +#NMC change, its needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + if (NOT TARGET Qt::GuiPrivate) message(FATAL_ERROR "Could not find GuiPrivate component of Qt. It might be shipped as a separate package, please check that.") endif() @@ -251,6 +254,10 @@ set(client_SRCS wizard/linklabel.cpp ) +file(GLOB NMC_FILES "nmcgui/*") +set(NMC_SRCS ${NMC_FILES}) +list(APPEND client_SRCS ${NMC_SRCS}) + if (WITH_WEBENGINE) list(APPEND client_SRCS wizard/webviewpage.h @@ -618,6 +625,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements) install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin) install(FILES ${client_I18N} DESTINATION i18n) + install(FILES ${CMAKE_SOURCE_DIR}/nmctheme_v1.rcc DESTINATION bin) endif() # we may not add MACOSX_BUNDLE here, if not building one diff --git a/src/gui/main.cpp b/src/gui/main.cpp index e91fb3be9a1f4..f9a92fda2d1be 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -57,6 +57,14 @@ int main(int argc, char **argv) qputenv("QML_IMPORT_PATH", (QDir::currentPath() + QStringLiteral("/qml")).toLatin1()); #endif + bool resourceLoaded = false; + const QString currentPath = QDir::currentPath(); + if(Utility::isMac()) { + resourceLoaded = QResource::registerResource(QDir::toNativeSeparators("/Applications/MagentaCLOUD.app/Contents/Resources/nmctheme_v1.rcc")); + } else if(Utility::isWindows() || !resourceLoaded) { + resourceLoaded = QResource::registerResource(QDir::toNativeSeparators(currentPath + "/nmctheme_v1.rcc")); + } + Q_INIT_RESOURCE(resources); Q_INIT_RESOURCE(theme); diff --git a/src/gui/networksettings.h b/src/gui/networksettings.h index 6fa95bd903381..0eb5426844ce3 100644 --- a/src/gui/networksettings.h +++ b/src/gui/networksettings.h @@ -39,6 +39,11 @@ class NetworkSettings : public QWidget ~NetworkSettings() override; [[nodiscard]] QSize sizeHint() const override; + Ui::NetworkSettings *getUi() const + { + return _ui; + } + private slots: void saveProxySettings(); void saveBWLimitSettings(); diff --git a/src/gui/nmcgui/nmcnetworksettings.cpp b/src/gui/nmcgui/nmcnetworksettings.cpp new file mode 100644 index 0000000000000..1e9eab21ffc5a --- /dev/null +++ b/src/gui/nmcgui/nmcnetworksettings.cpp @@ -0,0 +1,109 @@ +/* + * 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 "nmcgui/nmcnetworksettings.h" +#include "networksettings.h" +#include "ui_networksettings.h" + + +namespace OCC { + +NMCNetworkSettings::NMCNetworkSettings(const AccountPtr &account, QWidget *parent) + : NetworkSettings(account, parent) +{ + setLayout(); +} + +void NMCNetworkSettings::setLayout() +{ + //Fix Layouts + //Proxy settings + getUi()->proxyGroupBox->setTitle(""); + getUi()->proxyGroupBox->layout()->removeWidget(getUi()->manualProxyRadioButton); + getUi()->proxyGroupBox->layout()->removeWidget(getUi()->noProxyRadioButton); + getUi()->proxyGroupBox->layout()->removeWidget(getUi()->systemProxyRadioButton); + getUi()->proxyGroupBox->layout()->removeItem(getUi()->horizontalLayout_7); + getUi()->proxyGroupBox->layout()->removeItem(getUi()->horizontalSpacer_2); + getUi()->proxyGroupBox->layout()->setContentsMargins(16,16,16,16); + getUi()->proxyGroupBox->setStyleSheet("QGroupBox { background-color: white; border-radius: 4px; }"); + + QGridLayout *proxyLayout = static_cast(getUi()->proxyGroupBox->layout()); + auto proxyLabel = new QLabel(QCoreApplication::translate("", "PROXY_SETTINGS")); + proxyLabel->setStyleSheet("QLabel{font-size: 12px; font-weight: bold;}"); + + proxyLayout->addWidget(proxyLabel, 0, 0 ); + proxyLayout->addItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0); + proxyLayout->addWidget(getUi()->noProxyRadioButton, 2, 0 ); + proxyLayout->addWidget(getUi()->systemProxyRadioButton, 3, 0 ); + proxyLayout->addWidget(getUi()->manualProxyRadioButton, 4, 0 ); + proxyLayout->addLayout(getUi()->horizontalLayout_7, 5, 0); + + //Remove the spacer, so the elements can expand. + getUi()->horizontalSpacer->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + + //DownloadBox + getUi()->verticalSpacer_2->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + getUi()->downloadBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + getUi()->horizontalLayout_3->setSpacing(8); + getUi()->downloadBox->setTitle(""); + getUi()->downloadBox->layout()->removeWidget(getUi()->noDownloadLimitRadioButton); + getUi()->downloadBox->layout()->removeWidget(getUi()->autoDownloadLimitRadioButton); + getUi()->downloadBox->layout()->removeWidget(getUi()->downloadLimitRadioButton); + getUi()->downloadBox->layout()->removeItem(getUi()->horizontalLayout_3); + getUi()->downloadBox->layout()->setContentsMargins(16,16,16,16); + getUi()->downloadBox->setStyleSheet("QGroupBox { background-color: white; border-radius: 4px; }"); + + QGridLayout *downLayout = static_cast(getUi()->downloadBox->layout()); + + auto downLabel = new QLabel(QCoreApplication::translate("", "DOWNLOAD_BANDWIDTH")); + downLabel->setStyleSheet("QLabel{font-size: 12px; font-weight: bold;}"); + downLayout->addWidget(downLabel, 0, 0 ); + downLayout->addItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0); + downLayout->addWidget(getUi()->noDownloadLimitRadioButton, 2, 0 ); + downLayout->addWidget(getUi()->autoDownloadLimitRadioButton, 3, 0 ); + downLayout->addWidget(getUi()->downloadLimitRadioButton, 4, 0 ); + downLayout->addItem(getUi()->horizontalLayout_3, 4, 1); + + getUi()->downloadLimitRadioButton->setFixedHeight(getUi()->downloadSpinBox->height()); + + //UploadBox + getUi()->uploadBox->layout()->removeItem(getUi()->horizontalLayout_4); + static_cast(getUi()->uploadBox->layout())->addItem(getUi()->horizontalLayout_4, 2, 1); + + getUi()->verticalSpacer_3->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + getUi()->uploadBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + getUi()->horizontalLayout_4->setSpacing(8); + getUi()->uploadBox->setTitle(""); + getUi()->uploadBox->layout()->removeWidget(getUi()->noUploadLimitRadioButton); + getUi()->uploadBox->layout()->removeWidget(getUi()->autoUploadLimitRadioButton); + getUi()->uploadBox->layout()->removeWidget(getUi()->uploadLimitRadioButton); + getUi()->uploadBox->layout()->removeItem(getUi()->horizontalLayout_4); + getUi()->uploadBox->layout()->setContentsMargins(16,16,16,16); + getUi()->uploadBox->setStyleSheet("QGroupBox { background-color: white; border-radius: 4px; }"); + + QGridLayout *upLayout = static_cast(getUi()->uploadBox->layout()); + + auto uploadLabel = new QLabel(QCoreApplication::translate("", "UPLOAD_BANDWIDTH")); + uploadLabel->setStyleSheet("QLabel{font-size: 12px; font-weight: bold;}"); + upLayout->addWidget(uploadLabel, 0, 0 ); + upLayout->addItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0); + upLayout->addWidget(getUi()->noUploadLimitRadioButton, 2, 0 ); + upLayout->addWidget(getUi()->autoUploadLimitRadioButton, 3, 0 ); + upLayout->addWidget(getUi()->uploadLimitRadioButton, 4, 0 ); + upLayout->addItem(getUi()->horizontalLayout_4, 4, 1); + + getUi()->uploadLimitRadioButton->setFixedHeight(getUi()->uploadSpinBox->height()); +} + +} // namespace OCC \ No newline at end of file diff --git a/src/gui/nmcgui/nmcnetworksettings.h b/src/gui/nmcgui/nmcnetworksettings.h new file mode 100644 index 0000000000000..6254fb727b3b9 --- /dev/null +++ b/src/gui/nmcgui/nmcnetworksettings.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) by Daniel Molkentin + * + * 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_NETWORKSETTINGSMAGENTA_H +#define MIRALL_NETWORKSETTINGSMAGENTA_H + +#include "networksettings.h" + +namespace OCC { + +/** + * @brief The NMCNetworkSettings class + * @ingroup gui + * @brief Derived class for network settings specific to NMC (Magenta) in the ownCloud client. + */ +class NMCNetworkSettings : public NetworkSettings +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCNetworkSettings object. + * @param parent Pointer to the parent QWidget. + */ + explicit NMCNetworkSettings(const AccountPtr &account = {}, QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCNetworkSettings. + */ + ~NMCNetworkSettings() = default; + +private: + /** + * @brief Sets the layout for the network settings specific to NMC (Magenta). + */ + void setLayout(); +}; + +} // namespace OCC +#endif // MIRALL_NETWORKSETTINGSMAGENTA_H \ No newline at end of file diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index a59314a15ce73..63dbe26c98884 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -19,6 +19,7 @@ #include "theme.h" #include "generalsettings.h" #include "networksettings.h" +#include "nmcgui/nmcnetworksettings.h" #include "accountsettings.h" #include "configfile.h" #include "progressdispatcher.h" @@ -131,7 +132,8 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) QAction *networkAction = createColorAwareAction(QLatin1String(":/client/theme/network.svg"), tr("Network")); _actionGroup->addAction(networkAction); _toolBar->addAction(networkAction); - auto *networkSettings = new NetworkSettings; + // auto *networkSettings = new NetworkSettings; + auto *networkSettings = new NMCNetworkSettings; _ui->stack->addWidget(networkSettings); _actionGroupWidgets.insert(generalAction, generalSettings);