Fix for CommandLineParser
This commit is contained in:
parent
fffa4fc031
commit
0ca4f3b104
3 changed files with 25 additions and 17 deletions
|
@ -56,14 +56,17 @@
|
|||
|
||||
AmneziaApplication::~AmneziaApplication()
|
||||
{
|
||||
QObject::disconnect(m_engine, 0,0,0);
|
||||
delete m_engine;
|
||||
if (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);
|
||||
delete m_uiLogic;
|
||||
|
||||
delete m_protocolProps;
|
||||
delete m_containerProps;
|
||||
if (m_protocolProps) delete m_protocolProps;
|
||||
if (m_containerProps) delete m_containerProps;
|
||||
}
|
||||
|
||||
void AmneziaApplication::init()
|
||||
|
@ -170,7 +173,7 @@ void AmneziaApplication::loadTranslator()
|
|||
}
|
||||
}
|
||||
|
||||
void AmneziaApplication::parseCommands()
|
||||
bool AmneziaApplication::parseCommands()
|
||||
{
|
||||
m_parser.setApplicationDescription(APPLICATION_NAME);
|
||||
m_parser.addHelpOption();
|
||||
|
@ -186,11 +189,13 @@ void AmneziaApplication::parseCommands()
|
|||
|
||||
if (m_parser.isSet(c_cleanup)) {
|
||||
Debug::cleanUp();
|
||||
QTimer::singleShot(100,[this]{
|
||||
QTimer::singleShot(100, this, [this]{
|
||||
quit();
|
||||
});
|
||||
exec();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
||||
|
|
|
@ -40,19 +40,19 @@ public:
|
|||
void registerTypes();
|
||||
void loadFonts();
|
||||
void loadTranslator();
|
||||
void parseCommands();
|
||||
bool parseCommands();
|
||||
|
||||
QQmlApplicationEngine *qmlEngine() const;
|
||||
|
||||
private:
|
||||
QQmlApplicationEngine *m_engine;
|
||||
UiLogic *m_uiLogic;
|
||||
QQmlApplicationEngine *m_engine {};
|
||||
UiLogic *m_uiLogic {};
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
std::shared_ptr<VpnConfigurator> m_configurator;
|
||||
std::shared_ptr<ServerController> m_serverController;
|
||||
|
||||
ContainerProps* m_containerProps;
|
||||
ProtocolProps* m_protocolProps;
|
||||
ContainerProps* m_containerProps {};
|
||||
ProtocolProps* m_protocolProps {};
|
||||
|
||||
QTranslator* m_translator;
|
||||
QCommandLineParser m_parser;
|
||||
|
|
|
@ -63,8 +63,11 @@ int main(int argc, char *argv[])
|
|||
app.loadTranslator();
|
||||
app.loadFonts();
|
||||
|
||||
app.parseCommands();
|
||||
app.init();
|
||||
bool doExec = app.parseCommands();
|
||||
|
||||
return app.exec();
|
||||
if (doExec) {
|
||||
app.init();
|
||||
return app.exec();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue