@@ -7,8 +7,6 @@
|
||||
|
||||
|
||||
QtCommandLineParser::QtCommandLineParser()
|
||||
: m_projectFileString("")
|
||||
, m_noGUI(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,72 +25,45 @@ 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::evaluateCommandline()
|
||||
void QtCommandLineParser::parseCommandline()
|
||||
{
|
||||
if (isSet("database"))
|
||||
{
|
||||
m_noGUI = true;
|
||||
processProjectfile(value("database").toStdString());
|
||||
}
|
||||
|
||||
if(isSet("project"))
|
||||
{
|
||||
processProjectfile(value("project").toStdString());
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
void QtCommandLineParser::projectLoad()
|
||||
{
|
||||
if (!m_projectFileString.empty())
|
||||
{
|
||||
MessageLoadProject(m_projectFileString, false).dispatch();
|
||||
}
|
||||
}
|
||||
if(projectfile.extension() != ".coatiproject")
|
||||
{
|
||||
errorstring << "has a wrong fileending";
|
||||
isValidProjectfile = false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
std::shared_ptr<ConfigManager> configManager = ConfigManager::createEmpty();
|
||||
if(!configManager->load(TextAccess::createFromFile(projectfile.str())))
|
||||
{
|
||||
errorstring << "could not be loaded";
|
||||
isValidProjectfile = false;
|
||||
}
|
||||
|
||||
if(projectfile.extension() != ".coatiproject")
|
||||
{
|
||||
errorstring << "has a wrong fileending";
|
||||
isValidProjectfile = false;
|
||||
if(isValidProjectfile)
|
||||
{
|
||||
MessageLoadProject(projectfile.str(), false).dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageStatus(errorstring.str(), true).dispatch();
|
||||
LOG_ERROR(errorstring.str());
|
||||
}
|
||||
}
|
||||
|
||||
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,7 +1,6 @@
|
||||
#ifndef QTCOMMANDLINEPARSER_H
|
||||
#define QTCOMMANDLINEPARSER_H
|
||||
|
||||
#include <string>
|
||||
#include <QCommandLineParser>
|
||||
#include "Application.h"
|
||||
|
||||
@@ -11,16 +10,10 @@ public:
|
||||
QtCommandLineParser();
|
||||
~QtCommandLineParser();
|
||||
void setup();
|
||||
void evaluateCommandline();
|
||||
void projectLoad();
|
||||
bool noGUI();
|
||||
void parseCommandline();
|
||||
|
||||
private:
|
||||
std::string m_projectFileString;
|
||||
bool m_noGUI;
|
||||
|
||||
void processProjectfile(const std::string& file);
|
||||
};
|
||||
|
||||
#endif //QTCOMMANDLINEPARSER_H
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "qt/window/QtSplashScreen.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
@@ -38,7 +38,7 @@ QtSplashScreen::~QtSplashScreen()
|
||||
{
|
||||
}
|
||||
|
||||
void QtSplashScreen::exec(QCoreApplication& app)
|
||||
void QtSplashScreen::exec(QApplication& app)
|
||||
{
|
||||
m_state = 0;
|
||||
QTimer* timer = new QTimer(this);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QPainter>
|
||||
#include <QWidget>
|
||||
|
||||
class QCoreApplication;
|
||||
class QApplication;
|
||||
class QPixmap;
|
||||
|
||||
class QtSplashScreen
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
QtSplashScreen(const QPixmap& pixmap, Qt::WindowFlags f = 0);
|
||||
virtual ~QtSplashScreen();
|
||||
|
||||
void exec(QCoreApplication& app);
|
||||
void exec(QApplication& app);
|
||||
void setMessage(const QString& str);
|
||||
void setVersion(const QString& str);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user