[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [parley] src/dashboard: Prevent string cropping in bar widget and make practice button visible
From: Dimitris Kardarakos <dimkard () gmail ! com>
Date: 2016-06-04 9:54:49
Message-ID: E1b98I5-0006IQ-6Z () scm ! kde ! org
[Download RAW message or body]
Git commit 56b75e1de8a1b5ee8a5ccb15b4113e02cc2ef084 by Dimitris Kardarakos.
Committed on 04/06/2016 at 09:51.
Pushed by dkardarakos into branch 'master'.
Prevent string cropping in bar widget and make practice button visible
In dashboard page, a couple of issues have been identified in collection widget.
1. When the translation of string "%1 word due" is slightly longer than the English \
one or %1 is a large number, string is cropped. 2. Practice button does not seem \
clickable, using the default breeze theme and reference theme of parley. Even worse, \
when breeze dark is used, due to the forcibly white background of collection widget, \
practice button text is unreadable. I have addressed these issues by:
- Changing bar widget size to 2-lines, increasing also slightly the width of the \
collection widget
- Wrapping the text of bar widget
- Restoring theme colors to practice button (background was set to white due to \
collection widget white background)
REVIEW: 127561
M +4 -4 src/dashboard/barwidget.cpp
M +8 -5 src/dashboard/collectionwidget.cpp
http://commits.kde.org/parley/56b75e1de8a1b5ee8a5ccb15b4113e02cc2ef084
diff --git a/src/dashboard/barwidget.cpp b/src/dashboard/barwidget.cpp
old mode 100644
new mode 100755
index 61b6e43..8927c5e
--- a/src/dashboard/barwidget.cpp
+++ b/src/dashboard/barwidget.cpp
@@ -70,7 +70,7 @@ void BarWidget::paintEvent(QPaintEvent *)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
const int legendWidth = COLLWIDTH - 10;
- const int legendHeight = 20;
+ const int legendHeight = 45;
const int legendOffsetY = 0;
const int legendOffsetX = 0;
//const int alphaValueIncrement = 35;
@@ -133,10 +133,10 @@ void BarWidget::paintEvent(QPaintEvent *)
//QPen pen(QColor(0, 0, 0));
painter.setPen(pen);
if (m_percentageCompleted < 100) {
- painter.drawText(0, 0, legendWidth, 20, Qt::AlignCenter,
- i18np("%1 word due", "%1 words due", m_totalDueWords));
+ painter.drawText(0, 0, legendWidth, legendHeight, Qt::AlignCenter | \
Qt::TextWordWrap, + i18np("%1 word due", "%1 word due", m_totalDueWords));
}
else {
- painter.drawText(0, 0, legendWidth, 20, Qt::AlignCenter, i18n("Fully \
learned")); + painter.drawText(0, 0, legendWidth, legendHeight, \
Qt::AlignCenter | Qt::TextWordWrap, i18n("Fully learned")); }
}
diff --git a/src/dashboard/collectionwidget.cpp b/src/dashboard/collectionwidget.cpp
old mode 100644
new mode 100755
index 7925871..3d1ff33
--- a/src/dashboard/collectionwidget.cpp
+++ b/src/dashboard/collectionwidget.cpp
@@ -36,10 +36,10 @@
// Size constants for the collection widgets
-int COLLWIDTH = 140; // Width in pixels of a collection widget
+int COLLWIDTH = 155; // Width in pixels of a collection widget
//int COLLHEIGHT1 = 250; // Height in pixels of a collection widget not yet fully \
learned
-int COLLHEIGHT1 = 150; // Height in pixels of a collection widget not yet fully \
learned
-int COLLHEIGHT2 = 100; // Height in pixels of a collection widget fully learned
+int COLLHEIGHT1 = 175; // Height in pixels of a collection widget not yet fully \
learned +int COLLHEIGHT2 = 125; // Height in pixels of a collection widget fully \
learned
// ================================================================
@@ -178,10 +178,13 @@ void CollectionWidget::setupWidget(WordCount *dueWords)
}
m_barWidget = new BarWidget(dueWords, this);
- m_barWidget->setFixedSize(COLLWIDTH - 10, 20);
+ m_barWidget->setFixedSize(COLLWIDTH - 10, 45);
mainLayout->addWidget(m_barWidget);
m_practiceButton = new QPushButton(this);
- m_practiceButton->setStyleSheet(QStringLiteral("QPushButton {border: none; \
margin: 0px; padding: 0px;}")); + QString buttonStyleSheet = "QPushButton { \
border: none; margin: 0px; padding: 0px; color: " + + \
palette.color(QPalette::Active, QPalette::ButtonText).name()+ "; background-color: " \
+ + palette.color(QPalette::Active, QPalette::Button).name() + "; \
border-radius: 3px;}"; + m_practiceButton->setStyleSheet(buttonStyleSheet);
// buttonLayout is the horizontal layout for the bottom line in the
// collection widget: delete button, practice button, etc
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic