From 3ab05f51b846973e7b2c430f872c56d1a6bce18a Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 4 Mar 2025 15:00:33 +0100 Subject: [PATCH 01/62] run wizard introduction changes --- src/gui/CMakeLists.txt | 7 + src/gui/nmcgui/nmcflow2authwidget.cpp | 167 ++++++++++++ src/gui/nmcgui/nmcflow2authwidget.h | 55 ++++ .../nmcgui/nmcowncloudadvancedsetuppage.cpp | 258 ++++++++++++++++++ src/gui/nmcgui/nmcowncloudadvancedsetuppage.h | 66 +++++ src/gui/wizard/flow2authcredspage.cpp | 3 +- src/gui/wizard/flow2authwidget.h | 15 +- src/gui/wizard/owncloudadvancedsetuppage.h | 16 ++ src/gui/wizard/owncloudwizard.cpp | 20 +- theme/NMCIcons/ApplicationLogo.svg | 16 ++ theme/NMCIcons/folderLogo.svg | 83 ++++++ theme/NMCIcons/tlogocarrier.svg | 1 + 12 files changed, 692 insertions(+), 15 deletions(-) create mode 100644 src/gui/nmcgui/nmcflow2authwidget.cpp create mode 100644 src/gui/nmcgui/nmcflow2authwidget.h create mode 100644 src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp create mode 100644 src/gui/nmcgui/nmcowncloudadvancedsetuppage.h create mode 100644 theme/NMCIcons/ApplicationLogo.svg create mode 100644 theme/NMCIcons/folderLogo.svg create mode 100644 theme/NMCIcons/tlogocarrier.svg diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 2bfa004dd7fa3..de89a45ca519b 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -3,6 +3,9 @@ find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick Qui find_package(KF6Archive REQUIRED) find_package(KF6GuiAddons) +#NMC customization: needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + if (NOT TARGET Qt::GuiPrivate) message(FATAL_ERROR "Could not find GuiPrivate component of Qt. It might be shipped as a separate package, please check that.") endif() @@ -255,6 +258,10 @@ set(client_SRCS wizard/linklabel.cpp ) +file(GLOB NMC_FILES "nmcgui/*") +set(NMC_SRCS ${NMC_FILES}) +list(APPEND client_SRCS ${NMC_SRCS}) + if (WITH_WEBENGINE) list(APPEND client_SRCS wizard/webviewpage.h diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp new file mode 100644 index 0000000000000..f36d1246aa974 --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -0,0 +1,167 @@ +/* + * 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 "nmcflow2authwidget.h" + +#include "QProgressIndicator.h" +#include "QPushButton" +#include "QDesktopServices" +#include "QtGui/qpainter.h" +#include "theme.h" + +namespace OCC { + + +NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) + : Flow2AuthWidget(parent) +{ + + //setFixedSize(700,502); + + auto progressInd = getProgressIndicator(); + getUi().progressLayout->removeWidget(progressInd); + progressInd->setVisible(false); + progressInd->setFixedSize(0,0); + + //Create and connect the push buttons to base slots + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + loginBrowserButton->setFocusPolicy(Qt::NoFocus); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + slotOpenBrowser(); + }); + + //Set login button size and style + QSize buttonSize(130,32); + const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; + const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart ); + loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white")); + loginBrowserButton->setFixedSize(buttonSize); + + //Create needed layouts + auto mainVerticalLayout = new QVBoxLayout(this); + auto subMainHorizontalLayout = new QHBoxLayout(this); + auto leftSideVerticalLayout = new QVBoxLayout(this); + auto rightSideVerticalLayout = new QVBoxLayout(this); + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16,8,28,0); + subMainHorizontalLayout->setSpacing(0); + subMainHorizontalLayout->setContentsMargins(0,0,0,0); + leftSideVerticalLayout->setSpacing(0); + leftSideVerticalLayout->setContentsMargins(0,0,0,0); + rightSideVerticalLayout->setSpacing(0); + rightSideVerticalLayout->setContentsMargins(0,0,0,0); + + mainVerticalLayout->addLayout(subMainHorizontalLayout); + + QSpacerItem *spacer4 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + subMainHorizontalLayout->addSpacerItem(spacer4); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); + + //Create a horizontal Logo and label layout + auto hLogoAndLabelLayout = new QHBoxLayout(this); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + getUi().logoLabel->setFixedSize(36,36); + getUi().logoLabel->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); + + hLogoAndLabelLayout->addWidget(getUi().logoLabel); + + QSpacerItem *spacer3 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->addSpacerItem(spacer3); + + QSpacerItem *spacer9 = new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + hLogoAndLabelLayout->addSpacerItem(spacer9); + + QLabel *magentaLabel = new QLabel("MagentaCLOUD"); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + leftSideVerticalLayout->insertItem(1, hLogoAndLabelLayout); + + QSpacerItem *spacer7 = new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(2, spacer7); + + QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); + leftSideVerticalLayout->insertWidget(3, descriptionLabel); + + QSpacerItem *spacer5 = new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(4, spacer5); + + getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + leftSideVerticalLayout->insertWidget(5, getUi().label); + getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); + getUi().label->setFixedWidth(282); + getUi().label->setAlignment(Qt::AlignLeft); + + QSpacerItem *spacer6 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(6, spacer6); + + //Add buttons + leftSideVerticalLayout->insertWidget(7, loginBrowserButton); + + QSpacerItem *spacer11 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); + leftSideVerticalLayout->addSpacerItem(spacer11); + + //Add items to the right side + QLabel *bigMagetnaIcon = new QLabel("Test"); + bigMagetnaIcon->setFixedSize(175,175); + bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/applicationLogo.svg")).pixmap(175,175)); + + QSpacerItem *spacer1 = new QSpacerItem(1,98, QSizePolicy::Fixed, QSizePolicy::Fixed); + rightSideVerticalLayout->addSpacerItem(spacer1); + rightSideVerticalLayout->addWidget(bigMagetnaIcon); + + QSpacerItem *spacer10 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); + rightSideVerticalLayout->addSpacerItem(spacer10); + + QSpacerItem *spacer2 = new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + subMainHorizontalLayout->addSpacerItem(spacer2); + + mainVerticalLayout->addWidget(getUi().errorLabel); + + getUi().statusLabel->setFixedSize(0,0); + + //Delete previous installed layout, or you can not apply the new one. + QLayout* layout = this->layout (); + if (layout != 0) + { + QLayoutItem *item; + while ((item = layout->takeAt(0)) != 0) + layout->removeItem (item); + delete layout; + } + + this->setLayout(mainVerticalLayout); +} + +void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.fillRect(rect(), Qt::white); + painter.end(); + Flow2AuthWidget::paintEvent(event); +} + +void NMCFlow2AuthWidget::customizeStyle() +{ + //Empty +} + + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h new file mode 100644 index 0000000000000..0a74802bea5b4 --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef NMCFLOW2AUTHWIDGET_H +#define NMCFLOW2AUTHWIDGET_H + +#include "wizard/flow2authwidget.h" + +namespace OCC { + +class NMCFlow2AuthWidget : public Flow2AuthWidget +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCFlow2AuthWidget object. + * @param parent The parent widget (default is nullptr). + */ + NMCFlow2AuthWidget(QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCFlow2AuthWidget. + */ + ~NMCFlow2AuthWidget() = default; + +protected: + /** + * @brief Reimplemented from Flow2AuthWidget. + * Paints the widget during the paint event. + * @param event The paint event. + */ + void paintEvent(QPaintEvent *event) override; + + /** + * @brief Reimplemented from Flow2AuthWidget. + * Customizes the style of the widget. + */ + void customizeStyle() override; +}; + +} // namespace OCC + +#endif // NMCFLOW2AUTHWIDGET_H diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp new file mode 100644 index 0000000000000..06a4acc3a47c9 --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -0,0 +1,258 @@ +/* + * 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 "QtGui/qpainter.h" +#include "common/utility.h" +#include "wizard/owncloudwizard.h" +#include "wizard/owncloudadvancedsetuppage.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" + +namespace OCC { + +void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() +{ + getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); + getUi().syncLogoLabel->setFixedSize(0,0); + getUi().syncLogoLabel->setVisible(false); + + getUi().horizontalLayout_6->removeWidget(getUi().confCheckBoxSize); + getUi().confCheckBoxSize->setFixedSize(0,0); + getUi().confCheckBoxSize->setVisible(false); + + getUi().horizontalLayout_6->removeWidget(getUi().confSpinBox); + getUi().confSpinBox->setFixedSize(0,0); + getUi().confSpinBox->setVisible(false); + + getUi().horizontalLayout_6->removeWidget(getUi().confTraillingSizeLabel); + getUi().confTraillingSizeLabel->setFixedSize(0,0); + getUi().confTraillingSizeLabel->setVisible(false); + + getUi().horizontalLayout_8->removeWidget(getUi().confCheckBoxExternal); + getUi().confCheckBoxExternal->setFixedSize(0,0); + getUi().confCheckBoxExternal->setVisible(false); + + getUi().lVirtualFileSync->removeWidget(getUi().rVirtualFileSync); + getUi().rVirtualFileSync->setFixedSize(0,0); + getUi().rVirtualFileSync->setVisible(false); + getUi().rVirtualFileSync->setChecked(true); + + getUi().resolutionWidget->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().errorLabel); + getUi().errorLabel->setFixedSize(0,0); + getUi().errorLabel->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().bottomLabel); + getUi().bottomLabel->setFixedSize(0,0); + getUi().bottomLabel->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().topLabel); + getUi().topLabel->setFixedSize(0,0); + getUi().topLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); + getUi().syncLogoLabel->setFixedSize(0,0); + getUi().syncLogoLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().lLocal); + getUi().lLocal->setFixedSize(0,0); + getUi().lLocal->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().localFolderDescriptionLabel); + getUi().localFolderDescriptionLabel->setFixedSize(0,0); + getUi().localFolderDescriptionLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().lServerIcon); + getUi().lServerIcon->setFixedSize(0,0); + getUi().lServerIcon->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().userNameLabel); + getUi().userNameLabel->setFixedSize(0,0); + getUi().userNameLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().serverAddressLabel); + getUi().serverAddressLabel->setFixedSize(0,0); + getUi().serverAddressLabel->setVisible(false); +} + +NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) + : OwncloudAdvancedSetupPage(wizard), + _tLogoLbl(new QLabel(this)) +{ + + cleanUpElements(); + + //Create and connect the push buttons to base slots + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + validatePage(); + }); + + auto buttonLayout = new QHBoxLayout(this); + buttonLayout->setSpacing(8); + //Set login button size and style + QSize buttonSize(130,32); + const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;} QPushButton:hover { background-color: %4; }" ); + loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white", "#c00063")); + loginBrowserButton->setFixedSize(buttonSize); + + getUi().locationsGridLayout->removeWidget(getUi().pbSelectLocalFolder); + getUi().pbSelectLocalFolder->setFixedSize(180, 32); + getUi().pbSelectLocalFolder->setStyleSheet(styleSheet.arg("1","white","black", "#ededed")); + getUi().pbSelectLocalFolder->setText("Speicherort ändern"); + + buttonLayout->addWidget(getUi().pbSelectLocalFolder); + buttonLayout->addWidget(loginBrowserButton); + buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); + + //Create needed layouts + auto mainVerticalLayout = new QVBoxLayout(this); + auto subMainHorizontalLayout = new QHBoxLayout(this); + auto leftSideVerticalLayout = new QVBoxLayout(this); + auto rightSideVerticalLayout = new QVBoxLayout(this); + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16,8,40,0); + subMainHorizontalLayout->setSpacing(0); + subMainHorizontalLayout->setContentsMargins(0,0,0,0); + leftSideVerticalLayout->setSpacing(0); + leftSideVerticalLayout->setContentsMargins(0,0,0,0); + rightSideVerticalLayout->setSpacing(0); + rightSideVerticalLayout->setContentsMargins(0,0,0,0); + + mainVerticalLayout->addLayout(subMainHorizontalLayout); + + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(12,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); + + leftSideVerticalLayout->setSpacing(0); + + //Create a horizontal T-Logo and MagentaCLOUC-label layout + auto hLogoAndLabelLayout = new QHBoxLayout(this); + hLogoAndLabelLayout->setSpacing(0); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + + //T-Logo + _tLogoLbl->setFixedSize(36,36); + _tLogoLbl->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); + hLogoAndLabelLayout->addWidget(_tLogoLbl); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //MagentaCLOUD-label + QLabel *magentaLabel = new QLabel("MagentaCLOUD"); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + leftSideVerticalLayout->addItem(hLogoAndLabelLayout); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Headline + QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_2")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); + leftSideVerticalLayout->addWidget(descriptionLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Path to a local folder + getUi().locationsGridLayout->removeWidget(getFilePathLabel().data()); + leftSideVerticalLayout->addWidget(getFilePathLabel().data()); + getFilePathLabel().data()->setAlignment(Qt::AlignLeft); + getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); + + //Free space available + getUi().locationsGridLayout->removeWidget(getUi().lFreeSpace); + leftSideVerticalLayout->addWidget(getUi().lFreeSpace); + getUi().lFreeSpace->setAlignment(Qt::AlignLeft); + getUi().lFreeSpace->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Synch Radio button layout + getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_5); + leftSideVerticalLayout->addLayout(getUi().horizontalLayout_5); + + //Disable Mac related UI fields + if(Utility::isWindows()) + { + getUi().lSyncEverythingSizeLabel->setVisible(false); + getUi().rSyncEverything->setVisible(false); + getUi().rSelectiveSync->setVisible(false); + getUi().bSelectiveSync->setVisible(false); + getUi().lSelectiveSyncSizeLabel->setVisible(false); + } + + //Choose what to sync layout + getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_10); + leftSideVerticalLayout->addLayout(getUi().horizontalLayout_10); + getUi().horizontalLayout_10->removeWidget(getUi().lSelectiveSyncSizeLabel); //Remove text label, its not needed + getUi().lSelectiveSyncSizeLabel->setVisible(false); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Detail description + QLabel *detailLabel = new QLabel(QCoreApplication::translate("","SETUP_DESCRIPTION_TEXT_2")); + detailLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + detailLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + detailLabel->setWordWrap(true); + detailLabel->setMinimumWidth(396); + leftSideVerticalLayout->addWidget(detailLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Add buttons + leftSideVerticalLayout->addItem(buttonLayout); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + //Add items to the right side + QLabel *bigMagetnaIcon = new QLabel(""); + bigMagetnaIcon->setFixedSize(175,175); + bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/folderLogo.svg")).pixmap(175,175)); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,164, QSizePolicy::Fixed, QSizePolicy::Fixed)); + rightSideVerticalLayout->addWidget(bigMagetnaIcon); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Delete previous installed layout, or you can not apply the new one. + QLayout* layout = this->layout (); + if (layout != 0) + { + QLayoutItem *item; + while ((item = layout->takeAt(0)) != 0) + layout->removeItem (item); + delete layout; + } + + this->setLayout(mainVerticalLayout); +} + +void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.fillRect(rect(), Qt::white); + painter.end(); + OwncloudAdvancedSetupPage::paintEvent(event); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h new file mode 100644 index 0000000000000..cfaa79c35e833 --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H +#define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + +#include + +#include "wizard/owncloudadvancedsetuppage.h" + +namespace OCC { + +/** + * @brief The NMCOwncloudAdvancedSetupPage class. + * @ingroup gui + * Subclass of OwncloudAdvancedSetupPage, representing the advanced setup page for NMC OwnCloud. + */ +class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCOwncloudAdvancedSetupPage object. + * @param wizard Pointer to the parent OwncloudWizard. + */ + NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); + + /** + * @brief Destructor for NMCOwncloudAdvancedSetupPage. + */ + ~NMCOwncloudAdvancedSetupPage() = default; + +protected: + /** + * @brief Override of paintEvent to handle custom painting. + * @param event Pointer to the QPaintEvent object. + */ + void paintEvent(QPaintEvent *event) override; + +private: + /** + * @brief Pointer to the QLabel for the custom logo. + */ + QLabel *_tLogoLbl = nullptr; + + /** + * @brief Helper function to clean up elements. + */ + void cleanUpElements(); +}; + +} // namespace OCC + +#endif // MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index 8eef42fab0f4b..957f572275b48 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -25,6 +25,7 @@ #include "wizard/flow2authwidget.h" #include "creds/credentialsfactory.h" #include "creds/webflowcredentials.h" +#include "nmcgui/nmcflow2authwidget.h" namespace OCC { @@ -33,7 +34,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new Flow2AuthWidget(); + _flow2AuthWidget = new NMCFlow2AuthWidget(); _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult); diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index 4c622fab343ea..fed5183314c07 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -47,6 +47,17 @@ public Q_SLOTS: void authResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void pollNow(); +protected: + Ui_Flow2AuthWidget &getUi() + { + return _ui; + } + + QProgressIndicator *getProgressIndicator() + { + return _progressIndi; + } + private: Account *_account = nullptr; std::unique_ptr _asyncAuth; @@ -56,10 +67,12 @@ protected Q_SLOTS: void slotOpenBrowser(); void slotCopyLinkToClipboard(); +protected: + virtual void customizeStyle(); + private: void startSpinner(); void stopSpinner(bool showStatusLabel); - void customizeStyle(); void setLogo(); QProgressIndicator *_progressIndi; diff --git a/src/gui/wizard/owncloudadvancedsetuppage.h b/src/gui/wizard/owncloudadvancedsetuppage.h index d01ebe4d953d6..f6279069374d6 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.h +++ b/src/gui/wizard/owncloudadvancedsetuppage.h @@ -51,6 +51,16 @@ class OwncloudAdvancedSetupPage : public QWizardPage void setMultipleFoldersExist(bool exist); void directoriesCreated(); + QScopedPointer &getFilePathLabel() + { + return _filePathLabel; + } + + OwncloudWizard *ocWizard() const + { + return _ocWizard; + } + signals: void createLocalAndRemoteFolders(const QString &, const QString &); @@ -66,6 +76,12 @@ private slots: void slotQuotaRetrieved(const QVariantMap &result); void slotQuotaRetrievedWithError(QNetworkReply *reply); +protected: + Ui_OwncloudAdvancedSetupPage &getUi() + { + return _ui; + } + private: void setRadioChecked(QRadioButton *radio); diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index 3a209312bd0b7..992c0444ede8a 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -18,6 +18,7 @@ #include "configfile.h" #include "theme.h" #include "owncloudgui.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" #ifdef Q_OS_MAC #include "foregroundbackground_interface.h" @@ -55,7 +56,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) , _httpCredsPage(new OwncloudHttpCredsPage(this)) , _flow2CredsPage(new Flow2AuthCredsPage) , _termsOfServicePage(new TermsOfServiceWizardPage) - , _advancedSetupPage(new OwncloudAdvancedSetupPage(this)) + , _advancedSetupPage(new NMCOwncloudAdvancedSetupPage(this)) #ifdef WITH_WEBENGINE , _webViewPage(new WebViewPage(this)) #else // WITH_WEBENGINE @@ -128,6 +129,8 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) adjustWizardSize(); centerWindow(); + + this->setStyleSheet("QWizard { margin: 0; padding: 0; }" "QWizard::separator { width: 0; }"); } void OwncloudWizard::centerWindow() @@ -145,17 +148,7 @@ void OwncloudWizard::centerWindow() void OwncloudWizard::adjustWizardSize() { - const auto pageSizes = calculateWizardPageSizes(); - const auto currentPageIndex = currentId(); - - // If we can, just use the size of the current page - if(currentPageIndex > -1 && currentPageIndex < pageSizes.count()) { - resize(pageSizes.at(currentPageIndex)); - return; - } - - // As a backup, resize to largest page - resize(calculateLargestSizeOfWizardPages(pageSizes)); + resize(700,460); // NMC customization } QList OwncloudWizard::calculateWizardPageSizes() const @@ -350,8 +343,9 @@ void OwncloudWizard::slotCurrentPageChanged(int id) id == WizardCommon::Page_Flow2AuthCreds || id == WizardCommon::Page_TermsOfService) { setButtonLayout({ QWizard::BackButton, QWizard::Stretch }); + button(QWizard::BackButton)->setVisible(false); } else if (id == WizardCommon::Page_AdvancedSetup) { - setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton }); + setButtonLayout({ }); setNextButtonAsDefault(); } else { setButtonLayout({ QWizard::BackButton, QWizard::Stretch, QWizard::NextButton }); diff --git a/theme/NMCIcons/ApplicationLogo.svg b/theme/NMCIcons/ApplicationLogo.svg new file mode 100644 index 0000000000000..efc8c94e1df28 --- /dev/null +++ b/theme/NMCIcons/ApplicationLogo.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/theme/NMCIcons/folderLogo.svg b/theme/NMCIcons/folderLogo.svg new file mode 100644 index 0000000000000..45f4cb770d6bb --- /dev/null +++ b/theme/NMCIcons/folderLogo.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/theme/NMCIcons/tlogocarrier.svg b/theme/NMCIcons/tlogocarrier.svg new file mode 100644 index 0000000000000..8fb2ff11a1050 --- /dev/null +++ b/theme/NMCIcons/tlogocarrier.svg @@ -0,0 +1 @@ + \ No newline at end of file From 20365f08c678676f2c67322e96117c636fd995e2 Mon Sep 17 00:00:00 2001 From: memurats Date: Fri, 4 Apr 2025 12:52:35 +0200 Subject: [PATCH 02/62] update custom code --- src/gui/nmcgui/nmcflow2authwidget.cpp | 288 +++++++-------- src/gui/nmcgui/nmcflow2authwidget.h | 84 ++--- .../nmcgui/nmcowncloudadvancedsetuppage.cpp | 342 +++++------------- src/gui/nmcgui/nmcowncloudadvancedsetuppage.h | 106 +++--- 4 files changed, 330 insertions(+), 490 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index f36d1246aa974..5bc42ef6f1e0f 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -12,156 +12,138 @@ * for more details. */ -#include "nmcflow2authwidget.h" - -#include "QProgressIndicator.h" -#include "QPushButton" -#include "QDesktopServices" -#include "QtGui/qpainter.h" -#include "theme.h" - -namespace OCC { - - -NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) - : Flow2AuthWidget(parent) -{ - - //setFixedSize(700,502); - - auto progressInd = getProgressIndicator(); - getUi().progressLayout->removeWidget(progressInd); - progressInd->setVisible(false); - progressInd->setFixedSize(0,0); - - //Create and connect the push buttons to base slots - auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); - loginBrowserButton->setFocusPolicy(Qt::NoFocus); - connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ - slotOpenBrowser(); - }); - - //Set login button size and style - QSize buttonSize(130,32); - const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; - const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart ); - loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white")); - loginBrowserButton->setFixedSize(buttonSize); - - //Create needed layouts - auto mainVerticalLayout = new QVBoxLayout(this); - auto subMainHorizontalLayout = new QHBoxLayout(this); - auto leftSideVerticalLayout = new QVBoxLayout(this); - auto rightSideVerticalLayout = new QVBoxLayout(this); - mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16,8,28,0); - subMainHorizontalLayout->setSpacing(0); - subMainHorizontalLayout->setContentsMargins(0,0,0,0); - leftSideVerticalLayout->setSpacing(0); - leftSideVerticalLayout->setContentsMargins(0,0,0,0); - rightSideVerticalLayout->setSpacing(0); - rightSideVerticalLayout->setContentsMargins(0,0,0,0); - - mainVerticalLayout->addLayout(subMainHorizontalLayout); - - QSpacerItem *spacer4 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed); - subMainHorizontalLayout->addSpacerItem(spacer4); - subMainHorizontalLayout->addLayout(leftSideVerticalLayout); - subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - - //Create a horizontal Logo and label layout - auto hLogoAndLabelLayout = new QHBoxLayout(this); - hLogoAndLabelLayout->setContentsMargins(0,0,0,0); - getUi().logoLabel->setFixedSize(36,36); - getUi().logoLabel->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); - - hLogoAndLabelLayout->addWidget(getUi().logoLabel); - - QSpacerItem *spacer3 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->addSpacerItem(spacer3); - - QSpacerItem *spacer9 = new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed); - hLogoAndLabelLayout->addSpacerItem(spacer9); - - QLabel *magentaLabel = new QLabel("MagentaCLOUD"); - magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); - magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - hLogoAndLabelLayout->addWidget(magentaLabel); - leftSideVerticalLayout->insertItem(1, hLogoAndLabelLayout); - - QSpacerItem *spacer7 = new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->insertSpacerItem(2, spacer7); - - QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); - descriptionLabel->setWordWrap(true); - descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); - leftSideVerticalLayout->insertWidget(3, descriptionLabel); - - QSpacerItem *spacer5 = new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->insertSpacerItem(4, spacer5); - - getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - leftSideVerticalLayout->insertWidget(5, getUi().label); - getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); - getUi().label->setFixedWidth(282); - getUi().label->setAlignment(Qt::AlignLeft); - - QSpacerItem *spacer6 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->insertSpacerItem(6, spacer6); - - //Add buttons - leftSideVerticalLayout->insertWidget(7, loginBrowserButton); - - QSpacerItem *spacer11 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); - leftSideVerticalLayout->addSpacerItem(spacer11); - - //Add items to the right side - QLabel *bigMagetnaIcon = new QLabel("Test"); - bigMagetnaIcon->setFixedSize(175,175); - bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/applicationLogo.svg")).pixmap(175,175)); - - QSpacerItem *spacer1 = new QSpacerItem(1,98, QSizePolicy::Fixed, QSizePolicy::Fixed); - rightSideVerticalLayout->addSpacerItem(spacer1); - rightSideVerticalLayout->addWidget(bigMagetnaIcon); - - QSpacerItem *spacer10 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); - rightSideVerticalLayout->addSpacerItem(spacer10); - - QSpacerItem *spacer2 = new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed); - subMainHorizontalLayout->addSpacerItem(spacer2); - - mainVerticalLayout->addWidget(getUi().errorLabel); - - getUi().statusLabel->setFixedSize(0,0); - - //Delete previous installed layout, or you can not apply the new one. - QLayout* layout = this->layout (); - if (layout != 0) - { - QLayoutItem *item; - while ((item = layout->takeAt(0)) != 0) - layout->removeItem (item); - delete layout; - } - - this->setLayout(mainVerticalLayout); -} - -void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) -{ - QPainter painter; - painter.begin(this); - painter.fillRect(rect(), Qt::white); - painter.end(); - Flow2AuthWidget::paintEvent(event); -} - -void NMCFlow2AuthWidget::customizeStyle() -{ - //Empty -} - - -} // namespace OCC + #include "nmcflow2authwidget.h" + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "theme.h" + + namespace OCC { + + NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) + : Flow2AuthWidget(parent) + { + auto progressInd = getProgressIndicator(); + getUi().progressLayout->removeWidget(progressInd); + progressInd->setVisible(false); + progressInd->setFixedSize(0, 0); + + // LOGIN-Button erstellen + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + loginBrowserButton->setFocusPolicy(Qt::NoFocus); + connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { + slotOpenBrowser(); + }); + + // Button-Styling setzen + QSize buttonSize(130, 32); + const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; + const QString styleSheet = + QString("QPushButton{font-size: 15px; border: %1px solid; border-color: black; " + "border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart) + .arg("0", "#E20074", "white"); + + loginBrowserButton->setStyleSheet(styleSheet); + loginBrowserButton->setFixedSize(buttonSize); + + // Layouts erstellen + auto mainVerticalLayout = new QVBoxLayout(this); + auto subMainHorizontalLayout = new QHBoxLayout(); + auto leftSideVerticalLayout = new QVBoxLayout(); + auto rightSideVerticalLayout = new QVBoxLayout(); + + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16, 8, 28, 0); + subMainHorizontalLayout->setSpacing(0); + subMainHorizontalLayout->setContentsMargins(0, 0, 0, 0); + leftSideVerticalLayout->setSpacing(0); + leftSideVerticalLayout->setContentsMargins(0, 0, 0, 0); + rightSideVerticalLayout->setSpacing(0); + rightSideVerticalLayout->setContentsMargins(0, 0, 0, 0); + + mainVerticalLayout->addLayout(subMainHorizontalLayout); + + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); + + // Logo und Label Layout + auto hLogoAndLabelLayout = new QHBoxLayout(); + hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); + getUi().logoLabel->setFixedSize(36, 36); + getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + + hLogoAndLabelLayout->addWidget(getUi().logoLabel); + hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + auto magentaLabel = new QLabel("MagentaCLOUD"); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + + leftSideVerticalLayout->addLayout(hLogoAndLabelLayout); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 24, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Beschreibung + auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); + leftSideVerticalLayout->addWidget(descriptionLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + getUi().label->setText("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."); + getUi().label->setFixedWidth(282); + getUi().label->setAlignment(Qt::AlignLeft); + leftSideVerticalLayout->addWidget(getUi().label); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Login-Button hinzufügen + leftSideVerticalLayout->addWidget(loginBrowserButton); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + // Rechtsseitige Inhalte + auto bigMagentaIcon = new QLabel(); + bigMagentaIcon->setFixedSize(175, 175); + bigMagentaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 98, QSizePolicy::Fixed, QSizePolicy::Fixed)); + rightSideVerticalLayout->addWidget(bigMagentaIcon); + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + mainVerticalLayout->addWidget(getUi().errorLabel); + getUi().statusLabel->setFixedSize(0, 0); + + // Falls ein altes Layout existiert, entfernen + if (layout() != nullptr) { + delete layout(); + } + + setLayout(mainVerticalLayout); + } + + void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) + { + QPainter painter(this); + painter.fillRect(rect(), Qt::white); + Flow2AuthWidget::paintEvent(event); + } + + void NMCFlow2AuthWidget::customizeStyle() + { + // Empty + } + + } // namespace OCC + \ No newline at end of file diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 0a74802bea5b4..35481445f1430 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -12,44 +12,46 @@ * for more details. */ -#ifndef NMCFLOW2AUTHWIDGET_H -#define NMCFLOW2AUTHWIDGET_H - -#include "wizard/flow2authwidget.h" - -namespace OCC { - -class NMCFlow2AuthWidget : public Flow2AuthWidget -{ - Q_OBJECT - -public: - /** - * @brief Constructs an NMCFlow2AuthWidget object. - * @param parent The parent widget (default is nullptr). - */ - NMCFlow2AuthWidget(QWidget *parent = nullptr); - - /** - * @brief Destructor for NMCFlow2AuthWidget. - */ - ~NMCFlow2AuthWidget() = default; - -protected: - /** - * @brief Reimplemented from Flow2AuthWidget. - * Paints the widget during the paint event. - * @param event The paint event. - */ - void paintEvent(QPaintEvent *event) override; - - /** - * @brief Reimplemented from Flow2AuthWidget. - * Customizes the style of the widget. - */ - void customizeStyle() override; -}; - -} // namespace OCC - -#endif // NMCFLOW2AUTHWIDGET_H + #ifndef NMCFLOW2AUTHWIDGET_H + #define NMCFLOW2AUTHWIDGET_H + + #include "wizard/flow2authwidget.h" + #include + + namespace OCC { + + class NMCFlow2AuthWidget : public Flow2AuthWidget + { + Q_OBJECT + + public: + /** + * @brief Constructs an NMCFlow2AuthWidget object. + * @param parent The parent widget (default is nullptr). + */ + explicit NMCFlow2AuthWidget(QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCFlow2AuthWidget. + */ + ~NMCFlow2AuthWidget() override = default; + + protected: + /** + * @brief Reimplemented from Flow2AuthWidget. + * Paints the widget during the paint event. + * @param event The paint event. + */ + void paintEvent(QPaintEvent *event) override; + + /** + * @brief Reimplemented from Flow2AuthWidget. + * Customizes the style of the widget. + */ + void customizeStyle() override; + }; + + } // namespace OCC + + #endif // NMCFLOW2AUTHWIDGET_H + \ No newline at end of file diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 06a4acc3a47c9..a004830a28bb5 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -12,247 +12,101 @@ * for more details. */ -#include "QtGui/qpainter.h" -#include "common/utility.h" -#include "wizard/owncloudwizard.h" -#include "wizard/owncloudadvancedsetuppage.h" -#include "nmcgui/nmcowncloudadvancedsetuppage.h" - -namespace OCC { - -void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() -{ - getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); - getUi().syncLogoLabel->setFixedSize(0,0); - getUi().syncLogoLabel->setVisible(false); - - getUi().horizontalLayout_6->removeWidget(getUi().confCheckBoxSize); - getUi().confCheckBoxSize->setFixedSize(0,0); - getUi().confCheckBoxSize->setVisible(false); - - getUi().horizontalLayout_6->removeWidget(getUi().confSpinBox); - getUi().confSpinBox->setFixedSize(0,0); - getUi().confSpinBox->setVisible(false); - - getUi().horizontalLayout_6->removeWidget(getUi().confTraillingSizeLabel); - getUi().confTraillingSizeLabel->setFixedSize(0,0); - getUi().confTraillingSizeLabel->setVisible(false); - - getUi().horizontalLayout_8->removeWidget(getUi().confCheckBoxExternal); - getUi().confCheckBoxExternal->setFixedSize(0,0); - getUi().confCheckBoxExternal->setVisible(false); - - getUi().lVirtualFileSync->removeWidget(getUi().rVirtualFileSync); - getUi().rVirtualFileSync->setFixedSize(0,0); - getUi().rVirtualFileSync->setVisible(false); - getUi().rVirtualFileSync->setChecked(true); - - getUi().resolutionWidget->setVisible(false); - - getUi().verticalLayout->removeWidget(getUi().errorLabel); - getUi().errorLabel->setFixedSize(0,0); - getUi().errorLabel->setVisible(false); - - getUi().verticalLayout->removeWidget(getUi().bottomLabel); - getUi().bottomLabel->setFixedSize(0,0); - getUi().bottomLabel->setVisible(false); - - getUi().verticalLayout->removeWidget(getUi().topLabel); - getUi().topLabel->setFixedSize(0,0); - getUi().topLabel->setVisible(false); - - getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); - getUi().syncLogoLabel->setFixedSize(0,0); - getUi().syncLogoLabel->setVisible(false); - - getUi().locationsGridLayout->removeWidget(getUi().lLocal); - getUi().lLocal->setFixedSize(0,0); - getUi().lLocal->setVisible(false); - - getUi().locationsGridLayout->removeWidget(getUi().localFolderDescriptionLabel); - getUi().localFolderDescriptionLabel->setFixedSize(0,0); - getUi().localFolderDescriptionLabel->setVisible(false); - - getUi().locationsGridLayout->removeWidget(getUi().lServerIcon); - getUi().lServerIcon->setFixedSize(0,0); - getUi().lServerIcon->setVisible(false); - - getUi().locationsGridLayout->removeWidget(getUi().userNameLabel); - getUi().userNameLabel->setFixedSize(0,0); - getUi().userNameLabel->setVisible(false); - - getUi().locationsGridLayout->removeWidget(getUi().serverAddressLabel); - getUi().serverAddressLabel->setFixedSize(0,0); - getUi().serverAddressLabel->setVisible(false); -} - -NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) - : OwncloudAdvancedSetupPage(wizard), - _tLogoLbl(new QLabel(this)) -{ - - cleanUpElements(); - - //Create and connect the push buttons to base slots - auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); - connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ - validatePage(); - }); - - auto buttonLayout = new QHBoxLayout(this); - buttonLayout->setSpacing(8); - //Set login button size and style - QSize buttonSize(130,32); - const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;} QPushButton:hover { background-color: %4; }" ); - loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white", "#c00063")); - loginBrowserButton->setFixedSize(buttonSize); - - getUi().locationsGridLayout->removeWidget(getUi().pbSelectLocalFolder); - getUi().pbSelectLocalFolder->setFixedSize(180, 32); - getUi().pbSelectLocalFolder->setStyleSheet(styleSheet.arg("1","white","black", "#ededed")); - getUi().pbSelectLocalFolder->setText("Speicherort ändern"); - - buttonLayout->addWidget(getUi().pbSelectLocalFolder); - buttonLayout->addWidget(loginBrowserButton); - buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); - - //Create needed layouts - auto mainVerticalLayout = new QVBoxLayout(this); - auto subMainHorizontalLayout = new QHBoxLayout(this); - auto leftSideVerticalLayout = new QVBoxLayout(this); - auto rightSideVerticalLayout = new QVBoxLayout(this); - mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16,8,40,0); - subMainHorizontalLayout->setSpacing(0); - subMainHorizontalLayout->setContentsMargins(0,0,0,0); - leftSideVerticalLayout->setSpacing(0); - leftSideVerticalLayout->setContentsMargins(0,0,0,0); - rightSideVerticalLayout->setSpacing(0); - rightSideVerticalLayout->setContentsMargins(0,0,0,0); - - mainVerticalLayout->addLayout(subMainHorizontalLayout); - - subMainHorizontalLayout->addSpacerItem(new QSpacerItem(12,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - subMainHorizontalLayout->addLayout(leftSideVerticalLayout); - subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - - leftSideVerticalLayout->setSpacing(0); - - //Create a horizontal T-Logo and MagentaCLOUC-label layout - auto hLogoAndLabelLayout = new QHBoxLayout(this); - hLogoAndLabelLayout->setSpacing(0); - hLogoAndLabelLayout->setContentsMargins(0,0,0,0); - - //T-Logo - _tLogoLbl->setFixedSize(36,36); - _tLogoLbl->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); - hLogoAndLabelLayout->addWidget(_tLogoLbl); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //MagentaCLOUD-label - QLabel *magentaLabel = new QLabel("MagentaCLOUD"); - magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); - magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - hLogoAndLabelLayout->addWidget(magentaLabel); - leftSideVerticalLayout->addItem(hLogoAndLabelLayout); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //Headline - QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_2")); - descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); - descriptionLabel->setWordWrap(true); - descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); - leftSideVerticalLayout->addWidget(descriptionLabel); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //Path to a local folder - getUi().locationsGridLayout->removeWidget(getFilePathLabel().data()); - leftSideVerticalLayout->addWidget(getFilePathLabel().data()); - getFilePathLabel().data()->setAlignment(Qt::AlignLeft); - getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); - - //Free space available - getUi().locationsGridLayout->removeWidget(getUi().lFreeSpace); - leftSideVerticalLayout->addWidget(getUi().lFreeSpace); - getUi().lFreeSpace->setAlignment(Qt::AlignLeft); - getUi().lFreeSpace->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //Synch Radio button layout - getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_5); - leftSideVerticalLayout->addLayout(getUi().horizontalLayout_5); - - //Disable Mac related UI fields - if(Utility::isWindows()) - { - getUi().lSyncEverythingSizeLabel->setVisible(false); - getUi().rSyncEverything->setVisible(false); - getUi().rSelectiveSync->setVisible(false); - getUi().bSelectiveSync->setVisible(false); - getUi().lSelectiveSyncSizeLabel->setVisible(false); - } - - //Choose what to sync layout - getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_10); - leftSideVerticalLayout->addLayout(getUi().horizontalLayout_10); - getUi().horizontalLayout_10->removeWidget(getUi().lSelectiveSyncSizeLabel); //Remove text label, its not needed - getUi().lSelectiveSyncSizeLabel->setVisible(false); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //Detail description - QLabel *detailLabel = new QLabel(QCoreApplication::translate("","SETUP_DESCRIPTION_TEXT_2")); - detailLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - detailLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - detailLabel->setWordWrap(true); - detailLabel->setMinimumWidth(396); - leftSideVerticalLayout->addWidget(detailLabel); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //Add buttons - leftSideVerticalLayout->addItem(buttonLayout); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - - //Add items to the right side - QLabel *bigMagetnaIcon = new QLabel(""); - bigMagetnaIcon->setFixedSize(175,175); - bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/folderLogo.svg")).pixmap(175,175)); - - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,164, QSizePolicy::Fixed, QSizePolicy::Fixed)); - rightSideVerticalLayout->addWidget(bigMagetnaIcon); - - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - //Delete previous installed layout, or you can not apply the new one. - QLayout* layout = this->layout (); - if (layout != 0) - { - QLayoutItem *item; - while ((item = layout->takeAt(0)) != 0) - layout->removeItem (item); - delete layout; - } - - this->setLayout(mainVerticalLayout); -} - -void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) -{ - QPainter painter; - painter.begin(this); - painter.fillRect(rect(), Qt::white); - painter.end(); - OwncloudAdvancedSetupPage::paintEvent(event); -} - -} // namespace OCC + #include + #include "common/utility.h" + #include "wizard/owncloudwizard.h" + #include "wizard/owncloudadvancedsetuppage.h" + #include "nmcgui/nmcowncloudadvancedsetuppage.h" + + namespace OCC { + + void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() + { + auto &ui = getUi(); + ui.locationsGridLayout->removeWidget(ui.syncLogoLabel); + ui.syncLogoLabel->setFixedSize(0,0); + ui.syncLogoLabel->setVisible(false); + + ui.horizontalLayout_6->removeWidget(ui.confCheckBoxSize); + ui.confCheckBoxSize->setFixedSize(0,0); + ui.confCheckBoxSize->setVisible(false); + + ui.horizontalLayout_6->removeWidget(ui.confSpinBox); + ui.confSpinBox->setFixedSize(0,0); + ui.confSpinBox->setVisible(false); + + ui.horizontalLayout_6->removeWidget(ui.confTraillingSizeLabel); + ui.confTraillingSizeLabel->setFixedSize(0,0); + ui.confTraillingSizeLabel->setVisible(false); + + ui.horizontalLayout_8->removeWidget(ui.confCheckBoxExternal); + ui.confCheckBoxExternal->setFixedSize(0,0); + ui.confCheckBoxExternal->setVisible(false); + + ui.lVirtualFileSync->removeWidget(ui.rVirtualFileSync); + ui.rVirtualFileSync->setFixedSize(0,0); + ui.rVirtualFileSync->setVisible(false); + ui.rVirtualFileSync->setChecked(true); + + ui.resolutionWidget->setVisible(false); + + ui.verticalLayout->removeWidget(ui.errorLabel); + ui.errorLabel->setFixedSize(0,0); + ui.errorLabel->setVisible(false); + } + + NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) + : OwncloudAdvancedSetupPage(wizard), + _tLogoLbl(new QLabel(this)) + { + cleanUpElements(); + + auto loginBrowserButton = new QPushButton(tr("LOGIN")); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + validatePage(); + }); + + auto buttonLayout = new QHBoxLayout; + buttonLayout->setSpacing(8); + loginBrowserButton->setFixedSize(130,32); + loginBrowserButton->setStyleSheet("QPushButton{font-size: 15px; border: 0px solid; border-radius: 4px; background-color: #E20074; color: white;} QPushButton:hover { background-color: #c00063; }"); + + getUi().pbSelectLocalFolder->setFixedSize(180, 32); + getUi().pbSelectLocalFolder->setStyleSheet("QPushButton{border: 1px solid; border-color: black; border-radius: 4px; background-color: white; color: black;} QPushButton:hover { background-color: #ededed; }"); + getUi().pbSelectLocalFolder->setText(tr("Speicherort ändern")); + + buttonLayout->addWidget(getUi().pbSelectLocalFolder); + buttonLayout->addWidget(loginBrowserButton); + buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); + + auto mainVerticalLayout = new QVBoxLayout(this); + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16,8,40,0); + + auto leftSideVerticalLayout = new QVBoxLayout; + leftSideVerticalLayout->setSpacing(0); + + QLabel *magentaLabel = new QLabel(tr("MagentaCLOUD")); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + + QLabel *descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_2")); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px;}"); + descriptionLabel->setWordWrap(true); + + leftSideVerticalLayout->addWidget(magentaLabel); + leftSideVerticalLayout->addWidget(descriptionLabel); + leftSideVerticalLayout->addLayout(buttonLayout); + + mainVerticalLayout->addLayout(leftSideVerticalLayout); + setLayout(mainVerticalLayout); + } + + void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) + { + QPainter painter(this); + painter.fillRect(rect(), Qt::white); + OwncloudAdvancedSetupPage::paintEvent(event); + } + + } // namespace OCC + \ No newline at end of file diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h index cfaa79c35e833..509e53b8b374f 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -12,55 +12,57 @@ * for more details. */ -#ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H -#define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H - -#include - -#include "wizard/owncloudadvancedsetuppage.h" - -namespace OCC { - -/** - * @brief The NMCOwncloudAdvancedSetupPage class. - * @ingroup gui - * Subclass of OwncloudAdvancedSetupPage, representing the advanced setup page for NMC OwnCloud. - */ -class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage -{ - Q_OBJECT - -public: - /** - * @brief Constructs an NMCOwncloudAdvancedSetupPage object. - * @param wizard Pointer to the parent OwncloudWizard. - */ - NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); - - /** - * @brief Destructor for NMCOwncloudAdvancedSetupPage. - */ - ~NMCOwncloudAdvancedSetupPage() = default; - -protected: - /** - * @brief Override of paintEvent to handle custom painting. - * @param event Pointer to the QPaintEvent object. - */ - void paintEvent(QPaintEvent *event) override; - -private: - /** - * @brief Pointer to the QLabel for the custom logo. - */ - QLabel *_tLogoLbl = nullptr; - - /** - * @brief Helper function to clean up elements. - */ - void cleanUpElements(); -}; - -} // namespace OCC - -#endif // MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + #ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + #define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + + #include + #include + + #include "wizard/owncloudadvancedsetuppage.h" + + namespace OCC { + + /** + * @brief The NMCOwncloudAdvancedSetupPage class. + * @ingroup gui + * Subclass of OwncloudAdvancedSetupPage, representing the advanced setup page for NMC OwnCloud. + */ + class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage + { + Q_OBJECT + + public: + /** + * @brief Constructs an NMCOwncloudAdvancedSetupPage object. + * @param wizard Pointer to the parent OwncloudWizard. + */ + explicit NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); + + /** + * @brief Destructor for NMCOwncloudAdvancedSetupPage. + */ + ~NMCOwncloudAdvancedSetupPage() override = default; + + protected: + /** + * @brief Override of paintEvent to handle custom painting. + * @param event Pointer to the QPaintEvent object. + */ + void paintEvent(QPaintEvent *event) override; + + private: + /** + * @brief Pointer to the QLabel for the custom logo. + */ + QLabel *_tLogoLbl = nullptr; + + /** + * @brief Helper function to clean up elements. + */ + void cleanUpElements(); + }; + + } // namespace OCC + + #endif // MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + \ No newline at end of file From 62c96a8efaa10f93ef69f31ed0894cc921b09ca3 Mon Sep 17 00:00:00 2001 From: memurats Date: Fri, 4 Apr 2025 13:38:49 +0200 Subject: [PATCH 03/62] fix errors --- src/gui/nmcgui/nmcflow2authwidget.cpp | 295 +++++++++++++------------- src/gui/nmcgui/nmcflow2authwidget.h | 115 +++++----- 2 files changed, 206 insertions(+), 204 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 5bc42ef6f1e0f..ce866e4cc5688 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -1,149 +1,148 @@ /* - * 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 "nmcflow2authwidget.h" - - #include - #include - #include - #include - #include - #include - #include - #include - - #include "theme.h" - - namespace OCC { - - NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) - : Flow2AuthWidget(parent) - { - auto progressInd = getProgressIndicator(); - getUi().progressLayout->removeWidget(progressInd); - progressInd->setVisible(false); - progressInd->setFixedSize(0, 0); - - // LOGIN-Button erstellen - auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); - loginBrowserButton->setFocusPolicy(Qt::NoFocus); - connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { - slotOpenBrowser(); - }); - - // Button-Styling setzen - QSize buttonSize(130, 32); - const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; - const QString styleSheet = - QString("QPushButton{font-size: 15px; border: %1px solid; border-color: black; " - "border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart) - .arg("0", "#E20074", "white"); - - loginBrowserButton->setStyleSheet(styleSheet); - loginBrowserButton->setFixedSize(buttonSize); - - // Layouts erstellen - auto mainVerticalLayout = new QVBoxLayout(this); - auto subMainHorizontalLayout = new QHBoxLayout(); - auto leftSideVerticalLayout = new QVBoxLayout(); - auto rightSideVerticalLayout = new QVBoxLayout(); - - mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16, 8, 28, 0); - subMainHorizontalLayout->setSpacing(0); - subMainHorizontalLayout->setContentsMargins(0, 0, 0, 0); - leftSideVerticalLayout->setSpacing(0); - leftSideVerticalLayout->setContentsMargins(0, 0, 0, 0); - rightSideVerticalLayout->setSpacing(0); - rightSideVerticalLayout->setContentsMargins(0, 0, 0, 0); - - mainVerticalLayout->addLayout(subMainHorizontalLayout); - - subMainHorizontalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - subMainHorizontalLayout->addLayout(leftSideVerticalLayout); - subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - - // Logo und Label Layout - auto hLogoAndLabelLayout = new QHBoxLayout(); - hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); - getUi().logoLabel->setFixedSize(36, 36); - getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - - hLogoAndLabelLayout->addWidget(getUi().logoLabel); - hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - auto magentaLabel = new QLabel("MagentaCLOUD"); - magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); - magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - hLogoAndLabelLayout->addWidget(magentaLabel); - - leftSideVerticalLayout->addLayout(hLogoAndLabelLayout); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 24, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - // Beschreibung - auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); - descriptionLabel->setWordWrap(true); - descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); - leftSideVerticalLayout->addWidget(descriptionLabel); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 16, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - getUi().label->setText("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."); - getUi().label->setFixedWidth(282); - getUi().label->setAlignment(Qt::AlignLeft); - leftSideVerticalLayout->addWidget(getUi().label); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - // Login-Button hinzufügen - leftSideVerticalLayout->addWidget(loginBrowserButton); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - - // Rechtsseitige Inhalte - auto bigMagentaIcon = new QLabel(); - bigMagentaIcon->setFixedSize(175, 175); - bigMagentaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 98, QSizePolicy::Fixed, QSizePolicy::Fixed)); - rightSideVerticalLayout->addWidget(bigMagentaIcon); - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - - mainVerticalLayout->addWidget(getUi().errorLabel); - getUi().statusLabel->setFixedSize(0, 0); - - // Falls ein altes Layout existiert, entfernen - if (layout() != nullptr) { - delete layout(); - } - - setLayout(mainVerticalLayout); - } - - void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) - { - QPainter painter(this); - painter.fillRect(rect(), Qt::white); - Flow2AuthWidget::paintEvent(event); - } - - void NMCFlow2AuthWidget::customizeStyle() - { - // Empty - } - - } // namespace OCC - \ No newline at end of file +* 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 "nmcflow2authwidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "theme.h" + +namespace OCC { + +NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) + : Flow2AuthWidget(parent) +{ + auto progressInd = getProgressIndicator(); + getUi().progressLayout->removeWidget(progressInd); + progressInd->setVisible(false); + progressInd->setFixedSize(0, 0); + + // LOGIN-Button erstellen + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + loginBrowserButton->setFocusPolicy(Qt::NoFocus); + connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { + slotOpenBrowser(); + }); + + // Button-Styling setzen + QSize buttonSize(130, 32); + const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; + const QString styleSheet = + QString("QPushButton{font-size: 15px; border: %1px solid; border-color: black; " + "border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart) + .arg("0", "#E20074", "white"); + + loginBrowserButton->setStyleSheet(styleSheet); + loginBrowserButton->setFixedSize(buttonSize); + + // Layouts erstellen + auto mainVerticalLayout = new QVBoxLayout(this); + auto subMainHorizontalLayout = new QHBoxLayout(); + auto leftSideVerticalLayout = new QVBoxLayout(); + auto rightSideVerticalLayout = new QVBoxLayout(); + + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16, 8, 28, 0); + subMainHorizontalLayout->setSpacing(0); + subMainHorizontalLayout->setContentsMargins(0, 0, 0, 0); + leftSideVerticalLayout->setSpacing(0); + leftSideVerticalLayout->setContentsMargins(0, 0, 0, 0); + rightSideVerticalLayout->setSpacing(0); + rightSideVerticalLayout->setContentsMargins(0, 0, 0, 0); + + mainVerticalLayout->addLayout(subMainHorizontalLayout); + + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); + + // Logo und Label Layout + auto hLogoAndLabelLayout = new QHBoxLayout(); + hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); + getUi().logoLabel->setFixedSize(36, 36); + getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + + hLogoAndLabelLayout->addWidget(getUi().logoLabel); + hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + auto magentaLabel = new QLabel("MagentaCLOUD"); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + + leftSideVerticalLayout->addLayout(hLogoAndLabelLayout); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 24, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Beschreibung + auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); + leftSideVerticalLayout->addWidget(descriptionLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + getUi().label->setText("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."); + getUi().label->setFixedWidth(282); + getUi().label->setAlignment(Qt::AlignLeft); + leftSideVerticalLayout->addWidget(getUi().label); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Login-Button hinzufügen + leftSideVerticalLayout->addWidget(loginBrowserButton); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + // Rechtsseitige Inhalte + auto bigMagentaIcon = new QLabel(); + bigMagentaIcon->setFixedSize(175, 175); + bigMagentaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 98, QSizePolicy::Fixed, QSizePolicy::Fixed)); + rightSideVerticalLayout->addWidget(bigMagentaIcon); + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + mainVerticalLayout->addWidget(getUi().errorLabel); + getUi().statusLabel->setFixedSize(0, 0); + + // Falls ein altes Layout existiert, entfernen + if (layout() != nullptr) { + delete layout(); + } + + setLayout(mainVerticalLayout); +} + +void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.fillRect(rect(), Qt::white); + Flow2AuthWidget::paintEvent(event); +} + +void NMCFlow2AuthWidget::customizeStyle() +{ + // Empty +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 35481445f1430..4f48ea6b308b3 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -1,57 +1,60 @@ /* - * 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. - */ - - #ifndef NMCFLOW2AUTHWIDGET_H - #define NMCFLOW2AUTHWIDGET_H - - #include "wizard/flow2authwidget.h" - #include - - namespace OCC { - - class NMCFlow2AuthWidget : public Flow2AuthWidget - { - Q_OBJECT - - public: - /** - * @brief Constructs an NMCFlow2AuthWidget object. - * @param parent The parent widget (default is nullptr). - */ - explicit NMCFlow2AuthWidget(QWidget *parent = nullptr); - - /** - * @brief Destructor for NMCFlow2AuthWidget. - */ - ~NMCFlow2AuthWidget() override = default; - - protected: - /** - * @brief Reimplemented from Flow2AuthWidget. - * Paints the widget during the paint event. - * @param event The paint event. - */ - void paintEvent(QPaintEvent *event) override; - - /** - * @brief Reimplemented from Flow2AuthWidget. - * Customizes the style of the widget. - */ - void customizeStyle() override; - }; - - } // namespace OCC - - #endif // NMCFLOW2AUTHWIDGET_H - \ No newline at end of file +* 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. +*/ + +#ifndef NMCFLOW2AUTHWIDGET_H +#define NMCFLOW2AUTHWIDGET_H + +#include "wizard/flow2authwidget.h" +#include "QProgressIndicator.h" +#include + +namespace OCC { + +class NMCFlow2AuthWidget : public Flow2AuthWidget +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCFlow2AuthWidget object. + * @param parent The parent widget (default is nullptr). + */ + explicit NMCFlow2AuthWidget(QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCFlow2AuthWidget. + */ + ~NMCFlow2AuthWidget() override = default; + +protected: + /** + * @brief Reimplemented from Flow2AuthWidget. + * Paints the widget during the paint event. + * @param event The paint event. + */ + void paintEvent(QPaintEvent *event) override; + + /** + * @brief Reimplemented from Flow2AuthWidget. + * Customizes the style of the widget. + */ + void customizeStyle() override; + +private: + QProgressIndicator *_progressIndicator = nullptr; +}; + +} // namespace OCC + +#endif // NMCFLOW2AUTHWIDGET_H From bd5a2118ec27c038a46eee303c71c7c34a368184 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 12 May 2025 17:28:23 +0200 Subject: [PATCH 04/62] update setup page --- .../nmcgui/nmcowncloudadvancedsetuppage.cpp | 200 +++++++++--------- src/gui/nmcgui/nmcowncloudadvancedsetuppage.h | 107 +++++----- 2 files changed, 155 insertions(+), 152 deletions(-) diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index a004830a28bb5..6f902cdb8d6ce 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -12,101 +12,105 @@ * for more details. */ - #include - #include "common/utility.h" - #include "wizard/owncloudwizard.h" - #include "wizard/owncloudadvancedsetuppage.h" - #include "nmcgui/nmcowncloudadvancedsetuppage.h" - - namespace OCC { - - void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() - { - auto &ui = getUi(); - ui.locationsGridLayout->removeWidget(ui.syncLogoLabel); - ui.syncLogoLabel->setFixedSize(0,0); - ui.syncLogoLabel->setVisible(false); - - ui.horizontalLayout_6->removeWidget(ui.confCheckBoxSize); - ui.confCheckBoxSize->setFixedSize(0,0); - ui.confCheckBoxSize->setVisible(false); - - ui.horizontalLayout_6->removeWidget(ui.confSpinBox); - ui.confSpinBox->setFixedSize(0,0); - ui.confSpinBox->setVisible(false); - - ui.horizontalLayout_6->removeWidget(ui.confTraillingSizeLabel); - ui.confTraillingSizeLabel->setFixedSize(0,0); - ui.confTraillingSizeLabel->setVisible(false); - - ui.horizontalLayout_8->removeWidget(ui.confCheckBoxExternal); - ui.confCheckBoxExternal->setFixedSize(0,0); - ui.confCheckBoxExternal->setVisible(false); - - ui.lVirtualFileSync->removeWidget(ui.rVirtualFileSync); - ui.rVirtualFileSync->setFixedSize(0,0); - ui.rVirtualFileSync->setVisible(false); - ui.rVirtualFileSync->setChecked(true); - - ui.resolutionWidget->setVisible(false); - - ui.verticalLayout->removeWidget(ui.errorLabel); - ui.errorLabel->setFixedSize(0,0); - ui.errorLabel->setVisible(false); - } - - NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) - : OwncloudAdvancedSetupPage(wizard), - _tLogoLbl(new QLabel(this)) - { - cleanUpElements(); - - auto loginBrowserButton = new QPushButton(tr("LOGIN")); - connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ - validatePage(); - }); - - auto buttonLayout = new QHBoxLayout; - buttonLayout->setSpacing(8); - loginBrowserButton->setFixedSize(130,32); - loginBrowserButton->setStyleSheet("QPushButton{font-size: 15px; border: 0px solid; border-radius: 4px; background-color: #E20074; color: white;} QPushButton:hover { background-color: #c00063; }"); - - getUi().pbSelectLocalFolder->setFixedSize(180, 32); - getUi().pbSelectLocalFolder->setStyleSheet("QPushButton{border: 1px solid; border-color: black; border-radius: 4px; background-color: white; color: black;} QPushButton:hover { background-color: #ededed; }"); - getUi().pbSelectLocalFolder->setText(tr("Speicherort ändern")); - - buttonLayout->addWidget(getUi().pbSelectLocalFolder); - buttonLayout->addWidget(loginBrowserButton); - buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); - - auto mainVerticalLayout = new QVBoxLayout(this); - mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16,8,40,0); - - auto leftSideVerticalLayout = new QVBoxLayout; - leftSideVerticalLayout->setSpacing(0); - - QLabel *magentaLabel = new QLabel(tr("MagentaCLOUD")); - magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); - - QLabel *descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_2")); - descriptionLabel->setStyleSheet("QLabel{font-size: 28px;}"); - descriptionLabel->setWordWrap(true); - - leftSideVerticalLayout->addWidget(magentaLabel); - leftSideVerticalLayout->addWidget(descriptionLabel); - leftSideVerticalLayout->addLayout(buttonLayout); - - mainVerticalLayout->addLayout(leftSideVerticalLayout); - setLayout(mainVerticalLayout); - } - - void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) - { - QPainter painter(this); - painter.fillRect(rect(), Qt::white); - OwncloudAdvancedSetupPage::paintEvent(event); - } - - } // namespace OCC - \ No newline at end of file +#include +#include "common/utility.h" +#include "wizard/owncloudwizard.h" +#include "wizard/owncloudadvancedsetuppage.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" + +namespace OCC { + +void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() +{ + auto &ui = getUi(); + ui.locationsGridLayout->removeWidget(ui.syncLogoLabel); + ui.syncLogoLabel->setFixedSize(0,0); + ui.syncLogoLabel->setVisible(false); + + ui.horizontalLayout_6->removeWidget(ui.confCheckBoxSize); + ui.confCheckBoxSize->setFixedSize(0,0); + ui.confCheckBoxSize->setVisible(false); + + ui.horizontalLayout_6->removeWidget(ui.confSpinBox); + ui.confSpinBox->setFixedSize(0,0); + ui.confSpinBox->setVisible(false); + + ui.horizontalLayout_6->removeWidget(ui.confTraillingSizeLabel); + ui.confTraillingSizeLabel->setFixedSize(0,0); + ui.confTraillingSizeLabel->setVisible(false); + + ui.horizontalLayout_8->removeWidget(ui.confCheckBoxExternal); + ui.confCheckBoxExternal->setFixedSize(0,0); + ui.confCheckBoxExternal->setVisible(false); + + ui.lVirtualFileSync->removeWidget(ui.rVirtualFileSync); + ui.rVirtualFileSync->setFixedSize(0,0); + ui.rVirtualFileSync->setVisible(false); + ui.rVirtualFileSync->setChecked(true); + + ui.resolutionWidget->setVisible(false); + + ui.verticalLayout->removeWidget(ui.errorLabel); + ui.errorLabel->setFixedSize(0,0); + ui.errorLabel->setVisible(false); +} + +NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) + : OwncloudAdvancedSetupPage(wizard), + _tLogoLbl(new QLabel(this)) +{ + cleanUpElements(); + + auto loginBrowserButton = new QPushButton(tr("LOGIN"), this); + connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { + validatePage(); + }); + + auto buttonLayout = new QHBoxLayout; + buttonLayout->setSpacing(8); + loginBrowserButton->setFixedSize(130, 32); + loginBrowserButton->setStyleSheet("QPushButton{font-size: 15px; border: 0px solid; border-radius: 4px; background-color: #E20074; color: white;} QPushButton:hover { background-color: #c00063; }"); + + getUi().pbSelectLocalFolder->setFixedSize(180, 32); + getUi().pbSelectLocalFolder->setStyleSheet("QPushButton{border: 1px solid; border-color: black; border-radius: 4px; background-color: white; color: black;} QPushButton:hover { background-color: #ededed; }"); + getUi().pbSelectLocalFolder->setText(tr("Speicherort ändern")); + + buttonLayout->addWidget(getUi().pbSelectLocalFolder); + buttonLayout->addWidget(loginBrowserButton); + buttonLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed)); + + auto mainVerticalLayout = new QVBoxLayout; + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16, 8, 40, 0); + + auto leftSideVerticalLayout = new QVBoxLayout; + leftSideVerticalLayout->setSpacing(0); + + QLabel *magentaLabel = new QLabel(tr("MagentaCLOUD"), this); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + + QLabel *descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_2"), this); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px;}"); + descriptionLabel->setWordWrap(true); + + leftSideVerticalLayout->addWidget(magentaLabel); + leftSideVerticalLayout->addWidget(descriptionLabel); + leftSideVerticalLayout->addLayout(buttonLayout); + + mainVerticalLayout->addLayout(leftSideVerticalLayout); + + if (!layout()) { + setLayout(mainVerticalLayout); + } else { + layout()->addLayout(mainVerticalLayout); + } +} + +void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.fillRect(rect(), Qt::white); + OwncloudAdvancedSetupPage::paintEvent(event); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h index 509e53b8b374f..2f296d9d945c7 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -12,57 +12,56 @@ * for more details. */ - #ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H - #define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H - - #include - #include - - #include "wizard/owncloudadvancedsetuppage.h" - - namespace OCC { - - /** - * @brief The NMCOwncloudAdvancedSetupPage class. - * @ingroup gui - * Subclass of OwncloudAdvancedSetupPage, representing the advanced setup page for NMC OwnCloud. - */ - class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage - { - Q_OBJECT - - public: - /** - * @brief Constructs an NMCOwncloudAdvancedSetupPage object. - * @param wizard Pointer to the parent OwncloudWizard. - */ - explicit NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); - - /** - * @brief Destructor for NMCOwncloudAdvancedSetupPage. - */ - ~NMCOwncloudAdvancedSetupPage() override = default; - - protected: - /** - * @brief Override of paintEvent to handle custom painting. - * @param event Pointer to the QPaintEvent object. - */ - void paintEvent(QPaintEvent *event) override; - - private: - /** - * @brief Pointer to the QLabel for the custom logo. - */ - QLabel *_tLogoLbl = nullptr; - - /** - * @brief Helper function to clean up elements. - */ - void cleanUpElements(); - }; - - } // namespace OCC - - #endif // MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H - \ No newline at end of file +#ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H +#define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + +#include +#include + +#include "wizard/owncloudadvancedsetuppage.h" + +namespace OCC { + +/** + * @brief The NMCOwncloudAdvancedSetupPage class. + * @ingroup gui + * Subclass of OwncloudAdvancedSetupPage, representing the advanced setup page for NMC OwnCloud. + */ +class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCOwncloudAdvancedSetupPage object. + * @param wizard Pointer to the parent OwncloudWizard. + */ + explicit NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); + + /** + * @brief Destructor for NMCOwncloudAdvancedSetupPage. + */ + ~NMCOwncloudAdvancedSetupPage() override = default; + +protected: + /** + * @brief Override of paintEvent to handle custom painting. + * @param event Pointer to the QPaintEvent object. + */ + void paintEvent(QPaintEvent *event) override; + +private: + /** + * @brief Pointer to the QLabel for the custom logo. + */ + QLabel *_tLogoLbl; + + /** + * @brief Helper function to clean up elements. + */ + void cleanUpElements(); +}; + +} // namespace OCC + +#endif // MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H From 1de3d8c721fdf8d5da8f8e4429bf01272145f6fb Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 12 May 2025 17:36:14 +0200 Subject: [PATCH 05/62] fix error --- src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 6f902cdb8d6ce..15944acaa157d 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -57,7 +57,7 @@ void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) : OwncloudAdvancedSetupPage(wizard), - _tLogoLbl(new QLabel(this)) + _tLogoLbl(new QLabel(this)) { cleanUpElements(); @@ -99,11 +99,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar mainVerticalLayout->addLayout(leftSideVerticalLayout); - if (!layout()) { - setLayout(mainVerticalLayout); - } else { - layout()->addLayout(mainVerticalLayout); - } + setLayout(mainVerticalLayout); } void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) From ef3b5a350ef217cd5921829b512d9920e4a181c7 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 13 May 2025 10:53:44 +0200 Subject: [PATCH 06/62] solve client crash issue by using standard class --- src/gui/wizard/flow2authcredspage.cpp | 3 +- src/gui/wizard/flow2authwidget.cpp | 111 ++++++++++++++++---------- 2 files changed, 68 insertions(+), 46 deletions(-) diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index 957f572275b48..8eef42fab0f4b 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -25,7 +25,6 @@ #include "wizard/flow2authwidget.h" #include "creds/credentialsfactory.h" #include "creds/webflowcredentials.h" -#include "nmcgui/nmcflow2authwidget.h" namespace OCC { @@ -34,7 +33,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new NMCFlow2AuthWidget(); + _flow2AuthWidget = new Flow2AuthWidget(); _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult); diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index e89a08a7f250e..ddfd4f64c0125 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -1,15 +1,11 @@ /* * Copyright (C) by Michael Schuster + * Adapted by Eugen Fischer for MagentaCLOUD * * 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 "flow2authwidget.h" @@ -27,12 +23,13 @@ #include #include #include +#include +#include namespace OCC { Q_LOGGING_CATEGORY(lcFlow2AuthWidget, "nextcloud.gui.wizard.flow2authwidget", QtInfoMsg) - Flow2AuthWidget::Flow2AuthWidget(QWidget *parent) : QWidget(parent) , _progressIndi(new QProgressIndicator(this)) @@ -55,12 +52,65 @@ Flow2AuthWidget::Flow2AuthWidget(QWidget *parent) customizeStyle(); } +Flow2AuthWidget::~Flow2AuthWidget() +{ + _asyncAuth.reset(nullptr); +} + void Flow2AuthWidget::setLogo() { - const auto backgroundColor = palette().window().color(); - const auto logoIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("external.png", backgroundColor) - : Theme::hidpiFileName(":/client/theme/colored/external.png"); - _ui.logoLabel->setPixmap(logoIconFileName); + _ui.logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); +} + +void Flow2AuthWidget::customizeStyle() +{ + setLogo(); + + if (_progressIndi) { + const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); + _progressIndi->setColor(isDarkBackground ? Qt::white : Qt::black); + } + + // Textanpassung + _ui.label->setText( + tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); + _ui.label->setStyleSheet("font-size: 15px; font-weight: normal;"); + + // LOGIN-Button Styling + _ui.openLinkButton->setText(tr("LOGIN")); + _ui.openLinkButton->setStyleSheet(R"( + QPushButton { + font-size: 15px; + border: 0px solid; + border-radius: 4px; + background-color: #E20074; + color: white; + width: 130px; + height: 32px; + } + QPushButton:hover { + background-color: #c00063; + } + )"); + + // Copy-Link-Button ausblenden (optional) + _ui.copyLinkButton->setVisible(false); + + WizardCommon::customizeHintLabel(_ui.statusLabel); + _ui.errorLabel->setStyleSheet("color: red;"); + + // Weißer Hintergrund + setAutoFillBackground(true); + QPalette pal = palette(); + pal.setColor(QPalette::Window, Qt::white); + setPalette(pal); +} + +void Flow2AuthWidget::paintEvent(QPaintEvent *event) +{ + QPainter p(this); + p.fillRect(rect(), Qt::white); + QWidget::paintEvent(event); } void Flow2AuthWidget::startAuth(Account *account) @@ -72,7 +122,7 @@ void Flow2AuthWidget::startAuth(Account *account) _statusUpdateSkipCount = 0; - if(account) { + if (account) { _account = account; _asyncAuth = std::make_unique(_account, this); @@ -94,25 +144,23 @@ void Flow2AuthWidget::slotAuthResult(Flow2Auth::Result r, const QString &errorSt switch (r) { case Flow2Auth::NotSupported: - /* Flow2Auth can't open browser */ _ui.errorLabel->setText(tr("Unable to open the Browser, please copy the link to your Browser.")); _ui.errorLabel->show(); break; case Flow2Auth::Error: - /* Error while getting the access token. (Timeout, or the server did not accept our client credentials */ _ui.errorLabel->setText(errorString); _ui.errorLabel->show(); break; - case Flow2Auth::LoggedIn: { + case Flow2Auth::LoggedIn: _ui.errorLabel->hide(); break; } - } emit authResult(r, errorString, user, appPassword); } -void Flow2AuthWidget::setError(const QString &error) { +void Flow2AuthWidget::setError(const QString &error) +{ if (error.isEmpty()) { _ui.errorLabel->hide(); } else { @@ -121,11 +169,6 @@ void Flow2AuthWidget::setError(const QString &error) { } } -Flow2AuthWidget::~Flow2AuthWidget() { - // Forget sensitive data - _asyncAuth.reset(nullptr); -} - void Flow2AuthWidget::slotOpenBrowser() { if (_ui.errorLabel) @@ -151,10 +194,9 @@ void Flow2AuthWidget::slotPollNow() void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) { - switch(status) - { + switch (status) { case Flow2Auth::statusPollCountdown: - if(_statusUpdateSkipCount > 0) { + if (_statusUpdateSkipCount > 0) { _statusUpdateSkipCount--; break; } @@ -206,24 +248,5 @@ void Flow2AuthWidget::slotStyleChanged() customizeStyle(); } -void Flow2AuthWidget::customizeStyle() -{ - setLogo(); - - if (_progressIndi) { - const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); - if (isDarkBackground) { - _progressIndi->setColor(Qt::white); - } else { - _progressIndi->setColor(Qt::black); - } - } - - _ui.openLinkButton->setText(tr("Open Browser")); - - _ui.copyLinkButton->setText(tr("Copy Link")); - - WizardCommon::customizeHintLabel(_ui.statusLabel); -} - } // namespace OCC + \ No newline at end of file From a1a4abfee27511bb9ad82fa964147095059621bd Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 13 May 2025 11:01:41 +0200 Subject: [PATCH 07/62] fix error --- src/gui/wizard/flow2authwidget.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index fed5183314c07..931d4eb332826 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -19,7 +19,6 @@ #include #include "creds/flow2auth.h" - #include "ui_flow2authwidget.h" class QProgressIndicator; @@ -58,10 +57,8 @@ public Q_SLOTS: return _progressIndi; } -private: - Account *_account = nullptr; - std::unique_ptr _asyncAuth; - Ui_Flow2AuthWidget _ui{}; +protected: + void paintEvent(QPaintEvent *event) override; protected Q_SLOTS: void slotOpenBrowser(); @@ -75,6 +72,9 @@ protected Q_SLOTS: void stopSpinner(bool showStatusLabel); void setLogo(); + Account *_account = nullptr; + std::unique_ptr _asyncAuth; + Ui_Flow2AuthWidget _ui{}; QProgressIndicator *_progressIndi; int _statusUpdateSkipCount = 0; }; From af89b88fbb8b63c688eb301db7f09d9d2dd308b3 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 13 May 2025 12:52:49 +0200 Subject: [PATCH 08/62] fixed layout issues --- src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 15944acaa157d..e5613939e39a8 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -99,7 +99,9 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar mainVerticalLayout->addLayout(leftSideVerticalLayout); - setLayout(mainVerticalLayout); + if (getUi().verticalLayout) { + getUi().verticalLayout->insertLayout(0, mainVerticalLayout); + } } void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) From 4e78085055aa4eb4ede1e8cb070a6af1f50dd429 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 10:11:38 +0200 Subject: [PATCH 09/62] use standard setup page test --- src/gui/wizard/owncloudwizard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index 992c0444ede8a..a04e887259d3a 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -56,7 +56,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) , _httpCredsPage(new OwncloudHttpCredsPage(this)) , _flow2CredsPage(new Flow2AuthCredsPage) , _termsOfServicePage(new TermsOfServiceWizardPage) - , _advancedSetupPage(new NMCOwncloudAdvancedSetupPage(this)) + , _advancedSetupPage(new OwncloudAdvancedSetupPage(this)) #ifdef WITH_WEBENGINE , _webViewPage(new WebViewPage(this)) #else // WITH_WEBENGINE @@ -148,7 +148,7 @@ void OwncloudWizard::centerWindow() void OwncloudWizard::adjustWizardSize() { - resize(700,460); // NMC customization + resize(698, 474); // NMC customization } QList OwncloudWizard::calculateWizardPageSizes() const From 9e4fe46683dba35c98aff6a7fffd4ddd99090c42 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 12:59:13 +0200 Subject: [PATCH 10/62] restore original code --- .../nmcgui/nmcowncloudadvancedsetuppage.cpp | 236 ++++++++++++++---- src/gui/wizard/owncloudwizard.cpp | 2 +- 2 files changed, 191 insertions(+), 47 deletions(-) diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index e5613939e39a8..444783296b120 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -22,92 +22,236 @@ namespace OCC { void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() { - auto &ui = getUi(); - ui.locationsGridLayout->removeWidget(ui.syncLogoLabel); - ui.syncLogoLabel->setFixedSize(0,0); - ui.syncLogoLabel->setVisible(false); + getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); + getUi().syncLogoLabel->setFixedSize(0,0); + getUi().syncLogoLabel->setVisible(false); - ui.horizontalLayout_6->removeWidget(ui.confCheckBoxSize); - ui.confCheckBoxSize->setFixedSize(0,0); - ui.confCheckBoxSize->setVisible(false); + getUi().horizontalLayout_6->removeWidget(getUi().confCheckBoxSize); + getUi().confCheckBoxSize->setFixedSize(0,0); + getUi().confCheckBoxSize->setVisible(false); - ui.horizontalLayout_6->removeWidget(ui.confSpinBox); - ui.confSpinBox->setFixedSize(0,0); - ui.confSpinBox->setVisible(false); + getUi().horizontalLayout_6->removeWidget(getUi().confSpinBox); + getUi().confSpinBox->setFixedSize(0,0); + getUi().confSpinBox->setVisible(false); - ui.horizontalLayout_6->removeWidget(ui.confTraillingSizeLabel); - ui.confTraillingSizeLabel->setFixedSize(0,0); - ui.confTraillingSizeLabel->setVisible(false); + getUi().horizontalLayout_6->removeWidget(getUi().confTraillingSizeLabel); + getUi().confTraillingSizeLabel->setFixedSize(0,0); + getUi().confTraillingSizeLabel->setVisible(false); - ui.horizontalLayout_8->removeWidget(ui.confCheckBoxExternal); - ui.confCheckBoxExternal->setFixedSize(0,0); - ui.confCheckBoxExternal->setVisible(false); + getUi().horizontalLayout_8->removeWidget(getUi().confCheckBoxExternal); + getUi().confCheckBoxExternal->setFixedSize(0,0); + getUi().confCheckBoxExternal->setVisible(false); - ui.lVirtualFileSync->removeWidget(ui.rVirtualFileSync); - ui.rVirtualFileSync->setFixedSize(0,0); - ui.rVirtualFileSync->setVisible(false); - ui.rVirtualFileSync->setChecked(true); + getUi().lVirtualFileSync->removeWidget(getUi().rVirtualFileSync); + getUi().rVirtualFileSync->setFixedSize(0,0); + getUi().rVirtualFileSync->setVisible(false); + getUi().rVirtualFileSync->setChecked(true); - ui.resolutionWidget->setVisible(false); + getUi().resolutionWidget->setVisible(false); - ui.verticalLayout->removeWidget(ui.errorLabel); - ui.errorLabel->setFixedSize(0,0); - ui.errorLabel->setVisible(false); + getUi().verticalLayout->removeWidget(getUi().errorLabel); + getUi().errorLabel->setFixedSize(0,0); + getUi().errorLabel->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().bottomLabel); + getUi().bottomLabel->setFixedSize(0,0); + getUi().bottomLabel->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().topLabel); + getUi().topLabel->setFixedSize(0,0); + getUi().topLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); + getUi().syncLogoLabel->setFixedSize(0,0); + getUi().syncLogoLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().lLocal); + getUi().lLocal->setFixedSize(0,0); + getUi().lLocal->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().localFolderDescriptionLabel); + getUi().localFolderDescriptionLabel->setFixedSize(0,0); + getUi().localFolderDescriptionLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().lServerIcon); + getUi().lServerIcon->setFixedSize(0,0); + getUi().lServerIcon->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().userNameLabel); + getUi().userNameLabel->setFixedSize(0,0); + getUi().userNameLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().serverAddressLabel); + getUi().serverAddressLabel->setFixedSize(0,0); + getUi().serverAddressLabel->setVisible(false); } NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) : OwncloudAdvancedSetupPage(wizard), - _tLogoLbl(new QLabel(this)) + _tLogoLbl(new QLabel(this)) { + cleanUpElements(); - auto loginBrowserButton = new QPushButton(tr("LOGIN"), this); - connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { + //Create and connect the push buttons to base slots + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ validatePage(); }); - auto buttonLayout = new QHBoxLayout; + auto buttonLayout = new QHBoxLayout(this); buttonLayout->setSpacing(8); - loginBrowserButton->setFixedSize(130, 32); - loginBrowserButton->setStyleSheet("QPushButton{font-size: 15px; border: 0px solid; border-radius: 4px; background-color: #E20074; color: white;} QPushButton:hover { background-color: #c00063; }"); + //Set login button size and style + QSize buttonSize(130,32); + const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;} QPushButton:hover { background-color: %4; }" ); + loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white", "#c00063")); + loginBrowserButton->setFixedSize(buttonSize); + getUi().locationsGridLayout->removeWidget(getUi().pbSelectLocalFolder); getUi().pbSelectLocalFolder->setFixedSize(180, 32); - getUi().pbSelectLocalFolder->setStyleSheet("QPushButton{border: 1px solid; border-color: black; border-radius: 4px; background-color: white; color: black;} QPushButton:hover { background-color: #ededed; }"); - getUi().pbSelectLocalFolder->setText(tr("Speicherort ändern")); + getUi().pbSelectLocalFolder->setStyleSheet(styleSheet.arg("1","white","black", "#ededed")); + getUi().pbSelectLocalFolder->setText("Speicherort ändern"); buttonLayout->addWidget(getUi().pbSelectLocalFolder); buttonLayout->addWidget(loginBrowserButton); - buttonLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed)); + buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); - auto mainVerticalLayout = new QVBoxLayout; + //Create needed layouts + auto mainVerticalLayout = new QVBoxLayout(this); + auto subMainHorizontalLayout = new QHBoxLayout(this); + auto leftSideVerticalLayout = new QVBoxLayout(this); + auto rightSideVerticalLayout = new QVBoxLayout(this); mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16, 8, 40, 0); + mainVerticalLayout->setContentsMargins(16,8,40,0); + subMainHorizontalLayout->setSpacing(0); + subMainHorizontalLayout->setContentsMargins(0,0,0,0); + leftSideVerticalLayout->setSpacing(0); + leftSideVerticalLayout->setContentsMargins(0,0,0,0); + rightSideVerticalLayout->setSpacing(0); + rightSideVerticalLayout->setContentsMargins(0,0,0,0); + + mainVerticalLayout->addLayout(subMainHorizontalLayout); + + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(12,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - auto leftSideVerticalLayout = new QVBoxLayout; leftSideVerticalLayout->setSpacing(0); - QLabel *magentaLabel = new QLabel(tr("MagentaCLOUD"), this); + //Create a horizontal T-Logo and MagentaCLOUC-label layout + auto hLogoAndLabelLayout = new QHBoxLayout(this); + hLogoAndLabelLayout->setSpacing(0); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + + //T-Logo + _tLogoLbl->setFixedSize(36,36); + _tLogoLbl->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); + hLogoAndLabelLayout->addWidget(_tLogoLbl); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //MagentaCLOUD-label + QLabel *magentaLabel = new QLabel("MagentaCLOUD"); magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + leftSideVerticalLayout->addItem(hLogoAndLabelLayout); - QLabel *descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_2"), this); - descriptionLabel->setStyleSheet("QLabel{font-size: 28px;}"); - descriptionLabel->setWordWrap(true); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed)); - leftSideVerticalLayout->addWidget(magentaLabel); + //Headline + QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_2")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); leftSideVerticalLayout->addWidget(descriptionLabel); - leftSideVerticalLayout->addLayout(buttonLayout); - mainVerticalLayout->addLayout(leftSideVerticalLayout); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Path to a local folder + getUi().locationsGridLayout->removeWidget(getFilePathLabel().data()); + leftSideVerticalLayout->addWidget(getFilePathLabel().data()); + getFilePathLabel().data()->setAlignment(Qt::AlignLeft); + getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); + + //Free space available + getUi().locationsGridLayout->removeWidget(getUi().lFreeSpace); + leftSideVerticalLayout->addWidget(getUi().lFreeSpace); + getUi().lFreeSpace->setAlignment(Qt::AlignLeft); + getUi().lFreeSpace->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Synch Radio button layout + getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_5); + leftSideVerticalLayout->addLayout(getUi().horizontalLayout_5); - if (getUi().verticalLayout) { - getUi().verticalLayout->insertLayout(0, mainVerticalLayout); + //Disable Mac related UI fields + if(Utility::isWindows()) + { + getUi().lSyncEverythingSizeLabel->setVisible(false); + getUi().rSyncEverything->setVisible(false); + getUi().rSelectiveSync->setVisible(false); + getUi().bSelectiveSync->setVisible(false); + getUi().lSelectiveSyncSizeLabel->setVisible(false); } + + //Choose what to sync layout + getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_10); + leftSideVerticalLayout->addLayout(getUi().horizontalLayout_10); + getUi().horizontalLayout_10->removeWidget(getUi().lSelectiveSyncSizeLabel); //Remove text label, its not needed + getUi().lSelectiveSyncSizeLabel->setVisible(false); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Detail description + QLabel *detailLabel = new QLabel(QCoreApplication::translate("","SETUP_DESCRIPTION_TEXT_2")); + detailLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + detailLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + detailLabel->setWordWrap(true); + detailLabel->setMinimumWidth(396); + leftSideVerticalLayout->addWidget(detailLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Add buttons + leftSideVerticalLayout->addItem(buttonLayout); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + //Add items to the right side + QLabel *bigMagetnaIcon = new QLabel(""); + bigMagetnaIcon->setFixedSize(175,175); + bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/folderLogo.svg")).pixmap(175,175)); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,164, QSizePolicy::Fixed, QSizePolicy::Fixed)); + rightSideVerticalLayout->addWidget(bigMagetnaIcon); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + //Delete previous installed layout, or you can not apply the new one. + QLayout* layout = this->layout (); + if (layout != 0) + { + QLayoutItem *item; + while ((item = layout->takeAt(0)) != 0) + layout->removeItem (item); + delete layout; + } + + this->setLayout(mainVerticalLayout); } void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) { - QPainter painter(this); + QPainter painter; + painter.begin(this); painter.fillRect(rect(), Qt::white); + painter.end(); OwncloudAdvancedSetupPage::paintEvent(event); } diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index a04e887259d3a..11c09710ca60f 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -56,7 +56,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) , _httpCredsPage(new OwncloudHttpCredsPage(this)) , _flow2CredsPage(new Flow2AuthCredsPage) , _termsOfServicePage(new TermsOfServiceWizardPage) - , _advancedSetupPage(new OwncloudAdvancedSetupPage(this)) + , _advancedSetupPage(new NMCOwncloudAdvancedSetupPage(this)) #ifdef WITH_WEBENGINE , _webViewPage(new WebViewPage(this)) #else // WITH_WEBENGINE From d0c868fbd5c6831aa9de077e1ebebf44e5662d43 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 16:22:16 +0200 Subject: [PATCH 11/62] restored flow 2 auth --- src/gui/nmcgui/nmcflow2authwidget.cpp | 137 ++++++++++-------- .../nmcgui/nmcowncloudadvancedsetuppage.cpp | 32 ++-- src/gui/wizard/flow2authcredspage.cpp | 3 +- 3 files changed, 97 insertions(+), 75 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index ce866e4cc5688..fd9ae9403cdd8 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -14,14 +14,10 @@ #include "nmcflow2authwidget.h" +#include "QProgressIndicator.h" #include #include #include -#include -#include -#include -#include -#include #include "theme.h" @@ -30,113 +26,137 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { + // setFixedSize(700, 502); + + getUi().copyLinkLabel->setVisible(false); + getUi().openLinkLabel->setVisible(false); auto progressInd = getProgressIndicator(); getUi().progressLayout->removeWidget(progressInd); progressInd->setVisible(false); - progressInd->setFixedSize(0, 0); + progressInd->setFixedSize(0,0); - // LOGIN-Button erstellen + //Create and connect the push buttons to base slots auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginBrowserButton->setFocusPolicy(Qt::NoFocus); - connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ slotOpenBrowser(); }); - // Button-Styling setzen - QSize buttonSize(130, 32); + //Set login button size and style + QSize buttonSize(130,32); const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; - const QString styleSheet = - QString("QPushButton{font-size: 15px; border: %1px solid; border-color: black; " - "border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart) - .arg("0", "#E20074", "white"); - - loginBrowserButton->setStyleSheet(styleSheet); + const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart ); + loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white")); loginBrowserButton->setFixedSize(buttonSize); - // Layouts erstellen + //Create needed layouts auto mainVerticalLayout = new QVBoxLayout(this); - auto subMainHorizontalLayout = new QHBoxLayout(); - auto leftSideVerticalLayout = new QVBoxLayout(); - auto rightSideVerticalLayout = new QVBoxLayout(); - + auto subMainHorizontalLayout = new QHBoxLayout(this); + auto leftSideVerticalLayout = new QVBoxLayout(this); + auto rightSideVerticalLayout = new QVBoxLayout(this); mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16, 8, 28, 0); + mainVerticalLayout->setContentsMargins(16,8,28,0); subMainHorizontalLayout->setSpacing(0); - subMainHorizontalLayout->setContentsMargins(0, 0, 0, 0); + subMainHorizontalLayout->setContentsMargins(0,0,0,0); leftSideVerticalLayout->setSpacing(0); - leftSideVerticalLayout->setContentsMargins(0, 0, 0, 0); + leftSideVerticalLayout->setContentsMargins(0,0,0,0); rightSideVerticalLayout->setSpacing(0); - rightSideVerticalLayout->setContentsMargins(0, 0, 0, 0); + rightSideVerticalLayout->setContentsMargins(0,0,0,0); mainVerticalLayout->addLayout(subMainHorizontalLayout); - subMainHorizontalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + QSpacerItem *spacer4 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + subMainHorizontalLayout->addSpacerItem(spacer4); subMainHorizontalLayout->addLayout(leftSideVerticalLayout); subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - // Logo und Label Layout - auto hLogoAndLabelLayout = new QHBoxLayout(); - hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); - getUi().logoLabel->setFixedSize(36, 36); - getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + // Create a horizontal Logo and label layout + auto hLogoAndLabelLayout = new QHBoxLayout(this); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + getUi().verticalLayout_3->removeWidget(getUi().logoLabel); + getUi().logoLabel->setFixedSize(36,36); + getUi().logoLabel->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); hLogoAndLabelLayout->addWidget(getUi().logoLabel); - hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - auto magentaLabel = new QLabel("MagentaCLOUD"); + QSpacerItem *spacer3 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->addSpacerItem(spacer3); + + QSpacerItem *spacer9 = new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + hLogoAndLabelLayout->addSpacerItem(spacer9); + + QLabel *magentaLabel = new QLabel("MagentaCLOUD"); magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); hLogoAndLabelLayout->addWidget(magentaLabel); + leftSideVerticalLayout->insertItem(1, hLogoAndLabelLayout); - leftSideVerticalLayout->addLayout(hLogoAndLabelLayout); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 24, QSizePolicy::Fixed, QSizePolicy::Fixed)); + QSpacerItem *spacer7 = new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(2, spacer7); - // Beschreibung - auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); descriptionLabel->setWordWrap(true); descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); - leftSideVerticalLayout->addWidget(descriptionLabel); + leftSideVerticalLayout->insertWidget(3, descriptionLabel); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + QSpacerItem *spacer5 = new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(4, spacer5); getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - getUi().label->setText("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."); + getUi().verticalLayout_3->removeWidget(getUi().label); + leftSideVerticalLayout->insertWidget(5, getUi().label); + getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); getUi().label->setFixedWidth(282); getUi().label->setAlignment(Qt::AlignLeft); - leftSideVerticalLayout->addWidget(getUi().label); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + QSpacerItem *spacer6 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(6, spacer6); + + // Add buttons + leftSideVerticalLayout->insertWidget(7, loginBrowserButton); - // Login-Button hinzufügen - leftSideVerticalLayout->addWidget(loginBrowserButton); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + QSpacerItem *spacer11 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); + leftSideVerticalLayout->addSpacerItem(spacer11); - // Rechtsseitige Inhalte - auto bigMagentaIcon = new QLabel(); - bigMagentaIcon->setFixedSize(175, 175); - bigMagentaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + // Add items to the right side + QLabel *bigMagetnaIcon = new QLabel("Test"); + bigMagetnaIcon->setFixedSize(175,175); + bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/applicationLogo.svg")).pixmap(175,175)); - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 98, QSizePolicy::Fixed, QSizePolicy::Fixed)); - rightSideVerticalLayout->addWidget(bigMagentaIcon); - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + QSpacerItem *spacer1 = new QSpacerItem(1,98, QSizePolicy::Fixed, QSizePolicy::Fixed); + rightSideVerticalLayout->addSpacerItem(spacer1); + rightSideVerticalLayout->addWidget(bigMagetnaIcon); + QSpacerItem *spacer10 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); + rightSideVerticalLayout->addSpacerItem(spacer10); + + QSpacerItem *spacer2 = new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + subMainHorizontalLayout->addSpacerItem(spacer2); + + + getUi().verticalLayout_3->removeWidget(getUi().errorLabel); mainVerticalLayout->addWidget(getUi().errorLabel); - getUi().statusLabel->setFixedSize(0, 0); - // Falls ein altes Layout existiert, entfernen - if (layout() != nullptr) { - delete layout(); + getUi().verticalLayout_3->removeWidget(getUi().statusLabel); + getUi().statusLabel->setFixedSize(0,0); + + + // Delete previous installed layout, or you can not apply the new one. + if (QLayout *oldLayout = this->layout()) { + delete oldLayout; } - setLayout(mainVerticalLayout); + this->setLayout(mainVerticalLayout); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { - QPainter painter(this); + QPainter painter; + painter.begin(this); painter.fillRect(rect(), Qt::white); + painter.end(); Flow2AuthWidget::paintEvent(event); } @@ -145,4 +165,5 @@ void NMCFlow2AuthWidget::customizeStyle() // Empty } + } // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 444783296b120..01d8fa030881c 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -93,7 +93,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar cleanUpElements(); - //Create and connect the push buttons to base slots + // Create and connect the push buttons to base slots auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ validatePage(); @@ -101,7 +101,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar auto buttonLayout = new QHBoxLayout(this); buttonLayout->setSpacing(8); - //Set login button size and style + // Set login button size and style QSize buttonSize(130,32); const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;} QPushButton:hover { background-color: %4; }" ); loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white", "#c00063")); @@ -116,7 +116,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar buttonLayout->addWidget(loginBrowserButton); buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); - //Create needed layouts + // Create needed layouts auto mainVerticalLayout = new QVBoxLayout(this); auto subMainHorizontalLayout = new QHBoxLayout(this); auto leftSideVerticalLayout = new QVBoxLayout(this); @@ -138,12 +138,12 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->setSpacing(0); - //Create a horizontal T-Logo and MagentaCLOUC-label layout + // Create a horizontal T-Logo and MagentaCLOUC-label layout auto hLogoAndLabelLayout = new QHBoxLayout(this); hLogoAndLabelLayout->setSpacing(0); hLogoAndLabelLayout->setContentsMargins(0,0,0,0); - //T-Logo + // Telekom Logo _tLogoLbl->setFixedSize(36,36); _tLogoLbl->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); hLogoAndLabelLayout->addWidget(_tLogoLbl); @@ -152,7 +152,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //MagentaCLOUD-label + // MagentaCLOUD label QLabel *magentaLabel = new QLabel("MagentaCLOUD"); magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -161,7 +161,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //Headline + // Headline QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_2")); descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); @@ -171,13 +171,13 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //Path to a local folder + // Path to a local folder getUi().locationsGridLayout->removeWidget(getFilePathLabel().data()); leftSideVerticalLayout->addWidget(getFilePathLabel().data()); getFilePathLabel().data()->setAlignment(Qt::AlignLeft); getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); - //Free space available + // Free space available getUi().locationsGridLayout->removeWidget(getUi().lFreeSpace); leftSideVerticalLayout->addWidget(getUi().lFreeSpace); getUi().lFreeSpace->setAlignment(Qt::AlignLeft); @@ -185,11 +185,11 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //Synch Radio button layout + // Synch Radio button layout getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_5); leftSideVerticalLayout->addLayout(getUi().horizontalLayout_5); - //Disable Mac related UI fields + // Disable Mac related UI fields if(Utility::isWindows()) { getUi().lSyncEverythingSizeLabel->setVisible(false); @@ -199,7 +199,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar getUi().lSelectiveSyncSizeLabel->setVisible(false); } - //Choose what to sync layout + // Choose what to sync layout getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_10); leftSideVerticalLayout->addLayout(getUi().horizontalLayout_10); getUi().horizontalLayout_10->removeWidget(getUi().lSelectiveSyncSizeLabel); //Remove text label, its not needed @@ -207,7 +207,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //Detail description + // Detail description QLabel *detailLabel = new QLabel(QCoreApplication::translate("","SETUP_DESCRIPTION_TEXT_2")); detailLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); detailLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); @@ -217,12 +217,12 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //Add buttons + // Add buttons leftSideVerticalLayout->addItem(buttonLayout); leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - //Add items to the right side + // Add items to the right side QLabel *bigMagetnaIcon = new QLabel(""); bigMagetnaIcon->setFixedSize(175,175); bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/folderLogo.svg")).pixmap(175,175)); @@ -233,7 +233,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - //Delete previous installed layout, or you can not apply the new one. + // Delete previous installed layout, or you can not apply the new one. QLayout* layout = this->layout (); if (layout != 0) { diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index 8eef42fab0f4b..957f572275b48 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -25,6 +25,7 @@ #include "wizard/flow2authwidget.h" #include "creds/credentialsfactory.h" #include "creds/webflowcredentials.h" +#include "nmcgui/nmcflow2authwidget.h" namespace OCC { @@ -33,7 +34,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new Flow2AuthWidget(); + _flow2AuthWidget = new NMCFlow2AuthWidget(); _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult); From 4d12793506e0713923c8f2902b09861aa7346982 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 16:24:54 +0200 Subject: [PATCH 12/62] add paint event --- src/gui/wizard/owncloudwizard.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index df8e8c6fe10b8..eff1f91127a82 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -118,6 +118,7 @@ public slots: void changeEvent(QEvent *) override; void hideEvent(QHideEvent *) override; void closeEvent(QCloseEvent *) override; + void paintEvent(QPaintEvent *event) override; private: void customizeStyle(); From 6c2f2d4a994401c4ce52a4163148ae6d614b38e5 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 16:36:08 +0200 Subject: [PATCH 13/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index fd9ae9403cdd8..5d8c8a213ff37 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -28,8 +28,8 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) { // setFixedSize(700, 502); - getUi().copyLinkLabel->setVisible(false); - getUi().openLinkLabel->setVisible(false); + getUi().copyLinkButton->setVisible(false); + getUi().openLinkButton->setVisible(false); auto progressInd = getProgressIndicator(); getUi().progressLayout->removeWidget(progressInd); progressInd->setVisible(false); @@ -73,7 +73,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Create a horizontal Logo and label layout auto hLogoAndLabelLayout = new QHBoxLayout(this); hLogoAndLabelLayout->setContentsMargins(0,0,0,0); - getUi().verticalLayout_3->removeWidget(getUi().logoLabel); + getUi().verticalLayout->removeWidget(getUi().logoLabel); getUi().logoLabel->setFixedSize(36,36); getUi().logoLabel->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); @@ -105,7 +105,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) leftSideVerticalLayout->insertSpacerItem(4, spacer5); getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - getUi().verticalLayout_3->removeWidget(getUi().label); + getUi().verticalLayout->removeWidget(getUi().label); leftSideVerticalLayout->insertWidget(5, getUi().label); getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); getUi().label->setFixedWidth(282); @@ -136,10 +136,10 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) subMainHorizontalLayout->addSpacerItem(spacer2); - getUi().verticalLayout_3->removeWidget(getUi().errorLabel); + getUi().verticalLayout->removeWidget(getUi().errorLabel); mainVerticalLayout->addWidget(getUi().errorLabel); - getUi().verticalLayout_3->removeWidget(getUi().statusLabel); + getUi().verticalLayout->removeWidget(getUi().statusLabel); getUi().statusLabel->setFixedSize(0,0); From 9aa739706b6a633d5bd7bfd534c157c1fe759ef8 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 16:41:03 +0200 Subject: [PATCH 14/62] removed progressindicator --- src/gui/nmcgui/nmcflow2authwidget.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 4f48ea6b308b3..5c7e3319f69df 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -16,7 +16,6 @@ #define NMCFLOW2AUTHWIDGET_H #include "wizard/flow2authwidget.h" -#include "QProgressIndicator.h" #include namespace OCC { @@ -50,9 +49,6 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget * Customizes the style of the widget. */ void customizeStyle() override; - -private: - QProgressIndicator *_progressIndicator = nullptr; }; } // namespace OCC From 46057f1acbf9f3095ee2ad385fef70ed57502d17 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 16:50:15 +0200 Subject: [PATCH 15/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 5c7e3319f69df..415d391937d48 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -16,7 +16,8 @@ #define NMCFLOW2AUTHWIDGET_H #include "wizard/flow2authwidget.h" -#include + +class QPaintEvent; namespace OCC { From f3685c895712069e0874458ff53873c0c3387ee4 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 14 May 2025 17:04:09 +0200 Subject: [PATCH 16/62] added paintevent --- src/gui/wizard/owncloudwizard.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index 11c09710ca60f..bc961f7401c50 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -428,6 +428,11 @@ void OwncloudWizard::changeEvent(QEvent *e) QWizard::changeEvent(e); } +void OwncloudWizard::paintEvent(QPaintEvent *event) +{ + QWizard::paintEvent(event); +} + void OwncloudWizard::hideEvent(QHideEvent *event) { QWizard::hideEvent(event); From 2335bb7aada000f324fbdf807312ffb3a5f5192f Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 09:44:24 +0200 Subject: [PATCH 17/62] fix layout --- src/gui/nmcgui/nmcflow2authwidget.cpp | 142 ++++++++++++-------------- src/gui/wizard/flow2authwidget.cpp | 127 ++++++++++------------- 2 files changed, 119 insertions(+), 150 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 5d8c8a213ff37..c7f643752d835 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -18,6 +18,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include "theme.h" @@ -26,125 +33,113 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // setFixedSize(700, 502); - getUi().copyLinkButton->setVisible(false); getUi().openLinkButton->setVisible(false); + auto progressInd = getProgressIndicator(); getUi().progressLayout->removeWidget(progressInd); progressInd->setVisible(false); - progressInd->setFixedSize(0,0); + progressInd->setFixedSize(0, 0); - //Create and connect the push buttons to base slots + // Login Button auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginBrowserButton->setFocusPolicy(Qt::NoFocus); - connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { slotOpenBrowser(); }); - //Set login button size and style - QSize buttonSize(130,32); + const QSize buttonSize(130, 32); const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; - const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart ); - loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white")); + const QString styleSheet = QString("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}") + .arg("0", "#E20074", "white") + styleSheetHoverPart; + loginBrowserButton->setStyleSheet(styleSheet); loginBrowserButton->setFixedSize(buttonSize); - //Create needed layouts - auto mainVerticalLayout = new QVBoxLayout(this); - auto subMainHorizontalLayout = new QHBoxLayout(this); - auto leftSideVerticalLayout = new QVBoxLayout(this); - auto rightSideVerticalLayout = new QVBoxLayout(this); + // Layouts + auto mainVerticalLayout = new QVBoxLayout; + auto subMainHorizontalLayout = new QHBoxLayout; + auto leftSideVerticalLayout = new QVBoxLayout; + auto rightSideVerticalLayout = new QVBoxLayout; + mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16,8,28,0); + mainVerticalLayout->setContentsMargins(16, 8, 28, 0); subMainHorizontalLayout->setSpacing(0); - subMainHorizontalLayout->setContentsMargins(0,0,0,0); + subMainHorizontalLayout->setContentsMargins(0, 0, 0, 0); leftSideVerticalLayout->setSpacing(0); - leftSideVerticalLayout->setContentsMargins(0,0,0,0); + leftSideVerticalLayout->setContentsMargins(0, 0, 0, 0); rightSideVerticalLayout->setSpacing(0); - rightSideVerticalLayout->setContentsMargins(0,0,0,0); + rightSideVerticalLayout->setContentsMargins(0, 0, 0, 0); mainVerticalLayout->addLayout(subMainHorizontalLayout); - QSpacerItem *spacer4 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed); - subMainHorizontalLayout->addSpacerItem(spacer4); + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); subMainHorizontalLayout->addLayout(leftSideVerticalLayout); subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - // Create a horizontal Logo and label layout - auto hLogoAndLabelLayout = new QHBoxLayout(this); - hLogoAndLabelLayout->setContentsMargins(0,0,0,0); - getUi().verticalLayout->removeWidget(getUi().logoLabel); - getUi().logoLabel->setFixedSize(36,36); - getUi().logoLabel->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); + // Logo & Label + auto hLogoAndLabelLayout = new QHBoxLayout; + hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); + getUi().verticalLayout_3->removeWidget(getUi().logoLabel); + getUi().logoLabel->setFixedSize(36, 36); + getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); hLogoAndLabelLayout->addWidget(getUi().logoLabel); + hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - QSpacerItem *spacer3 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->addSpacerItem(spacer3); - - QSpacerItem *spacer9 = new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed); - hLogoAndLabelLayout->addSpacerItem(spacer9); - - QLabel *magentaLabel = new QLabel("MagentaCLOUD"); + auto magentaLabel = new QLabel("MagentaCLOUD"); magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); hLogoAndLabelLayout->addWidget(magentaLabel); - leftSideVerticalLayout->insertItem(1, hLogoAndLabelLayout); - QSpacerItem *spacer7 = new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->insertSpacerItem(2, spacer7); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + leftSideVerticalLayout->addLayout(hLogoAndLabelLayout); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 24, QSizePolicy::Fixed, QSizePolicy::Fixed)); - QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + // Beschreibung + auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); descriptionLabel->setWordWrap(true); descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); - leftSideVerticalLayout->insertWidget(3, descriptionLabel); + leftSideVerticalLayout->addWidget(descriptionLabel); - QSpacerItem *spacer5 = new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->insertSpacerItem(4, spacer5); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + // Anleitungstext getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - getUi().verticalLayout->removeWidget(getUi().label); - leftSideVerticalLayout->insertWidget(5, getUi().label); + getUi().verticalLayout_3->removeWidget(getUi().label); getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); getUi().label->setFixedWidth(282); getUi().label->setAlignment(Qt::AlignLeft); + leftSideVerticalLayout->addWidget(getUi().label); - QSpacerItem *spacer6 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); - leftSideVerticalLayout->insertSpacerItem(6, spacer6); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + leftSideVerticalLayout->addWidget(loginBrowserButton); + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - // Add buttons - leftSideVerticalLayout->insertWidget(7, loginBrowserButton); - - QSpacerItem *spacer11 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); - leftSideVerticalLayout->addSpacerItem(spacer11); - - // Add items to the right side - QLabel *bigMagetnaIcon = new QLabel("Test"); - bigMagetnaIcon->setFixedSize(175,175); - bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/applicationLogo.svg")).pixmap(175,175)); - - QSpacerItem *spacer1 = new QSpacerItem(1,98, QSizePolicy::Fixed, QSizePolicy::Fixed); - rightSideVerticalLayout->addSpacerItem(spacer1); + // Rechte Seite mit großem Logo + auto bigMagetnaIcon = new QLabel("Test"); + bigMagetnaIcon->setFixedSize(175, 175); + bigMagetnaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 98, QSizePolicy::Fixed, QSizePolicy::Fixed)); rightSideVerticalLayout->addWidget(bigMagetnaIcon); + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - QSpacerItem *spacer10 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); - rightSideVerticalLayout->addSpacerItem(spacer10); - - QSpacerItem *spacer2 = new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed); - subMainHorizontalLayout->addSpacerItem(spacer2); + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - getUi().verticalLayout->removeWidget(getUi().errorLabel); + // Fehler- und Statusanzeige + getUi().verticalLayout_3->removeWidget(getUi().errorLabel); mainVerticalLayout->addWidget(getUi().errorLabel); - getUi().verticalLayout->removeWidget(getUi().statusLabel); - getUi().statusLabel->setFixedSize(0,0); - + getUi().verticalLayout_3->removeWidget(getUi().statusLabel); + getUi().statusLabel->setFixedSize(0, 0); - // Delete previous installed layout, or you can not apply the new one. - if (QLayout *oldLayout = this->layout()) { + // Vorheriges Layout entfernen + if (auto *oldLayout = this->layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + delete item; + } delete oldLayout; } @@ -153,17 +148,14 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { - QPainter painter; - painter.begin(this); + QPainter painter(this); painter.fillRect(rect(), Qt::white); - painter.end(); Flow2AuthWidget::paintEvent(event); } void NMCFlow2AuthWidget::customizeStyle() { - // Empty + //Empty } - } // namespace OCC diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index ddfd4f64c0125..3ba0e50aad522 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -1,12 +1,16 @@ /* - * Copyright (C) by Michael Schuster - * Adapted by Eugen Fischer for MagentaCLOUD - * - * 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. - */ +* Copyright (C) by Michael Schuster +* +* 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 "flow2authwidget.h" @@ -23,13 +27,12 @@ #include #include #include -#include -#include namespace OCC { Q_LOGGING_CATEGORY(lcFlow2AuthWidget, "nextcloud.gui.wizard.flow2authwidget", QtInfoMsg) + Flow2AuthWidget::Flow2AuthWidget(QWidget *parent) : QWidget(parent) , _progressIndi(new QProgressIndicator(this)) @@ -52,65 +55,12 @@ Flow2AuthWidget::Flow2AuthWidget(QWidget *parent) customizeStyle(); } -Flow2AuthWidget::~Flow2AuthWidget() -{ - _asyncAuth.reset(nullptr); -} - void Flow2AuthWidget::setLogo() { - _ui.logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); -} - -void Flow2AuthWidget::customizeStyle() -{ - setLogo(); - - if (_progressIndi) { - const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); - _progressIndi->setColor(isDarkBackground ? Qt::white : Qt::black); - } - - // Textanpassung - _ui.label->setText( - tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); - _ui.label->setStyleSheet("font-size: 15px; font-weight: normal;"); - - // LOGIN-Button Styling - _ui.openLinkButton->setText(tr("LOGIN")); - _ui.openLinkButton->setStyleSheet(R"( - QPushButton { - font-size: 15px; - border: 0px solid; - border-radius: 4px; - background-color: #E20074; - color: white; - width: 130px; - height: 32px; - } - QPushButton:hover { - background-color: #c00063; - } - )"); - - // Copy-Link-Button ausblenden (optional) - _ui.copyLinkButton->setVisible(false); - - WizardCommon::customizeHintLabel(_ui.statusLabel); - _ui.errorLabel->setStyleSheet("color: red;"); - - // Weißer Hintergrund - setAutoFillBackground(true); - QPalette pal = palette(); - pal.setColor(QPalette::Window, Qt::white); - setPalette(pal); -} - -void Flow2AuthWidget::paintEvent(QPaintEvent *event) -{ - QPainter p(this); - p.fillRect(rect(), Qt::white); - QWidget::paintEvent(event); + const auto backgroundColor = palette().window().color(); + const auto logoIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("external.png", backgroundColor) + : Theme::hidpiFileName(":/client/theme/colored/external.png"); + _ui.logoLabel->setPixmap(logoIconFileName); } void Flow2AuthWidget::startAuth(Account *account) @@ -122,7 +72,7 @@ void Flow2AuthWidget::startAuth(Account *account) _statusUpdateSkipCount = 0; - if (account) { + if(account) { _account = account; _asyncAuth = std::make_unique(_account, this); @@ -144,23 +94,25 @@ void Flow2AuthWidget::slotAuthResult(Flow2Auth::Result r, const QString &errorSt switch (r) { case Flow2Auth::NotSupported: + /* Flow2Auth can't open browser */ _ui.errorLabel->setText(tr("Unable to open the Browser, please copy the link to your Browser.")); _ui.errorLabel->show(); break; case Flow2Auth::Error: + /* Error while getting the access token. (Timeout, or the server did not accept our client credentials */ _ui.errorLabel->setText(errorString); _ui.errorLabel->show(); break; - case Flow2Auth::LoggedIn: + case Flow2Auth::LoggedIn: { _ui.errorLabel->hide(); break; } + } emit authResult(r, errorString, user, appPassword); } -void Flow2AuthWidget::setError(const QString &error) -{ +void Flow2AuthWidget::setError(const QString &error) { if (error.isEmpty()) { _ui.errorLabel->hide(); } else { @@ -169,6 +121,11 @@ void Flow2AuthWidget::setError(const QString &error) } } +Flow2AuthWidget::~Flow2AuthWidget() { + // Forget sensitive data + _asyncAuth.reset(nullptr); +} + void Flow2AuthWidget::slotOpenBrowser() { if (_ui.errorLabel) @@ -194,9 +151,10 @@ void Flow2AuthWidget::slotPollNow() void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) { - switch (status) { + switch(status) + { case Flow2Auth::statusPollCountdown: - if (_statusUpdateSkipCount > 0) { + if(_statusUpdateSkipCount > 0) { _statusUpdateSkipCount--; break; } @@ -248,5 +206,24 @@ void Flow2AuthWidget::slotStyleChanged() customizeStyle(); } -} // namespace OCC - \ No newline at end of file +void Flow2AuthWidget::customizeStyle() +{ + setLogo(); + + if (_progressIndi) { + const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); + if (isDarkBackground) { + _progressIndi->setColor(Qt::white); + } else { + _progressIndi->setColor(Qt::black); + } + } + + _ui.openLinkButton->setText(tr("Open Browser")); + + _ui.copyLinkButton->setText(tr("Copy Link")); + + WizardCommon::customizeHintLabel(_ui.statusLabel); +} + +} // namespace OCC \ No newline at end of file From 06be0ac0c44d0e9538d5f4fec80a1510a3501ee1 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 09:51:40 +0200 Subject: [PATCH 18/62] clean old class --- src/gui/wizard/flow2authwidget.cpp | 28 ++++++++++++++-------------- src/gui/wizard/flow2authwidget.h | 11 +++++------ 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index 3ba0e50aad522..e89a08a7f250e 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -1,16 +1,16 @@ /* -* Copyright (C) by Michael Schuster -* -* 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. -*/ + * Copyright (C) by Michael Schuster + * + * 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 "flow2authwidget.h" @@ -59,7 +59,7 @@ void Flow2AuthWidget::setLogo() { const auto backgroundColor = palette().window().color(); const auto logoIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("external.png", backgroundColor) - : Theme::hidpiFileName(":/client/theme/colored/external.png"); + : Theme::hidpiFileName(":/client/theme/colored/external.png"); _ui.logoLabel->setPixmap(logoIconFileName); } @@ -226,4 +226,4 @@ void Flow2AuthWidget::customizeStyle() WizardCommon::customizeHintLabel(_ui.statusLabel); } -} // namespace OCC \ No newline at end of file +} // namespace OCC diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index 931d4eb332826..a7111295e254d 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -57,8 +57,10 @@ public Q_SLOTS: return _progressIndi; } -protected: - void paintEvent(QPaintEvent *event) override; +private: + Account *_account = nullptr; + std::unique_ptr _asyncAuth; + Ui_Flow2AuthWidget _ui{}; protected Q_SLOTS: void slotOpenBrowser(); @@ -72,13 +74,10 @@ protected Q_SLOTS: void stopSpinner(bool showStatusLabel); void setLogo(); - Account *_account = nullptr; - std::unique_ptr _asyncAuth; - Ui_Flow2AuthWidget _ui{}; QProgressIndicator *_progressIndi; int _statusUpdateSkipCount = 0; }; } // namespace OCC -#endif // FLOW2AUTHWIDGET_H +#endif // FLOW2AUTHWIDGET_H \ No newline at end of file From 5d773e848d2744ab99a82ee453375d63fb2972dd Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 10:00:44 +0200 Subject: [PATCH 19/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index c7f643752d835..8172b791c3511 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -80,7 +80,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) auto hLogoAndLabelLayout = new QHBoxLayout; hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); - getUi().verticalLayout_3->removeWidget(getUi().logoLabel); + getUi().verticalLayout->removeWidget(getUi().logoLabel); getUi().logoLabel->setFixedSize(36, 36); getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); hLogoAndLabelLayout->addWidget(getUi().logoLabel); @@ -107,7 +107,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Anleitungstext getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - getUi().verticalLayout_3->removeWidget(getUi().label); + getUi().verticalLayout->removeWidget(getUi().label); getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); getUi().label->setFixedWidth(282); getUi().label->setAlignment(Qt::AlignLeft); @@ -128,10 +128,10 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); // Fehler- und Statusanzeige - getUi().verticalLayout_3->removeWidget(getUi().errorLabel); + getUi().verticalLayout->removeWidget(getUi().errorLabel); mainVerticalLayout->addWidget(getUi().errorLabel); - getUi().verticalLayout_3->removeWidget(getUi().statusLabel); + getUi().verticalLayout->removeWidget(getUi().statusLabel); getUi().statusLabel->setFixedSize(0, 0); // Vorheriges Layout entfernen From dd4c05786acc02090d240dbfeba2345e2f14962a Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 13:00:18 +0200 Subject: [PATCH 20/62] layout test --- src/gui/nmcgui/nmcflow2authwidget.cpp | 146 ++++++++------------------ 1 file changed, 44 insertions(+), 102 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 8172b791c3511..9dac6d30882ab 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -33,129 +33,71 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - getUi().copyLinkButton->setVisible(false); - getUi().openLinkButton->setVisible(false); + // Bestehende Widgets anpassen + getUi().copyLinkButton->hide(); + getUi().openLinkButton->hide(); + getUi().statusLabel->hide(); auto progressInd = getProgressIndicator(); - getUi().progressLayout->removeWidget(progressInd); progressInd->setVisible(false); progressInd->setFixedSize(0, 0); - // Login Button - auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); - loginBrowserButton->setFocusPolicy(Qt::NoFocus); - connect(loginBrowserButton, &QPushButton::clicked, this, [this]() { - slotOpenBrowser(); - }); - - const QSize buttonSize(130, 32); - const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; - const QString styleSheet = QString("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}") - .arg("0", "#E20074", "white") + styleSheetHoverPart; - loginBrowserButton->setStyleSheet(styleSheet); - loginBrowserButton->setFixedSize(buttonSize); - - // Layouts - auto mainVerticalLayout = new QVBoxLayout; - auto subMainHorizontalLayout = new QHBoxLayout; - auto leftSideVerticalLayout = new QVBoxLayout; - auto rightSideVerticalLayout = new QVBoxLayout; - - mainVerticalLayout->setSpacing(0); - mainVerticalLayout->setContentsMargins(16, 8, 28, 0); - subMainHorizontalLayout->setSpacing(0); - subMainHorizontalLayout->setContentsMargins(0, 0, 0, 0); - leftSideVerticalLayout->setSpacing(0); - leftSideVerticalLayout->setContentsMargins(0, 0, 0, 0); - rightSideVerticalLayout->setSpacing(0); - rightSideVerticalLayout->setContentsMargins(0, 0, 0, 0); - - mainVerticalLayout->addLayout(subMainHorizontalLayout); - - subMainHorizontalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - subMainHorizontalLayout->addLayout(leftSideVerticalLayout); - subMainHorizontalLayout->addLayout(rightSideVerticalLayout); - - // Logo & Label - auto hLogoAndLabelLayout = new QHBoxLayout; - hLogoAndLabelLayout->setContentsMargins(0, 0, 0, 0); - - getUi().verticalLayout->removeWidget(getUi().logoLabel); + // Logo anpassen getUi().logoLabel->setFixedSize(36, 36); getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - hLogoAndLabelLayout->addWidget(getUi().logoLabel); - hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - auto magentaLabel = new QLabel("MagentaCLOUD"); - magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); - magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - hLogoAndLabelLayout->addWidget(magentaLabel); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); - leftSideVerticalLayout->addLayout(hLogoAndLabelLayout); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 24, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - // Beschreibung - auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); - descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - descriptionLabel->setWordWrap(true); - descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); - leftSideVerticalLayout->addWidget(descriptionLabel); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + // Titel und Beschreibung ersetzen + auto headerLabel = new QLabel("MagentaCLOUD"); + headerLabel->setStyleSheet("font-size: 15px; font-weight: bold;"); + getUi().verticalLayout->insertWidget(0, headerLabel); + + auto descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_1")); + descriptionLabel->setStyleSheet("font-size: 28px; font-weight: normal;"); + descriptionLabel->setWordWrap(true); + getUi().verticalLayout->insertWidget(1, descriptionLabel); - // Anleitungstext - getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); - getUi().verticalLayout->removeWidget(getUi().label); - getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); + // Textanleitung anpassen + getUi().label->setStyleSheet("font-size: 15px; font-weight: normal;"); + getUi().label->setText(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); getUi().label->setFixedWidth(282); getUi().label->setAlignment(Qt::AlignLeft); - leftSideVerticalLayout->addWidget(getUi().label); - - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 32, QSizePolicy::Fixed, QSizePolicy::Fixed)); - leftSideVerticalLayout->addWidget(loginBrowserButton); - leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - - // Rechte Seite mit großem Logo - auto bigMagetnaIcon = new QLabel("Test"); - bigMagetnaIcon->setFixedSize(175, 175); - bigMagetnaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 98, QSizePolicy::Fixed, QSizePolicy::Fixed)); - rightSideVerticalLayout->addWidget(bigMagetnaIcon); - rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); - - subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0, 1, QSizePolicy::Fixed, QSizePolicy::Fixed)); - - // Fehler- und Statusanzeige - getUi().verticalLayout->removeWidget(getUi().errorLabel); - mainVerticalLayout->addWidget(getUi().errorLabel); - - getUi().verticalLayout->removeWidget(getUi().statusLabel); - getUi().statusLabel->setFixedSize(0, 0); - - // Vorheriges Layout entfernen - if (auto *oldLayout = this->layout()) { - QLayoutItem *item; - while ((item = oldLayout->takeAt(0)) != nullptr) { - delete item; - } - delete oldLayout; - } - - this->setLayout(mainVerticalLayout); + + // Login Button hinzufügen + auto loginButton = new QPushButton(tr("LOGIN")); + loginButton->setFocusPolicy(Qt::NoFocus); + connect(loginButton, &QPushButton::clicked, this, [this]() { + slotOpenBrowser(); + }); + + const QSize buttonSize(130, 32); + const QString styleSheet = QString( + "QPushButton{font-size: 15px; border: 0px solid; border-color: black; border-radius: 4px; " + "background-color: #E20074; color: white;}" + "QPushButton:hover { background-color: #c00063; }"); + loginButton->setStyleSheet(styleSheet); + loginButton->setFixedSize(buttonSize); + + getUi().verticalLayout->addSpacing(24); + getUi().verticalLayout->addWidget(loginButton); + + // Großes Logo rechts – ergänzend, optional + auto bigLogo = new QLabel; + bigLogo->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + bigLogo->setAlignment(Qt::AlignRight | Qt::AlignTop); + getUi().verticalLayout->addSpacing(16); + getUi().verticalLayout->addWidget(bigLogo); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); + painter.fillRect(rect(), Qt::white); // weißer Hintergrund Flow2AuthWidget::paintEvent(event); } void NMCFlow2AuthWidget::customizeStyle() { - //Empty + // optional override, leer gelassen } } // namespace OCC From a0d149b3a56b8097ed8986feec067e95ac73cb90 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 15:04:02 +0200 Subject: [PATCH 21/62] move status label --- src/gui/nmcgui/nmcflow2authwidget.cpp | 131 ++++++++++++++++---------- 1 file changed, 81 insertions(+), 50 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 9dac6d30882ab..474f4bc7393b2 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -33,71 +33,102 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Bestehende Widgets anpassen - getUi().copyLinkButton->hide(); - getUi().openLinkButton->hide(); - getUi().statusLabel->hide(); - - auto progressInd = getProgressIndicator(); - progressInd->setVisible(false); - progressInd->setFixedSize(0, 0); - - // Logo anpassen - getUi().logoLabel->setFixedSize(36, 36); - getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - - // Titel und Beschreibung ersetzen - auto headerLabel = new QLabel("MagentaCLOUD"); - headerLabel->setStyleSheet("font-size: 15px; font-weight: bold;"); - getUi().verticalLayout->insertWidget(0, headerLabel); - - auto descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_1")); - descriptionLabel->setStyleSheet("font-size: 28px; font-weight: normal;"); - descriptionLabel->setWordWrap(true); - getUi().verticalLayout->insertWidget(1, descriptionLabel); - - // Textanleitung anpassen - getUi().label->setStyleSheet("font-size: 15px; font-weight: normal;"); - getUi().label->setText(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); - getUi().label->setFixedWidth(282); - getUi().label->setAlignment(Qt::AlignLeft); - - // Login Button hinzufügen - auto loginButton = new QPushButton(tr("LOGIN")); + // Alte UI-Elemente ausblenden oder entfernen + getUi().copyLinkButton->setVisible(false); + getUi().openLinkButton->setVisible(false); + getProgressIndicator()->setVisible(false); + getProgressIndicator()->setFixedSize(0, 0); + getUi().verticalLayout->removeWidget(getUi().statusLabel); + + // Login-Button + auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginButton->setFocusPolicy(Qt::NoFocus); + loginButton->setFixedSize(130, 32); + loginButton->setStyleSheet( + "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" + "QPushButton:hover { background-color: #c00063; }" + ); connect(loginButton, &QPushButton::clicked, this, [this]() { slotOpenBrowser(); }); - const QSize buttonSize(130, 32); - const QString styleSheet = QString( - "QPushButton{font-size: 15px; border: 0px solid; border-color: black; border-radius: 4px; " - "background-color: #E20074; color: white;}" - "QPushButton:hover { background-color: #c00063; }"); - loginButton->setStyleSheet(styleSheet); - loginButton->setFixedSize(buttonSize); - - getUi().verticalLayout->addSpacing(24); - getUi().verticalLayout->addWidget(loginButton); - - // Großes Logo rechts – ergänzend, optional - auto bigLogo = new QLabel; - bigLogo->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogo->setAlignment(Qt::AlignRight | Qt::AlignTop); - getUi().verticalLayout->addSpacing(16); - getUi().verticalLayout->addWidget(bigLogo); + // Linker Bereich + auto logoLabel = new QLabel; + logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(24, 24)); + logoLabel->setFixedSize(24, 24); + + auto titleLabel = new QLabel("MagentaCLOUD"); + titleLabel->setStyleSheet("font-weight: bold; font-size: 14px;"); + titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + auto logoTitleLayout = new QHBoxLayout; + logoTitleLayout->setSpacing(8); + logoTitleLayout->addWidget(logoLabel); + logoTitleLayout->addWidget(titleLabel); + logoTitleLayout->addStretch(); + + auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); + headerLabel->setWordWrap(true); + + auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); + instructionLabel->setStyleSheet("font-size: 14px;"); + instructionLabel->setWordWrap(true); + instructionLabel->setFixedWidth(300); + + auto leftLayout = new QVBoxLayout; + leftLayout->addLayout(logoTitleLayout); + leftLayout->addSpacing(24); + leftLayout->addWidget(headerLabel); + leftLayout->addSpacing(16); + leftLayout->addWidget(instructionLabel); + leftLayout->addSpacing(24); + leftLayout->addWidget(getUi().statusLabel); + leftLayout->addSpacing(24); + leftLayout->addWidget(loginButton); + leftLayout->addStretch(); + + // Rechter Bereich (großes Logo) + auto bigLogoLabel = new QLabel; + bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + bigLogoLabel->setFixedSize(175, 175); + + auto rightLayout = new QVBoxLayout; + rightLayout->addStretch(); + rightLayout->addWidget(bigLogoLabel, 0, Qt::AlignRight | Qt::AlignBottom); + + // Hauptlayout + auto mainLayout = new QHBoxLayout; + mainLayout->setContentsMargins(16, 16, 16, 16); + mainLayout->addLayout(leftLayout); + mainLayout->addLayout(rightLayout); + + // Ursprüngliches Layout leeren und ersetzen + if (auto *oldLayout = layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + delete item; + } + delete oldLayout; + } + + setLayout(mainLayout); + + // Fehlerlabel unten anzeigen + getUi().verticalLayout->removeWidget(getUi().errorLabel); + layout()->addWidget(getUi().errorLabel); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); // weißer Hintergrund + painter.fillRect(rect(), Qt::white); Flow2AuthWidget::paintEvent(event); } void NMCFlow2AuthWidget::customizeStyle() { - // optional override, leer gelassen + // leer } } // namespace OCC From 724b20be7fbe7f21933fca89877488eff5e9c62a Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 15:10:41 +0200 Subject: [PATCH 22/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 474f4bc7393b2..601e2b44be429 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -67,7 +67,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); - auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); headerLabel->setWordWrap(true); From 04d60e37bbe02889bdf56b2a0a5b68f0aa86cce9 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 17:58:27 +0200 Subject: [PATCH 23/62] hide status label --- src/gui/nmcgui/nmcflow2authwidget.cpp | 9 ++++++--- src/gui/nmcgui/nmcflow2authwidget.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 601e2b44be429..41499d2c2a481 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -36,9 +36,9 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Alte UI-Elemente ausblenden oder entfernen getUi().copyLinkButton->setVisible(false); getUi().openLinkButton->setVisible(false); + getUi().statusLabel->setVisible(false); getProgressIndicator()->setVisible(false); getProgressIndicator()->setFixedSize(0, 0); - getUi().verticalLayout->removeWidget(getUi().statusLabel); // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); @@ -83,8 +83,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) leftLayout->addSpacing(16); leftLayout->addWidget(instructionLabel); leftLayout->addSpacing(24); - leftLayout->addWidget(getUi().statusLabel); - leftLayout->addSpacing(24); leftLayout->addWidget(loginButton); leftLayout->addStretch(); @@ -131,4 +129,9 @@ void NMCFlow2AuthWidget::customizeStyle() // leer } +void NMCFlow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus, int) +{ + // leer +} + } // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 415d391937d48..20b2820440dd9 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -36,6 +36,8 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget * @brief Destructor for NMCFlow2AuthWidget. */ ~NMCFlow2AuthWidget() override = default; + + void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) override; protected: /** From 8010ac0da94e3c332851155df674c73e4d2fe358 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 15 May 2025 18:05:44 +0200 Subject: [PATCH 24/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 20b2820440dd9..eb5c8fdd0b0e5 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -36,8 +36,8 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget * @brief Destructor for NMCFlow2AuthWidget. */ ~NMCFlow2AuthWidget() override = default; - - void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) override; + + void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); protected: /** From 6d28b08d78527757dd908d609d4985c36894a97f Mon Sep 17 00:00:00 2001 From: memurats Date: Fri, 16 May 2025 08:19:07 +0200 Subject: [PATCH 25/62] disable status slot --- src/gui/nmcgui/nmcflow2authwidget.cpp | 6 ------ src/gui/nmcgui/nmcflow2authwidget.h | 2 -- src/gui/wizard/flow2authwidget.cpp | 31 ++++----------------------- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 41499d2c2a481..f753483fcd3b4 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -36,7 +36,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Alte UI-Elemente ausblenden oder entfernen getUi().copyLinkButton->setVisible(false); getUi().openLinkButton->setVisible(false); - getUi().statusLabel->setVisible(false); getProgressIndicator()->setVisible(false); getProgressIndicator()->setFixedSize(0, 0); @@ -129,9 +128,4 @@ void NMCFlow2AuthWidget::customizeStyle() // leer } -void NMCFlow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus, int) -{ - // leer -} - } // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index eb5c8fdd0b0e5..415d391937d48 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -37,8 +37,6 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget */ ~NMCFlow2AuthWidget() override = default; - void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); - protected: /** * @brief Reimplemented from Flow2AuthWidget. diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index e89a08a7f250e..4e32811bce0e8 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -150,33 +150,10 @@ void Flow2AuthWidget::slotPollNow() } void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) -{ - switch(status) - { - case Flow2Auth::statusPollCountdown: - if(_statusUpdateSkipCount > 0) { - _statusUpdateSkipCount--; - break; - } - _ui.statusLabel->setText(tr("Waiting for authorization") + QStringLiteral("… (%1)").arg(secondsLeft)); - stopSpinner(true); - break; - case Flow2Auth::statusPollNow: - _statusUpdateSkipCount = 0; - _ui.statusLabel->setText(tr("Polling for authorization") + "…"); - startSpinner(); - break; - case Flow2Auth::statusFetchToken: - _statusUpdateSkipCount = 0; - _ui.statusLabel->setText(tr("Starting authorization") + "…"); - startSpinner(); - break; - case Flow2Auth::statusCopyLinkToClipboard: - _ui.statusLabel->setText(tr("Link copied to clipboard.")); - _statusUpdateSkipCount = 3; - stopSpinner(true); - break; - } +{ + // Status-Label absichtlich nicht verwenden + Q_UNUSED(status); + Q_UNUSED(secondsLeft); } void Flow2AuthWidget::startSpinner() From 328d6376cb4e83c31a39c9569e17b3f2f3e2a511 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 19 May 2025 11:44:29 +0200 Subject: [PATCH 26/62] fix embed class --- src/gui/wizard/flow2authcredspage.cpp | 2 +- src/gui/wizard/flow2authwidget.cpp | 31 +++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index 957f572275b48..103944d3e3dea 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -34,7 +34,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new NMCFlow2AuthWidget(); + _flow2AuthWidget = new NMCFlow2AuthWidget(this); _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult); diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index 4e32811bce0e8..e89a08a7f250e 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -150,10 +150,33 @@ void Flow2AuthWidget::slotPollNow() } void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) -{ - // Status-Label absichtlich nicht verwenden - Q_UNUSED(status); - Q_UNUSED(secondsLeft); +{ + switch(status) + { + case Flow2Auth::statusPollCountdown: + if(_statusUpdateSkipCount > 0) { + _statusUpdateSkipCount--; + break; + } + _ui.statusLabel->setText(tr("Waiting for authorization") + QStringLiteral("… (%1)").arg(secondsLeft)); + stopSpinner(true); + break; + case Flow2Auth::statusPollNow: + _statusUpdateSkipCount = 0; + _ui.statusLabel->setText(tr("Polling for authorization") + "…"); + startSpinner(); + break; + case Flow2Auth::statusFetchToken: + _statusUpdateSkipCount = 0; + _ui.statusLabel->setText(tr("Starting authorization") + "…"); + startSpinner(); + break; + case Flow2Auth::statusCopyLinkToClipboard: + _ui.statusLabel->setText(tr("Link copied to clipboard.")); + _statusUpdateSkipCount = 3; + stopSpinner(true); + break; + } } void Flow2AuthWidget::startSpinner() From 00524b38bc69e6ac3270838136858cdb7ce2a23b Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 19 May 2025 13:28:35 +0200 Subject: [PATCH 27/62] took back changes --- src/gui/nmcgui/nmcflow2authwidget.cpp | 128 ++++++++++---------------- src/gui/wizard/flow2authcredspage.cpp | 2 +- 2 files changed, 51 insertions(+), 79 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index f753483fcd3b4..9dac6d30882ab 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -33,99 +33,71 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Alte UI-Elemente ausblenden oder entfernen - getUi().copyLinkButton->setVisible(false); - getUi().openLinkButton->setVisible(false); - getProgressIndicator()->setVisible(false); - getProgressIndicator()->setFixedSize(0, 0); - - // Login-Button - auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + // Bestehende Widgets anpassen + getUi().copyLinkButton->hide(); + getUi().openLinkButton->hide(); + getUi().statusLabel->hide(); + + auto progressInd = getProgressIndicator(); + progressInd->setVisible(false); + progressInd->setFixedSize(0, 0); + + // Logo anpassen + getUi().logoLabel->setFixedSize(36, 36); + getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + + // Titel und Beschreibung ersetzen + auto headerLabel = new QLabel("MagentaCLOUD"); + headerLabel->setStyleSheet("font-size: 15px; font-weight: bold;"); + getUi().verticalLayout->insertWidget(0, headerLabel); + + auto descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_1")); + descriptionLabel->setStyleSheet("font-size: 28px; font-weight: normal;"); + descriptionLabel->setWordWrap(true); + getUi().verticalLayout->insertWidget(1, descriptionLabel); + + // Textanleitung anpassen + getUi().label->setStyleSheet("font-size: 15px; font-weight: normal;"); + getUi().label->setText(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); + getUi().label->setFixedWidth(282); + getUi().label->setAlignment(Qt::AlignLeft); + + // Login Button hinzufügen + auto loginButton = new QPushButton(tr("LOGIN")); loginButton->setFocusPolicy(Qt::NoFocus); - loginButton->setFixedSize(130, 32); - loginButton->setStyleSheet( - "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" - "QPushButton:hover { background-color: #c00063; }" - ); connect(loginButton, &QPushButton::clicked, this, [this]() { slotOpenBrowser(); }); - // Linker Bereich - auto logoLabel = new QLabel; - logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(24, 24)); - logoLabel->setFixedSize(24, 24); - - auto titleLabel = new QLabel("MagentaCLOUD"); - titleLabel->setStyleSheet("font-weight: bold; font-size: 14px;"); - titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - - auto logoTitleLayout = new QHBoxLayout; - logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(logoLabel); - logoTitleLayout->addWidget(titleLabel); - logoTitleLayout->addStretch(); - - auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); - headerLabel->setWordWrap(true); - - auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); - instructionLabel->setStyleSheet("font-size: 14px;"); - instructionLabel->setWordWrap(true); - instructionLabel->setFixedWidth(300); - - auto leftLayout = new QVBoxLayout; - leftLayout->addLayout(logoTitleLayout); - leftLayout->addSpacing(24); - leftLayout->addWidget(headerLabel); - leftLayout->addSpacing(16); - leftLayout->addWidget(instructionLabel); - leftLayout->addSpacing(24); - leftLayout->addWidget(loginButton); - leftLayout->addStretch(); - - // Rechter Bereich (großes Logo) - auto bigLogoLabel = new QLabel; - bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogoLabel->setFixedSize(175, 175); - - auto rightLayout = new QVBoxLayout; - rightLayout->addStretch(); - rightLayout->addWidget(bigLogoLabel, 0, Qt::AlignRight | Qt::AlignBottom); - - // Hauptlayout - auto mainLayout = new QHBoxLayout; - mainLayout->setContentsMargins(16, 16, 16, 16); - mainLayout->addLayout(leftLayout); - mainLayout->addLayout(rightLayout); - - // Ursprüngliches Layout leeren und ersetzen - if (auto *oldLayout = layout()) { - QLayoutItem *item; - while ((item = oldLayout->takeAt(0)) != nullptr) { - delete item; - } - delete oldLayout; - } - - setLayout(mainLayout); - - // Fehlerlabel unten anzeigen - getUi().verticalLayout->removeWidget(getUi().errorLabel); - layout()->addWidget(getUi().errorLabel); + const QSize buttonSize(130, 32); + const QString styleSheet = QString( + "QPushButton{font-size: 15px; border: 0px solid; border-color: black; border-radius: 4px; " + "background-color: #E20074; color: white;}" + "QPushButton:hover { background-color: #c00063; }"); + loginButton->setStyleSheet(styleSheet); + loginButton->setFixedSize(buttonSize); + + getUi().verticalLayout->addSpacing(24); + getUi().verticalLayout->addWidget(loginButton); + + // Großes Logo rechts – ergänzend, optional + auto bigLogo = new QLabel; + bigLogo->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + bigLogo->setAlignment(Qt::AlignRight | Qt::AlignTop); + getUi().verticalLayout->addSpacing(16); + getUi().verticalLayout->addWidget(bigLogo); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); + painter.fillRect(rect(), Qt::white); // weißer Hintergrund Flow2AuthWidget::paintEvent(event); } void NMCFlow2AuthWidget::customizeStyle() { - // leer + // optional override, leer gelassen } } // namespace OCC diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index 103944d3e3dea..957f572275b48 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -34,7 +34,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new NMCFlow2AuthWidget(this); + _flow2AuthWidget = new NMCFlow2AuthWidget(); _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult); From 3f7ada905fd6c0f500410712f931ae53dd616bc7 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 19 May 2025 13:29:43 +0200 Subject: [PATCH 28/62] add translations --- src/gui/nmcgui/nmcflow2authwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 9dac6d30882ab..14407a4bccdd7 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -51,7 +51,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) headerLabel->setStyleSheet("font-size: 15px; font-weight: bold;"); getUi().verticalLayout->insertWidget(0, headerLabel); - auto descriptionLabel = new QLabel(tr("SETUP_HEADER_TEXT_1")); + auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); descriptionLabel->setStyleSheet("font-size: 28px; font-weight: normal;"); descriptionLabel->setWordWrap(true); getUi().verticalLayout->insertWidget(1, descriptionLabel); @@ -63,7 +63,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().label->setAlignment(Qt::AlignLeft); // Login Button hinzufügen - auto loginButton = new QPushButton(tr("LOGIN")); + auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginButton->setFocusPolicy(Qt::NoFocus); connect(loginButton, &QPushButton::clicked, this, [this]() { slotOpenBrowser(); From f5b90997204e73b0a0f9c1decc95981798ffe40f Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 19 May 2025 14:09:07 +0200 Subject: [PATCH 29/62] test new layout code --- src/gui/nmcgui/nmcflow2authwidget.cpp | 129 ++++++++++++++++---------- 1 file changed, 79 insertions(+), 50 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 14407a4bccdd7..51a57307243cf 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -33,71 +33,100 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Bestehende Widgets anpassen - getUi().copyLinkButton->hide(); - getUi().openLinkButton->hide(); - getUi().statusLabel->hide(); - - auto progressInd = getProgressIndicator(); - progressInd->setVisible(false); - progressInd->setFixedSize(0, 0); - - // Logo anpassen - getUi().logoLabel->setFixedSize(36, 36); - getUi().logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - - // Titel und Beschreibung ersetzen - auto headerLabel = new QLabel("MagentaCLOUD"); - headerLabel->setStyleSheet("font-size: 15px; font-weight: bold;"); - getUi().verticalLayout->insertWidget(0, headerLabel); - - auto descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - descriptionLabel->setStyleSheet("font-size: 28px; font-weight: normal;"); - descriptionLabel->setWordWrap(true); - getUi().verticalLayout->insertWidget(1, descriptionLabel); - - // Textanleitung anpassen - getUi().label->setStyleSheet("font-size: 15px; font-weight: normal;"); - getUi().label->setText(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); - getUi().label->setFixedWidth(282); - getUi().label->setAlignment(Qt::AlignLeft); - - // Login Button hinzufügen - auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + // Alte UI-Elemente ausblenden oder entfernen + getUi().copyLinkButton->setVisible(false); + getUi().openLinkButton->setVisible(false); + getProgressIndicator()->setVisible(false); + getProgressIndicator()->setFixedSize(0, 0); + getUi().statusLabel->setFixedSize(0, 0); + + // Login-Button + auto loginButton = new QPushButton(tr("Einloggen")); loginButton->setFocusPolicy(Qt::NoFocus); + loginButton->setFixedSize(130, 32); + loginButton->setStyleSheet( + "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" + "QPushButton:hover { background-color: #c00063; }" + ); connect(loginButton, &QPushButton::clicked, this, [this]() { slotOpenBrowser(); }); - const QSize buttonSize(130, 32); - const QString styleSheet = QString( - "QPushButton{font-size: 15px; border: 0px solid; border-color: black; border-radius: 4px; " - "background-color: #E20074; color: white;}" - "QPushButton:hover { background-color: #c00063; }"); - loginButton->setStyleSheet(styleSheet); - loginButton->setFixedSize(buttonSize); - - getUi().verticalLayout->addSpacing(24); - getUi().verticalLayout->addWidget(loginButton); - - // Großes Logo rechts – ergänzend, optional - auto bigLogo = new QLabel; - bigLogo->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogo->setAlignment(Qt::AlignRight | Qt::AlignTop); - getUi().verticalLayout->addSpacing(16); - getUi().verticalLayout->addWidget(bigLogo); + // Linker Bereich + auto logoLabel = new QLabel; + logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(24, 24)); + logoLabel->setFixedSize(24, 24); + + auto titleLabel = new QLabel("MagentaCLOUD"); + titleLabel->setStyleSheet("font-weight: bold; font-size: 14px;"); + titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + auto logoTitleLayout = new QHBoxLayout; + logoTitleLayout->setSpacing(8); + logoTitleLayout->addWidget(logoLabel); + logoTitleLayout->addWidget(titleLabel); + logoTitleLayout->addStretch(); + + auto headerLabel = new QLabel(tr("Melden Sie sich an um direkt loszulegen")); + headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); + headerLabel->setWordWrap(true); + + auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); + instructionLabel->setStyleSheet("font-size: 14px;"); + instructionLabel->setWordWrap(true); + instructionLabel->setFixedWidth(300); + + auto leftLayout = new QVBoxLayout; + leftLayout->addLayout(logoTitleLayout); + leftLayout->addSpacing(24); + leftLayout->addWidget(headerLabel); + leftLayout->addSpacing(16); + leftLayout->addWidget(instructionLabel); + leftLayout->addSpacing(24); + leftLayout->addWidget(loginButton); + leftLayout->addStretch(); + + // Rechter Bereich (großes Logo) + auto bigLogoLabel = new QLabel; + bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + bigLogoLabel->setFixedSize(175, 175); + + auto rightLayout = new QVBoxLayout; + rightLayout->addStretch(); + rightLayout->addWidget(bigLogoLabel, 0, Qt::AlignRight | Qt::AlignBottom); + + // Hauptlayout + auto mainLayout = new QHBoxLayout; + mainLayout->setContentsMargins(16, 16, 16, 16); + mainLayout->addLayout(leftLayout); + mainLayout->addLayout(rightLayout); + + // Ursprüngliches Layout leeren und ersetzen + if (auto *oldLayout = layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + delete item; + } + delete oldLayout; + } + + setLayout(mainLayout); + + // Fehlerlabel unten anzeigen + getUi().verticalLayout->removeWidget(getUi().errorLabel); + layout()->addWidget(getUi().errorLabel); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); // weißer Hintergrund + painter.fillRect(rect(), Qt::white); Flow2AuthWidget::paintEvent(event); } void NMCFlow2AuthWidget::customizeStyle() { - // optional override, leer gelassen + // leer } } // namespace OCC From 82d53e6b9923e7d51dd5fba986ce5c3db36cd3bf Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 19 May 2025 15:00:10 +0200 Subject: [PATCH 30/62] update code --- src/gui/nmcgui/nmcflow2authwidget.cpp | 62 ++++++++++++++++----------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 51a57307243cf..fdd9b4ec8f291 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -22,8 +22,6 @@ #include #include #include -#include -#include #include #include "theme.h" @@ -33,33 +31,38 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Alte UI-Elemente ausblenden oder entfernen - getUi().copyLinkButton->setVisible(false); - getUi().openLinkButton->setVisible(false); - getProgressIndicator()->setVisible(false); - getProgressIndicator()->setFixedSize(0, 0); - getUi().statusLabel->setFixedSize(0, 0); + // Bestehende UI-Elemente ausblenden + if (getUi().copyLinkButton) { + getUi().copyLinkButton->hide(); + } + if (getUi().openLinkButton) { + getUi().openLinkButton->hide(); + } + if (auto *progressInd = getProgressIndicator()) { + progressInd->setVisible(false); + progressInd->setFixedSize(0, 0); + } + if (getUi().statusLabel) { + getUi().statusLabel->setVisible(false); + } // Login-Button - auto loginButton = new QPushButton(tr("Einloggen")); + auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginButton->setFocusPolicy(Qt::NoFocus); loginButton->setFixedSize(130, 32); loginButton->setStyleSheet( "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" "QPushButton:hover { background-color: #c00063; }" ); - connect(loginButton, &QPushButton::clicked, this, [this]() { - slotOpenBrowser(); - }); + connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); - // Linker Bereich - auto logoLabel = new QLabel; + // Logo + Titel + auto logoLabel = new QLabel(this); logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(24, 24)); logoLabel->setFixedSize(24, 24); - auto titleLabel = new QLabel("MagentaCLOUD"); + auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 14px;"); - titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); @@ -67,15 +70,18 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); - auto headerLabel = new QLabel(tr("Melden Sie sich an um direkt loszulegen")); + // Überschrift + auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); headerLabel->setWordWrap(true); - auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); + // Anweisungs-Label + auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); instructionLabel->setStyleSheet("font-size: 14px;"); instructionLabel->setWordWrap(true); instructionLabel->setFixedWidth(300); + // Linke Seite auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); @@ -86,8 +92,8 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) leftLayout->addWidget(loginButton); leftLayout->addStretch(); - // Rechter Bereich (großes Logo) - auto bigLogoLabel = new QLabel; + // Rechtes Logo + auto bigLogoLabel = new QLabel(this); bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); bigLogoLabel->setFixedSize(175, 175); @@ -101,10 +107,13 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) mainLayout->addLayout(leftLayout); mainLayout->addLayout(rightLayout); - // Ursprüngliches Layout leeren und ersetzen + // Bestehendes Layout leeren und ersetzen if (auto *oldLayout = layout()) { QLayoutItem *item; while ((item = oldLayout->takeAt(0)) != nullptr) { + if (auto *widget = item->widget()) { + widget->setParent(nullptr); // Sicheres Entfernen + } delete item; } delete oldLayout; @@ -112,21 +121,22 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); - // Fehlerlabel unten anzeigen - getUi().verticalLayout->removeWidget(getUi().errorLabel); - layout()->addWidget(getUi().errorLabel); + // Fehlerlabel wieder hinzufügen + if (getUi().errorLabel) { + mainLayout->addWidget(getUi().errorLabel); + } } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); + painter.fillRect(rect(), Qt::white); // Hintergrundfarbe Flow2AuthWidget::paintEvent(event); } void NMCFlow2AuthWidget::customizeStyle() { - // leer + // optional leer lassen } } // namespace OCC From 0eafce1edd8449ba81510cbcc5f22bdd3e17cf11 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 19 May 2025 16:35:57 +0200 Subject: [PATCH 31/62] layout fix --- src/gui/nmcgui/nmcflow2authwidget.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index fdd9b4ec8f291..c2037b28b7530 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -45,6 +45,9 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) if (getUi().statusLabel) { getUi().statusLabel->setVisible(false); } + if (getUi().logoLabel) { + getUi().logoLabel->hide(); + } // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); @@ -57,16 +60,16 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); // Logo + Titel - auto logoLabel = new QLabel(this); - logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(24, 24)); - logoLabel->setFixedSize(24, 24); + auto titleLogoLabel = new QLabel(this); + titleLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + titleLogoLabel->setFixedSize(36, 36); auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); - titleLabel->setStyleSheet("font-weight: bold; font-size: 14px;"); + titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(logoLabel); + logoTitleLayout->addWidget(titleLogoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); @@ -74,12 +77,13 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); headerLabel->setWordWrap(true); + headerLabel->setFixedWidth(282); // Anweisungs-Label auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); instructionLabel->setStyleSheet("font-size: 14px;"); instructionLabel->setWordWrap(true); - instructionLabel->setFixedWidth(300); + instructionLabel->setFixedWidth(282); // Linke Seite auto leftLayout = new QVBoxLayout; @@ -99,7 +103,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) auto rightLayout = new QVBoxLayout; rightLayout->addStretch(); - rightLayout->addWidget(bigLogoLabel, 0, Qt::AlignRight | Qt::AlignBottom); + rightLayout->addWidget(bigLogoLabel, 0, Qt::AlignRight | Qt::AlignVCenter); // Hauptlayout auto mainLayout = new QHBoxLayout; From 36001ca9b5ce79ed9c6d35199abc302e0abae424 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 09:30:55 +0200 Subject: [PATCH 32/62] layout fix --- src/gui/nmcgui/nmcflow2authwidget.cpp | 48 ++++++++++++++------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index c2037b28b7530..26cb1c815d35c 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -44,9 +44,19 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) } if (getUi().statusLabel) { getUi().statusLabel->setVisible(false); + getUi().statusLabel->setFixedSize(0, 0); } - if (getUi().logoLabel) { - getUi().logoLabel->hide(); + + // Bestehendes Layout und Child-Widgets entfernen + if (auto *oldLayout = layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + if (auto *widget = item->widget()) { + widget->setParent(nullptr); + } + delete item; + } + delete oldLayout; } // Login-Button @@ -60,16 +70,16 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); // Logo + Titel - auto titleLogoLabel = new QLabel(this); - titleLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - titleLogoLabel->setFixedSize(36, 36); + auto logoLabel = new QLabel(this); + logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + logoLabel->setFixedSize(36, 36); auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(titleLogoLabel); + logoTitleLayout->addWidget(logoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); @@ -98,34 +108,26 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Rechtes Logo auto bigLogoLabel = new QLabel(this); - bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogoLabel->setFixedSize(175, 175); + bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg") + .pixmap(QSize(175, 175), QIcon::KeepAspectRatio)); + bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); auto rightLayout = new QVBoxLayout; rightLayout->addStretch(); - rightLayout->addWidget(bigLogoLabel, 0, Qt::AlignRight | Qt::AlignVCenter); + rightLayout->addWidget(bigLogoLabel); + rightLayout->addStretch(); // Hauptlayout auto mainLayout = new QHBoxLayout; mainLayout->setContentsMargins(16, 16, 16, 16); + mainLayout->setSpacing(24); mainLayout->addLayout(leftLayout); mainLayout->addLayout(rightLayout); - // Bestehendes Layout leeren und ersetzen - if (auto *oldLayout = layout()) { - QLayoutItem *item; - while ((item = oldLayout->takeAt(0)) != nullptr) { - if (auto *widget = item->widget()) { - widget->setParent(nullptr); // Sicheres Entfernen - } - delete item; - } - delete oldLayout; - } - setLayout(mainLayout); - // Fehlerlabel wieder hinzufügen + // Fehlerlabel wieder einfügen if (getUi().errorLabel) { mainLayout->addWidget(getUi().errorLabel); } @@ -140,7 +142,7 @@ void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) void NMCFlow2AuthWidget::customizeStyle() { - // optional leer lassen + // Optional überschreibbar } } // namespace OCC From bb674d03eed4b87b51e5b159b67aefeca4dc1196 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 09:45:10 +0200 Subject: [PATCH 33/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 26cb1c815d35c..18e5071af9dcf 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -108,8 +108,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Rechtes Logo auto bigLogoLabel = new QLabel(this); - bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg") - .pixmap(QSize(175, 175), QIcon::KeepAspectRatio)); + bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); From 0a28ddecfdbe25ba29b92304b5e07643871f8b03 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 11:26:50 +0200 Subject: [PATCH 34/62] layout test --- src/gui/nmcgui/nmcflow2authwidget.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 18e5071af9dcf..ecdc752c10ed9 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -46,6 +46,14 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setVisible(false); getUi().statusLabel->setFixedSize(0, 0); } + if (getUi().logoLabel) { + getUi().logoLabel->setVisible(false); + getUi().logoLabel->setFixedSize(0, 0); + } + if (getUi().label) { + getUi().label->setVisible(false); + getUi().label->setFixedSize(0, 0); + } // Bestehendes Layout und Child-Widgets entfernen if (auto *oldLayout = layout()) { @@ -70,16 +78,16 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); // Logo + Titel - auto logoLabel = new QLabel(this); - logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - logoLabel->setFixedSize(36, 36); + auto tlogoLabel = new QLabel(this); + tlogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + tlogoLabel->setFixedSize(36, 36); auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(logoLabel); + logoTitleLayout->addWidget(tlogoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); From 8838389afaccf8b23144d0273320be4ea570fda0 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 12:04:45 +0200 Subject: [PATCH 35/62] another try --- src/gui/nmcgui/nmcflow2authwidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index ecdc752c10ed9..b51583b6fbf31 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -50,10 +50,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().logoLabel->setVisible(false); getUi().logoLabel->setFixedSize(0, 0); } - if (getUi().label) { - getUi().label->setVisible(false); - getUi().label->setFixedSize(0, 0); - } // Bestehendes Layout und Child-Widgets entfernen if (auto *oldLayout = layout()) { From c285cdc1132a16eb260a5050a76ef1cbac3997ad Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 13:02:24 +0200 Subject: [PATCH 36/62] another test --- src/gui/nmcgui/nmcflow2authwidget.cpp | 12 ++++-------- src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index b51583b6fbf31..18e5071af9dcf 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -46,10 +46,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setVisible(false); getUi().statusLabel->setFixedSize(0, 0); } - if (getUi().logoLabel) { - getUi().logoLabel->setVisible(false); - getUi().logoLabel->setFixedSize(0, 0); - } // Bestehendes Layout und Child-Widgets entfernen if (auto *oldLayout = layout()) { @@ -74,16 +70,16 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); // Logo + Titel - auto tlogoLabel = new QLabel(this); - tlogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - tlogoLabel->setFixedSize(36, 36); + auto logoLabel = new QLabel(this); + logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + logoLabel->setFixedSize(36, 36); auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(tlogoLabel); + logoTitleLayout->addWidget(logoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 01d8fa030881c..7a98b317c75ee 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -145,7 +145,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar // Telekom Logo _tLogoLbl->setFixedSize(36,36); - _tLogoLbl->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); + _tLogoLbl->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); hLogoAndLabelLayout->addWidget(_tLogoLbl); leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed)); @@ -223,12 +223,12 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); // Add items to the right side - QLabel *bigMagetnaIcon = new QLabel(""); - bigMagetnaIcon->setFixedSize(175,175); - bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/folderLogo.svg")).pixmap(175,175)); + QLabel *bigMagentaIcon = new QLabel(""); + bigMagentaIcon->setFixedSize(175,175); + bigMagentaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/folderLogo.svg").pixmap(175, 175)); rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,164, QSizePolicy::Fixed, QSizePolicy::Fixed)); - rightSideVerticalLayout->addWidget(bigMagetnaIcon); + rightSideVerticalLayout->addWidget(bigMagentaIcon); rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); From e9494a2677a86e3c10939e8c59c772ad67d37ca2 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 13:38:26 +0200 Subject: [PATCH 37/62] new fix --- src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 7a98b317c75ee..53f21454c559d 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -99,7 +99,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar validatePage(); }); - auto buttonLayout = new QHBoxLayout(this); + auto buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(8); // Set login button size and style QSize buttonSize(130,32); @@ -117,10 +117,10 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); // Create needed layouts - auto mainVerticalLayout = new QVBoxLayout(this); - auto subMainHorizontalLayout = new QHBoxLayout(this); - auto leftSideVerticalLayout = new QVBoxLayout(this); - auto rightSideVerticalLayout = new QVBoxLayout(this); + auto mainVerticalLayout = new QVBoxLayout(); + auto subMainHorizontalLayout = new QHBoxLayout(); + auto leftSideVerticalLayout = new QVBoxLayout(); + auto rightSideVerticalLayout = new QVBoxLayout(); mainVerticalLayout->setSpacing(0); mainVerticalLayout->setContentsMargins(16,8,40,0); subMainHorizontalLayout->setSpacing(0); @@ -139,7 +139,7 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar leftSideVerticalLayout->setSpacing(0); // Create a horizontal T-Logo and MagentaCLOUC-label layout - auto hLogoAndLabelLayout = new QHBoxLayout(this); + auto hLogoAndLabelLayout = new QHBoxLayout(); hLogoAndLabelLayout->setSpacing(0); hLogoAndLabelLayout->setContentsMargins(0,0,0,0); From 916b211f647fc4dbc46aba4ba15819c51ad9b409 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 20 May 2025 16:53:26 +0200 Subject: [PATCH 38/62] new structure --- src/gui/nmcgui/nmcflow2authwidget.cpp | 49 +++++++++++++++------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 18e5071af9dcf..c7ca6448af992 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "theme.h" @@ -31,7 +32,7 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Bestehende UI-Elemente ausblenden + // Vorhandene UI-Elemente deaktivieren if (getUi().copyLinkButton) { getUi().copyLinkButton->hide(); } @@ -47,11 +48,12 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setFixedSize(0, 0); } - // Bestehendes Layout und Child-Widgets entfernen + // Altes Layout entfernen if (auto *oldLayout = layout()) { QLayoutItem *item; - while ((item = oldLayout->takeAt(0)) != nullptr) { + while ((item = oldLayout->takeAt(0))) { if (auto *widget = item->widget()) { + widget->hide(); widget->setParent(nullptr); } delete item; @@ -62,26 +64,25 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginButton->setFocusPolicy(Qt::NoFocus); - loginButton->setFixedSize(130, 32); loginButton->setStyleSheet( "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" "QPushButton:hover { background-color: #c00063; }" ); connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); - // Logo + Titel - auto logoLabel = new QLabel(this); + // Logo & Titel + auto logoLabel = new QLabel; logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); logoLabel->setFixedSize(36, 36); - auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); + auto titleLabel = new QLabel(tr("MagentaCLOUD")); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; - logoTitleLayout->setSpacing(8); logoTitleLayout->addWidget(logoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); + logoTitleLayout->setSpacing(8); // Überschrift auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); @@ -89,13 +90,20 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) headerLabel->setWordWrap(true); headerLabel->setFixedWidth(282); - // Anweisungs-Label - auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); - instructionLabel->setStyleSheet("font-size: 14px;"); + // Instruktion + auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); + instructionLabel->setStyleSheet("font-size: 15px; font-weight: normal;"); instructionLabel->setWordWrap(true); instructionLabel->setFixedWidth(282); - // Linke Seite + // Fehlerlabel vorbereiten + if (getUi().errorLabel) { + getUi().errorLabel->setWordWrap(true); + getUi().errorLabel->setFixedWidth(282); + getUi().errorLabel->setStyleSheet("color: red; font-size: 15px; font-weight: normal;"); + } + + // Linker Bereich auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); @@ -105,12 +113,16 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) leftLayout->addSpacing(24); leftLayout->addWidget(loginButton); leftLayout->addStretch(); + if (getUi().errorLabel) { + leftLayout->addSpacing(12); + leftLayout->addWidget(getUi().errorLabel); + } - // Rechtes Logo - auto bigLogoLabel = new QLabel(this); + // Rechter Bereich (großes Logo) + auto bigLogoLabel = new QLabel; bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); auto rightLayout = new QVBoxLayout; rightLayout->addStretch(); @@ -125,17 +137,12 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) mainLayout->addLayout(rightLayout); setLayout(mainLayout); - - // Fehlerlabel wieder einfügen - if (getUi().errorLabel) { - mainLayout->addWidget(getUi().errorLabel); - } } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); // Hintergrundfarbe + painter.fillRect(rect(), Qt::white); Flow2AuthWidget::paintEvent(event); } From 1ba5bdf7f9c3db77705f1f62a68579a170d82e1e Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 21 May 2025 08:04:52 +0200 Subject: [PATCH 39/62] took back changes --- src/gui/nmcgui/nmcflow2authwidget.cpp | 49 ++++++++++++--------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index c7ca6448af992..18e5071af9dcf 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "theme.h" @@ -32,7 +31,7 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Vorhandene UI-Elemente deaktivieren + // Bestehende UI-Elemente ausblenden if (getUi().copyLinkButton) { getUi().copyLinkButton->hide(); } @@ -48,12 +47,11 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setFixedSize(0, 0); } - // Altes Layout entfernen + // Bestehendes Layout und Child-Widgets entfernen if (auto *oldLayout = layout()) { QLayoutItem *item; - while ((item = oldLayout->takeAt(0))) { + while ((item = oldLayout->takeAt(0)) != nullptr) { if (auto *widget = item->widget()) { - widget->hide(); widget->setParent(nullptr); } delete item; @@ -64,25 +62,26 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); loginButton->setFocusPolicy(Qt::NoFocus); + loginButton->setFixedSize(130, 32); loginButton->setStyleSheet( "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" "QPushButton:hover { background-color: #c00063; }" ); connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); - // Logo & Titel - auto logoLabel = new QLabel; + // Logo + Titel + auto logoLabel = new QLabel(this); logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); logoLabel->setFixedSize(36, 36); - auto titleLabel = new QLabel(tr("MagentaCLOUD")); + auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; + logoTitleLayout->setSpacing(8); logoTitleLayout->addWidget(logoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); - logoTitleLayout->setSpacing(8); // Überschrift auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); @@ -90,20 +89,13 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) headerLabel->setWordWrap(true); headerLabel->setFixedWidth(282); - // Instruktion - auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden.")); - instructionLabel->setStyleSheet("font-size: 15px; font-weight: normal;"); + // Anweisungs-Label + auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); + instructionLabel->setStyleSheet("font-size: 14px;"); instructionLabel->setWordWrap(true); instructionLabel->setFixedWidth(282); - // Fehlerlabel vorbereiten - if (getUi().errorLabel) { - getUi().errorLabel->setWordWrap(true); - getUi().errorLabel->setFixedWidth(282); - getUi().errorLabel->setStyleSheet("color: red; font-size: 15px; font-weight: normal;"); - } - - // Linker Bereich + // Linke Seite auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); @@ -113,16 +105,12 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) leftLayout->addSpacing(24); leftLayout->addWidget(loginButton); leftLayout->addStretch(); - if (getUi().errorLabel) { - leftLayout->addSpacing(12); - leftLayout->addWidget(getUi().errorLabel); - } - // Rechter Bereich (großes Logo) - auto bigLogoLabel = new QLabel; + // Rechtes Logo + auto bigLogoLabel = new QLabel(this); bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); auto rightLayout = new QVBoxLayout; rightLayout->addStretch(); @@ -137,12 +125,17 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) mainLayout->addLayout(rightLayout); setLayout(mainLayout); + + // Fehlerlabel wieder einfügen + if (getUi().errorLabel) { + mainLayout->addWidget(getUi().errorLabel); + } } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); + painter.fillRect(rect(), Qt::white); // Hintergrundfarbe Flow2AuthWidget::paintEvent(event); } From 17ca2787ae23c7257cbe851d7a6ba49512a01ea4 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 08:31:05 +0200 Subject: [PATCH 40/62] remove unused widgets --- src/gui/nmcgui/nmcflow2authwidget.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 18e5071af9dcf..4d69dcc9052ae 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -47,6 +47,10 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setFixedSize(0, 0); } + getUi().verticalLayout->removeWidget(getUi().label); + getUi().verticalLayout->removeWidget(getUi().logoLabel); + getUi().verticalLayout->removeWidget(getUi().errorLabel); + // Bestehendes Layout und Child-Widgets entfernen if (auto *oldLayout = layout()) { QLayoutItem *item; @@ -127,9 +131,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); // Fehlerlabel wieder einfügen - if (getUi().errorLabel) { - mainLayout->addWidget(getUi().errorLabel); - } + mainLayout->addWidget(getUi().errorLabel); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) From e66a02fbee7848e4f274ced1d2ae22ba5b0cfdca Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 09:12:48 +0200 Subject: [PATCH 41/62] Test --- src/gui/nmcgui/nmcflow2authwidget.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 4d69dcc9052ae..be6b45b595d8f 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -48,8 +48,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) } getUi().verticalLayout->removeWidget(getUi().label); - getUi().verticalLayout->removeWidget(getUi().logoLabel); - getUi().verticalLayout->removeWidget(getUi().errorLabel); // Bestehendes Layout und Child-Widgets entfernen if (auto *oldLayout = layout()) { From 5db8588052f771653b2ab1d21330b4a2bee072f1 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 10:03:32 +0200 Subject: [PATCH 42/62] layout test --- src/gui/nmcgui/nmcflow2authwidget.cpp | 4 ++++ src/gui/wizard/owncloudsetuppage.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index be6b45b595d8f..41e7556c08dd1 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -48,8 +48,11 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) } getUi().verticalLayout->removeWidget(getUi().label); + getUi().verticalLayout->removeWidget(getUi().logoLabel); + getUi().verticalLayout->removeWidget(getUi().errorLabel); // Bestehendes Layout und Child-Widgets entfernen + /* if (auto *oldLayout = layout()) { QLayoutItem *item; while ((item = oldLayout->takeAt(0)) != nullptr) { @@ -60,6 +63,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) } delete oldLayout; } + */ // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 28bd2c3d849be..031f4c5f7ff9d 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -385,6 +385,8 @@ void OwncloudSetupPage::customizeStyle() { setLogo(); + this->setStyleSheet("background-color: #e20074;"); + if (_progressIndi) { const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); if (isDarkBackground) { From 60ef18bdee1016dd39071702193f928bdf556914 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 11:03:47 +0200 Subject: [PATCH 43/62] Bestehendes Layout rekursiv entfernen --- src/gui/nmcgui/nmcflow2authwidget.cpp | 38 +++++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 41e7556c08dd1..cab650ef614ad 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -28,6 +28,25 @@ namespace OCC { +// Hilfsfunktion: löscht Layout + alle Child-Layouts + Widgets +static void deleteLayoutRecursively(QLayout *layout) +{ + if (!layout) + return; + + QLayoutItem *item; + while ((item = layout->takeAt(0)) != nullptr) { + if (auto *childLayout = item->layout()) { + deleteLayoutRecursively(childLayout); + } else if (auto *widget = item->widget()) { + widget->setParent(nullptr); + } + delete item; + } + + delete layout; +} + NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { @@ -47,23 +66,8 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setFixedSize(0, 0); } - getUi().verticalLayout->removeWidget(getUi().label); - getUi().verticalLayout->removeWidget(getUi().logoLabel); - getUi().verticalLayout->removeWidget(getUi().errorLabel); - - // Bestehendes Layout und Child-Widgets entfernen - /* - if (auto *oldLayout = layout()) { - QLayoutItem *item; - while ((item = oldLayout->takeAt(0)) != nullptr) { - if (auto *widget = item->widget()) { - widget->setParent(nullptr); - } - delete item; - } - delete oldLayout; - } - */ + // Bestehendes Layout rekursiv entfernen + deleteLayoutRecursively(layout()); // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); From 28a048b13ec4ecf78065a549d811d2fd5797a3f6 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 11:20:09 +0200 Subject: [PATCH 44/62] custom logo color --- src/gui/wizard/owncloudsetuppage.cpp | 10 ++++++---- src/libsync/theme.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 031f4c5f7ff9d..8d918b2ee3d71 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -93,7 +93,12 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent) void OwncloudSetupPage::setLogo() { - _ui.logoLabel->setPixmap(Theme::instance()->wizardApplicationLogo()); + const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); + if (isDarkBackground) { + _ui.logoLabel->setPixmap(Theme::instance()->wizardApplicationLogo()); + } else { + _ui.logoLabel->setPixmap(Theme::instance()->wizardApplicationLogoColored(QColor("#e20074"))); + } } void OwncloudSetupPage::setupServerAddressDescriptionLabel() @@ -385,8 +390,6 @@ void OwncloudSetupPage::customizeStyle() { setLogo(); - this->setStyleSheet("background-color: #e20074;"); - if (_progressIndi) { const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); if (isDarkBackground) { @@ -396,7 +399,6 @@ void OwncloudSetupPage::customizeStyle() } } - WizardCommon::customizeHintLabel(_ui.serverAddressDescriptionLabel); } diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 59f1d5ef7b739..9fd75a905aa72 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -746,6 +746,30 @@ QPixmap Theme::wizardApplicationLogo() const #endif } +QPixmap Theme::wizardApplicationLogoColored(const QColor &color) const +{ + const QString svgPath = QString(Theme::themePrefix) + QStringLiteral("colored/wizard_logo.svg"); + + QSvgRenderer svg(svgPath); + const int maxHeight = Theme::isHidpi() ? 200 : 100; + const int maxWidth = 2 * maxHeight; + QSize size(maxWidth, maxHeight); + + QPixmap pixmap(size); + pixmap.fill(Qt::transparent); + + QPainter painter(&pixmap); + painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + + svg.render(&painter); + + painter.setCompositionMode(QPainter::CompositionMode_SourceIn); + painter.fillRect(pixmap.rect(), color); + painter.end(); + + return pixmap; +} + QPixmap Theme::wizardHeaderLogo() const { #ifdef APPLICATION_WIZARD_USE_CUSTOM_LOGO From c3030918797eb032377f550ad0fb2d93d7ec6d7a Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 11:26:13 +0200 Subject: [PATCH 45/62] fixed error --- src/libsync/theme.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 092fc112b4c65..f8efe744751dd 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -324,7 +324,8 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject /** @return color for the setup wizard. */ [[nodiscard]] QColor wizardHeaderBackgroundColor() const; - [[nodiscard]] QPixmap wizardApplicationLogo() const; + [[nodiscard]] QPixmap wizardApplicationLogo() const; + [[nodiscard]] QPixmap wizardApplicationLogoColored(const QColor &color) const; /** @return logo for the setup wizard. */ [[nodiscard]] QPixmap wizardHeaderLogo() const; From 7d1dfa9e574d1fda47175ed9e4c9097d371dcd28 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 12:32:07 +0200 Subject: [PATCH 46/62] revert change --- src/gui/nmcgui/nmcflow2authwidget.cpp | 36 +++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index cab650ef614ad..18e5071af9dcf 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -28,25 +28,6 @@ namespace OCC { -// Hilfsfunktion: löscht Layout + alle Child-Layouts + Widgets -static void deleteLayoutRecursively(QLayout *layout) -{ - if (!layout) - return; - - QLayoutItem *item; - while ((item = layout->takeAt(0)) != nullptr) { - if (auto *childLayout = item->layout()) { - deleteLayoutRecursively(childLayout); - } else if (auto *widget = item->widget()) { - widget->setParent(nullptr); - } - delete item; - } - - delete layout; -} - NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { @@ -66,8 +47,17 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().statusLabel->setFixedSize(0, 0); } - // Bestehendes Layout rekursiv entfernen - deleteLayoutRecursively(layout()); + // Bestehendes Layout und Child-Widgets entfernen + if (auto *oldLayout = layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + if (auto *widget = item->widget()) { + widget->setParent(nullptr); + } + delete item; + } + delete oldLayout; + } // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); @@ -137,7 +127,9 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); // Fehlerlabel wieder einfügen - mainLayout->addWidget(getUi().errorLabel); + if (getUi().errorLabel) { + mainLayout->addWidget(getUi().errorLabel); + } } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) From 398db1db1ab6d82ee08ecf12fdc38a18e3bb2ff5 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 13:45:22 +0200 Subject: [PATCH 47/62] another layout fix --- src/gui/nmcgui/nmcflow2authwidget.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 18e5071af9dcf..5cf3a8a486e68 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -42,6 +42,14 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) progressInd->setVisible(false); progressInd->setFixedSize(0, 0); } + if (getUi().logoLabel) { + getUi().logoLabel->setVisible(false); + getUi().logoLabel->setFixedSize(0, 0); + } + if (getUi().headerLabel) { + getUi().headerLabel->setVisible(false); + getUi().headerLabel->setFixedSize(0, 0); + } if (getUi().statusLabel) { getUi().statusLabel->setVisible(false); getUi().statusLabel->setFixedSize(0, 0); @@ -70,24 +78,24 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); // Logo + Titel - auto logoLabel = new QLabel(this); - logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - logoLabel->setFixedSize(36, 36); + auto logoTitleLabel = new QLabel(this); + logoTitleLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + logoTitleLabel->setFixedSize(36, 36); auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(logoLabel); + logoTitleLayout->addWidget(logoTitleLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); // Überschrift - auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); - headerLabel->setWordWrap(true); - headerLabel->setFixedWidth(282); + auto headerTextLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + headerTextLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); + headerTextLabel->setWordWrap(true); + headerTextLabel->setFixedWidth(282); // Anweisungs-Label auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); @@ -99,7 +107,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); - leftLayout->addWidget(headerLabel); + leftLayout->addWidget(headerTextLabel); leftLayout->addSpacing(16); leftLayout->addWidget(instructionLabel); leftLayout->addSpacing(24); @@ -122,6 +130,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) mainLayout->setContentsMargins(16, 16, 16, 16); mainLayout->setSpacing(24); mainLayout->addLayout(leftLayout); + mainLayout->addStretch(); // Spacer zwischen den Seiten mainLayout->addLayout(rightLayout); setLayout(mainLayout); From dead88c76eedc4c2401c41d66e470cf94a1777ac Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 14:10:49 +0200 Subject: [PATCH 48/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 5cf3a8a486e68..e06fd67f78241 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -46,10 +46,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) getUi().logoLabel->setVisible(false); getUi().logoLabel->setFixedSize(0, 0); } - if (getUi().headerLabel) { - getUi().headerLabel->setVisible(false); - getUi().headerLabel->setFixedSize(0, 0); - } if (getUi().statusLabel) { getUi().statusLabel->setVisible(false); getUi().statusLabel->setFixedSize(0, 0); From b16a5c82f5c10bc915424e9fa70e7ff1e0b44d3d Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 22 May 2025 15:18:18 +0200 Subject: [PATCH 49/62] layout fix --- src/gui/nmcgui/nmcflow2authwidget.cpp | 38 ++++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index e06fd67f78241..1da8830231008 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -42,10 +42,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) progressInd->setVisible(false); progressInd->setFixedSize(0, 0); } - if (getUi().logoLabel) { - getUi().logoLabel->setVisible(false); - getUi().logoLabel->setFixedSize(0, 0); - } if (getUi().statusLabel) { getUi().statusLabel->setVisible(false); getUi().statusLabel->setFixedSize(0, 0); @@ -74,38 +70,38 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); // Logo + Titel - auto logoTitleLabel = new QLabel(this); - logoTitleLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); - logoTitleLabel->setFixedSize(36, 36); + auto logoLabel = new QLabel(this); + logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + logoLabel->setFixedSize(36, 36); auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); auto logoTitleLayout = new QHBoxLayout; logoTitleLayout->setSpacing(8); - logoTitleLayout->addWidget(logoTitleLabel); + logoTitleLayout->addWidget(logoLabel); logoTitleLayout->addWidget(titleLabel); logoTitleLayout->addStretch(); // Überschrift - auto headerTextLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); - headerTextLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); - headerTextLabel->setWordWrap(true); - headerTextLabel->setFixedWidth(282); + auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); + headerLabel->setWordWrap(true); + headerLabel->setFixedWidth(282); // Anweisungs-Label - auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); - instructionLabel->setStyleSheet("font-size: 14px;"); - instructionLabel->setWordWrap(true); - instructionLabel->setFixedWidth(282); + auto label = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); + label->setStyleSheet("font-size: 14px;"); + label->setWordWrap(true); + label->setFixedWidth(282); // Linke Seite auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); - leftLayout->addWidget(headerTextLabel); + leftLayout->addWidget(headerLabel); leftLayout->addSpacing(16); - leftLayout->addWidget(instructionLabel); + leftLayout->addWidget(label); leftLayout->addSpacing(24); leftLayout->addWidget(loginButton); leftLayout->addStretch(); @@ -126,15 +122,15 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) mainLayout->setContentsMargins(16, 16, 16, 16); mainLayout->setSpacing(24); mainLayout->addLayout(leftLayout); - mainLayout->addStretch(); // Spacer zwischen den Seiten + mainLayout->addStretch(); mainLayout->addLayout(rightLayout); - setLayout(mainLayout); - // Fehlerlabel wieder einfügen if (getUi().errorLabel) { mainLayout->addWidget(getUi().errorLabel); } + + setLayout(mainLayout); } void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) From 2c060a34b68308ce12741f73122047241068163f Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 2 Jun 2025 14:33:05 +0200 Subject: [PATCH 50/62] status change override --- src/gui/nmcgui/nmcflow2authwidget.cpp | 10 ++++++++++ src/gui/nmcgui/nmcflow2authwidget.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 1da8830231008..8a7547373a935 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -133,6 +133,16 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); } +void NMCFlow2AuthWidget::slotStatusChanged(PollStatus status, int delay) +{ + if (auto *lyt = layout()) { + lyt->setEnabled(true); // oder false je nach Bedarf + } + + // Den Basis-Slot NICHT aufrufen, um Absturz zu vermeiden + // Flow2AuthWidget::slotStatusChanged(status, delay); +} + void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 415d391937d48..676ff4a58cf7f 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -50,6 +50,12 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget * Customizes the style of the widget. */ void customizeStyle() override; + + /** + * @brief Reimplemented from Flow2AuthWidget. + * Handles changes in the authentication status. + */ + void slotStatusChanged(OCC::Flow2Auth::PollStatus status, int delay) override; }; } // namespace OCC From 15b89db56f40c3ed2abd0d3771502f3d2888e5f0 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 2 Jun 2025 14:42:47 +0200 Subject: [PATCH 51/62] fix error --- src/gui/wizard/flow2authwidget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index a7111295e254d..72cc331de3682 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -39,7 +39,7 @@ class Flow2AuthWidget : public QWidget public Q_SLOTS: void slotAuthResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void slotPollNow(); - void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); + virtual void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); void slotStyleChanged(); Q_SIGNALS: From c2c163caad23cc463c757475c0518542cb6ce2b6 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 2 Jun 2025 14:49:54 +0200 Subject: [PATCH 52/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 8a7547373a935..c3cc693e8baee 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -133,7 +133,7 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); } -void NMCFlow2AuthWidget::slotStatusChanged(PollStatus status, int delay) +void NMCFlow2AuthWidget::slotStatusChanged(OCC::Flow2Auth::PollStatus status, int delay) { if (auto *lyt = layout()) { lyt->setEnabled(true); // oder false je nach Bedarf From 73184ebab0debc072814f2b9b5453ea8a3d85cad Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 2 Jun 2025 14:58:19 +0200 Subject: [PATCH 53/62] fix error --- src/gui/nmcgui/nmcflow2authwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index c3cc693e8baee..b9efb4c98f2b4 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -135,6 +135,9 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) void NMCFlow2AuthWidget::slotStatusChanged(OCC::Flow2Auth::PollStatus status, int delay) { + Q_UNUSED(status) + Q_UNUSED(delay) + if (auto *lyt = layout()) { lyt->setEnabled(true); // oder false je nach Bedarf } From ec3431f8855eae14cf4a6a62cc59c75e442bf050 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 3 Jun 2025 09:45:08 +0200 Subject: [PATCH 54/62] fix crash --- src/gui/nmcgui/nmcflow2authwidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index b9efb4c98f2b4..9d880d22076ee 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -137,10 +137,6 @@ void NMCFlow2AuthWidget::slotStatusChanged(OCC::Flow2Auth::PollStatus status, in { Q_UNUSED(status) Q_UNUSED(delay) - - if (auto *lyt = layout()) { - lyt->setEnabled(true); // oder false je nach Bedarf - } // Den Basis-Slot NICHT aufrufen, um Absturz zu vermeiden // Flow2AuthWidget::slotStatusChanged(status, delay); From 962284adbab986040798d364f65252da74b23225 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 3 Jun 2025 12:03:33 +0200 Subject: [PATCH 55/62] fixed crash --- src/gui/nmcgui/nmcflow2authwidget.cpp | 9 --------- src/gui/nmcgui/nmcflow2authwidget.h | 6 ------ src/gui/wizard/flow2authwidget.h | 2 +- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 9d880d22076ee..1da8830231008 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -133,15 +133,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); } -void NMCFlow2AuthWidget::slotStatusChanged(OCC::Flow2Auth::PollStatus status, int delay) -{ - Q_UNUSED(status) - Q_UNUSED(delay) - - // Den Basis-Slot NICHT aufrufen, um Absturz zu vermeiden - // Flow2AuthWidget::slotStatusChanged(status, delay); -} - void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 676ff4a58cf7f..415d391937d48 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -50,12 +50,6 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget * Customizes the style of the widget. */ void customizeStyle() override; - - /** - * @brief Reimplemented from Flow2AuthWidget. - * Handles changes in the authentication status. - */ - void slotStatusChanged(OCC::Flow2Auth::PollStatus status, int delay) override; }; } // namespace OCC diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index 72cc331de3682..a7111295e254d 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -39,7 +39,7 @@ class Flow2AuthWidget : public QWidget public Q_SLOTS: void slotAuthResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void slotPollNow(); - virtual void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); + void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); void slotStyleChanged(); Q_SIGNALS: From 3ef0a751218d278d087a006550dec26e20606c53 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 3 Jun 2025 17:40:21 +0200 Subject: [PATCH 56/62] fixed widget --- src/gui/nmcgui/nmcflow2authwidget.cpp | 95 ++++++++++++--------------- src/gui/nmcgui/nmcflow2authwidget.h | 15 +++++ src/gui/wizard/flow2authwidget.h | 6 +- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 1da8830231008..bf7cea67ca634 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -14,15 +14,14 @@ #include "nmcflow2authwidget.h" -#include "QProgressIndicator.h" -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include #include +#include #include "theme.h" @@ -31,33 +30,8 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // Bestehende UI-Elemente ausblenden - if (getUi().copyLinkButton) { - getUi().copyLinkButton->hide(); - } - if (getUi().openLinkButton) { - getUi().openLinkButton->hide(); - } - if (auto *progressInd = getProgressIndicator()) { - progressInd->setVisible(false); - progressInd->setFixedSize(0, 0); - } - if (getUi().statusLabel) { - getUi().statusLabel->setVisible(false); - getUi().statusLabel->setFixedSize(0, 0); - } - - // Bestehendes Layout und Child-Widgets entfernen - if (auto *oldLayout = layout()) { - QLayoutItem *item; - while ((item = oldLayout->takeAt(0)) != nullptr) { - if (auto *widget = item->widget()) { - widget->setParent(nullptr); - } - delete item; - } - delete oldLayout; - } + // UI von Flow2AuthWidget vollständig ignorieren: + QWidget *container = new QWidget(this); // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); @@ -89,27 +63,26 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) headerLabel->setWordWrap(true); headerLabel->setFixedWidth(282); - // Anweisungs-Label - auto label = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); - label->setStyleSheet("font-size: 14px;"); - label->setWordWrap(true); - label->setFixedWidth(282); + // Anweisungs-Text + auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); + instructionLabel->setStyleSheet("font-size: 14px;"); + instructionLabel->setWordWrap(true); + instructionLabel->setFixedWidth(282); - // Linke Seite + // Linke Spalte auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); leftLayout->addWidget(headerLabel); leftLayout->addSpacing(16); - leftLayout->addWidget(label); + leftLayout->addWidget(instructionLabel); leftLayout->addSpacing(24); leftLayout->addWidget(loginButton); leftLayout->addStretch(); - // Rechtes Logo + // Großes Logo rechts auto bigLogoLabel = new QLabel(this); bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); - bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); auto rightLayout = new QVBoxLayout; @@ -117,32 +90,46 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) rightLayout->addWidget(bigLogoLabel); rightLayout->addStretch(); - // Hauptlayout - auto mainLayout = new QHBoxLayout; + // Gesamt-Layout + auto mainLayout = new QHBoxLayout(container); mainLayout->setContentsMargins(16, 16, 16, 16); mainLayout->setSpacing(24); mainLayout->addLayout(leftLayout); mainLayout->addStretch(); mainLayout->addLayout(rightLayout); - // Fehlerlabel wieder einfügen - if (getUi().errorLabel) { - mainLayout->addWidget(getUi().errorLabel); - } - - setLayout(mainLayout); + // Hauptlayout zuweisen + auto wrapperLayout = new QVBoxLayout; + wrapperLayout->setContentsMargins(0, 0, 0, 0); + wrapperLayout->addWidget(container); + setLayout(wrapperLayout); } +// Hintergrundfarbe void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); // Hintergrundfarbe - Flow2AuthWidget::paintEvent(event); + painter.fillRect(rect(), Qt::white); + QWidget::paintEvent(event); +} + +// Styling bewusst ignorieren +void NMCFlow2AuthWidget::customizeStyle() {} + +// Spinner einblenden / ungenutzt +void NMCFlow2AuthWidget::startSpinner() {} + +// Spinner ausblenden / ungenutzt +void NMCFlow2AuthWidget::stopSpinner(bool showStatusLabel) +{ + Q_UNUSED(showStatusLabel); } -void NMCFlow2AuthWidget::customizeStyle() +// Statusänderung unterdrücken +void NMCFlow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) { - // Optional überschreibbar + Q_UNUSED(status); + Q_UNUSED(secondsLeft); } } // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index 415d391937d48..c2b041019ac08 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -50,6 +50,21 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget * Customizes the style of the widget. */ void customizeStyle() override; + + /** + * @brief Optionally reimplemented: controls spinner visibility/start. + */ + void startSpinner() override; + + /** + * @brief Optionally reimplemented: stops spinner and optionally shows label. + */ + void stopSpinner(bool showStatusLabel) override; + + /** + * @brief Optionally reimplemented: handles status updates during auth. + */ + void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) override; }; } // namespace OCC diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index a7111295e254d..2b2d9edfe60f6 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -39,7 +39,7 @@ class Flow2AuthWidget : public QWidget public Q_SLOTS: void slotAuthResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void slotPollNow(); - void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); + virtual void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); void slotStyleChanged(); Q_SIGNALS: @@ -70,8 +70,8 @@ protected Q_SLOTS: virtual void customizeStyle(); private: - void startSpinner(); - void stopSpinner(bool showStatusLabel); + virtual void startSpinner(); + virtual void stopSpinner(bool showStatusLabel); void setLogo(); QProgressIndicator *_progressIndi; From c644b80b5357d6fe201431697f670bf1b7b51cb2 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 4 Jun 2025 11:54:18 +0200 Subject: [PATCH 57/62] fix layout --- src/gui/nmcgui/nmcflow2authwidget.cpp | 73 ++++++++++++++++++--------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index bf7cea67ca634..4409d90dcee20 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -14,15 +14,16 @@ #include "nmcflow2authwidget.h" -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include "QProgressIndicator.h" #include "theme.h" namespace OCC { @@ -30,8 +31,33 @@ namespace OCC { NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { - // UI von Flow2AuthWidget vollständig ignorieren: - QWidget *container = new QWidget(this); + // Bestehende UI-Elemente ausblenden + if (getUi().copyLinkButton) { + getUi().copyLinkButton->hide(); + } + if (getUi().openLinkButton) { + getUi().openLinkButton->hide(); + } + if (auto *progressInd = getProgressIndicator()) { + progressInd->setVisible(false); + progressInd->setFixedSize(0, 0); + } + if (getUi().statusLabel) { + getUi().statusLabel->setVisible(false); + getUi().statusLabel->setFixedSize(0, 0); + } + + // Bestehendes Layout und Child-Widgets entfernen + if (auto *oldLayout = layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + if (auto *widget = item->widget()) { + widget->setParent(nullptr); + } + delete item; + } + delete oldLayout; + } // Login-Button auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); @@ -63,26 +89,27 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) headerLabel->setWordWrap(true); headerLabel->setFixedWidth(282); - // Anweisungs-Text - auto instructionLabel = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); - instructionLabel->setStyleSheet("font-size: 14px;"); - instructionLabel->setWordWrap(true); - instructionLabel->setFixedWidth(282); + // Anweisungs-Label + auto label = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); + label->setStyleSheet("font-size: 14px;"); + label->setWordWrap(true); + label->setFixedWidth(282); - // Linke Spalte + // Linke Seite auto leftLayout = new QVBoxLayout; leftLayout->addLayout(logoTitleLayout); leftLayout->addSpacing(24); leftLayout->addWidget(headerLabel); leftLayout->addSpacing(16); - leftLayout->addWidget(instructionLabel); + leftLayout->addWidget(label); leftLayout->addSpacing(24); leftLayout->addWidget(loginButton); leftLayout->addStretch(); - // Großes Logo rechts + // Rechtes Logo auto bigLogoLabel = new QLabel(this); bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); auto rightLayout = new QVBoxLayout; @@ -90,19 +117,19 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) rightLayout->addWidget(bigLogoLabel); rightLayout->addStretch(); - // Gesamt-Layout - auto mainLayout = new QHBoxLayout(container); + // Hauptlayout + auto mainLayout = new QHBoxLayout; mainLayout->setContentsMargins(16, 16, 16, 16); mainLayout->setSpacing(24); mainLayout->addLayout(leftLayout); mainLayout->addStretch(); mainLayout->addLayout(rightLayout); - // Hauptlayout zuweisen - auto wrapperLayout = new QVBoxLayout; - wrapperLayout->setContentsMargins(0, 0, 0, 0); - wrapperLayout->addWidget(container); - setLayout(wrapperLayout); + // Fehlerlabel wieder einfügen + if (getUi().errorLabel) { + mainLayout->addWidget(getUi().errorLabel); + } + setLayout(mainLayout); } // Hintergrundfarbe From 9db96edb6f94d6f6969e355b57c5cc3bbfc68de6 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 4 Jun 2025 13:03:33 +0200 Subject: [PATCH 58/62] more fixes --- src/gui/nmcgui/nmcflow2authwidget.cpp | 8 ++++++++ src/libsync/theme.cpp | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index 4409d90dcee20..a7159795abb8f 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -32,6 +32,14 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) : Flow2AuthWidget(parent) { // Bestehende UI-Elemente ausblenden + if (getUi().logoLabel) { + getUi().logoLabel->hide(); + getUi().logoLabel->setFixedSize(0, 0); + } + if (getUi().label) { + getUi().label->hide(); + getUi().label->setFixedSize(0, 0); + } if (getUi().copyLinkButton) { getUi().copyLinkButton->hide(); } diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 9fd75a905aa72..fcde76cf3d83b 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -751,16 +751,15 @@ QPixmap Theme::wizardApplicationLogoColored(const QColor &color) const const QString svgPath = QString(Theme::themePrefix) + QStringLiteral("colored/wizard_logo.svg"); QSvgRenderer svg(svgPath); - const int maxHeight = Theme::isHidpi() ? 200 : 100; - const int maxWidth = 2 * maxHeight; - QSize size(maxWidth, maxHeight); + + QSizeF viewBox = svg.viewBoxF().size(); + QSize size = viewBox.toSize(); QPixmap pixmap(size); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); painter.setCompositionMode(QPainter::CompositionMode_SourceOver); - svg.render(&painter); painter.setCompositionMode(QPainter::CompositionMode_SourceIn); From 8587c199d203a547c5a2aa1573c438f882773809 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 4 Jun 2025 16:34:21 +0200 Subject: [PATCH 59/62] removed white fill --- src/gui/nmcgui/nmcflow2authwidget.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index a7159795abb8f..a7134482ad2fd 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -144,7 +144,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(rect(), Qt::white); QWidget::paintEvent(event); } From 3a742d3768b32b7289a3f29ba69cc5b18e1e962d Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 4 Jun 2025 16:42:59 +0200 Subject: [PATCH 60/62] removed paint event --- src/gui/nmcgui/nmcflow2authwidget.cpp | 7 ------ src/gui/nmcgui/nmcflow2authwidget.h | 23 +++++++++++-------- .../nmcgui/nmcowncloudadvancedsetuppage.cpp | 9 -------- src/gui/nmcgui/nmcowncloudadvancedsetuppage.h | 7 ------ 4 files changed, 14 insertions(+), 32 deletions(-) diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp index a7134482ad2fd..b826e93e2b335 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.cpp +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -140,13 +140,6 @@ NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) setLayout(mainLayout); } -// Hintergrundfarbe -void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - QWidget::paintEvent(event); -} - // Styling bewusst ignorieren void NMCFlow2AuthWidget::customizeStyle() {} diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h index c2b041019ac08..93fb357d67679 100644 --- a/src/gui/nmcgui/nmcflow2authwidget.h +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -12,13 +12,25 @@ * for more details. */ +/* +* 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. +*/ + #ifndef NMCFLOW2AUTHWIDGET_H #define NMCFLOW2AUTHWIDGET_H #include "wizard/flow2authwidget.h" -class QPaintEvent; - namespace OCC { class NMCFlow2AuthWidget : public Flow2AuthWidget @@ -38,13 +50,6 @@ class NMCFlow2AuthWidget : public Flow2AuthWidget ~NMCFlow2AuthWidget() override = default; protected: - /** - * @brief Reimplemented from Flow2AuthWidget. - * Paints the widget during the paint event. - * @param event The paint event. - */ - void paintEvent(QPaintEvent *event) override; - /** * @brief Reimplemented from Flow2AuthWidget. * Customizes the style of the widget. diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 53f21454c559d..8f5026e0ad406 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -246,13 +246,4 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar this->setLayout(mainVerticalLayout); } -void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) -{ - QPainter painter; - painter.begin(this); - painter.fillRect(rect(), Qt::white); - painter.end(); - OwncloudAdvancedSetupPage::paintEvent(event); -} - } // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h index 2f296d9d945c7..f283f505a644c 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -43,13 +43,6 @@ class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage */ ~NMCOwncloudAdvancedSetupPage() override = default; -protected: - /** - * @brief Override of paintEvent to handle custom painting. - * @param event Pointer to the QPaintEvent object. - */ - void paintEvent(QPaintEvent *event) override; - private: /** * @brief Pointer to the QLabel for the custom logo. From 1c7df7b2905d090be7ca015a1fe1e5e3a4202cb6 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 5 Jun 2025 12:21:29 +0200 Subject: [PATCH 61/62] fixed color --- src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp index 8f5026e0ad406..ab117ef210ca1 100644 --- a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -175,13 +175,13 @@ NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizar getUi().locationsGridLayout->removeWidget(getFilePathLabel().data()); leftSideVerticalLayout->addWidget(getFilePathLabel().data()); getFilePathLabel().data()->setAlignment(Qt::AlignLeft); - getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); + getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); // Free space available getUi().locationsGridLayout->removeWidget(getUi().lFreeSpace); leftSideVerticalLayout->addWidget(getUi().lFreeSpace); getUi().lFreeSpace->setAlignment(Qt::AlignLeft); - getUi().lFreeSpace->setStyleSheet("QLabel{font-size: 15px; font-weight: normal; color: black}"); + getUi().lFreeSpace->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed)); From 5b0a20a618d8af851f4aa2bb8363458fc3647c95 Mon Sep 17 00:00:00 2001 From: memurats Date: Thu, 26 Jun 2025 14:09:03 +0200 Subject: [PATCH 62/62] added nmcicons to theme --- theme.qrc.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/theme.qrc.in b/theme.qrc.in index 5f0b5b417582d..9e773caea0b5f 100644 --- a/theme.qrc.in +++ b/theme.qrc.in @@ -9,6 +9,9 @@ theme/colored/256-@APPLICATION_ICON_NAME@-icon.png theme/colored/512-@APPLICATION_ICON_NAME@-icon.png theme/colored/1024-@APPLICATION_ICON_NAME@-icon.png + theme/NMCIcons/ApplicationLogo.svg + theme/NMCIcons/folderLogo.svg + theme/NMCIcons/tlogocarrier.svg theme/colored/state-error-32.png theme/colored/state-error-64.png theme/colored/state-error-128.png