Skip to content

Commit 480066a

Browse files
committed
Merge #407 [stable-4.0] [master] 2003-Network_Settings_Dialog
2 parents 18b710a + cb58885 commit 480066a

File tree

4 files changed

+184
-2
lines changed

4 files changed

+184
-2
lines changed

src/gui/networksettings.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ class NetworkSettings : public QWidget
3131
~NetworkSettings() override;
3232
[[nodiscard]] QSize sizeHint() const override;
3333

34+
Ui::NetworkSettings *getUi() const
35+
{
36+
return _ui;
37+
}
38+
3439
private slots:
3540
void saveProxySettings();
3641
void saveBWLimitSettings();

src/gui/networksettings.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
<string>Limit to 3/4 of estimated bandwidth</string>
338338
</property>
339339
<property name="text">
340-
<string>Limit automatically</string>
340+
<string>Limit to 3/4 of estimated bandwidth</string>
341341
</property>
342342
</widget>
343343
</item>
@@ -460,7 +460,7 @@
460460
<string>Limit to 3/4 of estimated bandwidth</string>
461461
</property>
462462
<property name="text">
463-
<string>Limit automatically</string>
463+
<string>Limit to 3/4 of estimated bandwidth</string>
464464
</property>
465465
</widget>
466466
</item>
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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 "nmcgui/nmcnetworksettings.h"
16+
#include "networksettings.h"
17+
#include "ui_networksettings.h"
18+
19+
#include <QLabel>
20+
#include <QSpacerItem>
21+
#include <QGridLayout>
22+
#include <QSizePolicy>
23+
#include <QCoreApplication>
24+
25+
namespace OCC {
26+
27+
NMCNetworkSettings::NMCNetworkSettings(const AccountPtr &account, QWidget *parent)
28+
: NetworkSettings(account, parent)
29+
{
30+
setLayout();
31+
}
32+
33+
void NMCNetworkSettings::setLayout()
34+
{
35+
auto *ui = getUi();
36+
37+
//
38+
// Proxy Settings
39+
//
40+
ui->proxyGroupBox->setTitle({});
41+
ui->proxyGroupBox->layout()->removeWidget(ui->manualProxyRadioButton);
42+
ui->proxyGroupBox->layout()->removeWidget(ui->noProxyRadioButton);
43+
ui->proxyGroupBox->layout()->removeWidget(ui->systemProxyRadioButton);
44+
ui->proxyGroupBox->layout()->removeItem(ui->horizontalLayout_7);
45+
ui->proxyGroupBox->layout()->removeItem(ui->horizontalSpacer_2);
46+
ui->proxyGroupBox->layout()->setContentsMargins(16, 16, 16, 16);
47+
ui->proxyGroupBox->setStyleSheet("border-radius: 4px;");
48+
49+
auto *proxyLayout = qobject_cast<QGridLayout *>(ui->proxyGroupBox->layout());
50+
auto *proxyLabel = new QLabel(QCoreApplication::translate("", "PROXY_SETTINGS"));
51+
proxyLabel->setStyleSheet("font-size: 12px; font-weight: bold;");
52+
53+
proxyLayout->addWidget(proxyLabel, 0, 0);
54+
proxyLayout->addItem(new QSpacerItem(1, 8, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
55+
proxyLayout->addWidget(ui->noProxyRadioButton, 2, 0);
56+
proxyLayout->addWidget(ui->systemProxyRadioButton, 3, 0);
57+
proxyLayout->addWidget(ui->manualProxyRadioButton, 4, 0);
58+
proxyLayout->addLayout(ui->horizontalLayout_7, 5, 0);
59+
60+
ui->horizontalSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
61+
ui->proxyGroupBox->setStyleSheet(ui->proxyGroupBox->styleSheet());
62+
63+
//
64+
// Download Bandwidth
65+
//
66+
ui->verticalSpacer_2->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
67+
ui->downloadBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
68+
ui->horizontalLayout_3->setSpacing(8);
69+
ui->downloadBox->setTitle({});
70+
ui->downloadBox->layout()->removeWidget(ui->noDownloadLimitRadioButton);
71+
ui->downloadBox->layout()->removeWidget(ui->autoDownloadLimitRadioButton);
72+
ui->downloadBox->layout()->removeWidget(ui->downloadLimitRadioButton);
73+
ui->downloadBox->layout()->removeItem(ui->horizontalLayout_3);
74+
ui->downloadBox->layout()->setContentsMargins(16, 16, 16, 16);
75+
ui->downloadBox->setStyleSheet("border-radius: 4px;");
76+
77+
auto *downLayout = qobject_cast<QGridLayout *>(ui->downloadBox->layout());
78+
auto *downLabel = new QLabel(QCoreApplication::translate("", "DOWNLOAD_BANDWIDTH"));
79+
downLabel->setStyleSheet("font-size: 12px; font-weight: bold;");
80+
81+
downLayout->addWidget(downLabel, 0, 0);
82+
downLayout->addItem(new QSpacerItem(1, 8, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
83+
downLayout->addWidget(ui->noDownloadLimitRadioButton, 2, 0);
84+
downLayout->addWidget(ui->autoDownloadLimitRadioButton, 3, 0);
85+
downLayout->addWidget(ui->downloadLimitRadioButton, 4, 0);
86+
downLayout->addLayout(ui->horizontalLayout_3, 4, 1);
87+
88+
ui->downloadLimitRadioButton->setFixedHeight(ui->downloadSpinBox->height());
89+
ui->downloadBox->setStyleSheet(ui->downloadBox->styleSheet());
90+
91+
//
92+
// Upload Bandwidth
93+
//
94+
ui->verticalSpacer_3->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
95+
ui->uploadBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
96+
ui->horizontalLayout_4->setSpacing(8);
97+
ui->uploadBox->setTitle({});
98+
ui->uploadBox->layout()->removeWidget(ui->noUploadLimitRadioButton);
99+
ui->uploadBox->layout()->removeWidget(ui->autoUploadLimitRadioButton);
100+
ui->uploadBox->layout()->removeWidget(ui->uploadLimitRadioButton);
101+
ui->uploadBox->layout()->removeItem(ui->horizontalLayout_4);
102+
ui->uploadBox->layout()->setContentsMargins(16, 16, 16, 16);
103+
ui->uploadBox->setStyleSheet("border-radius: 4px;");
104+
105+
auto *upLayout = qobject_cast<QGridLayout *>(ui->uploadBox->layout());
106+
auto *upLabel = new QLabel(QCoreApplication::translate("", "UPLOAD_BANDWIDTH"));
107+
upLabel->setStyleSheet("font-size: 12px; font-weight: bold;");
108+
109+
upLayout->addWidget(upLabel, 0, 0);
110+
upLayout->addItem(new QSpacerItem(1, 8, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
111+
upLayout->addWidget(ui->noUploadLimitRadioButton, 2, 0);
112+
upLayout->addWidget(ui->autoUploadLimitRadioButton, 3, 0);
113+
upLayout->addWidget(ui->uploadLimitRadioButton, 4, 0);
114+
upLayout->addLayout(ui->horizontalLayout_4, 4, 1);
115+
116+
ui->uploadLimitRadioButton->setFixedHeight(ui->uploadSpinBox->height());
117+
ui->uploadBox->setStyleSheet(ui->uploadBox->styleSheet());
118+
}
119+
120+
} // namespace OCC
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
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_NETWORKSETTINGSMAGENTA_H
16+
#define MIRALL_NETWORKSETTINGSMAGENTA_H
17+
18+
#include "networksettings.h"
19+
20+
QT_BEGIN_NAMESPACE
21+
class QWidget;
22+
QT_END_NAMESPACE
23+
24+
namespace OCC {
25+
26+
/**
27+
* @class NMCNetworkSettings
28+
* @ingroup gui
29+
* @brief Derived class for network settings specific to NMC (Magenta) in the ownCloud client.
30+
*/
31+
class NMCNetworkSettings : public NetworkSettings
32+
{
33+
Q_OBJECT
34+
35+
public:
36+
/**
37+
* @brief Constructor
38+
* @param account Account pointer used to configure settings
39+
* @param parent Parent widget
40+
*/
41+
explicit NMCNetworkSettings(const AccountPtr &account = {}, QWidget *parent = nullptr);
42+
43+
/**
44+
* @brief Destructor
45+
*/
46+
~NMCNetworkSettings() override = default;
47+
48+
private:
49+
/**
50+
* @brief Initializes and sets the custom layout
51+
*/
52+
void setLayout();
53+
};
54+
55+
} // namespace OCC
56+
57+
#endif // MIRALL_NETWORKSETTINGSMAGENTA_H

0 commit comments

Comments
 (0)