Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subclass settings test PR #60

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/gui/accountsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/gui/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ private slots:
void slotToggleAutoUpdateCheck();
#endif

protected:
Ui::GeneralSettings *_ui;

private:
void customizeStyle();

Ui::GeneralSettings *_ui;
QPointer<IgnoreListEditor> _ignoreEditor;
bool _currentlyLoading = false;
};
Expand Down
3 changes: 1 addition & 2 deletions src/gui/networksettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ private slots:

protected:
void showEvent(QShowEvent *event) override;
Ui::NetworkSettings *_ui;

private:
void loadProxySettings();
void loadBWLimitSettings();

Ui::NetworkSettings *_ui;
};


Expand Down
77 changes: 77 additions & 0 deletions src/gui/nmcgui/nmcaccountsettings.cpp
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions src/gui/nmcgui/nmcaccountsettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) by Daniel Molkentin <[email protected]>
*
* 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 <accountsettings.h>

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
158 changes: 158 additions & 0 deletions src/gui/nmcgui/nmcgeneralsettings.cpp
Original file line number Diff line number Diff line change
@@ -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<QGridLayout *>(_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("<a href=\"https://www.telekom.de/impressum/\"><span style=\"color:#ea0a8e\">Impressum</span></a>");
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("<a href=\"https://www.telekom.de/impressum/\"><span style=\"color:#ea0a8e\">Datenschutz</span></a>");
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("<a href=\"https://static.magentacloud.de/licences/windowsdesktop.html\"><span style=\"color:#ea0a8e\">Verwendete OpenSource Software</span></a>");
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("<a href=\"https://cloud.telekom-dienste.de/hilfe\"><span style=\"color:#ea0a8e\">Further Informations</span></a>");
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
Loading