Commit 3af877ca authored by Martin Schultz's avatar Martin Schultz

Merge branch 'unstable' into featureCoreProfile

parents e8c566d7 86b40c7f
......@@ -434,22 +434,43 @@ int main(int argc, char **argv)
OpenFlipper::Options::argc(&argc);
OpenFlipper::Options::argv(&argv);
// Ugly command line parse to check if we run in batch mode or not.
// Qt parser needs either QApplication or QCoreApplication to work.
// But we need that option to decide which one to choose so ...
for (int i = 1; i < argc; i++) {
QString option = QString(argv[i]);
if (option.contains("batch") || option.contains("-b") ||
option.contains("--batch")) {
std::cerr << "Batch Mode started" << std::endl;
OpenFlipper::Options::nogui(true);
}
// Set organization and application names
QCoreApplication::setOrganizationName("rwth-aachen.de");
QCoreApplication::setApplicationName(TOSTRING(PRODUCT_STRING));
QCoreApplication::setApplicationVersion(OpenFlipper::Options::coreVersion());
}
// initialize a core application to check for commandline parameters
QCoreApplication* coreApp = new QCoreApplication(argc, argv);
OpenFlipper::Options::initializeSettings();
QCommandLineParser parser;
QString errorMessage;
// parse command line options
switch (parseCommandLine(parser, &errorMessage)) {
case CommandLineOk:
break;
case CommandLineError:
fputs(qPrintable(errorMessage), stderr);
fputs("\n\n", stderr);
fputs(qPrintable(parser.helpText()), stderr);
return 1;
case CommandLineVersionRequested:
printf("%s %s\n", qPrintable(QCoreApplication::applicationName()),
qPrintable(QCoreApplication::applicationVersion()));
return 0;
case CommandLineHelpRequested:
parser.showHelp();
Q_UNREACHABLE();
}
// only one application is allowed so delete the core application
// once cmdline parsing is done
delete coreApp;
#ifdef WIN32
//attach a console if necessary
attachConsole();
......@@ -469,7 +490,6 @@ int main(int argc, char **argv)
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#endif
QApplication::setColorSpec( QApplication::CustomColor );
QApplication app(argc,argv);
#if QT_VERSION >= 0x050500
......@@ -490,7 +510,7 @@ int main(int argc, char **argv)
Q_UNREACHABLE();
}
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
QSurfaceFormat format;
format.setVersion(4, 4);
if (OpenFlipper::Options::coreProfile())
......@@ -508,6 +528,7 @@ int main(int argc, char **argv)
QSurfaceFormat::setDefaultFormat(format);
QApplication app(argc, argv);
QScreen *screen = app.primaryScreen();
QOffscreenSurface *surface = new QOffscreenSurface();
......@@ -520,11 +541,6 @@ int main(int argc, char **argv)
#endif
// Set organization and application names
QCoreApplication::setOrganizationName("rwth-aachen.de");
QCoreApplication::setApplicationName(TOSTRING(PRODUCT_STRING));
QCoreApplication::setApplicationVersion(OpenFlipper::Options::coreVersion());
if ( !QGLFormat::hasOpenGL() ) {
std::cerr << "This system has no OpenGL support.\n";
return -1;
......@@ -544,20 +560,11 @@ int main(int argc, char **argv)
// Install translator for qt internals
QTranslator qtTranslator;
// std::cerr << "Loading qt translations from: " << QLibraryInfo::location(QLibraryInfo::TranslationsPath).toStdString() << std::endl;
// if ( qtTranslator.load("qt_" + tLang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) )
// std::cerr << "Loaded" << std::endl;
// std::cerr << "Loading qt translations from: " << QLibraryInfo::location(QLibraryInfo::TranslationsPath).toStdString() << std::endl;
qtTranslator.load("qt_" + tLang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
// std::cerr << "Loaded" << std::endl;
app.installTranslator(&qtTranslator);
// install translator for Core Application
QString translationDir = OpenFlipper::Options::translationsDirStr() + QDir::separator();
// std::cerr << "Loading own translations from: " << QString(translationDir + " (" + tLang + ")").toStdString() << std::endl;
QDir dir(translationDir);
dir.setFilter(QDir::Files);
......@@ -569,12 +576,12 @@ int main(int argc, char **argv)
if ( fileInfo.baseName().contains(tLang) ){
QTranslator* myAppTranslator = new QTranslator();
if ( myAppTranslator->load( fileInfo.filePath() ) ){
// std::cerr << "Loaded " << fileInfo.fileName().toStdString() << std::endl;
if ( myAppTranslator->load( fileInfo.filePath() ) )
{
app.installTranslator(myAppTranslator);
} else {
delete myAppTranslator;
} else
{
delete myAppTranslator;
}
}
}
......@@ -598,28 +605,6 @@ int main(int argc, char **argv)
QCoreApplication app(argc,argv);
// Set organization and application names
QCoreApplication::setOrganizationName("rwth-aachen.de");
QCoreApplication::setApplicationName(TOSTRING(PRODUCT_STRING));
QCoreApplication::setApplicationVersion(OpenFlipper::Options::coreVersion());
switch (parseCommandLine(parser, &errorMessage)) {
case CommandLineOk:
break;
case CommandLineError:
fputs(qPrintable(errorMessage), stderr);
fputs("\n\n", stderr);
fputs(qPrintable(parser.helpText()), stderr);
return 1;
case CommandLineVersionRequested:
printf("%s %s\n", qPrintable(QCoreApplication::applicationName()),
qPrintable(QCoreApplication::applicationVersion()));
return 0;
case CommandLineHelpRequested:
parser.showHelp();
Q_UNREACHABLE();
}
// create widget ( this also reads the ini files )
Core * w = new Core( );
......
......@@ -414,6 +414,7 @@ set (PREFOUND_PACKAGES "${LOADED_PACKAGES}" CACHE INTERNAL "List of packages tha
# ========================================================================
add_subdirectory (OpenFlipper/CoreApp)
GROUP_PROJECT(${OPENFLIPPER_PRODUCT_STRING} ${OPENFLIPPER_PRODUCT_STRING})
# ========================================================================
......
This diff is collapsed.
......@@ -223,7 +223,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
format.setStencil(true);
format.setSampleBuffers(true);
#endif
OFGLFormat::setDefaultFormat(format);
// Construct GL context & widget
baseLayout_ = new QtMultiViewLayout;
......@@ -244,7 +243,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
if ( ! test->format().stereo() ) {
// std::cerr << "No stereo ... disabling stereo for real context!" << std::endl;
format.setStereo(false);
OFGLFormat::setDefaultFormat(format);
}/* else {
std::cerr << "Stereo found ok" << std::endl;
}*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment