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/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)

View File

@ -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 <QDesktopServices>
#include <QUrl>
#include <QDesktopWidget>
#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;
}

View File

@ -1,24 +1,25 @@
#ifndef FORMWELCOME_H
#define FORMWELCOME_H
#include <QDialog>
#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 <QDialog>
#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

View File

@ -1,42 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>FormWelcome</class>
<widget class="QDialog" name="FormWelcome">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>435</width>
<height>237</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Welcome</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<property name="modal">
<bool>true</bool>
</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">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<pixmapfunction/>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<sender>m_btnBox</sender>
<signal>accepted()</signal>
<receiver>FormWelcome</receiver>
<slot>accept()</slot>
@ -51,21 +120,5 @@
</hint>
</hints>
</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>
</ui>

View File

@ -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);