mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
Fix for CommandLineParser
This commit is contained in:
@@ -56,14 +56,17 @@
|
|||||||
|
|
||||||
AmneziaApplication::~AmneziaApplication()
|
AmneziaApplication::~AmneziaApplication()
|
||||||
{
|
{
|
||||||
QObject::disconnect(m_engine, 0,0,0);
|
if (m_engine) {
|
||||||
delete m_engine;
|
QObject::disconnect(m_engine, 0,0,0);
|
||||||
|
delete m_engine;
|
||||||
|
}
|
||||||
|
if (m_uiLogic) {
|
||||||
|
QObject::disconnect(m_uiLogic, 0,0,0);
|
||||||
|
delete m_uiLogic;
|
||||||
|
}
|
||||||
|
|
||||||
QObject::disconnect(m_uiLogic, 0,0,0);
|
if (m_protocolProps) delete m_protocolProps;
|
||||||
delete m_uiLogic;
|
if (m_containerProps) delete m_containerProps;
|
||||||
|
|
||||||
delete m_protocolProps;
|
|
||||||
delete m_containerProps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmneziaApplication::init()
|
void AmneziaApplication::init()
|
||||||
@@ -170,7 +173,7 @@ void AmneziaApplication::loadTranslator()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmneziaApplication::parseCommands()
|
bool AmneziaApplication::parseCommands()
|
||||||
{
|
{
|
||||||
m_parser.setApplicationDescription(APPLICATION_NAME);
|
m_parser.setApplicationDescription(APPLICATION_NAME);
|
||||||
m_parser.addHelpOption();
|
m_parser.addHelpOption();
|
||||||
@@ -186,11 +189,13 @@ void AmneziaApplication::parseCommands()
|
|||||||
|
|
||||||
if (m_parser.isSet(c_cleanup)) {
|
if (m_parser.isSet(c_cleanup)) {
|
||||||
Debug::cleanUp();
|
Debug::cleanUp();
|
||||||
QTimer::singleShot(100,[this]{
|
QTimer::singleShot(100, this, [this]{
|
||||||
quit();
|
quit();
|
||||||
});
|
});
|
||||||
exec();
|
exec();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
||||||
|
|||||||
@@ -40,19 +40,19 @@ public:
|
|||||||
void registerTypes();
|
void registerTypes();
|
||||||
void loadFonts();
|
void loadFonts();
|
||||||
void loadTranslator();
|
void loadTranslator();
|
||||||
void parseCommands();
|
bool parseCommands();
|
||||||
|
|
||||||
QQmlApplicationEngine *qmlEngine() const;
|
QQmlApplicationEngine *qmlEngine() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQmlApplicationEngine *m_engine;
|
QQmlApplicationEngine *m_engine {};
|
||||||
UiLogic *m_uiLogic;
|
UiLogic *m_uiLogic {};
|
||||||
std::shared_ptr<Settings> m_settings;
|
std::shared_ptr<Settings> m_settings;
|
||||||
std::shared_ptr<VpnConfigurator> m_configurator;
|
std::shared_ptr<VpnConfigurator> m_configurator;
|
||||||
std::shared_ptr<ServerController> m_serverController;
|
std::shared_ptr<ServerController> m_serverController;
|
||||||
|
|
||||||
ContainerProps* m_containerProps;
|
ContainerProps* m_containerProps {};
|
||||||
ProtocolProps* m_protocolProps;
|
ProtocolProps* m_protocolProps {};
|
||||||
|
|
||||||
QTranslator* m_translator;
|
QTranslator* m_translator;
|
||||||
QCommandLineParser m_parser;
|
QCommandLineParser m_parser;
|
||||||
|
|||||||
@@ -63,8 +63,11 @@ int main(int argc, char *argv[])
|
|||||||
app.loadTranslator();
|
app.loadTranslator();
|
||||||
app.loadFonts();
|
app.loadFonts();
|
||||||
|
|
||||||
app.parseCommands();
|
bool doExec = app.parseCommands();
|
||||||
app.init();
|
|
||||||
|
|
||||||
return app.exec();
|
if (doExec) {
|
||||||
|
app.init();
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user