Popup.qml 1.76 KB
Newer Older
1
2
/*
    Copyright 2013 Denis Kuplyakov <dener.kup@gmail.com>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
3

4
5
6
7
    This program is free software: you can redistribute it and/or modify
    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.
Denis Kuplyakov's avatar
Denis Kuplyakov committed
8

9
10
11
12
    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.
Denis Kuplyakov's avatar
Denis Kuplyakov committed
13

14
15
16
17
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

18
import QtQuick 1.1
19
import ColorScheme 1.0
20

Denis Kuplyakov's avatar
Denis Kuplyakov committed
21
Rectangle {
22
    id: popupContainer
23

Denis Kuplyakov's avatar
Denis Kuplyakov committed
24
25
26
    height: row.height + 30
    width: row.width + 30

27
    color: colorScheme.background
Denis Kuplyakov's avatar
Denis Kuplyakov committed
28
    opacity: 0.9
29
    border.color: colorScheme.border
Denis Kuplyakov's avatar
Denis Kuplyakov committed
30
31
    border.width: 1

32
    function show(message, showing_state) {
Denis Kuplyakov's avatar
Denis Kuplyakov committed
33
34
        text.text = message
        timer.start();
35
        state = showing_state
Denis Kuplyakov's avatar
Denis Kuplyakov committed
36
37
    }

38
39
40
41
    ColorScheme {
        id: colorScheme
    }

Denis Kuplyakov's avatar
Denis Kuplyakov committed
42
43
44
45
46
47
48
49
50
51
52
53
54
    Timer {
        id: timer
        repeat: false
        interval: 3000
        onTriggered: state = ""
    }

    Row {
        id: row
        x: 15
        y: 15
        spacing: 10

55
        Image {
Denis Kuplyakov's avatar
Denis Kuplyakov committed
56
57
            id: icon
            anchors.verticalCenter: parent.verticalCenter
58
59
60
61
            width: visible ? 32 : 0
            height: visible ? 32 : 0

            property string iconName: "dialog-information"
62
            source: "image://icon/" + iconName
Denis Kuplyakov's avatar
Denis Kuplyakov committed
63
64
65
66
67
68
        }


        Text {
            id: text
            anchors.verticalCenter: parent.verticalCenter
69
            color: colorScheme.foreground
Denis Kuplyakov's avatar
Denis Kuplyakov committed
70
71
72
            wrapMode: Text.WordWrap
        }
    }
73
}