Skip to content

Commit be2743e

Browse files
committed
Merge #401 [stable-4.0] [master] 2380-Run_Wizard_Introduction
2 parents e9e9c8a + a6eb62b commit be2743e

15 files changed

+728
-19
lines changed
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
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 "nmcflow2authwidget.h"
16+
17+
#include <QCoreApplication>
18+
#include <QDesktopServices>
19+
#include <QIcon>
20+
#include <QLabel>
21+
#include <QPainter>
22+
#include <QPushButton>
23+
#include <QHBoxLayout>
24+
#include <QVBoxLayout>
25+
26+
#include "QProgressIndicator.h"
27+
#include "theme.h"
28+
29+
namespace OCC {
30+
31+
NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent)
32+
: Flow2AuthWidget(parent)
33+
{
34+
// Bestehende UI-Elemente ausblenden
35+
if (getUi().logoLabel) {
36+
getUi().logoLabel->hide();
37+
getUi().logoLabel->setFixedSize(0, 0);
38+
}
39+
if (getUi().label) {
40+
getUi().label->hide();
41+
getUi().label->setFixedSize(0, 0);
42+
}
43+
if (getUi().copyLinkButton) {
44+
getUi().copyLinkButton->hide();
45+
}
46+
if (getUi().openLinkButton) {
47+
getUi().openLinkButton->hide();
48+
}
49+
if (auto *progressInd = getProgressIndicator()) {
50+
progressInd->setVisible(false);
51+
progressInd->setFixedSize(0, 0);
52+
}
53+
if (getUi().statusLabel) {
54+
getUi().statusLabel->setVisible(false);
55+
getUi().statusLabel->setFixedSize(0, 0);
56+
}
57+
58+
// Bestehendes Layout und Child-Widgets entfernen
59+
if (auto *oldLayout = layout()) {
60+
QLayoutItem *item;
61+
while ((item = oldLayout->takeAt(0)) != nullptr) {
62+
if (auto *widget = item->widget()) {
63+
widget->setParent(nullptr);
64+
}
65+
delete item;
66+
}
67+
delete oldLayout;
68+
}
69+
70+
// Login-Button
71+
auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN"));
72+
loginButton->setFocusPolicy(Qt::NoFocus);
73+
loginButton->setFixedSize(130, 32);
74+
loginButton->setStyleSheet(
75+
"QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }"
76+
"QPushButton:hover { background-color: #c00063; }"
77+
);
78+
connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser);
79+
80+
// Logo + Titel
81+
auto logoLabel = new QLabel(this);
82+
logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36));
83+
logoLabel->setFixedSize(36, 36);
84+
85+
auto titleLabel = new QLabel(tr("MagentaCLOUD"), this);
86+
titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;");
87+
88+
auto logoTitleLayout = new QHBoxLayout;
89+
logoTitleLayout->setSpacing(8);
90+
logoTitleLayout->addWidget(logoLabel);
91+
logoTitleLayout->addWidget(titleLabel);
92+
logoTitleLayout->addStretch();
93+
94+
// Überschrift
95+
auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1"));
96+
headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;");
97+
headerLabel->setWordWrap(true);
98+
headerLabel->setFixedWidth(282);
99+
100+
// Anweisungs-Label
101+
auto label = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this);
102+
label->setStyleSheet("font-size: 14px;");
103+
label->setWordWrap(true);
104+
label->setFixedWidth(282);
105+
106+
// Linke Seite
107+
auto leftLayout = new QVBoxLayout;
108+
leftLayout->addLayout(logoTitleLayout);
109+
leftLayout->addSpacing(24);
110+
leftLayout->addWidget(headerLabel);
111+
leftLayout->addSpacing(16);
112+
leftLayout->addWidget(label);
113+
leftLayout->addSpacing(24);
114+
leftLayout->addWidget(loginButton);
115+
leftLayout->addStretch();
116+
117+
// Rechtes Logo
118+
auto bigLogoLabel = new QLabel(this);
119+
bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175));
120+
bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
121+
bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
122+
123+
auto rightLayout = new QVBoxLayout;
124+
rightLayout->addStretch();
125+
rightLayout->addWidget(bigLogoLabel);
126+
rightLayout->addStretch();
127+
128+
// Hauptlayout
129+
auto mainLayout = new QHBoxLayout;
130+
mainLayout->setContentsMargins(16, 16, 16, 16);
131+
mainLayout->setSpacing(24);
132+
mainLayout->addLayout(leftLayout);
133+
mainLayout->addStretch();
134+
mainLayout->addLayout(rightLayout);
135+
136+
// Fehlerlabel wieder einfügen
137+
if (getUi().errorLabel) {
138+
mainLayout->addWidget(getUi().errorLabel);
139+
}
140+
setLayout(mainLayout);
141+
}
142+
143+
// Styling bewusst ignorieren
144+
void NMCFlow2AuthWidget::customizeStyle() {}
145+
146+
// Spinner einblenden / ungenutzt
147+
void NMCFlow2AuthWidget::startSpinner() {}
148+
149+
// Spinner ausblenden / ungenutzt
150+
void NMCFlow2AuthWidget::stopSpinner(bool showStatusLabel)
151+
{
152+
Q_UNUSED(showStatusLabel);
153+
}
154+
155+
// Statusänderung unterdrücken
156+
void NMCFlow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft)
157+
{
158+
Q_UNUSED(status);
159+
Q_UNUSED(secondsLeft);
160+
}
161+
162+
} // namespace OCC
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
/*
16+
* Copyright (C) by Eugen Fischer
17+
*
18+
* This program is free software; you can redistribute it and/or modify
19+
* it under the terms of the GNU General Public License as published by
20+
* the Free Software Foundation; either version 2 of the License, or
21+
* (at your option) any later version.
22+
*
23+
* This program is distributed in the hope that it will be useful, but
24+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26+
* for more details.
27+
*/
28+
29+
#ifndef NMCFLOW2AUTHWIDGET_H
30+
#define NMCFLOW2AUTHWIDGET_H
31+
32+
#include "wizard/flow2authwidget.h"
33+
34+
namespace OCC {
35+
36+
class NMCFlow2AuthWidget : public Flow2AuthWidget
37+
{
38+
Q_OBJECT
39+
40+
public:
41+
/**
42+
* @brief Constructs an NMCFlow2AuthWidget object.
43+
* @param parent The parent widget (default is nullptr).
44+
*/
45+
explicit NMCFlow2AuthWidget(QWidget *parent = nullptr);
46+
47+
/**
48+
* @brief Destructor for NMCFlow2AuthWidget.
49+
*/
50+
~NMCFlow2AuthWidget() override = default;
51+
52+
protected:
53+
/**
54+
* @brief Reimplemented from Flow2AuthWidget.
55+
* Customizes the style of the widget.
56+
*/
57+
void customizeStyle() override;
58+
59+
/**
60+
* @brief Optionally reimplemented: controls spinner visibility/start.
61+
*/
62+
void startSpinner() override;
63+
64+
/**
65+
* @brief Optionally reimplemented: stops spinner and optionally shows label.
66+
*/
67+
void stopSpinner(bool showStatusLabel) override;
68+
69+
/**
70+
* @brief Optionally reimplemented: handles status updates during auth.
71+
*/
72+
void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) override;
73+
};
74+
75+
} // namespace OCC
76+
77+
#endif // NMCFLOW2AUTHWIDGET_H

0 commit comments

Comments
 (0)