Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+81
@@ -0,0 +1,81 @@
|
||||
#include "lts_splash.h"
|
||||
|
||||
#include <LtsWidgets/lts_global_wait_dialog.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QEvent>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
|
||||
Splash::Splash()
|
||||
: QSplashScreen()
|
||||
, m_done(false)
|
||||
{
|
||||
static const auto splashFiles =
|
||||
{
|
||||
QStringLiteral(":/project/splash.png"),
|
||||
QStringLiteral(":/project/splash.jpg"),
|
||||
};
|
||||
for (const QString &f : splashFiles)
|
||||
{
|
||||
if (!QFile::exists(f))
|
||||
continue;
|
||||
setPixmap(QPixmap(f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Splash::event(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::MouseButtonPress ||
|
||||
e->type() == QEvent::MouseButtonRelease ||
|
||||
e->type() == QEvent::MouseButtonDblClick)
|
||||
{
|
||||
e->ignore();
|
||||
return false;
|
||||
}
|
||||
|
||||
return QSplashScreen::event(e);
|
||||
}
|
||||
|
||||
|
||||
void Splash::setMessage(const QString &message)
|
||||
{
|
||||
showMessage(message, Qt::AlignRight | Qt::AlignBottom);
|
||||
}
|
||||
|
||||
|
||||
void Splash::done()
|
||||
{
|
||||
if (m_done)
|
||||
return;
|
||||
m_done = true;
|
||||
|
||||
hide();
|
||||
LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
static Splash *s_splashInstance = nullptr;
|
||||
void Splash::cleanupSplashInstance()
|
||||
{
|
||||
delete s_splashInstance;
|
||||
s_splashInstance = nullptr;
|
||||
}
|
||||
|
||||
|
||||
Splash *Splash::getInstance()
|
||||
{
|
||||
if (!s_splashInstance)
|
||||
{
|
||||
s_splashInstance = new Splash;
|
||||
qAddPostRoutine(&Splash::cleanupSplashInstance);
|
||||
}
|
||||
return s_splashInstance;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user