blob: 8aca7d6e2f7088153e157e3e8dc42ac6b833e8e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/*
* Copyright (C) Fabian Müller <fmueller@owncloud.com>
*
* 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 "3rdparty/QProgressIndicator/QProgressIndicator.h"
#include "pages/abstractsetupwizardpage.h"
#include "pagination.h"
#include "setupwizardaccountbuilder.h"
#include <QDialog>
#include <QEvent>
#include <QKeyEvent>
#include <QList>
#include <QPair>
#include <QStackedLayout>
#include <QStackedWidget>
namespace Ui {
class SetupWizardWindow;
}
namespace OCC::Wizard {
/**
* This class contains the UI-specific code. It hides the complexity from the controller, and provides a high-level API.
*/
class SetupWizardWindow : public QDialog
{
Q_OBJECT
public:
explicit SetupWizardWindow(QWidget *parent);
~SetupWizardWindow() noexcept override;
/**
* Set entries in the pagination at the bottom of the wizard UI.
* The entries are identified by their position in the list (read: index).
*/
void setPaginationEntries(const QStringList &paginationEntries);
/**
* Render this page within the wizard window.
* @param page page to render
* @param index index to highlight in pagination (also used to decide which buttons to enable)
*/
void displayPage(AbstractSetupWizardPage *page, PageIndex index);
void showErrorMessage(const QString &errorMessage);
void disableNextButton();
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
Q_SIGNALS:
void paginationEntryClicked(PageIndex currentPage, PageIndex clickedPageIndex);
void nextButtonClicked(PageIndex currentPage);
void backButtonClicked(PageIndex currentPage);
public Q_SLOTS:
/**
* Show "transition to next page" animation. Use displayPage(...) to end it.
*/
void slotStartTransition();
private Q_SLOTS:
void slotReplaceContent(QWidget *newWidget);
void slotHideErrorMessageWidget();
void slotMoveToNextPage();
void slotUpdateNextButton();
private:
void loadStylesheet();
::Ui::SetupWizardWindow *_ui;
// the wizard window keeps at most one widget inside the content widget's layout
// we keep a pointer in order to be able to delete it (and thus remove it from the window) when replacing the content
QPointer<QWidget> _currentContentWidget;
// need to keep track of the current page for event filtering
QPointer<AbstractSetupWizardPage> _currentPage;
// during a transition, the event filter must be disabled
bool _transitioning;
};
}
|