diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 1968683e2341..d66f1a0a85e2 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -2,6 +2,9 @@ project(gui) find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network) find_package(KF5Archive REQUIRED) +#MNC change, its needed to fins the ui file in different location as the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + if(QUICK_COMPILER) find_package(Qt5QuickCompiler) set_package_properties(Qt5QuickCompiler PROPERTIES @@ -191,6 +194,15 @@ set(client_SRCS syncconflictsmodel.cpp fileactivitylistmodel.h fileactivitylistmodel.cpp + nmcgui/nmcaccountsettings.h + nmcgui/nmcaccountsettings.cpp + nmcgui/nmcgeneralsettings.h + nmcgui/nmcgeneralsettings.cpp + nmcgui/nmcguiinterface.h + nmcgui/nmcnetworksettings.h + nmcgui/nmcnetworksettings.cpp + nmcgui/nmcsettingsdialog.h + nmcgui/nmcsettingsdialog.cpp filedetails/datefieldbackend.h filedetails/datefieldbackend.cpp filedetails/filedetails.h diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 312e1fdf02e2..7bdbc4289b2a 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1111,7 +1111,7 @@ void AccountSettings::showConnectionLabel(const QString &message, QStringList er _ui->connectLabel->setToolTip({}); _ui->connectLabel->setStyleSheet(errStyle); } - _ui->accountStatus->setVisible(!message.isEmpty()); + //_ui->accountStatus->setVisible(!message.isEmpty()); } void AccountSettings::slotEnableCurrentFolder(bool terminate) @@ -1572,8 +1572,8 @@ void AccountSettings::refreshSelectiveSyncStatus() infoString += tr("There are folders that have grown in size beyond %1MB: %2").arg(folderSizeLimitString, becameBigFoldersString); } - _ui->selectiveSyncNotification->setText(infoString); - _ui->bigFolderUi->setVisible(!infoString.isEmpty()); + //_ui->selectiveSyncNotification->setText(infoString); + //_ui->bigFolderUi->setVisible(!infoString.isEmpty()); } bool AccountSettings::event(QEvent *e) diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index 1ddbc097d413..6cdde927a2e8 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -128,6 +128,9 @@ private slots: void checkClientSideEncryptionState(); void removeActionFromEncryptionMessage(const QString &actionId); +protected: + Ui::AccountSettings *_ui; + private: bool event(QEvent *) override; QAction *addActionToEncryptionMessage(const QString &actionTitle, const QString &actionId); @@ -137,8 +140,6 @@ private slots: /// Returns the alias of the selected folder, empty string if none [[nodiscard]] QString selectedFolderAlias() const; - Ui::AccountSettings *_ui; - FolderStatusModel *_model; QUrl _OCUrl; bool _wasDisabledBefore = false; diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h index 70a726142db8..8bd38f61851f 100644 --- a/src/gui/generalsettings.h +++ b/src/gui/generalsettings.h @@ -61,10 +61,11 @@ private slots: void slotToggleAutoUpdateCheck(); #endif +protected: + Ui::GeneralSettings *_ui; + private: void customizeStyle(); - - Ui::GeneralSettings *_ui; QPointer _ignoreEditor; bool _currentlyLoading = false; }; diff --git a/src/gui/networksettings.h b/src/gui/networksettings.h index 8e3a97c446b6..8548e71ef163 100644 --- a/src/gui/networksettings.h +++ b/src/gui/networksettings.h @@ -48,12 +48,11 @@ private slots: protected: void showEvent(QShowEvent *event) override; + Ui::NetworkSettings *_ui; private: void loadProxySettings(); void loadBWLimitSettings(); - - Ui::NetworkSettings *_ui; }; diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp new file mode 100644 index 000000000000..70ce72e8638d --- /dev/null +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -0,0 +1,77 @@ +/* + * 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 "nmcaccountsettings.h" +#include "accountsettings.h" +#include "ui_accountsettings.h" +#include "qdesktopservices.h" + + +namespace OCC { + +NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) + : AccountSettings(accountState, parent) +{ + setDefaultSettings(); + setLayout(); + setLogic(); +} + +void NMCAccountSettings::setDefaultSettings() +{ + //Set default settings + _ui->encryptionMessage->setCloseButtonVisible(true); + _ui->selectiveSyncStatus->setVisible(false); + _ui->selectiveSyncNotification->setVisible(false); + _ui->accountStatus->setVisible(false); + _ui->bigFolderUi->setVisible(false); +} + +void NMCAccountSettings::setLayout() +{ + //Fix layout + _ui->storageGroupBox->removeWidget(_ui->quotaInfoLabel); + _ui->storageGroupBox->removeWidget(_ui->quotaProgressBar); + + auto *quotaVLayout = new QVBoxLayout(this); + //auto *storage = new QLabel("test"); //Todo? Später zusammenbauen? + auto *quota = new QLabel("quota"); + quota->setText(tr("Speicherplatz zu ") + QString::number(_ui->quotaProgressBar->value() > 0 ? _ui->quotaProgressBar->value() : 0) + " %" + tr(" belegt")); //Todo + quotaVLayout->addWidget(_ui->quotaInfoLabel); + quotaVLayout->addWidget(_ui->quotaProgressBar); + quotaVLayout->addWidget(quota); + + auto *magentaHLayout = new QHBoxLayout(this); + magentaHLayout->addLayout(quotaVLayout); + auto *storageLinkButton = new QPushButton(this); + storageLinkButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + storageLinkButton->setFixedHeight(50); + connect(storageLinkButton, &QPushButton::clicked, this, [](){ + QDesktopServices::openUrl(QUrl("https://cloud.telekom-dienste.de/tarife")); + }); + storageLinkButton->setText(tr("Speicher erweitern")); + magentaHLayout->addWidget(storageLinkButton); + + _ui->gridLayout->addLayout(magentaHLayout, 0, 0); +} + +void NMCAccountSettings::setLogic() +{ + +} + + + + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcaccountsettings.h b/src/gui/nmcgui/nmcaccountsettings.h new file mode 100644 index 000000000000..dac11ebdc7c8 --- /dev/null +++ b/src/gui/nmcgui/nmcaccountsettings.h @@ -0,0 +1,45 @@ +/* + * 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_ACCOUNTSETTINGSMAGENTA_H +#define MIRALL_ACCOUNTSETTINGSMAGENTA_H + +#include "nmcguiinterface.h" +#include + +namespace OCC { + +/** + * @brief The AccountSettingsMagenta class + * @ingroup gui + */ +class NMCAccountSettings : public AccountSettings, public NMCGuiInterface +{ + Q_OBJECT + +public: + explicit NMCAccountSettings(AccountState *accountState, QWidget *parent = nullptr); + ~NMCAccountSettings() = default; + + // NMCGuiInterface interface +protected: + void setDefaultSettings() override final; + void setLayout() override final; + void setLogic() override final; + +}; + + +} // namespace OCC +#endif // MIRALL_ACCOUNTSETTINGSMAGENTA_H diff --git a/src/gui/nmcgui/nmcgeneralsettings.cpp b/src/gui/nmcgui/nmcgeneralsettings.cpp new file mode 100644 index 000000000000..13532e23a165 --- /dev/null +++ b/src/gui/nmcgui/nmcgeneralsettings.cpp @@ -0,0 +1,158 @@ +/* + * 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 "nmcgeneralsettings.h" +#include "GeneralSettings.h" +#include "ui_generalsettings.h" + + +namespace OCC { + +NMCGeneralSettings::NMCGeneralSettings(QWidget *parent) + : GeneralSettings(parent) +{ + setDefaultSettings(); + setLayout(); + setLogic(); +} + +void NMCGeneralSettings::setDefaultSettings() +{ + //Set default settings + //General settings + _ui->autostartCheckBox->setCheckState(Qt::Checked); + _ui->monoIconsCheckBox->setCheckState(Qt::Unchecked); + _ui->serverNotificationsCheckBox->setCheckState(Qt::Unchecked); + _ui->callNotificationsCheckBox->setCheckState(Qt::Unchecked); + //Advanced settings + _ui->newFolderLimitCheckBox->setCheckState(Qt::Unchecked); + //Info settings + _ui->aboutAndUpdatesGroupBox->setTitle(tr("Update")); + //Hide unsupported settings + //General settings + _ui->monoIconsCheckBox->setVisible(false); + _ui->callNotificationsCheckBox->setVisible(false); + //Advanced settings + _ui->groupBox->setVisible(false); + //Info settings + _ui->aboutAndUpdatesGroupBox->setVisible(false); +} + +void NMCGeneralSettings::setLayout() +{ + //Fix layout + //General settings + _ui->generalGroupBox->layout()->removeWidget(_ui->serverNotificationsCheckBox); + static_cast(_ui->generalGroupBox->layout())->addWidget(_ui->serverNotificationsCheckBox, 1, 0); + //Advanced settings + _ui->horizontalLayout_3->layout()->removeWidget(_ui->newFolderLimitCheckBox); + _ui->horizontalLayout_3->layout()->removeWidget(_ui->newFolderLimitSpinBox); + _ui->horizontalLayout_3->layout()->removeWidget(_ui->label); + + QWidget *folderLimit = new QWidget(this); + auto *folderHBoxLayout = new QHBoxLayout(this); + folderLimit->setLayout(folderHBoxLayout); + folderHBoxLayout->addWidget(_ui->newFolderLimitCheckBox); + folderHBoxLayout->addWidget(_ui->newFolderLimitSpinBox); + folderHBoxLayout->addWidget(_ui->label); + folderHBoxLayout->setContentsMargins(0,0,0,0); + + QGroupBox *advancedBox = new QGroupBox(this); + advancedBox->setTitle(_ui->groupBox->title()); + auto *advancedVBoxLayout = new QVBoxLayout(this); + advancedBox->setLayout(advancedVBoxLayout); + advancedVBoxLayout->addWidget(folderLimit); + _ui->gridLayout_3->addWidget(advancedBox, 2, 0); + + //Updates + _ui->updatesContainer->layout()->removeWidget(_ui->autoCheckForUpdatesCheckBox); + QGroupBox *aboutBox = new QGroupBox(this); + aboutBox->setTitle(_ui->aboutAndUpdatesGroupBox->title()); + aboutBox->setLayout(new QVBoxLayout); + aboutBox->layout()->addWidget(_ui->autoCheckForUpdatesCheckBox); + _ui->gridLayout_3->addWidget(aboutBox, 3, 0); + + //Datenschutz + QGroupBox *dataProtectionBox = new QGroupBox(this); + dataProtectionBox->setTitle(tr("DATA_PROTECTION")); + dataProtectionBox->setLayout(new QVBoxLayout); + dataProtectionBox->layout()->setContentsMargins(12,12,12,12); //Like in Nextcloud .ui file + dataProtectionBox->layout()->setSpacing(5); + + auto *dataAnalysisCheckBox = new QCheckBox(this); + //Todo, set key + dataAnalysisCheckBox->setText(tr("Analyse Datenerfassung TODO")); + dataProtectionBox->layout()->addWidget(dataAnalysisCheckBox); + dataProtectionBox->layout()->addItem(new QSpacerItem(1,5,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + auto *dataAnalysisImpressum = new QLabel(this); + dataAnalysisImpressum->setText("Impressum"); + dataAnalysisImpressum->setTextFormat(Qt::RichText); + dataAnalysisImpressum->setTextInteractionFlags(Qt::TextBrowserInteraction); + dataAnalysisImpressum->setOpenExternalLinks(true); + dataAnalysisImpressum->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + dataProtectionBox->layout()->addWidget(dataAnalysisImpressum); + + auto *dataAnalysisData = new QLabel(this); + dataAnalysisData->setText("Datenschutz"); + dataAnalysisData->setTextFormat(Qt::RichText); + dataAnalysisData->setTextInteractionFlags(Qt::TextBrowserInteraction); + dataAnalysisData->setOpenExternalLinks(true); + dataAnalysisData->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + dataProtectionBox->layout()->addWidget(dataAnalysisData); + + auto *dataAnalysisOpenSource = new QLabel(this); + dataAnalysisOpenSource->setText("Verwendete OpenSource Software"); + dataAnalysisOpenSource->setTextFormat(Qt::RichText); + dataAnalysisOpenSource->setTextInteractionFlags(Qt::TextBrowserInteraction); + dataAnalysisOpenSource->setOpenExternalLinks(true); + dataAnalysisOpenSource->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + dataProtectionBox->layout()->addWidget(dataAnalysisOpenSource); + + QWidget *versionLabel = new QWidget(this); + auto *versionLabelLayout = new QHBoxLayout(this); + versionLabel->setLayout(versionLabelLayout); + versionLabelLayout->setContentsMargins(0,0,0,0); + versionLabel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + + auto *currentVersion = new QLabel(this); + currentVersion->setText("MagentaCloud 2.34 Version not set."); + currentVersion->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + //Todo, set current version + versionLabelLayout->addWidget(currentVersion); + + auto *dataAnalysisFurtherInfo = new QLabel(this); + dataAnalysisFurtherInfo->setText("Further Informations"); + dataAnalysisFurtherInfo->setTextFormat(Qt::RichText); + dataAnalysisFurtherInfo->setTextInteractionFlags(Qt::TextBrowserInteraction); + dataAnalysisFurtherInfo->setOpenExternalLinks(true); + dataAnalysisFurtherInfo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + versionLabelLayout->addWidget(dataAnalysisFurtherInfo); + versionLabelLayout->layout()->addItem(new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Fixed)); + + dataProtectionBox->layout()->addWidget(versionLabel); + + _ui->gridLayout_3->addWidget(dataProtectionBox, 4, 0); + + auto *vExpandSpacer = new QSpacerItem(1,1,QSizePolicy::Fixed,QSizePolicy::Expanding); + _ui->gridLayout_3->layout()->addItem(vExpandSpacer); +} + +void NMCGeneralSettings::setLogic() +{ + +} + + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcgeneralsettings.h b/src/gui/nmcgui/nmcgeneralsettings.h new file mode 100644 index 000000000000..bb2443a4b826 --- /dev/null +++ b/src/gui/nmcgui/nmcgeneralsettings.h @@ -0,0 +1,44 @@ +/* + * 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_GENERALSETTINGSMAGENTA_H +#define MIRALL_GENERALSETTINGSMAGENTA_H + +#include "nmcguiinterface.h" +#include + +namespace OCC { + +/** + * @brief The GeneralSettingsMagenta class + * @ingroup gui + */ +class NMCGeneralSettings : public GeneralSettings, public NMCGuiInterface +{ + Q_OBJECT + +public: + explicit NMCGeneralSettings(QWidget *parent = nullptr); + ~NMCGeneralSettings() = default; + +// NMCGuiInterface interface +protected: + void setDefaultSettings() override final; + void setLayout() override final; + void setLogic() override final; +}; + + +} // namespace OCC +#endif // MIRALL_GENERALSETTINGSMAGENTA_H diff --git a/src/gui/nmcgui/nmcguiinterface.h b/src/gui/nmcgui/nmcguiinterface.h new file mode 100644 index 000000000000..a82ba8759933 --- /dev/null +++ b/src/gui/nmcgui/nmcguiinterface.h @@ -0,0 +1,42 @@ +/* + * 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_NMCGUIINTERFACE_H +#define MIRALL_NMCGUIINTERFACE_H + +namespace OCC { + +/** + * @brief The NMCGuiInterface class + * @ingroup gui + */ +class NMCGuiInterface +{ + +public: + explicit NMCGuiInterface() = default; + ~NMCGuiInterface() = default; + +protected: + virtual void setDefaultSettings() = 0; + virtual void setLayout() = 0; + virtual void setLogic() = 0; + +private: + +}; + + +} // namespace OCC +#endif // MIRALL_NMCGUIINTERFACE_H diff --git a/src/gui/nmcgui/nmcnetworksettings.cpp b/src/gui/nmcgui/nmcnetworksettings.cpp new file mode 100644 index 000000000000..7f680a80a76f --- /dev/null +++ b/src/gui/nmcgui/nmcnetworksettings.cpp @@ -0,0 +1,138 @@ +/* + * 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 "nmcnetworksettings.h" +#include "NetworkSettings.h" +#include "ui_networksettings.h" + + +namespace OCC { + +NMCNetworkSettings::NMCNetworkSettings(QWidget *parent) + : NetworkSettings(parent) +{ + setDefaultSettings(); + setLayout(); + setLogic(); +} + +void NMCNetworkSettings::setDefaultSettings() +{ + //Set default settings + _ui->manualSettings->setVisible(true); + _ui->manualSettings->setEnabled(false); + _ui->downloadSpinBox->setVisible(true); + if(_ui->downloadLimitRadioButton->isChecked()) + { + _ui->downloadSpinBox->setEnabled(true); + } + else{ + _ui->downloadSpinBox->setEnabled(false); + } + _ui->downloadSpinBoxLabel->setVisible(true); + _ui->uploadSpinBox->setVisible(true); + if(_ui->uploadLimitRadioButton->isChecked()) + { + _ui->uploadSpinBox->setEnabled(true); + } + else{ + _ui->uploadSpinBox->setEnabled(false); + } + _ui->uploadSpinBoxLabel->setVisible(true); +} + +void NMCNetworkSettings::setLayout() +{ + //Fix Layouts + //Proxy settings + _ui->manualSettings->layout()->removeItem(_ui->horizontalLayout_8); + auto *spinBoxWidget = new QWidget(this); + spinBoxWidget->setEnabled(false); + spinBoxWidget->setLayout(_ui->horizontalLayout_8); + _ui->horizontalLayout_8->setContentsMargins(0,0,0,0); + static_cast(_ui->proxyGroupBox->layout())->addWidget(spinBoxWidget, 2, 1); + disconnect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, _ui->manualSettings, &QWidget::setVisible); + connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, this, [this, spinBoxWidget](bool checked){ + _ui->manualSettings->setEnabled(checked); + spinBoxWidget->setEnabled(checked); + }); + + _ui->manualSettings->setContentsMargins(0,0,0,0); + _ui->manualSettings->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + _ui->horizontalSpacer_2->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + + //Remove spacer, so the elements can expand. + _ui->horizontalSpacer->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + + //DonwloadBox + _ui->downloadBox->layout()->removeItem(_ui->horizontalLayout_3); + static_cast(_ui->downloadBox->layout())->addItem(_ui->horizontalLayout_3, 3, 1); + _ui->verticalSpacer_2->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + _ui->downloadBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + _ui->horizontalLayout_3->setSpacing(5); + //UploadBox + _ui->uploadBox->layout()->removeItem(_ui->horizontalLayout_4); + static_cast(_ui->uploadBox->layout())->addItem(_ui->horizontalLayout_4, 2, 1); + _ui->verticalSpacer_3->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed); + _ui->uploadBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + _ui->horizontalLayout_4->setSpacing(5); + + //Fix widgets visibility + //Download settings + connect(_ui->noDownloadLimitRadioButton, &QAbstractButton::clicked, this, [this](){ + _ui->downloadSpinBox->setVisible(true); + _ui->downloadSpinBoxLabel->setVisible(true); + _ui->downloadSpinBox->setEnabled(false); + }); + connect(_ui->autoDownloadLimitRadioButton, &QAbstractButton::clicked, this, [this](){ + _ui->downloadSpinBox->setVisible(true); + _ui->downloadSpinBoxLabel->setVisible(true); + _ui->downloadSpinBox->setEnabled(false); + }); + connect(_ui->downloadLimitRadioButton, &QAbstractButton::clicked, this, [this](){ + _ui->downloadSpinBox->setVisible(true); + _ui->downloadSpinBoxLabel->setVisible(true); + _ui->downloadSpinBox->setEnabled(true); + }); + + + //Upload settings + connect(_ui->noUploadLimitRadioButton, &QAbstractButton::clicked, this, [this](){ + _ui->uploadSpinBox->setVisible(true); + _ui->uploadSpinBoxLabel->setVisible(true); + _ui->uploadSpinBox->setEnabled(false); + }); + connect(_ui->autoUploadLimitRadioButton, &QAbstractButton::clicked, this, [this](){ + _ui->uploadSpinBox->setVisible(true); + _ui->uploadSpinBoxLabel->setVisible(true); + _ui->uploadSpinBox->setEnabled(false); + }); + connect(_ui->uploadLimitRadioButton, &QAbstractButton::clicked, this, [this](){ + _ui->uploadSpinBox->setVisible(true); + _ui->uploadSpinBoxLabel->setVisible(true); + _ui->uploadSpinBox->setEnabled(true); + }); + + //Fix initial proxy warning, it shows a red border at initial state whenever the widget becomes visible + //Override the nextcloud stylesheet + _ui->hostLineEdit->setStyleSheet(QString()); +} + +void NMCNetworkSettings::setLogic() +{ + +} + + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcnetworksettings.h b/src/gui/nmcgui/nmcnetworksettings.h new file mode 100644 index 000000000000..d8294227d38a --- /dev/null +++ b/src/gui/nmcgui/nmcnetworksettings.h @@ -0,0 +1,44 @@ +/* + * 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 "nmcguiinterface.h" +#include + +namespace OCC { + +/** + * @brief The NetworkSettingsMagenta class + * @ingroup gui + */ +class NMCNetworkSettings : public NetworkSettings, public NMCGuiInterface +{ + Q_OBJECT + +public: + explicit NMCNetworkSettings(QWidget *parent = nullptr); + ~NMCNetworkSettings() = default; + +// NMCGuiInterface interface +protected: + void setDefaultSettings() override final; + void setLayout() override final; + void setLogic() override final; +}; + + +} // namespace OCC +#endif // MIRALL_NETWORKSETTINGSMAGENTA_H diff --git a/src/gui/nmcgui/nmcsettingsdialog.cpp b/src/gui/nmcgui/nmcsettingsdialog.cpp new file mode 100644 index 000000000000..e2f98344f48c --- /dev/null +++ b/src/gui/nmcgui/nmcsettingsdialog.cpp @@ -0,0 +1,31 @@ +/* + * 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 "QtWidgets/qtoolbar.h" +#include "settingsdialog.h" +#include "ui_settingsdialog.h" + + +namespace OCC { + +NMCSettingsDialog::NMCSettingsDialog(ownCloudGui *gui, QWidget *parent) + : SettingsDialog(gui, parent) +{ + + +} + + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcsettingsdialog.h b/src/gui/nmcgui/nmcsettingsdialog.h new file mode 100644 index 000000000000..ba888ab6cf79 --- /dev/null +++ b/src/gui/nmcgui/nmcsettingsdialog.h @@ -0,0 +1,40 @@ +/* + * 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_SETTINGSDIALOGMAGENTA_H +#define MIRALL_SETTINGSDIALOGMAGENTA_H + +#include + +namespace OCC { + +/** + * @brief The SettingsDialogMagenta class + * @ingroup gui + */ +class NMCSettingsDialog : public SettingsDialog +{ + Q_OBJECT + +public: + explicit NMCSettingsDialog(ownCloudGui *gui, QWidget *parent = nullptr); + ~NMCSettingsDialog() = default; + +private: + +}; + + +} // namespace OCC +#endif // MIRALL_SETTINGSDIALOGMAGENTA_H diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 6749df8a6e91..4e8ffd04e22a 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -28,7 +28,7 @@ #include "openfilemanager.h" #include "owncloudsetupwizard.h" #include "progressdispatcher.h" -#include "settingsdialog.h" +#include "nmcgui/nmcsettingsdialog.h" #include "theme.h" #include "wheelhandler.h" #include "syncconflictsmodel.h" @@ -569,7 +569,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); _settingsDialog->show(); } diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h index 8315fe228caa..cd4983457825 100644 --- a/src/gui/owncloudgui.h +++ b/src/gui/owncloudgui.h @@ -33,7 +33,7 @@ namespace OCC { class Folder; -class SettingsDialog; +class NMCSettingsDialog; class ShareDialog; class Application; class LogBrowser; @@ -112,7 +112,7 @@ private slots: private: QPointer _tray; - QPointer _settingsDialog; + QPointer _settingsDialog; QPointer _logBrowser; #ifdef WITH_LIBCLOUDPROVIDERS diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 130e5deac1c7..2829fa251e31 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -17,9 +17,9 @@ #include "folderman.h" #include "theme.h" -#include "generalsettings.h" -#include "networksettings.h" -#include "accountsettings.h" +#include "nmcgui/nmcgeneralsettings.h" +#include "nmcgui/nmcnetworksettings.h" +#include "nmcgui/nmcaccountsettings.h" #include "configfile.h" #include "progressdispatcher.h" #include "owncloudgui.h" @@ -120,16 +120,16 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General")); _actionGroup->addAction(generalAction); _toolBar->addAction(generalAction); - auto *generalSettings = new GeneralSettings; + auto *generalSettings = new NMCGeneralSettings; _ui->stack->addWidget(generalSettings); // Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching) - connect(this, &SettingsDialog::styleChanged, generalSettings, &GeneralSettings::slotStyleChanged); + connect(this, &SettingsDialog::styleChanged, generalSettings, &NMCGeneralSettings::slotStyleChanged); QAction *networkAction = createColorAwareAction(QLatin1String(":/client/theme/network.svg"), tr("Network")); _actionGroup->addAction(networkAction); _toolBar->addAction(networkAction); - auto *networkSettings = new NetworkSettings; + auto *networkSettings = new NMCNetworkSettings; _ui->stack->addWidget(networkSettings); connect(_ui->stack, &QStackedWidget::currentChanged, this, &SettingsDialog::currentPageChanged); @@ -243,7 +243,7 @@ void SettingsDialog::accountAdded(AccountState *s) } _toolBar->insertAction(_toolBar->actions().at(0), accountAction); - auto accountSettings = new AccountSettings(s, this); + auto accountSettings = new NMCAccountSettings(s, this); QString objectName = QLatin1String("accountSettings_"); objectName += s->account()->displayName(); accountSettings->setObjectName(objectName); @@ -305,7 +305,7 @@ void SettingsDialog::slotAccountDisplayNameChanged() void SettingsDialog::accountRemoved(AccountState *s) { for (auto it = _actionGroupWidgets.begin(); it != _actionGroupWidgets.end(); ++it) { - auto as = qobject_cast(*it); + auto as = qobject_cast(*it); if (!as) { continue; } diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h index 6034e21bbf99..bbed0deb7456 100644 --- a/src/gui/settingsdialog.h +++ b/src/gui/settingsdialog.h @@ -74,14 +74,16 @@ private slots: void accountAdded(OCC::AccountState *); void accountRemoved(OCC::AccountState *); +protected: + Ui::SettingsDialog *const _ui; + QToolBar *_toolBar; + private: void customizeStyle(); QAction *createColorAwareAction(const QString &iconName, const QString &fileName); QAction *createActionWithIcon(const QIcon &icon, const QString &text, const QString &iconPath = QString()); - Ui::SettingsDialog *const _ui; - QActionGroup *_actionGroup; // Maps the actions from the action group to the corresponding widgets QHash _actionGroupWidgets; @@ -90,8 +92,6 @@ private slots: // case the account avatar changes QHash _actionForAccount; - QToolBar *_toolBar; - ownCloudGui *_gui; }; }