added PageLoader and pageController
This commit is contained in:
parent
116fa6777b
commit
03a0e2084a
27 changed files with 265 additions and 193 deletions
50
client/ui/controllers/pageController.h
Normal file
50
client/ui/controllers/pageController.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef PAGECONTROLLER_H
|
||||
#define PAGECONTROLLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include "ui/models/servers_model.h"
|
||||
|
||||
namespace PageLoader
|
||||
{
|
||||
Q_NAMESPACE
|
||||
enum class PageEnum { PageStart = 0, PageHome, PageSettings, PageShare,
|
||||
|
||||
PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy,
|
||||
PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource,
|
||||
PageSetupWizardTextKey
|
||||
};
|
||||
Q_ENUM_NS(PageEnum)
|
||||
|
||||
static void declareQmlPageEnum() {
|
||||
qmlRegisterUncreatableMetaObject(
|
||||
PageLoader::staticMetaObject,
|
||||
"PageEnum",
|
||||
1, 0,
|
||||
"PageEnum",
|
||||
"Error: only enums"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PageController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PageController(const QSharedPointer<ServersModel> &serversModel,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void setStartPage();
|
||||
QString getPagePath(PageLoader::PageEnum page);
|
||||
|
||||
signals:
|
||||
void goToPage(PageLoader::PageEnum page, bool slide = true);
|
||||
void closePage();
|
||||
|
||||
private:
|
||||
QSharedPointer<ServersModel> m_serversModel;
|
||||
};
|
||||
|
||||
#endif // PAGECONTROLLER_H
|
Loading…
Add table
Add a link
Reference in a new issue