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/2278-welcome popup wizard #71

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
5 changes: 5 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ project(gui)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network)
find_package(KF5Archive REQUIRED)

#NMC change, its needed to find the ui file in different location as the header file
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")

if(QUICK_COMPILER)
find_package(Qt5QuickCompiler)
set_package_properties(Qt5QuickCompiler PROPERTIES
Expand Down Expand Up @@ -232,6 +235,8 @@ set(client_SRCS
creds/webflowcredentials.cpp
creds/webflowcredentialsdialog.h
creds/webflowcredentialsdialog.cpp
nmcgui/magentaWizardPage.h
nmcgui/magentaWizardPage.cpp
wizard/postfixlineedit.h
wizard/postfixlineedit.cpp
wizard/abstractcredswizardpage.h
Expand Down
69 changes: 69 additions & 0 deletions src/gui/nmcgui/magentaWizardPage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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 "nmcgui/magentaWizardPage.h"
#include "QtWidgets/qpushbutton.h"
#include "theme.h"
#include "wizard/ui_welcomepage.h"
#include "wizard/welcomepage.h"

namespace OCC {

MagentaWizardPage::MagentaWizardPage(OwncloudWizard *ocWizard)
: WelcomePage(ocWizard)
{
this->layout()->removeItem(_ui->horizontalLayout);
_ui->hostYourOwnServerLabel->setVisible(false);
_ui->loginButton->setVisible(false);
_ui->createAccountButton->setVisible(false);
_ui->slideShow->startShow(2500);

setFinalPage(true);
}

int MagentaWizardPage::nextId() const
{
return -1;
}

bool MagentaWizardPage::isComplete() const
{
return true;
}

void MagentaWizardPage::styleSlideShow()
{
const auto theme = Theme::instance();
const auto backgroundColor = palette().window().color();

const QString page1FileName = QString(":/client/theme/NMCIcons/page1.png");
const QString page2FileName = QString(":/client/theme/NMCIcons/page2.png");
const QString page3FileName = QString(":/client/theme/NMCIcons/page3.png");

_ui->slideShow->addSlide(page1FileName, tr("Page 1"));
_ui->slideShow->addSlide(page2FileName, tr("Page 2"));
_ui->slideShow->addSlide(page3FileName, tr("Page 3"));

const auto isDarkBackground = Theme::isDarkColor(backgroundColor);
_ui->slideShowNextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), isDarkBackground));
_ui->slideShowPreviousButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), isDarkBackground));
}

void MagentaWizardPage::setLoginButtonDefault()
{
//No login button available, keep empty
}


} // namespace OCC
35 changes: 35 additions & 0 deletions src/gui/nmcgui/magentaWizardPage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.
*/

#pragma once

#include "QtWidgets/qboxlayout.h"
#include "wizard/welcomepage.h"

namespace OCC {

class MagentaWizardPage : public WelcomePage
{
Q_OBJECT
public:
MagentaWizardPage(OwncloudWizard *ocWizard);
[[nodiscard]] int nextId() const override;
bool isComplete() const override;

protected:
void styleSlideShow() override final;
void setLoginButtonDefault() override final;
};

} // namespace OCC
8 changes: 4 additions & 4 deletions src/gui/wizard/owncloudadvancedsetuppage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage(OwncloudWizard *wizard)
setupCustomization();

connect(_ui.pbSelectLocalFolder, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectFolder);
setButtonText(QWizard::FinishButton, tr("Connect"));
setButtonText(QWizard::NextButton, tr("Connect"));

if (Theme::instance()->enforceVirtualFilesSyncFolder()) {
_ui.rSyncEverything->setDisabled(true);
Expand Down Expand Up @@ -135,7 +135,7 @@ void OwncloudAdvancedSetupPage::setupCustomization()

bool OwncloudAdvancedSetupPage::isComplete() const
{
return !_checking && _localFolderValid;
return true; //!_checking && _localFolderValid;
}

void OwncloudAdvancedSetupPage::initializePage()
Expand Down Expand Up @@ -169,7 +169,7 @@ void OwncloudAdvancedSetupPage::initializePage()
updateStatus();

// ensure "next" gets the focus, not obSelectLocalFolder
QTimer::singleShot(0, wizard()->button(QWizard::FinishButton), qOverload<>(&QWidget::setFocus));
QTimer::singleShot(0, wizard()->button(QWizard::NextButton), qOverload<>(&QWidget::setFocus));

auto acc = dynamic_cast<OwncloudWizard *>(wizard())->account();
auto quotaJob = new PropfindJob(acc, _remoteFolder, this);
Expand Down Expand Up @@ -366,7 +366,7 @@ QUrl OwncloudAdvancedSetupPage::serverUrl() const
int OwncloudAdvancedSetupPage::nextId() const
{
// tells the caller that this is the last dialog page
return -1;
return WizardCommon::Page_Magenta; //-1;
}

QString OwncloudAdvancedSetupPage::localFolder() const
Expand Down
7 changes: 6 additions & 1 deletion src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
#else // WITH_WEBENGINE
, _webViewPage(nullptr)
#endif // WITH_WEBENGINE
, _magentaPage(new MagentaWizardPage(this))
{
setObjectName("owncloudWizard");

Expand All @@ -64,6 +65,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
setPage(WizardCommon::Page_HttpCreds, _httpCredsPage);
setPage(WizardCommon::Page_Flow2AuthCreds, _flow2CredsPage);
setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage);
setPage(WizardCommon::Page_Magenta, _magentaPage);
#ifdef WITH_WEBENGINE
setPage(WizardCommon::Page_WebView, _webViewPage);
#endif // WITH_WEBENGINE
Expand Down Expand Up @@ -308,8 +310,11 @@ void OwncloudWizard::slotCurrentPageChanged(int id)
id == WizardCommon::Page_Flow2AuthCreds) {
setButtonLayout({ QWizard::BackButton, QWizard::Stretch });
} else if (id == WizardCommon::Page_AdvancedSetup) {
setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton });
setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::NextButton });
setNextButtonAsDefault();
} else if (id == WizardCommon::Page_Magenta) {
setButtonLayout({ QWizard::Stretch, QWizard::FinishButton });
//setNextButtonAsDefault();
} else {
setButtonLayout({ QWizard::BackButton, QWizard::Stretch, QWizard::NextButton });
setNextButtonAsDefault();
Expand Down
4 changes: 4 additions & 0 deletions src/gui/wizard/owncloudwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QSslCertificate>

#include "networkjobs.h"
#include "nmcgui/magentaWizardPage.h"
#include "wizard/owncloudwizardcommon.h"
#include "accountfwd.h"

Expand Down Expand Up @@ -127,6 +128,9 @@ public slots:
AbstractCredentialsWizardPage *_credentialsPage = nullptr;
WebViewPage *_webViewPage = nullptr;

//NMCCustomization
MagentaWizardPage *_magentaPage = nullptr;

QStringList _setupLog;

bool _registration = false;
Expand Down
1 change: 1 addition & 0 deletions src/gui/wizard/owncloudwizardcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace WizardCommon {
Page_WebView,
#endif // WITH_WEBENGINE
Page_AdvancedSetup,
Page_Magenta,
};

} // ns WizardCommon
Expand Down
11 changes: 6 additions & 5 deletions src/gui/wizard/welcomepage.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ class WelcomePage : public QWizardPage
~WelcomePage() override;
[[nodiscard]] int nextId() const override;
void initializePage() override;
void setLoginButtonDefault();
virtual void setLoginButtonDefault();

protected:
virtual void styleSlideShow();
QScopedPointer<Ui::WelcomePage> _ui;

private:
void setupUi();
void customizeStyle();
void styleSlideShow();
void setupSlideShow();
void setupUi();
void setupLoginButton();
void setupCreateAccountButton();
void setupHostYourOwnServerLabel();

QScopedPointer<Ui::WelcomePage> _ui;

OwncloudWizard *_ocWizard;
WizardCommon::Pages _nextPage = WizardCommon::Page_ServerSetup;
};
Expand Down
3 changes: 3 additions & 0 deletions theme.qrc.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,8 @@
<file>theme/delete.svg</file>
<file>theme/send.svg</file>
<file>theme/call-notification.wav</file>
<file>theme/NMCIcons/page1.png</file>
<file>theme/NMCIcons/page2.png</file>
<file>theme/NMCIcons/page3.png</file>
</qresource>
</RCC>
Binary file added theme/NMCIcons/page1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added theme/NMCIcons/page2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added theme/NMCIcons/page3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.