[sailfish] Rewrite Bubble.qml
Now all code is 'GPLv2 or later'
This commit is contained in:
parent
7b0a51d7ff
commit
a4b6bf7af9
4 changed files with 13 additions and 49 deletions
|
|
@ -40,8 +40,3 @@ License
|
|||
with TTRss; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
|
||||
http://www.gnu.org/licenses/.
|
||||
|
||||
Exception:
|
||||
|
||||
The file `Bubble.qml` in `qml/ttrss/sailfish/items/` is licensed
|
||||
under the GNU General Public License version 2 only.
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
/*
|
||||
* This file is part of TTRss, a Tiny Tiny RSS Reader App
|
||||
* for MeeGo Harmattan and Sailfish OS.
|
||||
* Copyright (C) 2014 Hauke Schade
|
||||
*
|
||||
* This file was adapted from ocNews
|
||||
* (https://github.com/Buschtrommel/ocNews).
|
||||
* Copyright (C) 2014 Buschtrommel
|
||||
* Copyright (C) 2012–2014 Hauke Schade
|
||||
*
|
||||
* TTRss is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* TTRss is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
@ -25,48 +22,20 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Item {
|
||||
id: bubble
|
||||
|
||||
property int value: 0
|
||||
property alias color: bubbleValue.color
|
||||
|
||||
function getBubbleWidth() {
|
||||
var absVal = Math.abs(bubble.value)
|
||||
if (absVal < 10)
|
||||
return 26
|
||||
else if (absVal < 100)
|
||||
return 35
|
||||
else if (absVal < 1000)
|
||||
return 48
|
||||
else
|
||||
return 58
|
||||
}
|
||||
|
||||
width: bubble.getBubbleWidth()
|
||||
height: 32
|
||||
|
||||
onValueChanged: {
|
||||
bubble.width = bubble.getBubbleWidth()
|
||||
}
|
||||
Label {
|
||||
text: "0"
|
||||
color: Theme.primaryColor
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRect
|
||||
width: parent.width
|
||||
width: parent.width + radius
|
||||
height: parent.height
|
||||
color: Theme.secondaryColor
|
||||
border.color: Theme.primaryColor
|
||||
border.width: 1
|
||||
radius: 10
|
||||
opacity: 0.3
|
||||
}
|
||||
|
||||
Text {
|
||||
id: bubbleValue
|
||||
anchors.centerIn: backgroundRect
|
||||
text: bubble.value
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
opacity: 1
|
||||
color: Theme.primaryColor
|
||||
anchors.centerIn: parent
|
||||
z: parent.z-1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ ListItem {
|
|||
}
|
||||
Bubble {
|
||||
id: bubble
|
||||
value: model.unreadcount
|
||||
text: model.unreadcount
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Theme.paddingMedium
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ ListItem {
|
|||
}
|
||||
Bubble {
|
||||
id: bubble
|
||||
value: model.unreadcount
|
||||
text: model.unreadcount
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Theme.paddingMedium
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue