diff --git a/cmainwindow.cpp b/cmainwindow.cpp index e0b3d3f..3120f8e 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -40,9 +40,10 @@ #include -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() diff --git a/cmainwindow.h b/cmainwindow.h index b73f0f9..b080a68 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -18,6 +18,8 @@ #include "cdatetimeedit.h" #include "ccombobox.h" +#include "csplashscreen.h" + #include #include @@ -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 */ diff --git a/csplashscreen.cpp b/csplashscreen.cpp new file mode 100644 index 0000000..e3f1929 --- /dev/null +++ b/csplashscreen.cpp @@ -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; +} diff --git a/csplashscreen.h b/csplashscreen.h new file mode 100644 index 0000000..beeda01 --- /dev/null +++ b/csplashscreen.h @@ -0,0 +1,27 @@ +#ifndef CSPLASHSCREEN_H +#define CSPLASHSCREEN_H + + +#include +#include + + +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 diff --git a/fonts/BiggerLove.ttf b/fonts/BiggerLove.ttf new file mode 100644 index 0000000..8a900d7 Binary files /dev/null and b/fonts/BiggerLove.ttf differ diff --git a/fonts/Luna.ttf b/fonts/Luna.ttf new file mode 100644 index 0000000..327ce75 Binary files /dev/null and b/fonts/Luna.ttf differ diff --git a/fonts/Stingray.otf b/fonts/Stingray.otf new file mode 100644 index 0000000..0c7c577 Binary files /dev/null and b/fonts/Stingray.otf differ diff --git a/fonts/Tomatoes.ttf b/fonts/Tomatoes.ttf new file mode 100644 index 0000000..b82f99a Binary files /dev/null and b/fonts/Tomatoes.ttf differ diff --git a/images/splash.png b/images/splash.png new file mode 100644 index 0000000..25147d0 Binary files /dev/null and b/images/splash.png differ diff --git a/main.cpp b/main.cpp index 5b5c1b4..a7cbaea 100644 --- a/main.cpp +++ b/main.cpp @@ -7,10 +7,34 @@ #include #include +#include +#include + +#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(); } diff --git a/qtStoryWriter.pro b/qtStoryWriter.pro index fad823d..86ad1fb 100644 --- a/qtStoryWriter.pro +++ b/qtStoryWriter.pro @@ -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 \ diff --git a/qtstorywriter.qrc b/qtstorywriter.qrc index ea4bca1..a1c5632 100644 --- a/qtstorywriter.qrc +++ b/qtstorywriter.qrc @@ -38,5 +38,10 @@ images/win/textunder.png images/win/zoomin.png images/win/zoomout.png + images/splash.png + fonts/Stingray.otf + fonts/BiggerLove.ttf + fonts/Luna.ttf + fonts/Tomatoes.ttf