This commit is contained in:
Martin Rotter 2015-12-17 10:03:15 +01:00
parent ec522efb6c
commit 2324544aaf
11 changed files with 137 additions and 12 deletions

View file

@ -65,8 +65,8 @@ project(rssguard)
set(APP_NAME "RSS Guard") set(APP_NAME "RSS Guard")
set(APP_LOW_NAME "rssguard") set(APP_LOW_NAME "rssguard")
set(APP_VERSION "3.0.0") set(APP_VERSION "3.0.1")
set(FILE_VERSION "3,0,0,0") set(FILE_VERSION "3,0,1,0")
set(APP_AUTHOR "Martin Rotter") set(APP_AUTHOR "Martin Rotter")
set(APP_URL "http://bitbucket.org/skunkos/rssguard") set(APP_URL "http://bitbucket.org/skunkos/rssguard")
set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues") set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues")
@ -381,6 +381,7 @@ set(APP_SOURCES
src/gui/edittableview.cpp src/gui/edittableview.cpp
src/gui/squeezelabel.cpp src/gui/squeezelabel.cpp
src/gui/discoverfeedsbutton.cpp src/gui/discoverfeedsbutton.cpp
src/gui/colorlabel.cpp
# DYNAMIC-SHORTCUTS sources. # DYNAMIC-SHORTCUTS sources.
src/dynamic-shortcuts/shortcutcatcher.cpp src/dynamic-shortcuts/shortcutcatcher.cpp
@ -516,6 +517,7 @@ set(APP_HEADERS
src/gui/edittableview.h src/gui/edittableview.h
src/gui/squeezelabel.h src/gui/squeezelabel.h
src/gui/discoverfeedsbutton.h src/gui/discoverfeedsbutton.h
src/gui/colorlabel.h
# DYNAMIC-SHORTCUTS headers. # DYNAMIC-SHORTCUTS headers.
src/dynamic-shortcuts/dynamicshortcutswidget.h src/dynamic-shortcuts/dynamicshortcutswidget.h

View file

@ -1,3 +1,10 @@
3.0.1
—————
Added:
▪ Background color of notifications is now changeable. (issue #134)
3.0.0 3.0.0
————— —————

27
src/gui/colorlabel.cpp Executable file
View file

@ -0,0 +1,27 @@
#include "gui/colorlabel.h"
#include <QPaintEvent>
#include <QPainter>
ColorLabel::ColorLabel(QWidget *parent) : QLabel(parent), m_color(QColor()) {
setFixedWidth(20);
}
ColorLabel::~ColorLabel() {
}
QColor ColorLabel::color() const {
return m_color;
}
void ColorLabel::setColor(const QColor &color) {
m_color = color;
repaint();
}
void ColorLabel::paintEvent(QPaintEvent *event) {
QPainter painter(this);
painter.fillRect(event->rect(), m_color);
}

24
src/gui/colorlabel.h Executable file
View file

@ -0,0 +1,24 @@
#ifndef COLORLABEL_H
#define COLORLABEL_H
#include <QLabel>
class ColorLabel : public QLabel {
Q_OBJECT
public:
explicit ColorLabel(QWidget *parent = 0);
virtual ~ColorLabel();
QColor color() const;
void setColor(const QColor &color);
protected:
void paintEvent(QPaintEvent *event);
private:
QColor m_color;
};
#endif // COLORLABEL_H

View file

@ -136,6 +136,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
connect(m_ui->m_cmbDatabaseDriver, SIGNAL(currentIndexChanged(int)), this, SLOT(selectSqlBackend(int))); connect(m_ui->m_cmbDatabaseDriver, SIGNAL(currentIndexChanged(int)), this, SLOT(selectSqlBackend(int)));
connect(m_ui->m_btnDownloadsTargetDirectory, SIGNAL(clicked()), this, SLOT(selectDownloadsDirectory())); connect(m_ui->m_btnDownloadsTargetDirectory, SIGNAL(clicked()), this, SLOT(selectDownloadsDirectory()));
connect(m_ui->m_checkMysqlShowPassword, SIGNAL(toggled(bool)), this, SLOT(switchMysqlPasswordVisiblity(bool))); connect(m_ui->m_checkMysqlShowPassword, SIGNAL(toggled(bool)), this, SLOT(switchMysqlPasswordVisiblity(bool)));
connect(m_ui->m_btnChangeNotificationColor, SIGNAL(clicked()), this, SLOT(selectNewNotificationColor()));
// Load all settings. // Load all settings.
loadGeneral(); loadGeneral();
@ -170,6 +171,14 @@ void FormSettings::onSkinSelected(QTreeWidgetItem *current,
} }
} }
void FormSettings::selectNewNotificationColor() {
QColorDialog dialog(m_ui->m_lblNotificationColor->color(), this);
if (dialog.exec() == QDialog::Accepted) {
m_ui->m_lblNotificationColor->setColor(dialog.selectedColor());
}
}
void FormSettings::loadDownloads() { void FormSettings::loadDownloads() {
m_ui->m_txtDownloadsTargetDirectory->setText(QDir::toNativeSeparators(qApp->settings()->value(GROUP(Downloads), m_ui->m_txtDownloadsTargetDirectory->setText(QDir::toNativeSeparators(qApp->settings()->value(GROUP(Downloads),
SETTING(Downloads::TargetDirectory)).toString())); SETTING(Downloads::TargetDirectory)).toString()));
@ -733,6 +742,7 @@ void FormSettings::loadInterface() {
m_ui->m_cmbNotificationPosition->addItem(tr("Top-right corner"), Qt::TopRightCorner); m_ui->m_cmbNotificationPosition->addItem(tr("Top-right corner"), Qt::TopRightCorner);
m_ui->m_cmbNotificationPosition->setCurrentIndex(m_ui->m_cmbNotificationPosition->findData(static_cast<Qt::Corner>(settings->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt()))); m_ui->m_cmbNotificationPosition->setCurrentIndex(m_ui->m_cmbNotificationPosition->findData(static_cast<Qt::Corner>(settings->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt())));
m_ui->m_grpBaseNotifications->setChecked(settings->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool()); m_ui->m_grpBaseNotifications->setChecked(settings->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool());
m_ui->m_lblNotificationColor->setColor(settings->value(GROUP(GUI), SETTING(GUI::NotificationBackgroundColor)).value<QColor>());
// Load settings of icon theme. // Load settings of icon theme.
QString current_theme = qApp->icons()->currentIconTheme(); QString current_theme = qApp->icons()->currentIconTheme();
@ -837,6 +847,7 @@ void FormSettings::saveInterface() {
settings->setValue(GROUP(GUI), GUI::UseFancyNotifications, m_ui->m_grpNotifications->isChecked()); settings->setValue(GROUP(GUI), GUI::UseFancyNotifications, m_ui->m_grpNotifications->isChecked());
settings->setValue(GROUP(GUI), GUI::EnableNotifications, m_ui->m_grpBaseNotifications->isChecked()); settings->setValue(GROUP(GUI), GUI::EnableNotifications, m_ui->m_grpBaseNotifications->isChecked());
settings->setValue(GROUP(GUI), GUI::FancyNotificationsPosition, static_cast<Qt::Corner>(m_ui->m_cmbNotificationPosition->itemData(m_ui->m_cmbNotificationPosition->currentIndex()).toInt())); settings->setValue(GROUP(GUI), GUI::FancyNotificationsPosition, static_cast<Qt::Corner>(m_ui->m_cmbNotificationPosition->itemData(m_ui->m_cmbNotificationPosition->currentIndex()).toInt()));
settings->setValue(GROUP(GUI), GUI::NotificationBackgroundColor, m_ui->m_lblNotificationColor->color());
// Save selected icon theme. // Save selected icon theme.
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString(); QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();

View file

@ -60,6 +60,7 @@ class FormSettings : public QDialog {
void loadInterface(); void loadInterface();
void saveInterface(); void saveInterface();
void onSkinSelected(QTreeWidgetItem *current, QTreeWidgetItem *previous); void onSkinSelected(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void selectNewNotificationColor();
void loadDownloads(); void loadDownloads();
void saveDownloads(); void saveDownloads();

View file

@ -88,7 +88,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings"> <widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="m_pageGeneral"> <widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5"> <layout class="QFormLayout" name="formLayout_5">
@ -463,7 +463,7 @@ Authors of this application are NOT responsible for lost data.</string>
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="m_tabIconSkin"> <widget class="QWidget" name="m_tabIconSkin">
<attribute name="title"> <attribute name="title">
@ -666,6 +666,44 @@ Authors of this application are NOT responsible for lost data.</string>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="m_cmbNotificationPosition"/> <widget class="QComboBox" name="m_cmbNotificationPosition"/>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Background color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="ColorLabel" name="m_lblNotificationColor">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_btnChangeNotificationColor">
<property name="text">
<string>Change</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1568,18 +1606,18 @@ Authors of this application are NOT responsible for lost data.</string>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>LabelWithStatus</class> <class>LabelWithStatus</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>labelwithstatus.h</header> <header>labelwithstatus.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>DynamicShortcutsWidget</class> <class>DynamicShortcutsWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -1592,6 +1630,11 @@ Authors of this application are NOT responsible for lost data.</string>
<header>toolbareditor.h</header> <header>toolbareditor.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ColorLabel</class>
<extends>QLabel</extends>
<header>colorlabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>m_cmbDatabaseDriver</tabstop> <tabstop>m_cmbDatabaseDriver</tabstop>

View file

@ -221,7 +221,7 @@ void Notification::paintEvent(QPaintEvent *event) {
#else #else
painter.setRenderHints(QPainter::HighQualityAntialiasing); painter.setRenderHints(QPainter::HighQualityAntialiasing);
#endif #endif
painter.setBrush(QColor(220, 220, 220)); painter.setBrush(m_backgroundColor);
painter.setPen(Qt::NoPen); painter.setPen(Qt::NoPen);
painter.drawRoundedRect(0, 0, width(), height(), 5.0, 5.0); painter.drawRoundedRect(0, 0, width(), height(), 5.0, 5.0);
@ -274,6 +274,7 @@ void Notification::timerEvent(QTimerEvent *event) {
void Notification::loadSettings() { void Notification::loadSettings() {
m_position = static_cast<Qt::Corner>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt()); m_position = static_cast<Qt::Corner>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt());
m_backgroundColor = qApp->settings()->value(GROUP(GUI), SETTING(GUI::NotificationBackgroundColor)).value<QColor>();
} }
void Notification::setupWidget() { void Notification::setupWidget() {

View file

@ -70,6 +70,7 @@ class Notification : public QWidget {
void setupWidget(); void setupWidget();
void updateGeometries(); void updateGeometries();
QColor m_backgroundColor;
QString m_title; QString m_title;
QString m_text; QString m_text;
QPixmap m_icon; QPixmap m_icon;

View file

@ -78,6 +78,9 @@ DVALUE(char*) GUI::SplitterFeedsDef = "";
DKEY GUI::SplitterMessages = "splitter_messages"; DKEY GUI::SplitterMessages = "splitter_messages";
DVALUE(char*) GUI::SplitterMessagesDef = ""; DVALUE(char*) GUI::SplitterMessagesDef = "";
DKEY GUI::NotificationBackgroundColor = "notification_background_color";
DVALUE(QColor) GUI::NotificationBackgroundColorDef = QColor(220, 220, 220);
DKEY GUI::ToolbarStyle = "toolbar_style"; DKEY GUI::ToolbarStyle = "toolbar_style";
DVALUE(Qt::ToolButtonStyle) GUI::ToolbarStyleDef = Qt::ToolButtonIconOnly; DVALUE(Qt::ToolButtonStyle) GUI::ToolbarStyleDef = Qt::ToolButtonIconOnly;

View file

@ -26,6 +26,7 @@
#include <QNetworkProxy> #include <QNetworkProxy>
#include <QStringList> #include <QStringList>
#include <QColor>
#define KEY extern const char* #define KEY extern const char*
#define DKEY const char* #define DKEY const char*
@ -37,6 +38,7 @@
#define DEFAULT_VALUE(x) x##Def #define DEFAULT_VALUE(x) x##Def
#define GROUP(x) x::ID #define GROUP(x) x::ID
// Feeds. // Feeds.
namespace Feeds { namespace Feeds {
KEY ID; KEY ID;
@ -93,6 +95,9 @@ namespace GUI {
KEY SplitterMessages; KEY SplitterMessages;
VALUE(char*) SplitterMessagesDef; VALUE(char*) SplitterMessagesDef;
KEY NotificationBackgroundColor;
VALUE(QColor) NotificationBackgroundColorDef;
KEY ToolbarStyle; KEY ToolbarStyle;
VALUE(Qt::ToolButtonStyle) ToolbarStyleDef; VALUE(Qt::ToolButtonStyle) ToolbarStyleDef;