mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Added splash screen to the app
This commit is contained in:
@@ -170,6 +170,8 @@ private:
|
||||
|
||||
// Actions-related.
|
||||
bool okToContinue();
|
||||
|
||||
public:
|
||||
bool loadFile(const QString &fileName);
|
||||
bool saveFile(const QString &fileName);
|
||||
void setCurrentFile(const QString &fileName);
|
||||
@@ -184,6 +186,7 @@ private:
|
||||
// Returns a short version of filename.
|
||||
static QString strippedName(const QString &fullFileName);
|
||||
|
||||
private:
|
||||
// Connects/disconnects project-specific widgets (paints and mappings).
|
||||
void connectProjectWidgets();
|
||||
void disconnectProjectWidgets();
|
||||
|
||||
@@ -7,27 +7,63 @@
|
||||
#include "MainWindow.h"
|
||||
#include "MainApplication.h"
|
||||
|
||||
// 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
|
||||
MainApplication app(argc, argv);
|
||||
|
||||
if (! QGLFormat::hasOpenGL())
|
||||
{
|
||||
std::cerr << "This system has no OpenGL support" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
qFatal(QObject::tr("This system has no OpenGL support.").toUtf8().constData());
|
||||
|
||||
// Create splash screen.
|
||||
QPixmap pixmap("splash.png");
|
||||
QSplashScreen splash(pixmap);
|
||||
|
||||
// Show splash.
|
||||
splash.show();
|
||||
|
||||
splash.showMessage(" " + QObject::tr("Initiating your program now..."),
|
||||
Qt::AlignLeft | Qt::AlignTop, QColor("#f6f5f5"));
|
||||
|
||||
// Set translator.
|
||||
QTranslator translator;
|
||||
translator.load("mapmap_fr");
|
||||
app.installTranslator(&translator);
|
||||
|
||||
MainWindow win;
|
||||
// Let splash for at least one second.
|
||||
I::sleep(1);
|
||||
|
||||
// Create window.
|
||||
MainWindow win;
|
||||
//win.setLocale(QLocale("fr"));
|
||||
|
||||
// Load file from commandline (optional).
|
||||
if (QCoreApplication::arguments().size() > 1)
|
||||
win.loadFile(QCoreApplication::arguments().at(1));
|
||||
|
||||
// Show window.
|
||||
win.show();
|
||||
|
||||
// Terminate splash.
|
||||
splash.finish(&win);
|
||||
splash.raise();
|
||||
|
||||
// Start app.
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user