~ahayzen/ubuntu-printing-app/add-qmlscene-depends

« back to all changes in this revision

Viewing changes to queue-dialog/pages/QueuePage.qml

  • Committer: Bileto Bot
  • Author(s): Andrew Hayzen
  • Date: 2017-03-23 12:37:45 UTC
  • mfrom: (23.5.22 queue-dialog)
  • Revision ID: ci-train-bot@canonical.com-20170323123745-sgraaxsapmg9sa0m
* Add queue dialog with relevant components
* Add tests for the queue components

Approved by: Michael Sheldon

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2017 Canonical Ltd.
 
3
 *
 
4
 * This file is part of ubuntu-printing-app.
 
5
 *
 
6
 * ubuntu-printing-app is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * ubuntu-printing-app is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 *
 
18
 * Authored-by: Andrew Hayzen <andrew.hayzen@canonical.com>
 
19
 */
 
20
import QtQuick 2.4
 
21
 
 
22
import Ubuntu.Components 1.3
 
23
 
 
24
import Ubuntu.Components.Extras.Printers 0.1
 
25
import "../components"
 
26
 
 
27
Page {
 
28
    id: page
 
29
    header: PageHeader {
 
30
        subtitle: i18n.tr("%1 job", "%1 jobs", queueHelper.count).arg(queueHelper.count)
 
31
        title: i18n.tr("Printing")
 
32
        trailingActionBar {
 
33
            actions: [
 
34
                Action {
 
35
                    iconName: "settings"
 
36
                    objectName: "headerSettings"
 
37
 
 
38
                    onTriggered: page.settings()
 
39
                }
 
40
            ]
 
41
        }
 
42
    }
 
43
    objectName: "queuePage"
 
44
 
 
45
    property QtObject queueHelper: null
 
46
 
 
47
    signal settings()
 
48
 
 
49
    ScrollView {
 
50
        id: scrollView
 
51
        anchors {
 
52
            bottom: parent.bottom
 
53
            left: parent.left
 
54
            right: parent.right
 
55
            top: page.header.bottom
 
56
        }
 
57
 
 
58
        QueueView {
 
59
            anchors {
 
60
                fill: parent
 
61
            }
 
62
            filtersModel: ListModel {
 
63
                id: filtersModel
 
64
                objectName: "filtersModel"
 
65
            }
 
66
            objectName: "queueView"
 
67
            queueHelper: page.queueHelper
 
68
        }
 
69
    }
 
70
 
 
71
    Label {
 
72
        anchors {
 
73
            centerIn: parent
 
74
        }
 
75
        objectName: "emptyLabel"
 
76
        text: i18n.tr("No printer jobs")
 
77
        visible: queueHelper.count === 0
 
78
    }
 
79
 
 
80
    Component.onCompleted: {
 
81
        filtersModel.append(
 
82
            {
 
83
                filter: queueHelper.createActiveFilter(),
 
84
                name: i18n.tr("Active"),
 
85
                state: "active",
 
86
            }
 
87
        );
 
88
 
 
89
        filtersModel.append(
 
90
            {
 
91
                filter: queueHelper.createQueuedFilter(),
 
92
                name: i18n.tr("Queued"),
 
93
                state: "queued",
 
94
            }
 
95
        );
 
96
 
 
97
        filtersModel.append(
 
98
            {
 
99
                filter: queueHelper.createPausedFilter(),
 
100
                name: i18n.tr("Paused"),
 
101
                state: "paused",
 
102
            }
 
103
        );
 
104
    }
 
105
}