2022-08-06 21:08:55 +02:00
|
|
|
#ifndef SETTINGS_WIZARD_H
|
|
|
|
#define SETTINGS_WIZARD_H
|
|
|
|
|
|
|
|
#include "../global.h"
|
|
|
|
|
2022-08-22 23:48:18 +02:00
|
|
|
#include <syncthingconnector/syncthingconfig.h>
|
|
|
|
|
2022-08-06 21:08:55 +02:00
|
|
|
#include <QWizard>
|
|
|
|
#include <QWizardPage>
|
|
|
|
|
2022-08-22 23:48:18 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QProgressBar)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QLabel)
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
class SyncthingConnection;
|
|
|
|
class SyncthingService;
|
|
|
|
class SyncthingProcess;
|
|
|
|
class SyncthingLauncher;
|
|
|
|
} // namespace Data
|
|
|
|
|
2022-08-06 21:08:55 +02:00
|
|
|
namespace QtGui {
|
|
|
|
|
2022-08-22 23:48:18 +02:00
|
|
|
class DetectionWizardPage;
|
|
|
|
|
2022-08-06 21:08:55 +02:00
|
|
|
class SYNCTHINGWIDGETS_EXPORT Wizard : public QWizard {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Wizard(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
|
|
|
~Wizard() override;
|
|
|
|
|
|
|
|
static Wizard *instance();
|
2022-08-22 23:48:18 +02:00
|
|
|
DetectionWizardPage *detectionPage() const;
|
2022-08-06 21:08:55 +02:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void settingsRequested();
|
|
|
|
|
|
|
|
private:
|
|
|
|
static Wizard *s_instance;
|
2022-08-22 23:48:18 +02:00
|
|
|
DetectionWizardPage *m_detectionPage;
|
2022-08-06 21:08:55 +02:00
|
|
|
};
|
|
|
|
|
2022-08-22 23:48:18 +02:00
|
|
|
inline DetectionWizardPage *Wizard::detectionPage() const
|
|
|
|
{
|
|
|
|
return m_detectionPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SYNCTHINGWIDGETS_EXPORT WelcomeWizardPage final : public QWizardPage {
|
2022-08-06 21:08:55 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit WelcomeWizardPage(QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
bool isComplete() const override;
|
|
|
|
};
|
|
|
|
|
2022-08-22 23:48:18 +02:00
|
|
|
class SYNCTHINGWIDGETS_EXPORT DetectionWizardPage final : public QWizardPage {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DetectionWizardPage(QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
bool isComplete() const override;
|
|
|
|
void initializePage() override;
|
|
|
|
void cleanupPage() override;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void tryToConnect();
|
|
|
|
void handleConnectionStatusChanged();
|
|
|
|
void handleConnectionError(const QString &error);
|
|
|
|
void showSummary();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_configFilePath;
|
|
|
|
QString m_certPath;
|
|
|
|
QStringList m_connectionErrors;
|
|
|
|
Data::SyncthingConfig m_config;
|
|
|
|
Data::SyncthingConnection *m_connection;
|
|
|
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
|
|
|
Data::SyncthingService *m_service;
|
|
|
|
#endif
|
|
|
|
QProgressBar *m_progressBar;
|
|
|
|
QLabel *m_logLabel;
|
|
|
|
bool m_configOk;
|
|
|
|
};
|
|
|
|
|
2022-08-06 21:08:55 +02:00
|
|
|
} // namespace QtGui
|
|
|
|
|
|
|
|
#endif // SETTINGS_WIZARD_H
|