Skip to content

Commit f2f079f

Browse files
committed
Merge #412 [stable-4.0] [master] 2003-General_Settings_Dialog
2 parents c455e74 + 92c51dd commit f2f079f

File tree

11 files changed

+416
-6
lines changed

11 files changed

+416
-6
lines changed

src/gui/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ endif()
2323
configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc)
2424
set(theme_dir ${CMAKE_SOURCE_DIR}/theme)
2525

26+
#NMC customization: needed to find the ui file in a different location than the header file
27+
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")
28+
2629
set(client_UI_SRCS
2730
accountsettings.ui
2831
conflictdialog.ui
@@ -260,6 +263,10 @@ set(client_SRCS
260263
wizard/wizardproxysettingsdialog.cpp
261264
)
262265

266+
file(GLOB NMC_FILES "nmcgui/*")
267+
set(NMC_SRCS ${NMC_FILES})
268+
list(APPEND client_SRCS ${NMC_SRCS})
269+
263270
if (NOT DISABLE_ACCOUNT_MIGRATION)
264271
list(APPEND client_SRCS
265272
legacyaccountselectiondialog.h

src/gui/generalsettings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ class GeneralSettings : public QWidget
3434
~GeneralSettings() override;
3535
[[nodiscard]] QSize sizeHint() const override;
3636

37+
protected:
38+
Ui::GeneralSettings *getUi() const
39+
{
40+
return _ui;
41+
}
42+
3743
public slots:
3844
void slotStyleChanged();
3945
#if defined(BUILD_UPDATER)

src/gui/ignorelisteditor.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<item row="0" column="0">
1818
<widget class="QGroupBox" name="groupBox">
1919
<property name="title">
20-
<string>Global Ignore Settings</string>
20+
<string/>
2121
</property>
2222
<layout class="QGridLayout" name="gridLayout_2">
2323
<item row="0" column="0">
@@ -33,7 +33,7 @@
3333
<item row="1" column="0">
3434
<widget class="QGroupBox" name="groupBox_2">
3535
<property name="title">
36-
<string>Files Ignored by Patterns</string>
36+
<string/>
3737
</property>
3838
<layout class="QGridLayout" name="gridLayout">
3939
<item row="0" column="0">
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
/*
2+
* Copyright (C) by Eugen Fischer
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but
10+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* for more details.
13+
*/
14+
15+
#include "nmcgeneralsettings.h"
16+
#include "generalsettings.h"
17+
#include "nmclibsync/nmcconfigfile.h"
18+
#include "ui_generalsettings.h"
19+
#include "theme.h"
20+
21+
22+
namespace OCC {
23+
24+
NMCGeneralSettings::NMCGeneralSettings(QWidget *parent)
25+
: GeneralSettings(parent)
26+
{
27+
setDefaultSettings();
28+
setNMCLayout();
29+
}
30+
31+
void NMCGeneralSettings::setDefaultSettings()
32+
{
33+
//Set default settings
34+
//General settings
35+
getUi()->autostartCheckBox->setCheckState(Qt::Checked);
36+
getUi()->monoIconsCheckBox->setCheckState(Qt::Unchecked);
37+
getUi()->serverNotificationsCheckBox->setCheckState(Qt::Unchecked);
38+
getUi()->callNotificationsCheckBox->setCheckState(Qt::Unchecked);
39+
getUi()->quotaWarningNotificationsCheckBox->setCheckState(Qt::Unchecked);
40+
//Advanced settings
41+
getUi()->newFolderLimitCheckBox->setCheckState(Qt::Unchecked);
42+
//Info settings
43+
getUi()->aboutAndUpdatesGroupBox->setTitle(tr("Update"));
44+
//Hide unsupported settings
45+
//General settings
46+
getUi()->monoIconsCheckBox->setVisible(false);
47+
getUi()->callNotificationsCheckBox->setVisible(false);
48+
getUi()->quotaWarningNotificationsCheckBox->setVisible(false);
49+
//Advanced settings
50+
getUi()->groupBox->setVisible(false);
51+
//Info settings
52+
getUi()->aboutAndUpdatesGroupBox->setVisible(false);
53+
}
54+
55+
void NMCGeneralSettings::setNMCLayout()
56+
{
57+
// General settings
58+
auto generalSettingsLabel = new QLabel(QCoreApplication::translate("", "GENERAL_SETTINGS"));
59+
generalSettingsLabel->setStyleSheet("font-size: 13px; font-weight: bold;");
60+
getUi()->chatNotificationsCheckBox->hide();
61+
getUi()->generalGroupBox->layout()->removeWidget(getUi()->chatNotificationsCheckBox);
62+
getUi()->generalGroupBox->layout()->removeWidget(getUi()->serverNotificationsCheckBox);
63+
getUi()->generalGroupBox->layout()->removeWidget(getUi()->autostartCheckBox);
64+
getUi()->generalGroupBox->layout()->removeWidget(getUi()->quotaWarningNotificationsCheckBox);
65+
getUi()->generalGroupBox->setTitle({});
66+
static_cast<QGridLayout *>(getUi()->generalGroupBox->layout())->addWidget(generalSettingsLabel, 0, 0);
67+
static_cast<QGridLayout *>(getUi()->generalGroupBox->layout())->addWidget(getUi()->autostartCheckBox, 1, 0);
68+
static_cast<QGridLayout *>(getUi()->generalGroupBox->layout())->addWidget(getUi()->serverNotificationsCheckBox, 2, 0);
69+
getUi()->generalGroupBox->layout()->setContentsMargins(16, 16, 16, 16);
70+
getUi()->generalGroupBox->layout()->setSpacing(8);
71+
72+
getUi()->autostartCheckBox->setFocusPolicy(Qt::FocusPolicy::NoFocus);
73+
getUi()->serverNotificationsCheckBox->setFocusPolicy(Qt::FocusPolicy::NoFocus);
74+
75+
// Advanced settings
76+
auto advancedSettingsLabel = new QLabel(QCoreApplication::translate("", "ADVANCED_SETTINGS"));
77+
advancedSettingsLabel->setStyleSheet("font-size: 13px; font-weight: bold;");
78+
QGroupBox *advancedSettingsBox = new QGroupBox(this);
79+
advancedSettingsBox->setTitle("");
80+
advancedSettingsBox->setLayout(new QVBoxLayout);
81+
advancedSettingsBox->layout()->setContentsMargins(16, 16, 16, 16);
82+
advancedSettingsBox->layout()->setSpacing(8);
83+
84+
// Entferne Widgets aus alten Layouts, falls notwendig
85+
getUi()->horizontalLayout_10->removeWidget(getUi()->showInExplorerNavigationPaneCheckBox);
86+
getUi()->horizontalLayout->removeWidget(getUi()->moveFilesToTrashCheckBox);
87+
getUi()->horizontalLayout_3->removeWidget(getUi()->newFolderLimitCheckBox);
88+
getUi()->horizontalLayout_3->removeWidget(getUi()->newFolderLimitSpinBox);
89+
getUi()->horizontalLayout_3->removeWidget(getUi()->label);
90+
getUi()->horizontalLayout_4->removeWidget(getUi()->ignoredFilesButton);
91+
92+
getUi()->ignoredFilesButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
93+
getUi()->ignoredFilesButton->setFocusPolicy(Qt::NoFocus);
94+
getUi()->ignoredFilesButton->setStyleSheet(R"(
95+
QPushButton {
96+
min-height: 32px;
97+
min-width: 200px;
98+
border: 1px solid black;
99+
color: black;
100+
background-color: #ededed;
101+
font-size: 13px;
102+
border-radius: 4px;
103+
}
104+
QPushButton:hover {
105+
background-color: white;
106+
}
107+
)");
108+
109+
advancedSettingsBox->layout()->addWidget(advancedSettingsLabel);
110+
advancedSettingsBox->layout()->addWidget(getUi()->showInExplorerNavigationPaneCheckBox);
111+
advancedSettingsBox->layout()->addWidget(getUi()->moveFilesToTrashCheckBox);
112+
113+
QHBoxLayout *folderLimitLayout = new QHBoxLayout;
114+
folderLimitLayout->setContentsMargins(0,0,0,0);
115+
folderLimitLayout->setSpacing(8);
116+
folderLimitLayout->addWidget(getUi()->newFolderLimitCheckBox);
117+
folderLimitLayout->addWidget(getUi()->newFolderLimitSpinBox);
118+
getUi()->newFolderLimitSpinBox->setFixedWidth(80);
119+
getUi()->newFolderLimitSpinBox->setFocusPolicy(Qt::NoFocus);
120+
folderLimitLayout->addWidget(getUi()->label);
121+
getUi()->label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
122+
folderLimitLayout->addStretch();
123+
124+
QWidget *folderLimitBox = new QWidget(this);
125+
folderLimitBox->setLayout(folderLimitLayout);
126+
folderLimitBox->setContentsMargins(0, 0, 0, 0);
127+
folderLimitBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
128+
129+
advancedSettingsBox->layout()->addWidget(folderLimitBox);
130+
advancedSettingsBox->layout()->addItem(new QSpacerItem(1, 8, QSizePolicy::Fixed, QSizePolicy::Fixed));
131+
advancedSettingsBox->layout()->addWidget(getUi()->ignoredFilesButton);
132+
133+
getUi()->showInExplorerNavigationPaneCheckBox->setFocusPolicy(Qt::FocusPolicy::NoFocus);
134+
getUi()->moveFilesToTrashCheckBox->setFocusPolicy(Qt::FocusPolicy::NoFocus);
135+
136+
getUi()->gridLayout_3->addWidget(advancedSettingsBox, 2, 0);
137+
138+
//Datenschutz
139+
auto updatesLabel = new QLabel(QCoreApplication::translate("", "UPDATES_SETTINGS"));
140+
updatesLabel->setStyleSheet("font-size: 13px; font-weight: bold;");
141+
QGroupBox *dataProtectionBox = new QGroupBox(this);
142+
dataProtectionBox->setTitle("");
143+
dataProtectionBox->setLayout(new QVBoxLayout);
144+
dataProtectionBox->layout()->setContentsMargins(16, 16, 16, 16);
145+
dataProtectionBox->layout()->setSpacing(8);
146+
147+
auto *dataAnalysisCheckBox = new QCheckBox(this);
148+
dataAnalysisCheckBox->setText(QCoreApplication::translate("", "DATA_ANALYSIS"));
149+
dataAnalysisCheckBox->setFocusPolicy(Qt::FocusPolicy::NoFocus);
150+
getUi()->autoCheckForUpdatesCheckBox->setFocusPolicy(Qt::FocusPolicy::NoFocus);
151+
152+
dataProtectionBox->layout()->addWidget(updatesLabel);
153+
dataProtectionBox->layout()->addWidget(getUi()->autoCheckForUpdatesCheckBox);
154+
dataProtectionBox->layout()->addWidget(dataAnalysisCheckBox);
155+
156+
connect(dataAnalysisCheckBox, &QAbstractButton::toggled, this, [](bool toggle){
157+
NMCConfigFile cfgFile;
158+
cfgFile.setTransferUsageData(toggle, QString());
159+
});
160+
NMCConfigFile cfgFile;
161+
dataAnalysisCheckBox->setChecked(cfgFile.transferUsageData());
162+
163+
dataProtectionBox->layout()->addItem(new QSpacerItem(1,8,QSizePolicy::Fixed,QSizePolicy::Fixed));
164+
165+
auto *dataAnalysisImpressum = new QLabel(this);
166+
dataAnalysisImpressum->setText(QString("<a href=\"https://www.telekom.de/impressum/\"><span style=\"color:#2238df\">%1</span></a>").arg(QCoreApplication::translate("", "IMPRESSUM")));
167+
dataAnalysisImpressum->setTextFormat(Qt::RichText);
168+
dataAnalysisImpressum->setTextInteractionFlags(Qt::TextBrowserInteraction);
169+
dataAnalysisImpressum->setOpenExternalLinks(true);
170+
dataAnalysisImpressum->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
171+
dataAnalysisImpressum->setStyleSheet("font-size: 13px");
172+
dataProtectionBox->layout()->addWidget(dataAnalysisImpressum);
173+
174+
auto *dataAnalysisData = new QLabel(this);
175+
dataAnalysisData->setText(QString("<a href=\"https://static.magentacloud.de/privacy/datenschutzhinweise_software.pdf\"><span style=\"color:#2238df\">%1</span></a>").arg(QCoreApplication::translate("", "DATA_PROTECTION")));
176+
dataAnalysisData->setTextFormat(Qt::RichText);
177+
dataAnalysisData->setTextInteractionFlags(Qt::TextBrowserInteraction);
178+
dataAnalysisData->setOpenExternalLinks(true);
179+
dataAnalysisData->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
180+
dataAnalysisData->setStyleSheet("font-size: 13px");
181+
dataProtectionBox->layout()->addWidget(dataAnalysisData);
182+
183+
auto *dataAnalysisOpenSource = new QLabel(this);
184+
dataAnalysisOpenSource->setText(QString("<a href=\"https://static.magentacloud.de/licences/windowsdesktop.html\"><span style=\"color:#2238df\">%1</span></a>").arg(QCoreApplication::translate("", "LICENCE")));
185+
dataAnalysisOpenSource->setTextFormat(Qt::RichText);
186+
dataAnalysisOpenSource->setTextInteractionFlags(Qt::TextBrowserInteraction);
187+
dataAnalysisOpenSource->setOpenExternalLinks(true);
188+
dataAnalysisOpenSource->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
189+
dataAnalysisOpenSource->setStyleSheet("font-size: 13px");
190+
dataProtectionBox->layout()->addWidget(dataAnalysisOpenSource);
191+
192+
auto *dataAnalysisFurtherInfo = new QLabel(this);
193+
dataAnalysisFurtherInfo->setText(QString("<a href=\"https://cloud.telekom-dienste.de/hilfe\"><span style=\"color:#2238df\">%1</span></a>").arg(QCoreApplication::translate("", "FURTHER_INFO")));
194+
dataAnalysisFurtherInfo->setTextFormat(Qt::RichText);
195+
dataAnalysisFurtherInfo->setTextInteractionFlags(Qt::TextBrowserInteraction);
196+
dataAnalysisFurtherInfo->setOpenExternalLinks(true);
197+
dataAnalysisFurtherInfo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
198+
dataAnalysisFurtherInfo->setStyleSheet("font-size: 13px");
199+
dataProtectionBox->layout()->addWidget(dataAnalysisFurtherInfo);
200+
201+
dataProtectionBox->layout()->addItem(new QSpacerItem(1,8,QSizePolicy::Fixed,QSizePolicy::Fixed));
202+
203+
auto *currentVersion = new QLabel(this);
204+
currentVersion->setText(Theme::instance()->about());
205+
currentVersion->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
206+
//Todo, set current version
207+
dataProtectionBox->layout()->addWidget(currentVersion);
208+
209+
getUi()->gridLayout_3->addWidget(dataProtectionBox, 3, 0);
210+
211+
auto *vExpandSpacer = new QSpacerItem(1,1,QSizePolicy::Fixed,QSizePolicy::Expanding);
212+
getUi()->gridLayout_3->addItem(vExpandSpacer, 99, 0);
213+
}
214+
215+
} // namespace OCC
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (C) by Eugen Fischer
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but
10+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* for more details.
13+
*/
14+
15+
#ifndef MIRALL_GENERALSETTINGSMAGENTA_H
16+
#define MIRALL_GENERALSETTINGSMAGENTA_H
17+
18+
#include "generalsettings.h"
19+
20+
namespace OCC {
21+
22+
/**
23+
* @brief The NMCGeneralSettings class
24+
*
25+
* This class represents the Magenta-specific implementation of general settings
26+
* for a graphical user interface. It inherits from the base class GeneralSettings.
27+
*
28+
* @ingroup gui
29+
*/
30+
class NMCGeneralSettings : public GeneralSettings
31+
{
32+
Q_OBJECT
33+
34+
public:
35+
/**
36+
* @brief Constructor for NMCGeneralSettings
37+
*
38+
* Creates an instance of NMCGeneralSettings with the specified parent widget.
39+
*
40+
* @param parent The parent widget (default is nullptr).
41+
*/
42+
explicit NMCGeneralSettings(QWidget *parent = nullptr);
43+
44+
/**
45+
* @brief Destructor for NMCGeneralSettings
46+
*/
47+
~NMCGeneralSettings() = default;
48+
49+
protected:
50+
/**
51+
* @brief Set default settings
52+
*
53+
* Sets the default values for Magenta-specific general settings.
54+
*/
55+
void setDefaultSettings();
56+
57+
/**
58+
* @brief Set layout
59+
*
60+
* Sets the layout for the Magenta-specific general settings user interface.
61+
*/
62+
void setNMCLayout();
63+
};
64+
65+
} // namespace OCC
66+
#endif // MIRALL_GENERALSETTINGSMAGENTA_H

src/gui/settingsdialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "folderman.h"
1111
#include "theme.h"
1212
#include "generalsettings.h"
13+
#include "nmcgui/nmcgeneralsettings.h"
1314
#include "networksettings.h"
1415
#include "accountsettings.h"
1516
#include "configfile.h"
@@ -114,7 +115,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
114115
QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General"));
115116
_actionGroup->addAction(generalAction);
116117
_toolBar->addAction(generalAction);
117-
auto *generalSettings = new GeneralSettings;
118+
auto *generalSettings = new NMCGeneralSettings;
118119
_ui->stack->addWidget(generalSettings);
119120

120121
// Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching)

src/libsync/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ set(libsync_SRCS
164164
caseclashconflictsolver.cpp
165165
)
166166

167+
file(GLOB NMC_FILES "nmclibsync/*")
168+
set(NMC_SRCS ${NMC_FILES})
169+
list(APPEND libsync_SRCS ${NMC_SRCS})
170+
167171
if (WIN32)
168172
# to fix warnings from ntstatus.h
169173
add_definitions(-DUMDF_USING_NTSTATUS)

src/libsync/configfile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
309309
[[nodiscard]] QVariant retrieveData(const QString &group, const QString &key) const;
310310
void removeData(const QString &group, const QString &key);
311311
[[nodiscard]] bool dataExists(const QString &group, const QString &key) const;
312-
313-
private:
314312
[[nodiscard]] QVariant getValue(const QString &param, const QString &group = QString(),
315313
const QVariant &defaultValue = QVariant()) const;
314+
315+
private:
316316
void setValue(const QString &key, const QVariant &value);
317317

318318
[[nodiscard]] QString keychainProxyPasswordKey() const;

0 commit comments

Comments
 (0)