utility: headless parsing

* resolve merge conflict
   * rpath for dev
   * generate a coatidb with a coatiproject
   * build script change to cmake --build
This commit is contained in:
Andreas Stallinger
2016-02-23 18:59:17 +01:00
parent 5b7e958ea7
commit 76697d8b6e
9 changed files with 184 additions and 85 deletions
@@ -7,6 +7,8 @@
QtCommandLineParser::QtCommandLineParser()
: m_projectFileString("")
, m_noGUI(false)
{
}
@@ -25,45 +27,72 @@ void QtCommandLineParser::setup()
QCoreApplication::translate("main", "Load Coati with the a Coatiprojectfile <CoatiProject>."),
QCoreApplication::translate("main", "CoatiProject"));
addOption(projectOption);
QCommandLineOption parseProjectWithoutGUIOption(QStringList() << "d" << "database",
QCoreApplication::translate("main", "Start coati to parse the Coatiprojectfile <CoatiProject>. Result *.coatidb"),
QCoreApplication::translate("main", "CoatiProject"));
addOption(parseProjectWithoutGUIOption);
}
void QtCommandLineParser::parseCommandline()
void QtCommandLineParser::evaluateCommandline()
{
if (isSet("database"))
{
m_noGUI = true;
processProjectfile(value("database").toStdString());
}
if(isSet("project"))
{
QString projectfilename = value("project") ;
FilePath projectfile(projectfilename.toStdString());
bool isValidProjectfile = true;
std::stringstream errorstring("Provided Projectfile is not valid: ");
errorstring << "Provided Projectfile('" << projectfile.fileName() << ") ";
if(!projectfile.exists())
{
errorstring << "does not exist";
isValidProjectfile = false;
}
if(projectfile.extension() != ".coatiproject")
{
errorstring << "has a wrong fileending";
isValidProjectfile = false;
}
std::shared_ptr<ConfigManager> configManager = ConfigManager::createEmpty();
if(!configManager->load(TextAccess::createFromFile(projectfile.str())))
{
errorstring << "could not be loaded";
isValidProjectfile = false;
}
if(isValidProjectfile)
{
MessageLoadProject(projectfile.str(), false).dispatch();
}
else
{
MessageStatus(errorstring.str(), true).dispatch();
LOG_ERROR(errorstring.str());
}
processProjectfile(value("project").toStdString());
}
}
}
void QtCommandLineParser::projectLoad()
{
if (!m_projectFileString.empty())
{
MessageLoadProject(m_projectFileString, false).dispatch();
}
}
void QtCommandLineParser::processProjectfile(const std::string& file)
{
FilePath projectfile(file);
bool isValidProjectfile = true;
std::stringstream errorstring("Provided Projectfile is not valid: ");
errorstring << "Provided Projectfile('" << projectfile.fileName() << ") ";
if(!projectfile.exists())
{
errorstring << "does not exist";
isValidProjectfile = false;
}
if(projectfile.extension() != ".coatiproject")
{
errorstring << "has a wrong fileending";
isValidProjectfile = false;
}
std::shared_ptr<ConfigManager> configManager = ConfigManager::createEmpty();
if(!configManager->load(TextAccess::createFromFile(projectfile.str())))
{
errorstring << "could not be loaded";
isValidProjectfile = false;
}
if(isValidProjectfile)
{
m_projectFileString = projectfile.str();
}
else
{
MessageStatus(errorstring.str(), true).dispatch();
LOG_ERROR(errorstring.str());
}
}
bool QtCommandLineParser::noGUI()
{
return m_noGUI;
}
@@ -1,6 +1,7 @@
#ifndef QTCOMMANDLINEPARSER_H
#define QTCOMMANDLINEPARSER_H
#include <string>
#include <QCommandLineParser>
#include "Application.h"
@@ -10,10 +11,16 @@ public:
QtCommandLineParser();
~QtCommandLineParser();
void setup();
void parseCommandline();
void evaluateCommandline();
void projectLoad();
bool noGUI();
private:
std::string m_projectFileString;
bool m_noGUI;
void processProjectfile(const std::string& file);
};
#endif //QTCOMMANDLINEPARSER_H
+2 -2
View File
@@ -1,6 +1,6 @@
#include "qt/window/QtSplashScreen.h"
#include <QApplication>
#include <QCoreApplication>
#include <QThread>
#include <QTimer>
@@ -38,7 +38,7 @@ QtSplashScreen::~QtSplashScreen()
{
}
void QtSplashScreen::exec(QApplication& app)
void QtSplashScreen::exec(QCoreApplication& app)
{
m_state = 0;
QTimer* timer = new QTimer(this);
+2 -2
View File
@@ -5,7 +5,7 @@
#include <QPainter>
#include <QWidget>
class QApplication;
class QCoreApplication;
class QPixmap;
class QtSplashScreen
@@ -17,7 +17,7 @@ public:
QtSplashScreen(const QPixmap& pixmap, Qt::WindowFlags f = 0);
virtual ~QtSplashScreen();
void exec(QApplication& app);
void exec(QCoreApplication& app);
void setMessage(const QString& str);
void setVersion(const QString& str);