summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-15 10:55:45 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-15 10:55:45 -0600
commit56740b68ea97d8d30ba92a505d74f0a9ddc4d50b (patch)
tree48891e002a2313f7b63201c4aa37f10cc9e3b9f0
parentff8d9e8fcecc3cc8ace64b6cdeafdb11cf9854f3 (diff)
downloadhorizon-56740b68ea97d8d30ba92a505d74f0a9ddc4d50b.tar.gz
horizon-56740b68ea97d8d30ba92a505d74f0a9ddc4d50b.tar.bz2
horizon-56740b68ea97d8d30ba92a505d74f0a9ddc4d50b.tar.xz
horizon-56740b68ea97d8d30ba92a505d74f0a9ddc4d50b.zip
Qt UI: Add status assets, factor DPI-aware pixmap loader into fn
-rw-r--r--assets/README4
-rw-r--r--assets/status-current-high.svg6
-rw-r--r--assets/status-current-low.svg4
-rw-r--r--assets/status-issue-high.svg6
-rw-r--r--assets/status-issue-low.svg4
-rw-r--r--assets/status-success-high.svg4
-rw-r--r--assets/status-success-low.svg4
-rw-r--r--ui/qt5/horizon.qrc6
-rw-r--r--ui/qt5/horizonwizardpage.cc28
-rw-r--r--ui/qt5/horizonwizardpage.hh1
10 files changed, 51 insertions, 16 deletions
diff --git a/assets/README b/assets/README
index d21e193..4104288 100644
--- a/assets/README
+++ b/assets/README
@@ -1,3 +1,7 @@
The Horizon icon is based on preferences-wallpaper and preferences-system-login
from the fabulous Newaita-dark icon set, licensed CC-BY-NC-SA-3.0 and available
on the World Wide Web at: https://gitlab.com/cybernix/Newaita.
+
+The status icons are from the Papirus icon theme, licensed GPL-3.0-only and
+available on the World Wide Web at:
+https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.
diff --git a/assets/status-current-high.svg b/assets/status-current-high.svg
new file mode 100644
index 0000000..ef294e5
--- /dev/null
+++ b/assets/status-current-high.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" version="1.1">
+ <g transform="scale(2)">
+ <circle style="fill:#c579be" cx="8" cy="8" r="7"/>
+ <path style="fill:#ffffff;fill-rule:evenodd" d="M 8,4 V 6.0182 H 6.3799 C 5.351,6.0183 4.4003,6.527 3.8859,7.3528 3.3714,8.1786 3.3714,9.3461 3.8859,10.172 4.3756,10.955 5.2606,11.455 6.2364,11.5 5.5003,11.432 4.9999,10.858 5,10.172 5,9.4349 5.5846,8.9908 6.3799,9 H 8 V 11 L 12,7.5 Z"/>
+ </g>
+</svg>
diff --git a/assets/status-current-low.svg b/assets/status-current-low.svg
new file mode 100644
index 0000000..1e07741
--- /dev/null
+++ b/assets/status-current-low.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
+ <circle style="fill:#c579be" cx="8" cy="8" r="7"/>
+ <path style="fill:#ffffff;fill-rule:evenodd" d="M 8,4 V 6.0182 H 6.3799 C 5.351,6.0183 4.4003,6.527 3.8859,7.3528 3.3714,8.1786 3.3714,9.3461 3.8859,10.172 4.3756,10.955 5.2606,11.455 6.2364,11.5 5.5003,11.432 4.9999,10.858 5,10.172 5,9.4349 5.5846,8.9908 6.3799,9 H 8 V 11 L 12,7.5 Z"/>
+</svg>
diff --git a/assets/status-issue-high.svg b/assets/status-issue-high.svg
new file mode 100644
index 0000000..6a39c8c
--- /dev/null
+++ b/assets/status-issue-high.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" version="1.1">
+ <g transform="scale(2)">
+ <circle style="fill:#af4c5f" cx="8" cy="8" r="7"/>
+ <path style="fill:#ffffff" d="M 7,3 V 9 H 9 V 3 Z M 7,11 V 13 H 9 V 11 Z"/>
+ </g>
+</svg>
diff --git a/assets/status-issue-low.svg b/assets/status-issue-low.svg
new file mode 100644
index 0000000..e7be61a
--- /dev/null
+++ b/assets/status-issue-low.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
+ <circle style="fill:#af4c5f" cx="8" cy="8" r="7"/>
+ <path style="fill:#ffffff" d="M 7,3 V 9 H 9 V 3 Z M 7,11 V 13 H 9 V 11 Z"/>
+</svg>
diff --git a/assets/status-success-high.svg b/assets/status-success-high.svg
new file mode 100644
index 0000000..1718f43
--- /dev/null
+++ b/assets/status-success-high.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" version="1.1">
+ <circle style="fill:#252a35" cx="16" cy="16" r="14"/>
+ <path style="fill:#ffffff" d="m 6.454059,17.06066 4.24264,4.242641 2.121321,2.12132 L 25.545941,10.6967 23.424621,8.575379 12.81802,19.181981 8.5753786,14.93934 Z"/>
+</svg>
diff --git a/assets/status-success-low.svg b/assets/status-success-low.svg
new file mode 100644
index 0000000..4bd8975
--- /dev/null
+++ b/assets/status-success-low.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
+ <circle style="fill:#252a35" cx="8" cy="8" r="7"/>
+ <path style="fill:#ffffff" d="m 3.2270295,8.53033 2.12132,2.12132 L 6.40901,11.71231 12.772971,5.34835 11.71231,4.2876895 6.40901,9.5909905 4.2876893,7.46967 Z"/>
+</svg>
diff --git a/ui/qt5/horizon.qrc b/ui/qt5/horizon.qrc
index 5e740b6..9af8207 100644
--- a/ui/qt5/horizon.qrc
+++ b/ui/qt5/horizon.qrc
@@ -6,6 +6,12 @@
<file>resources/network-high.png</file>
<file>resources/software-high.png</file>
<file>resources/software-low.png</file>
+ <file alias="resources/status-current-high.svg">../../assets/status-current-high.svg</file>
+ <file alias="resources/status-current-low.svg">../../assets/status-current-low.svg</file>
+ <file alias="resources/status-issue-high.svg">../../assets/status-issue-high.svg</file>
+ <file alias="resources/status-issue-low.svg">../../assets/status-issue-low.svg</file>
+ <file alias="resources/status-success-high.svg">../../assets/status-success-high.svg</file>
+ <file alias="resources/status-success-low.svg">../../assets/status-success-low.svg</file>
</qresource>
<qresource prefix="/wizard_help">
<file>resources/intro-help.txt</file>
diff --git a/ui/qt5/horizonwizardpage.cc b/ui/qt5/horizonwizardpage.cc
index f707876..352de0e 100644
--- a/ui/qt5/horizonwizardpage.cc
+++ b/ui/qt5/horizonwizardpage.cc
@@ -14,41 +14,37 @@
using std::string;
-void HorizonWizardPage::loadWatermark(string page) {
- QPixmap pixmap;
- qreal pixelRatio = 0;
+QPixmap HorizonWizardPage::loadDPIAwarePixmap(string pixmap, string type) {
string path = ":/wizard_pixmaps/resources/";
- path += page;
+ path += pixmap;
path += "-";
- if(window()->devicePixelRatioF() == 2.0) {
- path += "high";
- pixelRatio = 2.0;
- } else if(window()->devicePixelRatioF() == 1.0) {
+ if(window()->devicePixelRatioF() <= 1.0) {
path += "low";
- pixelRatio = 1.0;
} else {
path += "high";
}
- path += ".png";
+ path += type;
+ return QPixmap(path.c_str());
+}
- pixmap = QPixmap(path.c_str());
+void HorizonWizardPage::loadWatermark(string page) {
+ QPixmap pixmap = loadDPIAwarePixmap(page);
+ qreal pixelRatio = window()->devicePixelRatioF();
// Handle cases where ratio is not exactly 1.0 or 2.0
// Wizard machinary automatically uses FastTransformation, which is
// ugly as sin.
if(pixelRatio > 1.0) {
- qreal width = 232 * window()->devicePixelRatioF();
- qreal height = 380 * window()->devicePixelRatioF();
+ qreal width = 232 * pixelRatio;
+ qreal height = 380 * pixelRatio;
QSize newSize = QSize(width, height);
pixmap = pixmap.scaled(newSize, Qt::KeepAspectRatio,
Qt::SmoothTransformation);
- pixmap.setDevicePixelRatio(window()->devicePixelRatioF());
- } else {
- pixmap.setDevicePixelRatio(pixelRatio);
}
+ pixmap.setDevicePixelRatio(pixelRatio);
setPixmap(QWizard::WatermarkPixmap, pixmap);
}
diff --git a/ui/qt5/horizonwizardpage.hh b/ui/qt5/horizonwizardpage.hh
index 4ddb160..6ed8a6e 100644
--- a/ui/qt5/horizonwizardpage.hh
+++ b/ui/qt5/horizonwizardpage.hh
@@ -22,6 +22,7 @@ class HorizonWizardPage : public QWizardPage {
public:
HorizonWizardPage(QWidget *parent = 0) : QWizardPage(parent) {}
+ QPixmap loadDPIAwarePixmap(std::string pixmap, std::string type = ".png");
void loadWatermark(std::string page);
HorizonWizard *horizonWizard() const;
};