amnezia-client/client/ui/controllers/installController.h
vladimir.kuznetsov e00656d757 added PageSettings and PageSettingsServersList.
- replaced PageLoader with PageType with stackView property.
- added error handling when installing a server/container
2023-05-25 15:40:17 +08:00

43 lines
1.4 KiB
C++

#ifndef INSTALLCONTROLLER_H
#define INSTALLCONTROLLER_H
#include <QObject>
#include "core/defs.h"
#include "containers/containers_defs.h"
#include "ui/models/servers_model.h"
#include "ui/models/containers_model.h"
class InstallController : public QObject
{
Q_OBJECT
public:
explicit InstallController(const QSharedPointer<ServersModel> &serversModel,
const QSharedPointer<ContainersModel> &containersModel,
const std::shared_ptr<Settings> &settings,
QObject *parent = nullptr);
public slots:
void install(DockerContainer container, int port, TransportProto transportProto);
void setCurrentlyInstalledServerCredentials(const QString &hostName, const QString &userName, const QString &secretData);
void setShouldCreateServer(bool shouldCreateServer);
signals:
void installContainerFinished();
void installServerFinished();
void installationErrorOccurred(QString errorMessage);
private:
void installServer(DockerContainer container, QJsonObject& config);
void installContainer(DockerContainer container, QJsonObject& config);
QSharedPointer<ServersModel> m_serversModel;
QSharedPointer<ContainersModel> m_containersModel;
std::shared_ptr<Settings> m_settings;
ServerCredentials m_currentlyInstalledServerCredentials;
bool m_shouldCreateServer;
};
#endif // INSTALLCONTROLLER_H