#ifndef AMNEZIA_APPLICATION_H #define AMNEZIA_APPLICATION_H #include #include #include #include #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) #include #else #include #endif #include "settings.h" #include "vpnconnection.h" #include "ui/controllers/connectionController.h" #include "ui/controllers/exportController.h" #include "ui/controllers/importController.h" #include "ui/controllers/installController.h" #include "ui/controllers/pageController.h" #include "ui/controllers/settingsController.h" #include "ui/controllers/sitesController.h" #include "ui/controllers/systemController.h" #include "ui/controllers/appSplitTunnelingController.h" #include "ui/models/containers_model.h" #include "ui/models/languageModel.h" #include "ui/models/protocols/cloakConfigModel.h" #include "ui/notificationhandler.h" #ifdef Q_OS_WINDOWS #include "ui/models/protocols/ikev2ConfigModel.h" #endif #include "ui/models/protocols/awgConfigModel.h" #include "ui/models/protocols/openvpnConfigModel.h" #include "ui/models/protocols/shadowsocksConfigModel.h" #include "ui/models/protocols/wireguardConfigModel.h" #include "ui/models/protocols/xrayConfigModel.h" #include "ui/models/protocols_model.h" #include "ui/models/servers_model.h" #include "ui/models/services/sftpConfigModel.h" #include "ui/models/sites_model.h" #include "ui/models/clientManagementModel.h" #include "ui/models/appSplitTunnelingModel.h" #define amnApp (static_cast(QCoreApplication::instance())) #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) #define AMNEZIA_BASE_CLASS QGuiApplication #else #define AMNEZIA_BASE_CLASS SingleApplication #define QAPPLICATION_CLASS QApplication #include "singleapplication.h" #endif class AmneziaApplication : public AMNEZIA_BASE_CLASS { Q_OBJECT public: #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) AmneziaApplication(int &argc, char *argv[]); #else AmneziaApplication(int &argc, char *argv[], bool allowSecondary = false, SingleApplication::Options options = SingleApplication::User, int timeout = 1000, const QString &userData = {}); #endif virtual ~AmneziaApplication(); void init(); void registerTypes(); void loadFonts(); void loadTranslator(); void updateTranslator(const QLocale &locale); bool parseCommands(); QQmlApplicationEngine *qmlEngine() const; signals: void translationsUpdated(); private: void initModels(); void initControllers(); QQmlApplicationEngine *m_engine {}; std::shared_ptr m_settings; QSharedPointer m_containerProps; QSharedPointer m_protocolProps; QSharedPointer m_translator; QCommandLineParser m_parser; QSharedPointer m_containersModel; QSharedPointer m_defaultServerContainersModel; QSharedPointer m_serversModel; QSharedPointer m_languageModel; QSharedPointer m_protocolsModel; QSharedPointer m_sitesModel; QSharedPointer m_appSplitTunnelingModel; QSharedPointer m_clientManagementModel; QScopedPointer m_openVpnConfigModel; QScopedPointer m_shadowSocksConfigModel; QScopedPointer m_cloakConfigModel; QScopedPointer m_xrayConfigModel; QScopedPointer m_wireGuardConfigModel; QScopedPointer m_awgConfigModel; #ifdef Q_OS_WINDOWS QScopedPointer m_ikev2ConfigModel; #endif QScopedPointer m_sftpConfigModel; QSharedPointer m_vpnConnection; QThread m_vpnConnectionThread; QScopedPointer m_notificationHandler; QScopedPointer m_connectionController; QScopedPointer m_pageController; QScopedPointer m_installController; QScopedPointer m_importController; QScopedPointer m_exportController; QScopedPointer m_settingsController; QScopedPointer m_sitesController; QScopedPointer m_systemController; QScopedPointer m_appSplitTunnelingController; }; #endif // AMNEZIA_APPLICATION_H