FormWelcome tweaked and added to boot sequence

This commit is contained in:
Martin Rotter 2013-06-16 19:38:46 +02:00
parent 36edebf377
commit d5110d86ee
5 changed files with 163 additions and 79 deletions

View File

@ -161,6 +161,7 @@ set(APP_SOURCES
src/gui/systemtrayicon.cpp src/gui/systemtrayicon.cpp
src/gui/themefactory.cpp src/gui/themefactory.cpp
src/gui/formsettings.cpp src/gui/formsettings.cpp
src/gui/formwelcome.cpp
# CORE sources. # CORE sources.
src/core/debugging.cpp src/core/debugging.cpp
@ -183,6 +184,7 @@ set(APP_HEADERS
src/gui/formmain.h src/gui/formmain.h
src/gui/systemtrayicon.h src/gui/systemtrayicon.h
src/gui/formsettings.h src/gui/formsettings.h
src/gui/formwelcome.h
# CORE headers. # CORE headers.
) )
@ -191,6 +193,7 @@ set(APP_HEADERS
set(APP_FORMS set(APP_FORMS
src/gui/formmain.ui src/gui/formmain.ui
src/gui/formsettings.ui src/gui/formsettings.ui
src/gui/formwelcome.ui
) )
# Add resources. # Add resources.
@ -215,6 +218,10 @@ set(APP_SKIN_PLAIN
# resources/skins/base/plain.qss # resources/skins/base/plain.qss
) )
set(APP_MISC
# resources/text/changelog
)
# Wrap files, create moc files. # Wrap files, create moc files.
qt5_wrap_cpp(APP_MOC ${APP_HEADERS}) qt5_wrap_cpp(APP_MOC ${APP_HEADERS})
qt5_wrap_ui(APP_UI ${APP_FORMS}) qt5_wrap_ui(APP_UI ${APP_FORMS})
@ -273,7 +280,7 @@ if(WIN32)
DESTINATION ./) DESTINATION ./)
install(FILES ${APP_QM} install(FILES ${APP_QM}
DESTINATION ./l10n) DESTINATION ./l10n)
install(DIRECTORY resources/text install(FILES ${APP_MISC}
DESTINATION ./) DESTINATION ./)
elseif(UNIX) elseif(UNIX)
message(STATUS "[${APP_LOW_NAME}] You will probably install on Linux.") message(STATUS "[${APP_LOW_NAME}] You will probably install on Linux.")
@ -287,7 +294,7 @@ elseif(UNIX)
DESTINATION share/icons/hicolor/256x256/apps/) DESTINATION share/icons/hicolor/256x256/apps/)
install(FILES ${APP_QM} install(FILES ${APP_QM}
DESTINATION share/${APP_LOW_NAME}/l10n) DESTINATION share/${APP_LOW_NAME}/l10n)
install(DIRECTORY resources/text install(FILES ${APP_MISC}
DESTINATION share/${APP_LOW_NAME}/information) DESTINATION share/${APP_LOW_NAME}/information)
endif(WIN32) endif(WIN32)

View File

@ -1,8 +1,29 @@
#include "formwelcome.h" #include <QDesktopServices>
#include <QUrl>
#include <QDesktopWidget>
#include "gui/formwelcome.h"
#include "core/defs.h"
FormWelcome::FormWelcome(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormWelcome) { FormWelcome::FormWelcome(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormWelcome) {
m_ui->setupUi(this); 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() { FormWelcome::~FormWelcome() {

View File

@ -14,6 +14,7 @@ class FormWelcome : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
// Constructors and destructors.
explicit FormWelcome(QWidget *parent = 0); explicit FormWelcome(QWidget *parent = 0);
~FormWelcome(); ~FormWelcome();

View File

@ -1,42 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>FormWelcome</class> <class>FormWelcome</class>
<widget class="QDialog" name="FormWelcome"> <widget class="QDialog" name="FormWelcome">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>435</width>
<height>300</height> <height>237</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Welcome</string>
</property> </property>
<widget class="QDialogButtonBox" name="buttonBox"> <property name="modal">
<property name="geometry"> <bool>true</bool>
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="m_lblLogo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>110</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>110</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_lblCaption">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Welcome to RSS Guard</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_lblInfo">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;RSS Guard is a (very) easy feed reader. It supports all major feed formats, including RSS, ATOM and RDF.&lt;/p&gt;&lt;p&gt;Make sure you explore all available features. If you find a bug or if you want to propose new feature, then create new &lt;a href=&quot;https://sourceforge.net/p/rssguard/tickets&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;issue report&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;RSS Guard can be translated to any language. Contact its &lt;a href=&quot;mailto:rotter.martinos@gmail.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;author&lt;/span&gt;&lt;/a&gt; in case of your interest.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="m_btnBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item>
</layout>
</widget> </widget>
<pixmapfunction/>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>m_btnBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>FormWelcome</receiver> <receiver>FormWelcome</receiver>
<slot>accept()</slot> <slot>accept()</slot>
@ -51,21 +120,5 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>FormWelcome</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>

View File

@ -8,6 +8,7 @@
#include "core/settings.h" #include "core/settings.h"
#include "gui/themefactory.h" #include "gui/themefactory.h"
#include "gui/formmain.h" #include "gui/formmain.h"
#include "gui/formwelcome.h"
#include "qtsingleapplication/qtsingleapplication.h" #include "qtsingleapplication/qtsingleapplication.h"
@ -66,15 +67,16 @@ int main(int argc, char *argv[]) {
QtSingleApplication::setWindowIcon(QIcon(APP_INFO_PATH)); QtSingleApplication::setWindowIcon(QIcon(APP_INFO_PATH));
qDebug("%s", qPrintable(APP_ICON_PATH)); qDebug("%s", qPrintable(APP_ICON_PATH));
// Instantiate main application window and show it. // Instantiate main application window.
FormMain window; FormMain window;
window.show();
if (Settings::getInstance().value(APP_CFG_GEN, "first_start", true).toBool()) { 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); Settings::getInstance().setValue(APP_CFG_GEN, "first_start", false);
FormWelcome(&window).exec();
} }
// Display main window.
window.show();
// Setup single-instance behavior. // Setup single-instance behavior.
application.setActivationWindow(&window, true); application.setActivationWindow(&window, true);