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/nmcaccountsettings.h"
16+ #include " ui_accountsettings.h"
17+ #include " ../common/utility.h"
18+ #include " guiutility.h"
19+
20+ #include < QDesktopServices>
21+ #include < QUrl>
22+ #include < QPushButton>
23+ #include < QLabel>
24+ #include < QHBoxLayout>
25+ #include < QVBoxLayout>
26+ #include < QSpacerItem>
27+ #include < QSizePolicy>
28+
29+ namespace OCC {
30+
31+ NMCAccountSettings::NMCAccountSettings (AccountState *accountState, QWidget *parent)
32+ : AccountSettings(accountState, parent)
33+ , m_liveAccountButton(new CustomButton(QCoreApplication::translate(" " , " ADD_LIVE_BACKUP" ), QIcon(QLatin1String(" :/client/theme/NMCIcons/action-add.svg" )).pixmap(24 ,24 )))
34+ , m_liveTitle(new QLabel(QCoreApplication::translate(" " , " LIVE_BACKUPS" )))
35+ , m_liveDescription(new QLabel(QCoreApplication::translate(" " , " LIVE_DESCRIPTION" )))
36+ , m_folderSync(new QLabel(QCoreApplication::translate(" " , " YOUR_FOLDER_SYNC" )))
37+ {
38+ setDefaultSettings ();
39+ setLayout ();
40+ connect (m_liveAccountButton, &CustomButton::clicked, this , &NMCAccountSettings::slotAddFolder);
41+ }
42+
43+ void NMCAccountSettings::setDefaultSettings ()
44+ {
45+ getUi ()->encryptionMessage ->setCloseButtonVisible (true );
46+ getUi ()->selectiveSyncStatus ->setVisible (false );
47+ getUi ()->selectiveSyncNotification ->setVisible (false );
48+ getUi ()->accountStatus ->setVisible (false );
49+ getUi ()->bigFolderUi ->setVisible (false );
50+ getUi ()->gridLayout ->setSpacing (8 );
51+ }
52+
53+ void NMCAccountSettings::setLayout ()
54+ {
55+ // Entferne alte Quota-Widgets
56+ getUi ()->storageGroupBox ->removeWidget (getUi ()->quotaInfoLabel );
57+ getUi ()->storageGroupBox ->removeWidget (getUi ()->quotaProgressBar );
58+ getUi ()->storageGroupBox ->removeWidget (getUi ()->quotaInfoText );
59+
60+ getUi ()->gridLayout ->removeWidget (getUi ()->encryptionMessage );
61+ getUi ()->gridLayout ->addWidget (getUi ()->encryptionMessage , 0 , 0 );
62+
63+ // Titel für Folder Sync
64+ m_folderSync->setStyleSheet (" font-size: 15px; font-weight: 600; padding: 8px;" );
65+ m_folderSync->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Fixed);
66+ getUi ()->gridLayout ->addWidget (m_folderSync, 1 , 0 );
67+
68+ // Live-Backup-Bereich
69+ auto *liveHLayout = new QHBoxLayout ();
70+ liveHLayout->setContentsMargins (8 , 8 , 8 , 8 );
71+
72+ auto *liveVLayout = new QVBoxLayout ();
73+ auto *liveWidget = new QWidget (this );
74+ liveWidget->setStyleSheet (" QWidget {border-radius: 4px;}" );
75+ liveWidget->setLayout (liveHLayout);
76+
77+ liveHLayout->addLayout (liveVLayout);
78+ liveHLayout->addStretch ();
79+
80+ const QString styleSheet = QStringLiteral (
81+ " QPushButton { font-size: %5px; border: %1px solid; border-color: black; "
82+ " border-radius: 4px; background-color: %2; color: %3; } "
83+ " QPushButton:hover { background-color: %4; }" );
84+
85+ m_liveAccountButton->setStyleSheet (styleSheet.arg (" 0" , " #E20074" , " white" , " #c00063" , " 13" ));
86+ m_liveAccountButton->setFixedSize (180 , 32 );
87+ m_liveAccountButton->setLeftIconMargin (4 );
88+
89+ liveHLayout->addWidget (m_liveAccountButton);
90+
91+ liveVLayout->addWidget (m_liveTitle);
92+ m_liveTitle->setStyleSheet (" font-size: 15px; font-weight: 600;" );
93+
94+ liveVLayout->addWidget (m_liveDescription);
95+ m_liveDescription->setStyleSheet (" font-size: 13px;" );
96+ m_liveDescription->setText (QCoreApplication::translate (" " , " LIVE_BACKUPS_DESCRIPTION" ));
97+ m_liveDescription->setWordWrap (true );
98+ m_liveDescription->setFixedWidth (450 );
99+
100+ getUi ()->gridLayout ->addWidget (liveWidget, 4 , 0 );
101+
102+ // Speicherbereich
103+ auto *magentaHLayout = new QHBoxLayout ();
104+ magentaHLayout->setSpacing (32 );
105+
106+ auto *quotaVLayout = new QVBoxLayout ();
107+ quotaVLayout->setSpacing (4 );
108+ quotaVLayout->addSpacing (12 );
109+
110+ quotaVLayout->addWidget (getUi ()->quotaInfoLabel );
111+ getUi ()->quotaInfoLabel ->setStyleSheet (" QLabel { font-size: 18px; padding: 8px; font-weight: 500; }" );
112+
113+ quotaVLayout->addWidget (getUi ()->quotaProgressBar );
114+ getUi ()->quotaProgressBar ->setStyleSheet (
115+ " QProgressBar { background-color: #e5e5e5; color: black; border: 1px solid black; border-radius: 4px; margin-left: 8px; } "
116+ " QProgressBar::chunk { background-color: #E20074; }" );
117+ getUi ()->quotaProgressBar ->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
118+
119+ quotaVLayout->addWidget (getUi ()->quotaInfoText );
120+ getUi ()->quotaInfoText ->setStyleSheet (" QLabel { font-size: 13px; padding: 8px; }" );
121+
122+ quotaVLayout->addSpacing (20 );
123+ magentaHLayout->addLayout (quotaVLayout);
124+
125+ auto *storageLinkButton = new QPushButton (QCoreApplication::translate (" " , " STORAGE_EXTENSION" ), this );
126+ storageLinkButton->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Fixed);
127+ storageLinkButton->setStyleSheet (
128+ " QPushButton { height: 32px; width: 180px; border: 1px solid black; background-color: #ededed; "
129+ " color: black; font-size: 13px; border-radius: 4px; } "
130+ " QPushButton::hover { background-color: white; }" );
131+
132+ connect (storageLinkButton, &QPushButton::clicked, this , []() {
133+ QDesktopServices::openUrl (QUrl (QStringLiteral (" https://cloud.telekom-dienste.de/tarife" )));
134+ });
135+
136+ magentaHLayout->addWidget (storageLinkButton);
137+ magentaHLayout->addSpacing (8 );
138+
139+ getUi ()->gridLayout ->addLayout (magentaHLayout, 5 , 0 );
140+
141+ // Sichtbarkeit initial ausblenden
142+ getUi ()->encryptionMessage ->hide ();
143+ checkClientSideEncryptionState ();
144+ }
145+
146+ } // namespace OCC
147+
0 commit comments