Skip to content

Commit 0365655

Browse files
committed
1.1 Fixed panel issue #1, added 'Show Text' option
1 parent acdbd1a commit 0365655

6 files changed

Lines changed: 64 additions & 36 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,12 @@ Use additional `-g` flag to install plasmoid globally, for all users.
3838
![Bitcoin Price Plasmoid (Panel)](https://raw.githubusercontent.com/MakG10/plasma-applet-bitcoin-price/master/bitcoin-price-panel.png)
3939

4040
![Bitcoin Price Plasmoid (Configuration)](https://raw.githubusercontent.com/MakG10/plasma-applet-bitcoin-price/master/bitcoin-price-config.png)
41+
42+
## Changelog
43+
44+
### 1.1
45+
- Fixed displaying on panels (issue #1)
46+
- Added "Show text" option
47+
48+
### 1.0
49+
Initial release

bitcoin-price.plasmoid

6.94 KB
Binary file not shown.

package/contents/config/main.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
<label>Show icon</label>
2222
<default>true</default>
2323
</entry>
24-
<entry name="onClickAction" type="String">
24+
<entry name="showText" type="bool">
25+
<label>Show text</label>
26+
<default>true</default>
27+
</entry>
28+
<entry name="onClickAction" type="String">
2529
<label>On click</label>
2630
<default>refresh</default>
2731
</entry>

package/contents/ui/config/configGeneral.qml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Item {
1313
property string cfg_onClickAction: plasmoid.configuration.onClickAction
1414
property alias cfg_refreshRate: refreshRate.value
1515
property alias cfg_showIcon: showIcon.checked
16+
property alias cfg_showText: showText.checked
1617
property variant sourceList: { Bitcoin.getAllSources() }
1718
property variant currencyList: { Bitcoin.getAllCurrencies() }
1819

@@ -76,6 +77,31 @@ Item {
7677
CheckBox {
7778
id: showIcon
7879
text: i18n("Show icon")
80+
onClicked: {
81+
if(!this.checked) {
82+
showText.checked = true
83+
showText.enabled = false
84+
} else {
85+
showText.enabled = true
86+
}
87+
}
88+
}
89+
90+
Label {
91+
text: ""
92+
}
93+
94+
CheckBox {
95+
id: showText
96+
text: i18n("Show text (when disabled, the rate is visible on hover)")
97+
onClicked: {
98+
if(!this.checked) {
99+
showIcon.checked = true
100+
showIcon.enabled = false
101+
} else {
102+
showIcon.enabled = true
103+
}
104+
}
79105
}
80106

81107
Label {
@@ -85,7 +111,7 @@ Item {
85111
ExclusiveGroup { id: clickGroup }
86112

87113
RadioButton {
88-
Layout.row: 4
114+
Layout.row: 5
89115
Layout.column: 1
90116
exclusiveGroup: clickGroup
91117
checked: cfg_onClickAction == 'refresh'
@@ -96,7 +122,7 @@ Item {
96122
}
97123

98124
RadioButton {
99-
Layout.row: 5
125+
Layout.row: 6
100126
Layout.column: 1
101127
exclusiveGroup: clickGroup
102128
checked: cfg_onClickAction == 'website'

package/contents/ui/main.qml

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
/***************************************************************************
2-
* Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
3-
* *
4-
* This program is free software; you can redistribute it and/or modify *
5-
* it under the terms of the GNU General Public License as published by *
6-
* the Free Software Foundation; either version 2 of the License, or *
7-
* (at your option) any later version. *
8-
* *
9-
* This program is distributed in the hope that it will be useful, *
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12-
* GNU General Public License for more details. *
13-
* *
14-
* You should have received a copy of the GNU General Public License *
15-
* along with this program; if not, write to the *
16-
* Free Software Foundation, Inc., *
17-
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
2+
* Copyright (C) 2017 by MakG <makg@makg.eu> *
183
***************************************************************************/
194

205
import QtQuick 2.1
@@ -28,18 +13,31 @@ import "../code/bitcoin.js" as Bitcoin
2813
Item {
2914
id: root
3015

31-
width: units.gridUnit * 10
32-
height: units.gridUnit * 2
16+
Layout.fillHeight: true
3317

3418
property string bitcoinRate: '...'
3519
property bool showIcon: plasmoid.configuration.showIcon
20+
property bool showText: plasmoid.configuration.showText
3621
property bool updatingRate: false
3722

3823
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
3924
Plasmoid.toolTipTextFormat: Text.RichText
4025

4126
Plasmoid.compactRepresentation: Item {
42-
Layout.fillWidth: true
27+
property int textMargin: bitcoinIcon.height * 0.25
28+
property int minWidth: {
29+
if(root.showIcon && root.showText) {
30+
return bitcoinValue.paintedWidth + bitcoinIcon.width + textMargin;
31+
}
32+
else if(root.showIcon) {
33+
return bitcoinIcon.width;
34+
} else {
35+
return bitcoinValue.paintedWidth
36+
}
37+
}
38+
39+
Layout.fillWidth: false
40+
Layout.minimumWidth: minWidth
4341

4442
MouseArea {
4543
id: mouseArea
@@ -74,37 +72,28 @@ Item {
7472
anchors.top: parent.top
7573
anchors.left: parent.left
7674
anchors.topMargin: parent.height * 0.05
77-
anchors.leftMargin: parent.height * 0.05
75+
anchors.leftMargin: root.showText ? parent.height * 0.05 : 0
7876

7977
source: "../images/bitcoin.svg"
8078
visible: root.showIcon
8179
opacity: root.updatingRate ? 0.2 : mouseArea.containsMouse ? 0.8 : 1.0
82-
83-
states: State {
84-
name: "mouseover"
85-
PropertyChanges { target: bitcoinIcon; opacity: 0.5; rotation: 180 }
86-
}
87-
88-
transitions: Transition {
89-
from: "*"; to: "mouseover"
90-
NumberAnimation { properties: "opacity,rotation"; easing.type: Easing.OutBounce; duration: 2000 }
91-
}
9280
}
9381

9482
PlasmaComponents.Label {
9583
id: bitcoinValue
9684
height: parent.height
9785
anchors.left: root.showIcon ? bitcoinIcon.right : parent.left
9886
anchors.right: parent.right
99-
anchors.leftMargin: root.showIcon ? 10 : 0
87+
anchors.leftMargin: root.showIcon ? textMargin : 0
10088

10189
horizontalAlignment: root.showIcon ? Text.AlignLeft : Text.AlignHCenter
10290
verticalAlignment: Text.AlignVCenter
10391

92+
visible: root.showText
10493
opacity: root.updatingRate ? 0.2 : mouseArea.containsMouse ? 0.8 : 1.0
10594

10695
fontSizeMode: Text.Fit
107-
minimumPixelSize: 10
96+
minimumPixelSize: bitcoinIcon.width * 0.7
10897
font.pixelSize: 72
10998
text: root.bitcoinRate
11099
}

package/metadata.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ServiceTypes=Plasma/Applet
1212

1313
X-KDE-PluginInfo-Author=Maciej Gierej
1414
X-KDE-PluginInfo-Email=makg@makg.eu
15-
X-KDE-PluginInfo-Version=1.0
15+
X-KDE-PluginInfo-Version=1.1
1616
X-KDE-PluginInfo-Website=http://maciej.gierej.pl
1717
X-KDE-PluginInfo-Category=Utilities
1818
X-KDE-PluginInfo-Depends=

0 commit comments

Comments
 (0)