diff --git a/resources/skins/base/vergilius.xml b/resources/skins/base/vergilius.xml
index a8e59d906..3af5cb344 100644
--- a/resources/skins/base/vergilius.xml
+++ b/resources/skins/base/vergilius.xml
@@ -5,7 +5,7 @@
Martin Rotter
rotter.martinos@gmail.com
-
+
PGh0bWw+IDxoZWFkPiA8c3R5bGU+cHJle3doaXRlLXNwYWNlOnByZS13cmFwfS5oZWFkZXJ0ZXh0
e2ZvbnQtc2l6ZToxOXB4O21hcmdpbi1ib3R0b206MTBweH0uaGVhZGVye2ZvbnQtc2l6ZToxNXB4
Oy13ZWJraXQtdHJhbnNpdGlvbjpiYWNrZ3JvdW5kIDFzIGVhc2Utb3V0O2JhY2tncm91bmQ6LXdl
diff --git a/src/core/defs.h.in b/src/core/defs.h.in
index 8b3a1e3ad..7689dbd2b 100644
--- a/src/core/defs.h.in
+++ b/src/core/defs.h.in
@@ -50,6 +50,7 @@
#define APP_IS_RUNNING "app_is_running"
#define APP_THEME_PATH_QRC ":/themes"
+#define APP_SKIN_DEFAULT "base/vergilius.xml"
#if defined(Q_OS_LINUX)
#define APP_DESKTOP_ENTRY_PATH "@DESKTOP_ENTRY@"
diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp
index 60850775f..1b9ebc4ab 100644
--- a/src/core/messagesmodel.cpp
+++ b/src/core/messagesmodel.cpp
@@ -7,6 +7,7 @@ MessagesModel::MessagesModel(QObject *parent) : QSqlTableModel(parent) {
}
void MessagesModel::setupHeaderData() {
+ // TODO: Enhance this.
m_headerData << tr("aaa") <<
tr("bbb");
}
diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp
index b4009466d..9f5fc8c2c 100644
--- a/src/gui/formsettings.cpp
+++ b/src/gui/formsettings.cpp
@@ -417,7 +417,6 @@ void FormSettings::loadInterface() {
// Load skin.
QList installed_skins = SkinFactory::getInstance()->getInstalledSkins();
QString selected_skin = SkinFactory::getInstance()->getSelectedSkinName();
- QString active_skin = SkinFactory::getInstance()->getCurrentSkinName();
foreach (Skin skin, installed_skins) {
QTreeWidgetItem *new_item = new QTreeWidgetItem(QStringList() <<
@@ -432,16 +431,17 @@ void FormSettings::loadInterface() {
if (skin.m_baseName == selected_skin) {
m_ui->m_treeSkins->setCurrentItem(new_item);
+ m_ui->m_lblActiveContents->setText(skin.m_visibleName);
}
}
- if (m_ui->m_treeSkins->currentItem() == NULL) {
- // No skin is selected or currently selected skin is unavailable.
+ if (m_ui->m_treeSkins->currentItem() == NULL &&
+ m_ui->m_treeSkins->topLevelItemCount() > 0) {
+ // Currently active skin is NOT available, select another one as selected
+ // if possible.
m_ui->m_treeSkins->setCurrentItem(m_ui->m_treeSkins->topLevelItem(0));
}
- m_ui->m_lblActiveContents->setText(SkinFactory::getInstance()->getSkinInfo(active_skin).m_visibleName);
-
// Load tab settings.
m_ui->m_checkCloseTabsMiddleClick->setChecked(settings->value(APP_CFG_GUI,
"tab_close_mid_button",
diff --git a/src/gui/formsettings.ui b/src/gui/formsettings.ui
index 6625c587f..cbf46ec57 100644
--- a/src/gui/formsettings.ui
+++ b/src/gui/formsettings.ui
@@ -69,8 +69,8 @@
0
0
- 100
- 30
+ 666
+ 399
@@ -115,7 +115,7 @@
QTabWidget::North
- 2
+ 0
@@ -147,91 +147,101 @@
0
0
- 436
- 196
+ 662
+ 371
- -
-
-
- Icon theme
-
-
- m_cmbIconTheme
+
+ QFormLayout::AllNonFixedFieldsGrow
+
+
-
+
+
+ Icons
+
+
-
+
+
+ Icon theme
+
+
+ m_cmbIconTheme
+
+
+
+ -
+
+
+
- -
-
-
- -
-
-
- Skin
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 0
-
-
- false
-
-
- false
-
-
-
- 1
-
-
-
-
- -
-
-
- Active skin
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Selected skin
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Newly selected skin is activated after the applicaton gets restarted!!!
-
-
- Qt::AlignCenter
+
-
+
+
+ Skins
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ false
+
+
+ 0
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ 1
+
+
+
+
+ -
+
+
+ Active skin:
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Selected skin:
+
+
+
+ -
+
+
+
+
+
+
+
@@ -640,8 +650,20 @@
16777215
+
+ false
+
+
+ true
+
+
+ QListView::Static
+
+
+ false
+
- -1
+ 0
-
diff --git a/src/gui/skinfactory.cpp b/src/gui/skinfactory.cpp
index b698d65f3..6e00bb3f1 100644
--- a/src/gui/skinfactory.cpp
+++ b/src/gui/skinfactory.cpp
@@ -14,10 +14,6 @@ QPointer SkinFactory::s_instance;
SkinFactory::SkinFactory(QObject *parent) : QObject(parent) {
}
-// TODO: Skin "base/vergilius.xml" is now NEEDED for rssguard
-// to run. IT IS DEFAULT skin. It sets no styles and stylesheet.
-// It just contains markup for webbrowser.
-
SkinFactory::~SkinFactory() {
qDebug("Destroying SkinFactory instance.");
}
@@ -36,14 +32,7 @@ void SkinFactory::loadCurrentSkin() {
Skin skin_data = getSkinInfo(skin_name_from_settings, &skin_parsed);
if (skin_parsed) {
- loadSkinFromData(skin_data.m_rawData, skin_name_from_settings);
-
- foreach (QString style, skin_data.m_stylesNames) {
- if (qApp->setStyle(style) != 0) {
- qDebug("Style '%s' loaded.", qPrintable(style));
- break;
- }
- }
+ loadSkinFromData(skin_data);
// Set this 'Skin' object as active one.
m_currentSkin = skin_data;
@@ -51,23 +40,23 @@ void SkinFactory::loadCurrentSkin() {
qDebug("Skin '%s' loaded.", qPrintable(skin_name_from_settings));
}
else {
- qDebug("Skin '%s' not loaded because style name is not specified or skin raw data is missing. Default skin loaded.",
+ qDebug("Skin '%s' not loaded because its data are corrupted. No skin is loaded now!",
qPrintable(skin_name_from_settings));
}
}
-bool SkinFactory::loadSkinFromData(QString skin_data, const QString &skin_path) {
- QStringList skin_parts = skin_path.split('/', QString::SkipEmptyParts);
+bool SkinFactory::loadSkinFromData(const Skin &skin) {
+ QStringList skin_parts = skin.m_baseName.split('/', QString::SkipEmptyParts);
// Skin does not contain leading folder name or the actual skin file name.
if (skin_parts.size() != 2) {
- qDebug("Loading of sking %s failed because skin name does not contain "
+ qDebug("Loading of sking '%s' failed because skin name does not contain "
"base folder name or the actual skin name.",
- qPrintable(skin_path));
+ qPrintable(skin.m_baseName));
return false;
}
else {
- qDebug("Loading skin '%s'.", qPrintable(skin_path));
+ qDebug("Loading skin '%s'.", qPrintable(skin.m_baseName));
}
// Create needed variables and create QFile object representing skin contents.
@@ -78,9 +67,23 @@ bool SkinFactory::loadSkinFromData(QString skin_data, const QString &skin_path)
//
// "##" is placeholder for the actual path to skin file. This is needed for using
// images within the QSS file.
- QString parsed_data = skin_data.replace("##",
- APP_SKIN_PATH + "/" + skin_folder + "/images");
- qApp->setStyleSheet(parsed_data);
+ QString raw_data = skin.m_rawData;
+
+ if (!raw_data.isEmpty()) {
+ QString parsed_data = raw_data.replace("##",
+ APP_SKIN_PATH + "/" +
+ skin_folder + "/images");
+ qApp->setStyleSheet(parsed_data);
+ }
+
+ // Iterate supported styles and load one.
+ foreach (QString style, skin.m_stylesNames) {
+ if (qApp->setStyle(style) != 0) {
+ qDebug("Style '%s' loaded.", qPrintable(style));
+ break;
+ }
+ }
+
return true;
}
@@ -91,11 +94,7 @@ void SkinFactory::setCurrentSkinName(const QString &skin_name) {
QString SkinFactory::getSelectedSkinName() {
return Settings::getInstance()->value(APP_CFG_GUI,
"skin",
- "base/vergilius.xml").toString();
-}
-
-QString SkinFactory::getCurrentSkinName() {
- return m_currentSkin.m_baseName;
+ APP_SKIN_DEFAULT).toString();
}
QString SkinFactory::getCurrentMarkup() {
@@ -112,6 +111,7 @@ Skin SkinFactory::getSkinInfo(const QString &skin_name, bool *ok) {
if (ok) {
*ok = false;
}
+
return skin;
}
@@ -128,7 +128,7 @@ Skin SkinFactory::getSkinInfo(const QString &skin_name, bool *ok) {
// Obtain style name.
query.setQuery("string(/skin/style)");
query.evaluateTo(&styles);
- skin.m_stylesNames = styles.remove("\n").split(",");
+ skin.m_stylesNames = styles.remove("\n").split(",", QString::SkipEmptyParts);
// Obtain author.
query.setQuery("string(/skin/author/name)");
diff --git a/src/gui/skinfactory.h b/src/gui/skinfactory.h
index ee81ef758..77811d610 100644
--- a/src/gui/skinfactory.h
+++ b/src/gui/skinfactory.h
@@ -20,6 +20,13 @@ struct Skin {
Q_DECLARE_METATYPE(Skin)
+// TODO: Skin "base/vergilius.xml" is now NEEDED for rssguard
+// to run. IT IS DEFAULT skin. It sets no styles and stylesheet.
+// It just contains markup for webbrowser.
+// NOTE: Check skins "base/vergilius.xml" and "luxuous.xml"
+// for skin syntax reference. Note that and tags
+// have contents encoded in Base64.
+
class SkinFactory : public QObject {
Q_OBJECT
@@ -29,7 +36,7 @@ class SkinFactory : public QObject {
// Loads the skin from give skin_data.
// NOTE: Extra relative path escaping is done for loading of
// external resources.
- bool loadSkinFromData(QString skin_data, const QString &skin_path);
+ bool loadSkinFromData(const Skin &skin);
public:
// Singleton getter.
@@ -41,10 +48,6 @@ class SkinFactory : public QObject {
// Loads skin name from settings and sets it as active.
void loadCurrentSkin();
- // Returns the name of the currently activated skin.
- // NOTE: Skin name is formatted as "/.xml".
- QString getCurrentSkinName();
-
// Returns contents of current layout markup.
QString getCurrentMarkup();