add splash screen
This commit is contained in:
+4
-1
@@ -40,9 +40,10 @@
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
cMainWindow::cMainWindow(QWidget *parent) :
|
||||
cMainWindow::cMainWindow(cSplashScreen *lpSplashScreen, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen),
|
||||
m_lpOutlineModel(0),
|
||||
m_lpCharacterModel(0),
|
||||
m_lpPlaceModel(0),
|
||||
@@ -69,6 +70,8 @@ cMainWindow::cMainWindow(QWidget *parent) :
|
||||
QSettings settings;
|
||||
m_szOldPath = settings.value("file/lastPath", QDir::homePath()).toString();
|
||||
updateRecentFileActions();
|
||||
|
||||
QThread::msleep(2000);
|
||||
}
|
||||
|
||||
cMainWindow::~cMainWindow()
|
||||
|
||||
+7
-1
@@ -18,6 +18,8 @@
|
||||
#include "cdatetimeedit.h"
|
||||
#include "ccombobox.h"
|
||||
|
||||
#include "csplashscreen.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
@@ -51,9 +53,10 @@ public:
|
||||
\brief
|
||||
|
||||
\fn cMainWindow
|
||||
\param lpSplashScreen
|
||||
\param parent
|
||||
*/
|
||||
explicit cMainWindow(QWidget* parent = 0);
|
||||
explicit cMainWindow(cSplashScreen* lpSplashScreen, QWidget* parent = 0);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -609,6 +612,9 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::cMainWindow* ui; /*!< User Interface */
|
||||
|
||||
cSplashScreen* m_lpSplashScreen;
|
||||
|
||||
QStandardItemModel* m_lpOutlineModel; /*!< Item Model for Outline list */
|
||||
QStandardItemModel* m_lpCharacterModel; /*!< Item Model for Character list */
|
||||
QStandardItemModel* m_lpPlaceModel; /*!< Item Model for Place list */
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "csplashscreen.h"
|
||||
|
||||
|
||||
cSplashScreen::cSplashScreen(const QPixmap& pixmap) :
|
||||
QSplashScreen(pixmap)
|
||||
{
|
||||
}
|
||||
|
||||
void cSplashScreen::drawContents(QPainter *painter)
|
||||
{
|
||||
painter->setPen(m_color);
|
||||
painter->drawText(m_rect, m_iAlignement, m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::setStatusMessageColor(const QColor& color)
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
void cSplashScreen::showStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage = message;
|
||||
showMessage(m_szMessage, m_iAlignement, m_color);
|
||||
}
|
||||
|
||||
void cSplashScreen::addStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage.append(message);
|
||||
showMessage(m_szMessage, m_iAlignement, m_color);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMessageRect(QRect rect, int alignement)
|
||||
{
|
||||
m_rect = rect;
|
||||
m_iAlignement = alignement;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CSPLASHSCREEN_H
|
||||
#define CSPLASHSCREEN_H
|
||||
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
class cSplashScreen : public QSplashScreen
|
||||
{
|
||||
public:
|
||||
cSplashScreen(const QPixmap& pixmap);
|
||||
|
||||
virtual void drawContents(QPainter *painter);
|
||||
void setStatusMessageColor(const QColor& color);
|
||||
void showStatusMessage(const QString &message);
|
||||
void addStatusMessage(const QString &message);
|
||||
void setMessageRect(QRect rect, int alignment = Qt::AlignLeft);
|
||||
|
||||
private:
|
||||
QString m_szMessage;
|
||||
int m_iAlignement;
|
||||
QColor m_color;
|
||||
QRect m_rect;
|
||||
};
|
||||
|
||||
#endif // CSPLASHSCREEN_H
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
@@ -7,10 +7,34 @@
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QThread>
|
||||
|
||||
#include "csplashscreen.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QApplication a(argc, argv);
|
||||
QPixmap pixmap(":/images/splash.png");
|
||||
cSplashScreen* lpSplash = new cSplashScreen(pixmap.scaled(480, 289));
|
||||
// int id = QFontDatabase::addApplicationFont(":/fonts/Stingray.otf");
|
||||
int id = QFontDatabase::addApplicationFont(":/fonts/BiggerLove.ttf");
|
||||
// int id = QFontDatabase::addApplicationFont(":/fonts/Luna.ttf");
|
||||
// int id = QFontDatabase::addApplicationFont(":/fonts/Tomatoes.ttf");
|
||||
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
QFont splashFont(family);
|
||||
|
||||
lpSplash->setMessageRect(QRect(0, 50, 480, 189), Qt::AlignHCenter);
|
||||
|
||||
splashFont.setPixelSize(18);
|
||||
lpSplash->setFont(splashFont);
|
||||
lpSplash->setStatusMessageColor(Qt::white);
|
||||
|
||||
lpSplash->show();
|
||||
a.processEvents();
|
||||
|
||||
lpSplash->showStatusMessage(QObject::tr("initializing..."));
|
||||
|
||||
QCoreApplication::setOrganizationName("WIN-DESIGN");
|
||||
QCoreApplication::setOrganizationDomain("windesign.at");
|
||||
@@ -18,12 +42,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
QSettings settings;
|
||||
|
||||
cMainWindow w;
|
||||
cMainWindow w(lpSplash);
|
||||
|
||||
if(settings.value("main/maximized").toBool())
|
||||
w.showMaximized();
|
||||
else
|
||||
w.show();
|
||||
|
||||
lpSplash->finish(&w);
|
||||
delete lpSplash;
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
+4
-2
@@ -75,7 +75,8 @@ SOURCES += \
|
||||
ccombobox.cpp \
|
||||
cdatetimeedit.cpp \
|
||||
cpropertieswindow.cpp \
|
||||
ccharacterselectdialog.cpp
|
||||
ccharacterselectdialog.cpp \
|
||||
csplashscreen.cpp
|
||||
|
||||
HEADERS += \
|
||||
cmainwindow.h \
|
||||
@@ -112,7 +113,8 @@ HEADERS += \
|
||||
ccombobox.h \
|
||||
cdatetimeedit.h \
|
||||
cpropertieswindow.h \
|
||||
ccharacterselectdialog.h
|
||||
ccharacterselectdialog.h \
|
||||
csplashscreen.h
|
||||
|
||||
FORMS += \
|
||||
cmainwindow.ui \
|
||||
|
||||
@@ -38,5 +38,10 @@
|
||||
<file>images/win/textunder.png</file>
|
||||
<file>images/win/zoomin.png</file>
|
||||
<file>images/win/zoomout.png</file>
|
||||
<file>images/splash.png</file>
|
||||
<file>fonts/Stingray.otf</file>
|
||||
<file>fonts/BiggerLove.ttf</file>
|
||||
<file>fonts/Luna.ttf</file>
|
||||
<file>fonts/Tomatoes.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user