diff options
| author | Aleix Pol <aleixpol@kde.org> | 2015-09-30 16:45:23 (GMT) |
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2015-09-30 16:45:23 (GMT) |
| commit | fd7343ef5dcc0671217f48766a6e7b9f158c6880 (patch) | |
| tree | 3a59ea3c114246966e1b2eba983c03e218631042 | |
| parent | 9396cc5f12fcae8264d944492981f81629e3019c (diff) | |
Unify the application state indicator in one place
This way we can change the colors just once
Also don't use opacity there, it only makes the colors look fuzzy.
| -rw-r--r-- | discover/qml/ApplicationIndicator.qml | 40 | ||||
| -rw-r--r-- | discover/qml/ApplicationsGridDelegate.qml | 5 | ||||
| -rw-r--r-- | discover/qml/ApplicationsList.qml | 5 | ||||
| -rw-r--r-- | discover/resources.qrc | 1 |
4 files changed, 45 insertions, 6 deletions
diff --git a/discover/qml/ApplicationIndicator.qml b/discover/qml/ApplicationIndicator.qml new file mode 100644 index 0000000..0d4f600 --- /dev/null +++ b/discover/qml/ApplicationIndicator.qml @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library/Lesser General Public License + * version 2, or (at your option) any later version, as published by the + * Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library/Lesser General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.1 + +Rectangle { + id: root + state: "none" + + states: [ + State { + name: "none" + PropertyChanges { target: root; color: "transparent" } + }, + State { + name: "installed" + PropertyChanges { target: root; color: "#090" } + }, + State { + name: "upgradeable" + PropertyChanges { target: root; color: "#339" } + } + ] +} diff --git a/discover/qml/ApplicationsGridDelegate.qml b/discover/qml/ApplicationsGridDelegate.qml index 78b42dc..bd26a70 100644 --- a/discover/qml/ApplicationsGridDelegate.qml +++ b/discover/qml/ApplicationsGridDelegate.qml @@ -114,12 +114,11 @@ GridItem { } } - Rectangle { + ApplicationIndicator { id: indicator - color: canUpgrade ? "#337" : (isInstalled ? "#070" : "transparent") + state: canUpgrade ? "upgradeable" : (isInstalled ? "installed" : "none") height: 5 width: parent.width anchors.bottom: parent.bottom - opacity: 0.7 } } diff --git a/discover/qml/ApplicationsList.qml b/discover/qml/ApplicationsList.qml index e2635a2..c76e32d 100644 --- a/discover/qml/ApplicationsList.qml +++ b/discover/qml/ApplicationsList.qml @@ -131,13 +131,12 @@ ScrollView { } } - Rectangle { + ApplicationIndicator { id: indicator - color: canUpgrade ? "#337" : isInstalled && view.model.stateFilter!=2 ? "#070" : "transparent" + state: canUpgrade ? "upgradeable" : isInstalled && view.model.stateFilter!=2 ? "installed" : "none" width: 5 height: parent.height anchors.right: parent.right - opacity: 0.7 } } } diff --git a/discover/resources.qrc b/discover/resources.qrc index 1de5ffb..86506a2 100644 --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -39,6 +39,7 @@ <file>qml/MuonToolbar.qml</file> <file>qml/ApplicationDetails.qml</file> <file>qml/ApplicationScreenshots.qml</file> + <file>qml/ApplicationIndicator.qml</file> <file>qml/LabelBackground.qml</file> <file>qml/navigation.js</file> |
