+22
-53
@@ -18,21 +18,7 @@
|
||||
#include "version.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
|
||||
|
||||
class Quitter : public MessageListener<MessageFinishedParsing>
|
||||
{
|
||||
public:
|
||||
Quitter(QCoreApplication* app){};
|
||||
virtual ~Quitter(){};
|
||||
private:
|
||||
virtual void handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
QCoreApplication::exit(0);
|
||||
}
|
||||
};
|
||||
#include "utility/solution/SolutionParserCompilationDatabase.h"
|
||||
|
||||
void init()
|
||||
{
|
||||
@@ -44,6 +30,8 @@ void init()
|
||||
fileLogger->setLogLevel(Logger::LOG_ALL);
|
||||
FileLogger::setFilePath(UserPaths::getLogPath());
|
||||
LogManager::getInstance()->addLogger(fileLogger);
|
||||
|
||||
utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".otf");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -52,52 +40,33 @@ int main(int argc, char *argv[])
|
||||
|
||||
Version version = Version::fromString(GIT_VERSION_NUMBER);
|
||||
QApplication::setApplicationVersion(version.toDisplayString().c_str());
|
||||
QCoreApplication* qtApp = new QCoreApplication(argc, argv);
|
||||
|
||||
setup(argc, argv);
|
||||
if(AppPath::getAppPath().empty())
|
||||
QtApplication qtApp(argc, argv);
|
||||
|
||||
qtApp.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
init();
|
||||
|
||||
QtCommandLineParser commandLineParser;
|
||||
commandLineParser.setup();
|
||||
commandLineParser.process(qtApp);
|
||||
|
||||
QtViewFactory viewFactory;
|
||||
QtNetworkFactory networkFactory;
|
||||
|
||||
if(AppPath::getAppPath().empty())
|
||||
{
|
||||
AppPath::setAppPath(QCoreApplication::applicationDirPath().toStdString());
|
||||
}
|
||||
|
||||
init();
|
||||
LicenseChecker checker;
|
||||
|
||||
QtCommandLineParser commandLineParser;
|
||||
commandLineParser.setup();
|
||||
commandLineParser.process(*qtApp);
|
||||
commandLineParser.evaluateCommandline();
|
||||
std::shared_ptr<Application> app;
|
||||
std::shared_ptr<Application> app = Application::create(version, &viewFactory, &networkFactory);
|
||||
|
||||
if(commandLineParser.noGUI())
|
||||
{
|
||||
app = Application::create( version );
|
||||
commandLineParser.projectLoad();
|
||||
checker.setApp(app.get());
|
||||
|
||||
Quitter quitter(qtApp);
|
||||
return qtApp->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace the qt app with a gui qt app
|
||||
// FIXME qtApp to shared_ptr
|
||||
qtApp->quit();
|
||||
delete qtApp;
|
||||
qtApp = new QtApplication(argc, argv);
|
||||
qtApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
commandLineParser.parseCommandline();
|
||||
|
||||
utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".otf");
|
||||
|
||||
QtViewFactory viewFactory;
|
||||
QtNetworkFactory networkFactory;
|
||||
|
||||
LicenseChecker checker;
|
||||
|
||||
app = Application::create(version, &viewFactory, &networkFactory);
|
||||
|
||||
checker.setApp(app.get());
|
||||
|
||||
commandLineParser.projectLoad();
|
||||
return qtApp->exec();
|
||||
}
|
||||
return qtApp.exec();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user