Work on ThemeFactory + added settings dialog.
This commit is contained in:
parent
fa2cebc811
commit
bb420269fe
@ -157,6 +157,7 @@ set(APP_SOURCES
|
||||
src/gui/formmain.cpp
|
||||
src/gui/systemtrayicon.cpp
|
||||
src/gui/themefactory.cpp
|
||||
src/gui/formsettings.cpp
|
||||
|
||||
# CORE sources.
|
||||
src/core/debugging.cpp
|
||||
@ -178,6 +179,7 @@ set(APP_HEADERS
|
||||
# GUI headers.
|
||||
src/gui/formmain.h
|
||||
src/gui/systemtrayicon.h
|
||||
src/gui/formsettings.h
|
||||
|
||||
# CORE headers.
|
||||
)
|
||||
@ -185,6 +187,7 @@ set(APP_HEADERS
|
||||
# Add form files.
|
||||
set(APP_FORMS
|
||||
src/gui/formmain.ui
|
||||
src/gui/formsettings.ui
|
||||
)
|
||||
|
||||
# Add resources.
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#define APP_IS_RUNNING "app_is_running"
|
||||
|
||||
// TODO: OS/2 support missing. No way to test this w/o OS/2 machine.
|
||||
#if defined(Q_OS_LINUX)
|
||||
#define APP_LANG_PATH APP_PREFIX + QString("/share/rssguard/l10n")
|
||||
#define APP_SKIN_PATH APP_PREFIX + QString("/share/rssguard/skins")
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/formsettings.h"
|
||||
#include "core/settings.h"
|
||||
#include "qtsingleapplication/qtsingleapplication.h"
|
||||
|
||||
@ -32,6 +33,14 @@ void FormMain::createConnections() {
|
||||
// Menu "File" connections.
|
||||
connect(m_ui->m_actionQuit, &QAction::triggered, this, &FormMain::quit);
|
||||
|
||||
// Menu "Tools" connections.
|
||||
connect(m_ui->m_actionSettings, &QAction::triggered, this, &FormMain::showSettings);
|
||||
|
||||
// General connections.
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, this, &FormMain::cleanupResources);
|
||||
}
|
||||
|
||||
void FormMain::showSettings() {
|
||||
FormSettings form_settings(this);
|
||||
form_settings.exec();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ class FormMain : public QMainWindow {
|
||||
|
||||
protected slots:
|
||||
void cleanupResources();
|
||||
void showSettings();
|
||||
|
||||
private:
|
||||
Ui::FormMain *m_ui;
|
||||
|
@ -27,7 +27,9 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="application-exit"/>
|
||||
<iconset theme="application-exit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@ -233,11 +235,18 @@
|
||||
<string>&View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="m_menuTools">
|
||||
<property name="title">
|
||||
<string>&Tools</string>
|
||||
</property>
|
||||
<addaction name="m_actionSettings"/>
|
||||
</widget>
|
||||
<addaction name="m_menuFile"/>
|
||||
<addaction name="menu_View"/>
|
||||
<addaction name="m_menuTools"/>
|
||||
<addaction name="m_menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QStatusBar" name="m_statusBar"/>
|
||||
<action name="m_actionImport">
|
||||
<property name="text">
|
||||
<string>&Import</string>
|
||||
@ -253,6 +262,11 @@
|
||||
<string>&Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionSettings">
|
||||
<property name="text">
|
||||
<string>&Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
10
src/gui/formsettings.cpp
Normal file
10
src/gui/formsettings.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "gui/formsettings.h"
|
||||
|
||||
|
||||
FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings) {
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
FormSettings::~FormSettings() {
|
||||
delete m_ui;
|
||||
}
|
24
src/gui/formsettings.h
Normal file
24
src/gui/formsettings.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef FORMSETTINGS_H
|
||||
#define FORMSETTINGS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_formsettings.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class FormSettings;
|
||||
}
|
||||
|
||||
class FormSettings : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormSettings(QWidget *parent = 0);
|
||||
~FormSettings();
|
||||
|
||||
private:
|
||||
Ui::FormSettings *m_ui;
|
||||
};
|
||||
|
||||
#endif // FORMSETTINGS_H
|
150
src/gui/formsettings.ui
Normal file
150
src/gui/formsettings.ui
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FormSettings</class>
|
||||
<widget class="QDialog" name="FormSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>586</width>
|
||||
<height>355</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QListWidget" name="m_listSettings">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentRow">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>General</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>User interface</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_pageGeneral"/>
|
||||
<widget class="QWidget" name="m_pageUi">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="m_scrollUi">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_scrollUiContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>394</width>
|
||||
<height>290</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblIconTheme">
|
||||
<property name="text">
|
||||
<string>Icon theme</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_cmbIconTheme</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_cmbIconTheme"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FormSettings</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FormSettings</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>
|
||||
<connection>
|
||||
<sender>m_listSettings</sender>
|
||||
<signal>currentRowChanged(int)</signal>
|
||||
<receiver>m_stackedSettings</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>83</x>
|
||||
<y>162</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>370</x>
|
||||
<y>162</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -19,13 +19,17 @@ void ThemeFactory::setupSearchPaths() {
|
||||
|
||||
// TODO: Load currently selected "real" icon theme name instead of
|
||||
// Qt default "", which stands for currently active system icon theme name on
|
||||
// linux. On Windows, tiny "oxygen" version will be added.
|
||||
// linux. On Windows, tiny "oxygen" version will be used as default icon theme.
|
||||
QString ThemeFactory::getSystemIconTheme() {
|
||||
#if defined(Q_OS_LINUX)
|
||||
// Empty string forces Qt to use icon theme from operating system.
|
||||
//
|
||||
// WARNING: We should realize that any visible list of available
|
||||
// icon themes should replace empty string with "system" keyword.
|
||||
// This needs to be done in FormSettings.
|
||||
return QString();
|
||||
#else
|
||||
// It is expected that mini-oxygen is provided as fall-back theme for
|
||||
// NOTE: It is expected that mini-oxygen is provided as fall-back theme for
|
||||
// windows edition of RSS Guard.
|
||||
return "mini-oxygen";
|
||||
#endif
|
||||
@ -91,7 +95,3 @@ QStringList ThemeFactory::getInstalledIconThemes() {
|
||||
icon_theme_names.removeDuplicates();
|
||||
return icon_theme_names;
|
||||
}
|
||||
|
||||
// zjištění názvů témat dle d:\Programovani\Materiály\Qt\qt5\qtbase\src\gui\image\qiconloader.cpp,
|
||||
// řádek 172, jak se prochází ty složky
|
||||
// http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/unix/uunixicontheme.pas
|
||||
|
Loading…
x
Reference in New Issue
Block a user