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_LOW_NAME "rssguard")
set(APP_VERSION "3.0.0")
set(FILE_VERSION "3,0,0,0")
set(APP_VERSION "3.0.1")
set(FILE_VERSION "3,0,1,0")
set(APP_AUTHOR "Martin Rotter")
set(APP_URL "http://bitbucket.org/skunkos/rssguard")
set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues")
@ -381,6 +381,7 @@ set(APP_SOURCES
src/gui/edittableview.cpp
src/gui/squeezelabel.cpp
src/gui/discoverfeedsbutton.cpp
src/gui/colorlabel.cpp
# DYNAMIC-SHORTCUTS sources.
src/dynamic-shortcuts/shortcutcatcher.cpp
@ -516,6 +517,7 @@ set(APP_HEADERS
src/gui/edittableview.h
src/gui/squeezelabel.h
src/gui/discoverfeedsbutton.h
src/gui/colorlabel.h
# DYNAMIC-SHORTCUTS headers.
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
—————

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_btnDownloadsTargetDirectory, SIGNAL(clicked()), this, SLOT(selectDownloadsDirectory()));
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.
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() {
m_ui->m_txtDownloadsTargetDirectory->setText(QDir::toNativeSeparators(qApp->settings()->value(GROUP(Downloads),
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->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_lblNotificationColor->setColor(settings->value(GROUP(GUI), SETTING(GUI::NotificationBackgroundColor)).value<QColor>());
// Load settings of icon theme.
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::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::NotificationBackgroundColor, m_ui->m_lblNotificationColor->color());
// Save selected icon theme.
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();

View File

@ -39,7 +39,7 @@ struct TemporarySettings {
class FormSettings : public QDialog {
Q_OBJECT
public:
// Constructors and destructors.
explicit FormSettings(QWidget *parent = 0);
@ -60,6 +60,7 @@ class FormSettings : public QDialog {
void loadInterface();
void saveInterface();
void onSkinSelected(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void selectNewNotificationColor();
void loadDownloads();
void saveDownloads();

View File

@ -88,7 +88,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="m_pageGeneral">
<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>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="m_tabIconSkin">
<attribute name="title">
@ -666,6 +666,44 @@ Authors of this application are NOT responsible for lost data.</string>
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbNotificationPosition"/>
</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>
</widget>
</item>
@ -1568,18 +1606,18 @@ Authors of this application are NOT responsible for lost data.</string>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LabelWithStatus</class>
<extends>QWidget</extends>
<header>labelwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DynamicShortcutsWidget</class>
<extends>QWidget</extends>
@ -1592,6 +1630,11 @@ Authors of this application are NOT responsible for lost data.</string>
<header>toolbareditor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ColorLabel</class>
<extends>QLabel</extends>
<header>colorlabel.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_cmbDatabaseDriver</tabstop>

View File

@ -221,7 +221,7 @@ void Notification::paintEvent(QPaintEvent *event) {
#else
painter.setRenderHints(QPainter::HighQualityAntialiasing);
#endif
painter.setBrush(QColor(220, 220, 220));
painter.setBrush(m_backgroundColor);
painter.setPen(Qt::NoPen);
painter.drawRoundedRect(0, 0, width(), height(), 5.0, 5.0);
@ -274,6 +274,7 @@ void Notification::timerEvent(QTimerEvent *event) {
void Notification::loadSettings() {
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() {

View File

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

View File

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

View File

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