From d5110d86ee9b1a63ee785ce93d2f111003556e51 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 16 Jun 2013 19:38:46 +0200 Subject: [PATCH] FormWelcome tweaked and added to boot sequence --- CMakeLists.txt | 11 +++- src/gui/formwelcome.cpp | 41 ++++++++++--- src/gui/formwelcome.h | 49 +++++++-------- src/gui/formwelcome.ui | 133 ++++++++++++++++++++++++++++------------ src/main.cpp | 8 ++- 5 files changed, 163 insertions(+), 79 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2acef709..bd3885956 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,7 @@ set(APP_SOURCES src/gui/systemtrayicon.cpp src/gui/themefactory.cpp src/gui/formsettings.cpp + src/gui/formwelcome.cpp # CORE sources. src/core/debugging.cpp @@ -183,6 +184,7 @@ set(APP_HEADERS src/gui/formmain.h src/gui/systemtrayicon.h src/gui/formsettings.h + src/gui/formwelcome.h # CORE headers. ) @@ -191,6 +193,7 @@ set(APP_HEADERS set(APP_FORMS src/gui/formmain.ui src/gui/formsettings.ui + src/gui/formwelcome.ui ) # Add resources. @@ -215,6 +218,10 @@ set(APP_SKIN_PLAIN # resources/skins/base/plain.qss ) +set(APP_MISC + # resources/text/changelog +) + # Wrap files, create moc files. qt5_wrap_cpp(APP_MOC ${APP_HEADERS}) qt5_wrap_ui(APP_UI ${APP_FORMS}) @@ -273,7 +280,7 @@ if(WIN32) DESTINATION ./) install(FILES ${APP_QM} DESTINATION ./l10n) - install(DIRECTORY resources/text + install(FILES ${APP_MISC} DESTINATION ./) elseif(UNIX) message(STATUS "[${APP_LOW_NAME}] You will probably install on Linux.") @@ -287,7 +294,7 @@ elseif(UNIX) DESTINATION share/icons/hicolor/256x256/apps/) install(FILES ${APP_QM} DESTINATION share/${APP_LOW_NAME}/l10n) - install(DIRECTORY resources/text + install(FILES ${APP_MISC} DESTINATION share/${APP_LOW_NAME}/information) endif(WIN32) diff --git a/src/gui/formwelcome.cpp b/src/gui/formwelcome.cpp index 51dd5d52c..c391ecbe4 100644 --- a/src/gui/formwelcome.cpp +++ b/src/gui/formwelcome.cpp @@ -1,10 +1,31 @@ -#include "formwelcome.h" - - -FormWelcome::FormWelcome(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormWelcome) { - m_ui->setupUi(this); -} - -FormWelcome::~FormWelcome() { - delete m_ui; -} +#include +#include +#include + +#include "gui/formwelcome.h" +#include "core/defs.h" + + +FormWelcome::FormWelcome(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormWelcome) { + m_ui->setupUi(this); + + // Set flags. + setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog); + + // Set icon. + setWindowIcon(QIcon(APP_ICON_PATH)); + m_ui->m_lblLogo->setPixmap(QPixmap(APP_ICON_PATH)); + + // Move the dialog into the middle of the screen. + QRect screen = qApp->desktop()->screenGeometry(); + move(screen.center() - rect().center()); + + // Make sure that clicked hyperlinks are opened in defult web browser. + connect(m_ui->m_lblInfo, &QLabel::linkActivated, [=] (const QString &link) { + QDesktopServices::openUrl(QUrl(link)); + }); +} + +FormWelcome::~FormWelcome() { + delete m_ui; +} diff --git a/src/gui/formwelcome.h b/src/gui/formwelcome.h index 6172f51db..001f88f44 100644 --- a/src/gui/formwelcome.h +++ b/src/gui/formwelcome.h @@ -1,24 +1,25 @@ -#ifndef FORMWELCOME_H -#define FORMWELCOME_H - -#include - -#include "ui_formwelcome.h" - - -namespace Ui { - class FormWelcome; -} - -class FormWelcome : public QDialog { - Q_OBJECT - - public: - explicit FormWelcome(QWidget *parent = 0); - ~FormWelcome(); - - private: - Ui::FormWelcome *m_ui; -}; - -#endif // FORMWELCOME_H +#ifndef FORMWELCOME_H +#define FORMWELCOME_H + +#include + +#include "ui_formwelcome.h" + + +namespace Ui { + class FormWelcome; +} + +class FormWelcome : public QDialog { + Q_OBJECT + + public: + // Constructors and destructors. + explicit FormWelcome(QWidget *parent = 0); + ~FormWelcome(); + + private: + Ui::FormWelcome *m_ui; +}; + +#endif // FORMWELCOME_H diff --git a/src/gui/formwelcome.ui b/src/gui/formwelcome.ui index 9ce80ab5c..5a81a84e6 100644 --- a/src/gui/formwelcome.ui +++ b/src/gui/formwelcome.ui @@ -1,42 +1,111 @@ + - - - FormWelcome + + Qt::ApplicationModal + 0 0 - 400 - 300 + 435 + 237 - Dialog + Welcome - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + true + + + + + + + 0 + 0 + + + + + 110 + 110 + + + + + 110 + 110 + + + + + + + true + + + false + + + Qt::NoTextInteraction + + + + + + + + 16777215 + 20 + + + + + 11 + 50 + false + + + + Welcome to RSS Guard + + + Qt::AlignCenter + + + + + + + <html><head/><body><p>RSS Guard is a (very) easy feed reader. It supports all major feed formats, including RSS, ATOM and RDF.</p><p>Make sure you explore all available features. If you find a bug or if you want to propose new feature, then create new <a href="https://sourceforge.net/p/rssguard/tickets"><span style=" text-decoration: underline; color:#0000ff;">issue report</span></a>.</p><p>RSS Guard can be translated to any language. Contact its <a href="mailto:rotter.martinos@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">author</span></a> in case of your interest.</p><p><br/></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + - - buttonBox + m_btnBox accepted() FormWelcome accept() @@ -51,21 +120,5 @@ - - buttonBox - rejected() - FormWelcome - reject() - - - 316 - 260 - - - 286 - 274 - - - diff --git a/src/main.cpp b/src/main.cpp index 4c48f87f1..847e12e0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include "core/settings.h" #include "gui/themefactory.h" #include "gui/formmain.h" +#include "gui/formwelcome.h" #include "qtsingleapplication/qtsingleapplication.h" @@ -66,15 +67,16 @@ int main(int argc, char *argv[]) { QtSingleApplication::setWindowIcon(QIcon(APP_INFO_PATH)); qDebug("%s", qPrintable(APP_ICON_PATH)); - // Instantiate main application window and show it. + // Instantiate main application window. FormMain window; - window.show(); if (Settings::getInstance().value(APP_CFG_GEN, "first_start", true).toBool()) { - // TODO: Open initial "Welcome" dialog here. Settings::getInstance().setValue(APP_CFG_GEN, "first_start", false); + FormWelcome(&window).exec(); } + // Display main window. + window.show(); // Setup single-instance behavior. application.setActivationWindow(&window, true);