Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nmc/2380-Run_Wizard_Introduction_New #303

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)

set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

set(NMC_RCC_FILE "nmctheme_v1.rcc")
configure_file(${CMAKE_SOURCE_DIR}/${NMC_RCC_FILE} "${BIN_OUTPUT_DIRECTORY}/${NMC_RCC_FILE}" COPYONLY)

include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake)

set(QT_VERSION_MAJOR "6")
Expand Down Expand Up @@ -341,6 +344,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
install(FILES nmctheme_v1.rcc DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
elseif(BUILD_CLIENT)
install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
Expand Down
Binary file added nmctheme_v1.rcc
Binary file not shown.
8 changes: 8 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 change, its 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()
Expand Down Expand Up @@ -251,6 +254,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
Expand Down Expand Up @@ -618,6 +625,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements)
install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin)
install(FILES ${client_I18N} DESTINATION i18n)
install(FILES ${CMAKE_SOURCE_DIR}/nmctheme_v1.rcc DESTINATION bin)
endif()

# we may not add MACOSX_BUNDLE here, if not building one
Expand Down
8 changes: 8 additions & 0 deletions src/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ int main(int argc, char **argv)
qputenv("QML_IMPORT_PATH", (QDir::currentPath() + QStringLiteral("/qml")).toLatin1());
#endif

bool resourceLoaded = false;
const QString currentPath = QDir::currentPath();
if(Utility::isMac()) {
resourceLoaded = QResource::registerResource(QDir::toNativeSeparators("/Applications/MagentaCLOUD.app/Contents/Resources/nmctheme_v1.rcc"));
} else if(Utility::isWindows() || !resourceLoaded) {
resourceLoaded = QResource::registerResource(QDir::toNativeSeparators(currentPath + "/nmctheme_v1.rcc"));
}

Q_INIT_RESOURCE(resources);
Q_INIT_RESOURCE(theme);

Expand Down
175 changes: 175 additions & 0 deletions src/gui/nmcgui/nmcflow2authwidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*
* 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);

getUi().copyLinkLabel->setVisible(false);
getUi().openLinkLabel->setVisible(false);
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().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);

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;}");
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);

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);


getUi().verticalLayout_3->removeWidget(getUi().errorLabel);
mainVerticalLayout->addWidget(getUi().errorLabel);

getUi().verticalLayout_3->removeWidget(getUi().statusLabel);
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
55 changes: 55 additions & 0 deletions src/gui/nmcgui/nmcflow2authwidget.h
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading