Revert "utility: headless parsing"

This reverts commit 76697d8b6e.
This commit is contained in:
Eberhard Graether
2016-02-24 11:17:25 +01:00
parent 4dabe31776
commit 39e7789acd
9 changed files with 82 additions and 181 deletions
+22 -53
View File
@@ -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();
}