Some changes...

This commit is contained in:
Martin Rotter 2014-03-22 18:29:01 +01:00
parent 4139243b0c
commit 17b9e67200
9 changed files with 34 additions and 17 deletions

View File

@ -4,10 +4,12 @@
Fixed: Fixed:
<ul> <ul>
<li>Informative buttons now do not accept focus.</li> <li>Informative buttons now do not accept focus.</li>
<li>Button for resetting keyboard shortcut now works.</li>
</ul> </ul>
Added: Added:
<ul> <ul>
<li>"Defragment database" button shortcut is now changeable.</li>
<li>Added option to clear keyboard shortcuts.</li> <li>Added option to clear keyboard shortcuts.</li>
<li>Added "progress bar" to web browser.</li> <li>Added "progress bar" to web browser.</li>
<li>Added blue color to feeds/categories which contain unread msgs.</li> <li>Added blue color to feeds/categories which contain unread msgs.</li>

View File

@ -25,6 +25,7 @@
FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item) FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item)
: m_kind(FeedsModelRootItem::RootItem), : m_kind(FeedsModelRootItem::RootItem),
m_parentItem(parent_item) { m_parentItem(parent_item) {
setupFonts();
} }
FeedsModelRootItem::~FeedsModelRootItem() { FeedsModelRootItem::~FeedsModelRootItem() {
@ -33,7 +34,11 @@ FeedsModelRootItem::~FeedsModelRootItem() {
qDeleteAll(m_childItems); qDeleteAll(m_childItems);
} }
void FeedsModelRootItem::setupFonts() {
m_normalFont = QtSingleApplication::font("FeedsView");
m_boldFont = m_normalFont;
m_boldFont.setBold(true);
}
int FeedsModelRootItem::row() const { int FeedsModelRootItem::row() const {
if (m_parentItem) { if (m_parentItem) {

View File

@ -21,6 +21,7 @@
#include <QIcon> #include <QIcon>
#include <QDateTime> #include <QDateTime>
#include <QFont>
// Represents ROOT item of FeedsModel. // Represents ROOT item of FeedsModel.
@ -169,6 +170,8 @@ class FeedsModelRootItem {
static bool lessThan(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs); static bool lessThan(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs);
protected: protected:
void setupFonts();
Kind m_kind; Kind m_kind;
int m_id; int m_id;
QString m_title; QString m_title;
@ -176,6 +179,9 @@ class FeedsModelRootItem {
QIcon m_icon; QIcon m_icon;
QDateTime m_creationDate; QDateTime m_creationDate;
QFont m_normalFont;
QFont m_boldFont;
QList<FeedsModelRootItem*> m_childItems; QList<FeedsModelRootItem*> m_childItems;
FeedsModelRootItem *m_parentItem; FeedsModelRootItem *m_parentItem;
}; };

View File

@ -68,8 +68,8 @@ QVariant FeedsModelStandardCategory::data(int column, int role) const {
return QVariant(); return QVariant();
} }
case Qt::ForegroundRole: case Qt::FontRole:
return countOfUnreadMessages() > 0 ? QColor(0, 64, 255) : QVariant(); return countOfUnreadMessages() > 0 ? m_boldFont : m_normalFont;
case Qt::DisplayRole: case Qt::DisplayRole:
if (column == FDS_MODEL_TITLE_INDEX) { if (column == FDS_MODEL_TITLE_INDEX) {

View File

@ -274,8 +274,8 @@ QVariant FeedsModelStandardFeed::data(int column, int role) const {
return QVariant(); return QVariant();
} }
case Qt::ForegroundRole: case Qt::FontRole:
return countOfUnreadMessages() > 0 ? QColor(0, 64, 255) : QVariant(); return countOfUnreadMessages() > 0 ? m_boldFont : m_normalFont;
default: default:
return QVariant(); return QVariant();

View File

@ -65,7 +65,7 @@ void DynamicShortcutsWidget::updateShortcuts() {
} }
} }
void DynamicShortcutsWidget::populate(const QList<QAction *> actions) { void DynamicShortcutsWidget::populate(const QList<QAction*> actions) {
m_actionBindings.clear(); m_actionBindings.clear();
int row_id = 0; int row_id = 0;
@ -73,7 +73,7 @@ void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
foreach (QAction *action, actions) { foreach (QAction *action, actions) {
// Create shortcut catcher for this action and set default shortcut. // Create shortcut catcher for this action and set default shortcut.
ShortcutCatcher *catcher = new ShortcutCatcher(this); ShortcutCatcher *catcher = new ShortcutCatcher(this);
catcher->setShortcut(action->shortcut()); catcher->setDefaultShortcut(action->shortcut());
// Store information for re-initialization of shortcuts // Store information for re-initialization of shortcuts
// of actions when widget gets "confirmed". // of actions when widget gets "confirmed".

View File

@ -120,7 +120,8 @@ QList<QAction*> FormMain::allActions() {
m_ui->m_actionSelectNextFeedCategory << m_ui->m_actionSelectNextFeedCategory <<
m_ui->m_actionSelectPreviousFeedCategory << m_ui->m_actionSelectPreviousFeedCategory <<
m_ui->m_actionSelectNextMessage << m_ui->m_actionSelectNextMessage <<
m_ui->m_actionSelectPreviousMessage; m_ui->m_actionSelectPreviousMessage <<
m_ui->m_actionDefragmentDatabase;
return actions; return actions;
} }

View File

@ -133,5 +133,3 @@ void ShortcutCatcher::updateDisplayShortcut() {
m_btnChange->setText(str); m_btnChange->setText(str);
} }

View File

@ -54,14 +54,15 @@ class ShortcutCatcher : public QWidget {
return m_currentSequence; return m_currentSequence;
} }
inline void setShortcut(const QKeySequence &key) { inline void setDefaultShortcut(const QKeySequence &key) {
m_currentSequence = m_defaultSequence = key; m_defaultSequence = key;
doneRecording(); setShortcut(key);
} }
protected slots: inline void setShortcut(const QKeySequence &key) {
void startRecording(); m_currentSequence = key;
void doneRecording(); doneRecording();
}
public slots: public slots:
inline void resetShortcut() { inline void resetShortcut() {
@ -72,6 +73,10 @@ class ShortcutCatcher : public QWidget {
setShortcut(QKeySequence()); setShortcut(QKeySequence());
} }
protected slots:
void startRecording();
void doneRecording();
signals: signals:
void shortcutChanged(const QKeySequence &seguence); void shortcutChanged(const QKeySequence &seguence);