mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Merge branch 'develop' into mike-style-integration
Conflicts: main.cpp
This commit is contained in:
@@ -3,27 +3,70 @@
|
||||
#include <iostream>
|
||||
#include <QTranslator>
|
||||
#include <QtGui>
|
||||
#include "Common.h"
|
||||
#include "MM.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MainApplication.h"
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
static void set_env_vars_if_needed()
|
||||
{
|
||||
#ifdef __MACOSX_CORE__
|
||||
std::cout << "OS X detected. Set environment for GStreamer-SDK support." << std::endl;
|
||||
if (0 == setenv("GST_PLUGIN_PATH", "/Library/Frameworks/GStreamer.framework/Libraries", 1))
|
||||
std::cout << " * GST_PLUGIN_PATH=Library/Frameworks/GStreamer.framework/Libraries" << std::endl;
|
||||
if (0 == setenv("GST_DEBUG", "2", 1))
|
||||
std::cout << " * GST_DEBUG=2" << std::endl;
|
||||
//setenv("LANG", "C", 1);
|
||||
#endif // __MACOSX_CORE__
|
||||
}
|
||||
|
||||
// This class is just used to provide sleep functionalities in the main() method.
|
||||
class I : public QThread
|
||||
{
|
||||
public:
|
||||
static void sleep(unsigned long secs) {
|
||||
QThread::sleep(secs);
|
||||
}
|
||||
static void msleep(unsigned long msecs) {
|
||||
QThread::msleep(msecs);
|
||||
}
|
||||
static void usleep(unsigned long usecs) {
|
||||
QThread::usleep(usecs);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// TODO: avoid segfaults when OSC port is busy
|
||||
set_env_vars_if_needed();
|
||||
|
||||
MainApplication app(argc, argv);
|
||||
|
||||
if (! QGLFormat::hasOpenGL())
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
qFatal("This system has no OpenGL support.");
|
||||
|
||||
// Create splash screen.
|
||||
QPixmap pixmap("splash.png");
|
||||
QSplashScreen splash(pixmap);
|
||||
|
||||
// Show splash.
|
||||
splash.show();
|
||||
|
||||
splash.showMessage(" " + QObject::tr("Initiating program..."),
|
||||
Qt::AlignLeft | Qt::AlignTop, MM::WHITE);
|
||||
|
||||
bool FORCE_FRENCH_LANG = false;
|
||||
// set_language_to_french(app);
|
||||
if (FORCE_FRENCH_LANG)
|
||||
{
|
||||
std::cerr << "This system has no OpenGL support" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Load translation.
|
||||
QTranslator translator;
|
||||
translator.load("mapmap_fr");
|
||||
app.installTranslator(&translator);
|
||||
// Let splash for at least one second.
|
||||
I::sleep(1);
|
||||
|
||||
// Create main window.
|
||||
// Create window.
|
||||
MainWindow win;
|
||||
|
||||
QFontDatabase db;
|
||||
@@ -37,9 +80,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
//win.setLocale(QLocale("fr"));
|
||||
|
||||
// Terminate splash.
|
||||
splash.showMessage(" " + QObject::tr("Done."),
|
||||
Qt::AlignLeft | Qt::AlignTop, MM::WHITE);
|
||||
I::msleep(500);
|
||||
splash.finish(&win);
|
||||
splash.raise();
|
||||
|
||||
// Launch program.
|
||||
win.show();
|
||||
|
||||
// Start app.
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user