2021-09-20 21:51:28 +03:00
|
|
|
#ifndef SERVER_CONFIGURING_PROGRESS_LOGIC_H
|
|
|
|
|
#define SERVER_CONFIGURING_PROGRESS_LOGIC_H
|
2021-09-07 11:48:25 +03:00
|
|
|
|
2021-09-21 01:49:28 +03:00
|
|
|
#include <functional>
|
2021-09-07 21:01:56 +03:00
|
|
|
#include "PageLogicBase.h"
|
2022-08-25 17:35:28 +03:00
|
|
|
#include "core/defs.h"
|
|
|
|
|
|
|
|
|
|
using namespace amnezia;
|
2021-09-07 11:48:25 +03:00
|
|
|
|
|
|
|
|
class UiLogic;
|
|
|
|
|
|
2021-09-20 21:51:28 +03:00
|
|
|
class ServerConfiguringProgressLogic : public PageLogicBase
|
2021-09-07 11:48:25 +03:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2021-09-07 22:11:43 +03:00
|
|
|
AUTO_PROPERTY(double, progressBarValue)
|
|
|
|
|
AUTO_PROPERTY(bool, labelWaitInfoVisible)
|
|
|
|
|
AUTO_PROPERTY(QString, labelWaitInfoText)
|
|
|
|
|
AUTO_PROPERTY(bool, progressBarVisible)
|
2023-04-11 09:50:44 -04:00
|
|
|
AUTO_PROPERTY(int, progressBarMaximum)
|
2021-09-07 22:11:43 +03:00
|
|
|
AUTO_PROPERTY(bool, progressBarTextVisible)
|
|
|
|
|
AUTO_PROPERTY(QString, progressBarText)
|
2023-01-01 21:48:20 +03:00
|
|
|
AUTO_PROPERTY(bool, labelServerBusyVisible)
|
|
|
|
|
AUTO_PROPERTY(QString, labelServerBusyText)
|
2023-01-02 17:32:27 +03:00
|
|
|
AUTO_PROPERTY(bool, pushButtonCancelVisible)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Q_INVOKABLE void onPushButtonCancelClicked();
|
2021-09-21 01:49:28 +03:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct ProgressFunc {
|
|
|
|
|
std::function<void(bool)> setVisibleFunc;
|
|
|
|
|
std::function<void(int)> setValueFunc;
|
|
|
|
|
std::function<int(void)> getValueFunc;
|
2023-04-11 09:50:44 -04:00
|
|
|
std::function<int(void)> getMaximumFunc;
|
2021-09-21 01:49:28 +03:00
|
|
|
std::function<void(bool)> setTextVisibleFunc;
|
|
|
|
|
std::function<void(const QString&)> setTextFunc;
|
|
|
|
|
};
|
|
|
|
|
struct PageFunc {
|
|
|
|
|
std::function<void(bool)> setEnabledFunc;
|
|
|
|
|
};
|
|
|
|
|
struct ButtonFunc {
|
|
|
|
|
std::function<void(bool)> setVisibleFunc;
|
|
|
|
|
};
|
|
|
|
|
struct LabelFunc {
|
|
|
|
|
std::function<void(bool)> setVisibleFunc;
|
|
|
|
|
std::function<void(const QString&)> setTextFunc;
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-01 21:48:20 +03:00
|
|
|
public:
|
|
|
|
|
explicit ServerConfiguringProgressLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
|
|
|
|
~ServerConfiguringProgressLogic() = default;
|
|
|
|
|
|
|
|
|
|
friend class OpenVpnLogic;
|
|
|
|
|
friend class ShadowSocksLogic;
|
|
|
|
|
friend class CloakLogic;
|
|
|
|
|
friend class UiLogic;
|
|
|
|
|
|
|
|
|
|
void onUpdatePage() override;
|
|
|
|
|
ErrorCode doInstallAction(const std::function<ErrorCode()> &action);
|
|
|
|
|
ErrorCode doInstallAction(const std::function<ErrorCode()> &action,
|
|
|
|
|
const PageFunc &page,
|
|
|
|
|
const ProgressFunc &progress,
|
2023-01-02 17:32:27 +03:00
|
|
|
const ButtonFunc &saveButton,
|
2023-01-01 21:48:20 +03:00
|
|
|
const LabelFunc &waitInfo,
|
2023-01-02 17:32:27 +03:00
|
|
|
const LabelFunc &serverBusyInfo,
|
|
|
|
|
const ButtonFunc &cancelButton);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void cancelDoInstallAction(const bool cancel);
|
2023-01-01 21:48:20 +03:00
|
|
|
|
2021-09-07 11:48:25 +03:00
|
|
|
};
|
2021-09-20 21:51:28 +03:00
|
|
|
#endif // SERVER_CONFIGURING_PROGRESS_LOGIC_H
|