├── .gitignore ├── AboutPage.qml ├── Application.qml ├── AutoSpacedGrid.qml ├── BarGraph.qml ├── BarGraphBar.qml ├── CMakeLists.txt ├── COPYING ├── ColumnFlow.qml ├── ConfirmDialog.qml ├── DialogButtonRow.qml ├── InputDialog.qml ├── ListItemBackground.qml ├── MasterDetailView.qml ├── Notification.qml ├── NotifyDialog.qml ├── README.md ├── Sidebar.qml ├── TabView.qml ├── Table.qml ├── TimePicker.qml ├── UndoStack.qml ├── VerticalDivider.qml ├── Walkthough.qml ├── header.in └── ubuntu-ui-extras.qmlproject /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.qmlproject.user 3 | *.click 4 | *.db 5 | -------------------------------------------------------------------------------- /AboutPage.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.Popups 1.0 26 | import Ubuntu.Components.ListItems 1.0 as ListItem 27 | import "../qml-extras/listutils.js" as List 28 | 29 | Page { 30 | id: page 31 | 32 | title: i18n.tr("About") 33 | 34 | head.sections { 35 | model: credits.length > 0 ? [i18n.tr("About"), i18n.tr("Credits")] 36 | : undefined 37 | } 38 | 39 | property string appName 40 | property var credits: [] 41 | property string website 42 | property string reportABug 43 | property string version 44 | property string copyright 45 | property string author 46 | property string contactEmail 47 | property bool iconFrame: true 48 | 49 | property color linkColor: "blue" 50 | 51 | property alias icon: icon.source 52 | 53 | function colorLinks(text) { 54 | return text.replace(/(.*?)$2<") 55 | } 56 | 57 | property bool landscape: width > height && height < units.gu(60) 58 | 59 | Item { 60 | anchors { 61 | left: parent.left 62 | top: parent.top 63 | bottom: parent.bottom 64 | leftMargin: show ? 0 : -width 65 | 66 | Behavior on leftMargin { 67 | UbuntuNumberAnimation {} 68 | } 69 | } 70 | 71 | width: parent.width 72 | 73 | opacity: show ? 1 : 0 74 | 75 | Behavior on opacity { 76 | UbuntuNumberAnimation {} 77 | } 78 | 79 | property bool show: head.sections.selectedIndex <= 0 80 | 81 | Column { 82 | anchors { 83 | centerIn: parent 84 | horizontalCenterOffset: landscape ? -parent.width/4 : 0 85 | } 86 | spacing: units.gu(3) 87 | 88 | UbuntuShape { 89 | visible: iconFrame && landscape 90 | image: Image { 91 | id: icon2 92 | source: icon.source 93 | } 94 | 95 | width: units.gu(16) 96 | height: width * icon.sourceSize.height/icon.sourceSize.width 97 | radius: "medium" 98 | anchors.horizontalCenter: parent.horizontalCenter 99 | } 100 | 101 | Image { 102 | source: icon.source 103 | width: units.gu(16.1) 104 | height: width * icon.sourceSize.height/icon.sourceSize.width 105 | visible: !iconFrame && landscape 106 | 107 | anchors.horizontalCenter: parent.horizontalCenter 108 | } 109 | 110 | Label { 111 | fontSize: "large" 112 | text: appName 113 | visible: landscape 114 | anchors.horizontalCenter: parent.horizontalCenter 115 | } 116 | } 117 | 118 | Column { 119 | anchors { 120 | centerIn: parent 121 | horizontalCenterOffset: landscape ? parent.width/4 : 0 122 | margins: units.gu(3) 123 | topMargin: units.gu(8) 124 | } 125 | 126 | spacing: units.gu(3) 127 | 128 | UbuntuShape { 129 | visible: iconFrame && !landscape 130 | image: Image { 131 | id: icon 132 | } 133 | 134 | width: units.gu(16) 135 | height: width * icon.sourceSize.height/icon.sourceSize.width 136 | radius: "medium" 137 | anchors.horizontalCenter: parent.horizontalCenter 138 | } 139 | 140 | Image { 141 | source: icon.source 142 | width: units.gu(16.1) 143 | height: width * icon.sourceSize.height/icon.sourceSize.width 144 | visible: !iconFrame && !landscape 145 | 146 | anchors.horizontalCenter: parent.horizontalCenter 147 | } 148 | 149 | Label { 150 | fontSize: "large" 151 | text: appName 152 | visible: !landscape 153 | anchors.horizontalCenter: parent.horizontalCenter 154 | } 155 | 156 | Column { 157 | anchors.horizontalCenter: parent.horizontalCenter 158 | 159 | Label { 160 | font.bold: true 161 | anchors.horizontalCenter: parent.horizontalCenter 162 | text: author 163 | } 164 | 165 | Label { 166 | anchors.horizontalCenter: parent.horizontalCenter 167 | text: contactEmail 168 | } 169 | } 170 | 171 | Label { 172 | text: colorLinks(i18n.tr("Report a BugWebsite").arg(reportABug).arg(website)) 173 | anchors.horizontalCenter: parent.horizontalCenter 174 | onLinkActivated: Qt.openUrlExternally(link) 175 | } 176 | 177 | Label { 178 | text: i18n.tr("Version %1").arg(version) 179 | anchors.horizontalCenter: parent.horizontalCenter 180 | } 181 | 182 | Label { 183 | text: i18n.tr(copyright) 184 | anchors.horizontalCenter: parent.horizontalCenter 185 | } 186 | } 187 | } 188 | 189 | Item { 190 | anchors { 191 | right: parent.right 192 | top: parent.top 193 | bottom: parent.bottom 194 | rightMargin: show ? 0 : -width 195 | 196 | Behavior on rightMargin { 197 | UbuntuNumberAnimation {} 198 | } 199 | } 200 | 201 | width: parent.width 202 | 203 | opacity: show ? 1 : 0 204 | 205 | Behavior on opacity { 206 | UbuntuNumberAnimation {} 207 | } 208 | 209 | property bool show: head.sections.selectedIndex == 1 210 | 211 | ListView { 212 | anchors.fill: parent 213 | model: List.objectKeys(credits) 214 | delegate: ListItem.SingleValue { 215 | text: modelData 216 | value: credits[modelData] 217 | } 218 | } 219 | } 220 | } 221 | -------------------------------------------------------------------------------- /Application.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import Ubuntu.Components 1.1 3 | MainView { 4 | id: mainView 5 | 6 | objectName: "mainView" 7 | 8 | automaticOrientation: true 9 | anchorToKeyboard: true 10 | 11 | width: units.gu(100) 12 | height: units.gu(75) 13 | 14 | useDeprecatedToolbar: false 15 | 16 | property var colors: { 17 | "green": "#5cb85c", 18 | "red": "#db3131", 19 | "yellow": "#f0ad4e", 20 | "blue": "#5bc0f9", 21 | "orange": UbuntuColors.orange, 22 | "default": Theme.palette.normal.baseText, 23 | } 24 | 25 | property bool wideAspect: width > units.gu(80) 26 | property bool extraWideAspect: width > units.gu(150) 27 | 28 | property Page initialPage 29 | property alias pages: pageStack.children 30 | 31 | PageStack { 32 | id: pageStack 33 | 34 | anchors.bottomMargin: wideAspect && mainView.toolbar.opened && mainView.toolbar.locked ? -mainView.toolbar.triggerSize : 0 35 | 36 | Component.onCompleted: { 37 | if (initialPage) 38 | pageStack.push(initialPage) 39 | } 40 | } 41 | 42 | Notification { 43 | id: notification 44 | } 45 | 46 | function toast(text, icon) { 47 | notification.show(text, icon) 48 | } 49 | 50 | function error(title, message, action) { 51 | PopupUtils.open(Qt.resolvedUrl("NotifyDialog.qml"), mainView, 52 | { 53 | title: title, 54 | text: message, 55 | action:action 56 | }) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /AutoSpacedGrid.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | 25 | Item { 26 | id: root 27 | 28 | 29 | property int cellWidth 30 | property int cellHeight 31 | 32 | property int xCount 33 | property int yCount: { 34 | var count = cellCount/xCount 35 | if (cellCount % xCount > 0) 36 | count++ 37 | return count 38 | } 39 | 40 | height: yCount * cellHeight + (yCount) * ySpacing 41 | 42 | property int cellCount 43 | 44 | Component.onCompleted: layout() 45 | 46 | onWidthChanged: layout() 47 | 48 | // FIXME: A really uggly hack to get the layout right 49 | Timer { 50 | interval: 1 51 | running: true 52 | onTriggered: layout() 53 | } 54 | 55 | function layout() { 56 | var count = 1 57 | var space = calcSpacing(count) 58 | while (space >= minSpacing) { 59 | count++ 60 | space = calcSpacing(count) 61 | } 62 | 63 | count-- 64 | spacing = calcSpacing(count) 65 | if (root.cellCount <= count) { 66 | spacing = minSpacing 67 | } 68 | 69 | xCount = count 70 | //print("Spacing is", spacing, xCount) 71 | } 72 | 73 | function calcSpacing(count) { 74 | var spacing = (width - count * cellWidth)/(count) 75 | //print("Spacing for count", count, "is", spacing/8, "gu") 76 | return spacing 77 | } 78 | 79 | property real spacing 80 | property int minSpacing: units.gu(2) 81 | property real outerSpacing: 1/2 * spacing 82 | property real outerYSpacing: 1/2 * ySpacing 83 | property real ySpacing: spacing 84 | 85 | default property alias children: grid.children 86 | 87 | Grid { 88 | id: grid 89 | anchors { 90 | fill: parent 91 | leftMargin: root.outerSpacing 92 | rightMargin: root.outerSpacing 93 | topMargin: root.outerYSpacing 94 | bottomMargin: root.outerYSpacing 95 | } 96 | 97 | columns: xCount 98 | 99 | columnSpacing: root.spacing 100 | rowSpacing: root.ySpacing 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /BarGraph.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 26 | 27 | Item { 28 | id: root 29 | 30 | property var colors: [] 31 | property var values: [[]] 32 | property var names: [] 33 | property var labels: [] 34 | 35 | property bool autoSize: false // true to show more values the wider the graph 36 | property int count: autoSize ? Math.round((graph.width + repeater.spacing)/(barWidth + repeater.spacing), 0) - 1 : values.length 37 | property int maxValue 38 | property int barWidth: autoSize ? units.gu(3) : units.gu(3) // TODO: Auto calculate? 39 | 40 | property real scale: (graph.height - 2)/maxValue 41 | 42 | function shouldDisplay(index) { 43 | var max = 10 44 | var total = count 45 | //print("Should Display?", 10 % (index * 10/total)) 46 | var result = 10 % (index * 10/total) 47 | return true 48 | } 49 | 50 | Row { 51 | id: legendBar 52 | 53 | anchors { 54 | top: parent.top 55 | horizontalCenter: parent.horizontalCenter 56 | margins: units.gu(2) 57 | } 58 | 59 | spacing: units.gu(3) 60 | 61 | Repeater { 62 | model: names.length 63 | delegate: Row { 64 | spacing: units.gu(1) 65 | UbuntuShape { 66 | anchors.verticalCenter: parent.verticalCenter 67 | width: units.gu(3) 68 | height: width 69 | color: colors[index] 70 | } 71 | Label { 72 | anchors.verticalCenter: parent.verticalCenter 73 | text: names[index] 74 | //color: Theme.palette.normal.overlayText 75 | } 76 | } 77 | } 78 | } 79 | 80 | UbuntuShape { 81 | id: graph 82 | color: "white" 83 | //border.color: "darkgray" 84 | radius: "medium" 85 | 86 | anchors { 87 | top: legendBar.bottom 88 | left: parent.left 89 | leftMargin: units.gu(4) 90 | right: parent.right 91 | bottom: parent.bottom 92 | margins: units.gu(2) 93 | bottomMargin: units.gu(9) 94 | } 95 | 96 | Repeater { 97 | model: root.maxValue + 1 98 | 99 | delegate: Rectangle { 100 | visible: shouldDisplay(index) 101 | color: index === root.maxValue || index === 0 ? "transparent" : "lightgray" 102 | height: 1 103 | y: root.scale * index + 1 104 | anchors { 105 | left: parent.left 106 | right: parent.right 107 | margins: 1 108 | } 109 | 110 | Label { 111 | text: root.maxValue - modelData 112 | visible: shouldDisplay(index) 113 | //color: Theme.palette.normal.overlayText 114 | anchors { 115 | right: parent.left 116 | rightMargin: units.gu(1) 117 | verticalCenter: parent.verticalCenter 118 | } 119 | } 120 | } 121 | } 122 | 123 | Row { 124 | id: repeater 125 | 126 | anchors { 127 | bottom: parent.bottom 128 | horizontalCenter: parent.horizontalCenter 129 | } 130 | 131 | spacing: units.gu(1) 132 | 133 | Repeater { 134 | model: root.values 135 | delegate: BarGraphBar { 136 | graph: root 137 | width: barWidth 138 | height: graph.height 139 | values: root.values[index] 140 | label: labels[index] || "" 141 | } 142 | } 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /BarGraphBar.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 26 | 27 | Item { 28 | id: root 29 | 30 | property var graph 31 | property var values: [] 32 | property string label 33 | 34 | anchors { 35 | bottom: parent.bottom 36 | bottomMargin: 1 37 | } 38 | 39 | Item { 40 | width: labelItem.height 41 | height: labelItem.width 42 | anchors.top: parent.bottom 43 | anchors.topMargin: units.gu(1.5) 44 | anchors.horizontalCenter: parent.horizontalCenter 45 | Label { 46 | id: labelItem 47 | rotation: -90 48 | text: label 49 | anchors.centerIn: parent 50 | } 51 | } 52 | 53 | Column { 54 | id: column 55 | anchors.bottom: parent.bottom 56 | width: parent.width 57 | 58 | Repeater { 59 | id: repeater 60 | model: values 61 | 62 | delegate: Rectangle { 63 | property int reversedIndex: repeater.count - index - 1 64 | width: root.width 65 | height: values[reversedIndex] * (graph.scale) 66 | color: graph.colors[reversedIndex] 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB UBUNTU-UI-EXTRAS_QML_JS_FILES *.qml *.js) 2 | 3 | # make the files visible in the qtcreator tree 4 | add_custom_target(ubuntu-ui-extras_QMlFiles ALL SOURCES ${UBUNTU-UI-EXTRAS_QML_JS_FILES}) 5 | 6 | install(FILES ${UBUNTU-UI-EXTRAS_QML_JS_FILES} DESTINATION ${APP_DIR}/ubuntu-ui-extras) 7 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /ColumnFlow.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | /* 4 | example usage: 5 | 6 | Rectangle { 7 | width: 600 8 | height: 600 9 | 10 | ColumnFlow { 11 | id: grid 12 | anchors.fill: parent 13 | columns: 5 14 | model: 20 15 | 16 | delegate: Rectangle { 17 | id: item 18 | height: 100.0 * Math.random() 19 | color: Qt.rgba(Math.random(), Math.random(), Math.random(), Math.random()) 20 | Text {text: index} 21 | } 22 | } 23 | } 24 | */ 25 | Item { 26 | id: columnFlow 27 | 28 | property int columns: 1 29 | property bool repeaterCompleted: false 30 | property alias model: repeater.model 31 | property alias delegate: repeater.delegate 32 | property int contentHeight: 0 33 | 34 | onColumnsChanged: reEvalColumns() 35 | onModelChanged: reEvalColumns() 36 | 37 | onWidthChanged: updateWidths() 38 | 39 | function updateWidths() { 40 | if (repeaterCompleted) { 41 | var count = 0 42 | 43 | //add the first elements 44 | for (var i = 0; count < columns && i < columnFlow.children.length; i++) { 45 | //print(i, count) 46 | if (!columnFlow.children[i] || String(columnFlow.children[i]).indexOf("QQuickRepeater") == 0 47 | || !columnFlow.children[i].visible) continue 48 | 49 | columnFlow.children[i].width = width / columns 50 | count++ 51 | } 52 | } 53 | } 54 | 55 | function reEvalColumns() { 56 | if (columnFlow.repeaterCompleted === false) 57 | return 58 | 59 | if (columns === 0) { 60 | contentHeight = 0 61 | return 62 | } 63 | 64 | var i, j 65 | var columnHeights = new Array(columns); 66 | var lastItem = new Array(columns) 67 | var lastI = -1 68 | var count = 0 69 | 70 | //add the first elements 71 | for (i = 0; count < columns && i < columnFlow.children.length; i++) { 72 | if (!columnFlow.children[i] || String(columnFlow.children[i]).indexOf("QQuickRepeater") == 0 73 | || !columnFlow.children[i].visible) continue 74 | 75 | 76 | lastItem[count] = i 77 | columnHeights[count] = columnFlow.children[i].height 78 | 79 | columnFlow.children[i].anchors.top = columnFlow.top 80 | columnFlow.children[i].anchors.left = (lastI === -1 ? columnFlow.left : columnFlow.children[lastI].right) 81 | columnFlow.children[i].anchors.right = undefined 82 | columnFlow.children[i].width = columnFlow.width / columns 83 | 84 | lastI = i 85 | count++ 86 | } 87 | 88 | //add the other elements 89 | for (i = i; i < columnFlow.children.length; i++) { 90 | var highestHeight = Number.MAX_VALUE 91 | var newColumn = 0 92 | 93 | if (!columnFlow.children[i] || String(columnFlow.children[i]).indexOf("QQuickRepeater") == 0 94 | || !columnFlow.children[i].visible) continue 95 | 96 | // find the shortest column 97 | for (j = 0; j < columns; j++) { 98 | if (columnHeights[j] !== null && columnHeights[j] < highestHeight) { 99 | newColumn = j 100 | highestHeight = columnHeights[j] 101 | } 102 | } 103 | 104 | // add the element to the shortest column 105 | columnFlow.children[i].anchors.top = columnFlow.children[lastItem[newColumn]].bottom 106 | columnFlow.children[i].anchors.left = columnFlow.children[lastItem[newColumn]].left 107 | columnFlow.children[i].anchors.right = columnFlow.children[lastItem[newColumn]].right 108 | 109 | lastItem[newColumn] = i 110 | columnHeights[newColumn] += columnFlow.children[i].height 111 | } 112 | 113 | var cHeight = 0 114 | 115 | for (i = 0; i < columnHeights.length; i++) { 116 | if (columnHeights[i]) 117 | cHeight = Math.max(cHeight, columnHeights[i]) 118 | } 119 | 120 | contentHeight = cHeight 121 | 122 | updateWidths() 123 | } 124 | 125 | Repeater { 126 | id: repeater 127 | model: columnFlow.model 128 | 129 | Component.onCompleted: { 130 | columnFlow.repeaterCompleted = true 131 | columnFlow.reEvalColumns() 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /ConfirmDialog.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.Popups 1.0 26 | import Ubuntu.Components.ListItems 1.0 as ListItem 27 | 28 | Dialog { 29 | id: root 30 | 31 | signal accepted 32 | signal rejected 33 | 34 | property alias cancelText: buttons.rejectText 35 | property alias acceptText: buttons.acceptText 36 | property alias acceptColor: buttons.acceptColor 37 | 38 | DialogButtonRow { 39 | id: buttons 40 | 41 | onAccepted: { 42 | PopupUtils.close(root) 43 | root.accepted() 44 | } 45 | 46 | onRejected: { 47 | PopupUtils.close(root) 48 | root.rejected() 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /DialogButtonRow.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Ubuntu UI Extras - A collection of QML widgets not available 3 | * in the default Ubuntu UI Toolkit 4 | * 5 | * Copyright (C) 2014 Michael Spencer 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | import QtQuick 2.0 21 | import Ubuntu.Components 1.1 22 | 23 | 24 | Item { 25 | width: parent.width 26 | height: childrenRect.height 27 | 28 | signal accepted 29 | signal rejected 30 | 31 | property alias acceptText: okButton.text 32 | property alias rejectText: cancelButton.text 33 | property alias acceptColor: okButton.color 34 | 35 | property alias enabled: okButton.enabled 36 | 37 | Button { 38 | id: cancelButton 39 | objectName: "cancelButton" 40 | text: i18n.tr("Cancel") 41 | 42 | anchors { 43 | left: parent.left 44 | right: parent.horizontalCenter 45 | rightMargin: units.gu(1) 46 | } 47 | 48 | onTriggered: { 49 | rejected() 50 | } 51 | } 52 | 53 | Button { 54 | id: okButton 55 | objectName: "okButton" 56 | 57 | anchors { 58 | left: parent.horizontalCenter 59 | right: parent.right 60 | leftMargin: units.gu(1) 61 | } 62 | 63 | text: i18n.tr("Ok") 64 | color: "#3fb24f" 65 | 66 | onTriggered: { 67 | print("TRIGGERED") 68 | accepted() 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /InputDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Ubuntu UI Extras - A collection of QML widgets not available 3 | * in the default Ubuntu UI Toolkit 4 | * 5 | * Copyright (C) 2014 Michael Spencer 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | import QtQuick 2.0 21 | import Ubuntu.Components 1.1 22 | import Ubuntu.Components.Popups 1.0 23 | import Ubuntu.Components.ListItems 1.0 as ListItem 24 | 25 | Dialog { 26 | id: root 27 | 28 | signal accepted 29 | signal rejected 30 | 31 | property alias value: textField.text 32 | property alias placeholderText: textField.placeholderText 33 | 34 | Component.onCompleted: { 35 | textField.forceActiveFocus() 36 | textField.cursorPosition = textField.text.length 37 | } 38 | 39 | property bool valid: true 40 | 41 | TextField { 42 | id: textField 43 | objectName: "inputField" 44 | 45 | onAccepted: if (valid) buttons.accepted() 46 | validator: RegExpValidator { 47 | regExp: /.+/ 48 | } 49 | } 50 | 51 | DialogButtonRow { 52 | id: buttons 53 | 54 | enabled: textField.acceptableInput && valid 55 | 56 | onAccepted: { 57 | PopupUtils.close(root) 58 | root.accepted() 59 | } 60 | 61 | onRejected: { 62 | PopupUtils.close(root) 63 | root.rejected() 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ListItemBackground.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 26 | 27 | // Widget based on code from Clock app 28 | Rectangle { 29 | id: swipeBackgroundItem 30 | 31 | property url iconSource 32 | property string text 33 | 34 | anchors.fill: parent 35 | //color: Theme.palette.normal.base; 36 | anchors.bottomMargin: units.dp(2) 37 | color: Qt.rgba(0,0,0,0.3) 38 | property color fontColor: Theme.palette.normal.baseText//Theme.palette.selected.backgroundText 39 | 40 | Image { 41 | id: leftSwipeDeleteIcon 42 | 43 | anchors { 44 | top: leftSwipeBackgroundText.top 45 | right: leftSwipeBackgroundText.left 46 | rightMargin: units.gu(1) 47 | bottom: leftSwipeBackgroundText.bottom 48 | } 49 | source: swipeBackgroundItem.iconSource 50 | width: height 51 | visible: swipeBackgroundItem.state === "SwipingRight" 52 | } 53 | 54 | Label { 55 | id: leftSwipeBackgroundText 56 | visible: swipeBackgroundItem.state === "SwipingRight" 57 | text: swipeBackgroundItem.text 58 | color: fontColor 59 | 60 | anchors { 61 | verticalCenter: parent.verticalCenter 62 | right: parent.right 63 | rightMargin: units.gu(2) 64 | } 65 | 66 | fontSize: "large" 67 | } 68 | 69 | 70 | Image { 71 | id: rightSwipeDeleteIcon 72 | source: swipeBackgroundItem.iconSource 73 | 74 | anchors { 75 | top: rightSwipeBackgroundText.top 76 | left: rightSwipeBackgroundText.right 77 | leftMargin: units.gu(1) 78 | bottom: rightSwipeBackgroundText.bottom 79 | } 80 | width: height 81 | visible: swipeBackgroundItem.state === "SwipingLeft" 82 | } 83 | 84 | Label { 85 | id: rightSwipeBackgroundText 86 | visible: swipeBackgroundItem.state === "SwipingLeft" 87 | text: swipeBackgroundItem.text 88 | color: fontColor 89 | 90 | anchors { 91 | verticalCenter: parent.verticalCenter 92 | left: parent.left 93 | leftMargin: units.gu(2) 94 | } 95 | 96 | fontSize: "large" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /MasterDetailView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import Ubuntu.Components 1.1 3 | import Ubuntu.Components.ListItems 1.0 as ListItem 4 | 5 | Item { 6 | id: view 7 | 8 | property alias model: messagesList.model 9 | property bool itemSelected 10 | property Component delegate 11 | property alias masterWidth: messagesList.width 12 | property alias content: contentView.children 13 | property alias count: messagesList.count 14 | property string noneMessage: "No messages" 15 | property string noneSelected: "No message selected" 16 | property alias header: messagesList.header 17 | property alias footer: _footer.children 18 | 19 | property bool forceSidebar: false 20 | 21 | property Action action: null 22 | 23 | Label { 24 | opacity: 0.5 25 | fontSize: "large" 26 | text: noneMessage 27 | visible: messagesList.count === 0 && !forceSidebar 28 | anchors.centerIn: parent 29 | } 30 | 31 | Item { 32 | visible: messagesList.count > 0 || forceSidebar 33 | anchors.fill: parent 34 | 35 | Sidebar { 36 | id: sidebar 37 | width: Math.max(units.gu(30), Math.min(units.gu(40), view.width * 1/3)) 38 | 39 | autoFlick: false 40 | 41 | ListView { 42 | id: messagesList 43 | anchors { 44 | left: parent.left 45 | right: parent.right 46 | top: parent.top 47 | bottom: _footer.top 48 | } 49 | 50 | 51 | clip: true 52 | delegate: view.delegate 53 | } 54 | 55 | Scrollbar { 56 | flickableItem: messagesList 57 | } 58 | 59 | 60 | 61 | Column { 62 | id: _footer 63 | 64 | visible: view.action 65 | 66 | anchors { 67 | left: parent.left 68 | right: parent.right 69 | bottom: parent.bottom 70 | } 71 | 72 | Rectangle { 73 | width: parent.width 74 | height: addButton.height + units.gu(2) 75 | 76 | ListItem.ThinDivider { 77 | anchors.top: parent.top 78 | } 79 | 80 | color: Qt.rgba(0,0,0,0.2) 81 | 82 | Button { 83 | id: addButton 84 | anchors.centerIn: parent 85 | width: parent.width - units.gu(2) 86 | 87 | text: view.action.text 88 | enabled: view.action.enabled 89 | onClicked: view.action.triggered(addButton) 90 | } 91 | } 92 | } 93 | } 94 | 95 | Item { 96 | id: contents 97 | anchors { 98 | left: sidebar.right 99 | top: parent.top 100 | bottom: parent.bottom 101 | right: parent.right 102 | } 103 | 104 | Label { 105 | opacity: 0.5 106 | fontSize: "large" 107 | text: noneSelected 108 | visible: !itemSelected 109 | anchors.centerIn: parent 110 | } 111 | 112 | Item { 113 | id: contentView 114 | anchors.fill: parent 115 | } 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Notification.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import Ubuntu.Components 1.1 3 | 4 | Rectangle { 5 | id: notification 6 | 7 | anchors { 8 | horizontalCenter: parent.horizontalCenter 9 | bottom: parent.bottom 10 | bottomMargin: (mainView.useDeprecatedToolbar && toolbar.opened && !toolbar.locked ? toolbar.height : 0) + units.gu(2) + ((!mainView.anchorToKeyboard && Qt.inputMethod.visible) ? Qt.inputMethod.keyboardRectangle.height : 0) 11 | leftMargin: units.gu(2) 12 | rightMargin: units.gu(2) 13 | } 14 | 15 | readonly property real labelPadding: units.gu(4.5) 16 | 17 | height: label.height + units.gu(3) 18 | width: label.width + labelPadding 19 | radius: label.height / (2 * label.lineCount) + units.gu(1.5) 20 | color: Qt.rgba(0,0,0,0.7) 21 | 22 | opacity: showing ? 1 : 0 23 | 24 | Behavior on opacity { 25 | UbuntuNumberAnimation {} 26 | } 27 | 28 | property bool showing: false 29 | property alias text: label.text 30 | property MainView mainView 31 | property var queue: [] 32 | property color textColor: "white" 33 | 34 | Component.onCompleted: mainView = findMainView() //This cannot be done as a property binding because the method will later return the QQuickRootItem. 35 | 36 | function show(text) { 37 | queue.push(text) 38 | if (!showing && !timer.running) { //!timer.running for the time between two notifications (when timer.interval === 800) 39 | update() 40 | } 41 | } 42 | 43 | function update() { 44 | notification.text = "" 45 | notification.text = queue.shift() 46 | notification.showing = true 47 | } 48 | 49 | onShowingChanged: { 50 | if (showing) { 51 | timer.restart() 52 | } else { 53 | if (queue.length > 0) { 54 | timer.interval = 800 55 | timer.restart() 56 | } 57 | } 58 | } 59 | 60 | Label { 61 | id: label 62 | anchors.centerIn: parent 63 | fontSize: "medium" 64 | color: textColor 65 | horizontalAlignment: Text.AlignHCenter 66 | wrapMode: Text.WordWrap 67 | 68 | property real wantedWidth: 0 //Needed for multi-line notifications 69 | 70 | onTextChanged: { 71 | if (text !== "") { 72 | wantedWidth = Math.min(contentWidth, mainView.width - notification.anchors.rightMargin - notification.anchors.leftMargin - notification.labelPadding) 73 | } else { 74 | wantedWidth = 0 75 | } 76 | } 77 | 78 | state: (wantedWidth === 0) ? "" : "wanted" 79 | states: [ 80 | State { 81 | name: "" 82 | }, 83 | State { 84 | name: "wanted" 85 | 86 | PropertyChanges { 87 | target: label 88 | width: wantedWidth 89 | } 90 | } 91 | ] 92 | } 93 | 94 | Timer { 95 | id: timer 96 | interval: 2000 97 | onTriggered: { 98 | if (interval === 2000) { 99 | showing = false 100 | } else { 101 | interval = 2000 102 | update() 103 | } 104 | } 105 | } 106 | 107 | function findMainView() { 108 | var up = parent 109 | while (up.parent !== null) { 110 | up = up.parent 111 | } 112 | return up 113 | } 114 | } 115 | 116 | -------------------------------------------------------------------------------- /NotifyDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 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 version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.0 19 | import Ubuntu.Components 1.1 20 | import Ubuntu.Components.Popups 1.0 21 | 22 | Dialog { 23 | id: root 24 | 25 | signal accepted() 26 | 27 | Button { 28 | text: i18n.tr("Ok") 29 | onClicked: { 30 | PopupUtils.close(root) 31 | accepted() 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ubuntu UI Extras 2 | ================ 3 | 4 | A collection of QML widgets not available in the default Ubuntu UI Toolkit. 5 | 6 | ### Included Widgets ### 7 | 8 | * Sidebar 9 | * HideableTab 10 | * BarGraph 11 | 12 | ### How to Use ### 13 | 14 | To use, you will need [Code Units](https://github.com/iBeliever/code-units), a small utility to download bits of code. 15 | 16 | Once Code Units is installed, you can use the Ubuntu UI Extras by running 17 | 18 | code install ubuntu-ui-extras 19 | code use ubuntu-ui-extras 20 | 21 | And make sure you add `ubuntu-ui-extras` to your git ignore. 22 | 23 | To update the `ubuntu-ui-extras`, run: 24 | 25 | code update ubuntu-ui-extras 26 | 27 | To use a component from QML, import it like this: 28 | 29 | import "ubuntu-ui-extras" 30 | 31 | Or, if you're in a subdirectory like `ui` or `components`, you'll need 32 | 33 | import "../ubuntu-ui-extras" 34 | 35 | Than use whatever components you want just as any component in the Ubuntu UI Toolkit! 36 | -------------------------------------------------------------------------------- /Sidebar.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 26 | 27 | /*! 28 | \qmltype Sidebar 29 | \brief A sidebar component for use in adaptive layouts 30 | 31 | To use, simply add an instance to your code, and anchor other components to it. 32 | 33 | To show or hide, set the expanded property. 34 | 35 | By default, the sidebar has a flickable built in, and whatever contents are added 36 | will be placed in the flickable. When you want this disabled, or want to fill the 37 | entire sidebar, set the autoFill property to false. 38 | 39 | Examples: 40 | \qml 41 | property bool wideAspect: width > units.gu(80) 42 | 43 | Sidebar { 44 | expanded: wideAspect 45 | 46 | // Anchoring is automatic 47 | } 48 | \endqml 49 | */ 50 | Rectangle { 51 | id: root 52 | 53 | color: Qt.rgba(0.2,0.2,0.2,0.6) 54 | 55 | property bool expanded: true 56 | 57 | function toggle() { 58 | expanded = !expanded 59 | } 60 | 61 | property string mode: "left" // or "right" 62 | property alias header: headerItem.text 63 | 64 | property alias dividerColor: divider.color 65 | 66 | anchors { 67 | left: mode === "left" ? parent.left : undefined 68 | right: mode === "right" ? parent.right : undefined 69 | top: parent.top 70 | bottom: parent.bottom 71 | } 72 | 73 | VerticalDivider { 74 | id: divider 75 | mode: root.mode 76 | 77 | anchors { 78 | top: parent.top 79 | bottom: parent.bottom 80 | right: mode === "left" ? parent.right : undefined 81 | left: mode === "right" ? parent.left : undefined 82 | //rightMargin: -1 83 | } 84 | } 85 | 86 | width: units.gu(35) 87 | 88 | 89 | anchors.leftMargin: expanded ? 0 : -width 90 | anchors.rightMargin: expanded ? 0 : -width 91 | 92 | Behavior on anchors.leftMargin { 93 | UbuntuNumberAnimation {} 94 | } 95 | 96 | Behavior on anchors.rightMargin { 97 | UbuntuNumberAnimation {} 98 | } 99 | 100 | default property alias contents: contents.data 101 | 102 | Header { 103 | id: headerItem 104 | 105 | visible: text !== "" 106 | } 107 | 108 | property bool autoFlick: true 109 | 110 | Flickable { 111 | id: flickable 112 | 113 | clip: true 114 | 115 | anchors { 116 | top: headerItem.visible ? headerItem.bottom : parent.top 117 | left: parent.left 118 | right: parent.right 119 | bottom: parent.bottom 120 | rightMargin: mode === "left" ? 1 : 0 121 | leftMargin: mode === "right" ? 1 : 0 122 | } 123 | 124 | contentWidth: width 125 | contentHeight: autoFlick ? contents.height : height 126 | interactive: contentHeight > height 127 | 128 | Item { 129 | id: contents 130 | 131 | width: flickable.width 132 | height: autoFlick ? childrenRect.height : flickable.height 133 | } 134 | 135 | function getFlickableChild(item) { 136 | if (item && item.hasOwnProperty("children")) { 137 | for (var i=0; i < item.children.length; i++) { 138 | var child = item.children[i]; 139 | if (internal.isVerticalFlickable(child)) { 140 | if (child.anchors.top === projectPage.top || child.anchors.fill === projectPage) { 141 | return item.children[i]; 142 | } 143 | } 144 | } 145 | } 146 | return null; 147 | } 148 | } 149 | 150 | Scrollbar { 151 | flickableItem: flickable 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /TabView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import Ubuntu.Components 1.1 3 | 4 | ListView { 5 | id: tabView 6 | 7 | orientation: Qt.Horizontal 8 | 9 | highlightMoveDuration: UbuntuAnimation.SlowDuration 10 | clip: true 11 | 12 | snapMode: ListView.SnapOneItem 13 | interactive: false 14 | } 15 | -------------------------------------------------------------------------------- /Table.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 as ListItem 26 | 27 | Item { 28 | id: root 29 | 30 | property var columnHeaders: [] 31 | property var rowHeaders: [] 32 | 33 | property int columnCount: columnHeaders.length 34 | property int rowCount: rowHeaders.length 35 | 36 | property var model: [] 37 | 38 | property var delegate 39 | 40 | property int cellWidth: (root.width - headerWidth)/columnCount 41 | property int cellHeight: (root.height - headerHeight)/rowCount 42 | property int headerWidth: units.gu(4) 43 | property int headerHeight: units.gu(4) 44 | 45 | property color color: "white" 46 | property int radius: units.gu(2) 47 | 48 | property var modelCompleted: [] 49 | 50 | Rectangle { 51 | anchors { 52 | left: parent.left 53 | right: parent.right 54 | top: parent.top 55 | leftMargin: root.headerWidth 56 | } 57 | 58 | height: headerHeight * 3 59 | radius: root.radius 60 | antialiasing: true 61 | } 62 | 63 | Rectangle { 64 | anchors { 65 | left: parent.left 66 | bottom: parent.bottom 67 | top: parent.top 68 | topMargin: root.headerHeight 69 | } 70 | 71 | width: headerWidth * 3 72 | radius: root.radius 73 | antialiasing: true 74 | } 75 | 76 | Rectangle { 77 | anchors { 78 | left: parent.left 79 | bottom: parent.bottom 80 | top: parent.top 81 | right: parent.right 82 | topMargin: root.headerHeight 83 | leftMargin: root.headerWidth 84 | } 85 | 86 | radius: root.radius 87 | antialiasing: true 88 | } 89 | 90 | Repeater { 91 | model: columnCount 92 | delegate: Rectangle { 93 | anchors { 94 | top: parent.top 95 | bottom: parent.bottom 96 | topMargin: index === 0 ? root.headerHeight : 0 97 | } 98 | 99 | width: 1 100 | color: UbuntuColors.warmGrey 101 | x: (index) * cellWidth + headerWidth 102 | } 103 | } 104 | 105 | Column { 106 | anchors.fill: parent 107 | Row { 108 | anchors { 109 | left: parent.left 110 | leftMargin: root.headerWidth 111 | } 112 | 113 | Repeater { 114 | id: headerRepeater 115 | 116 | model: root.columnHeaders 117 | 118 | delegate: Label { 119 | width: cellWidth 120 | horizontalAlignment: Text.AlignHCenter 121 | text: modelData 122 | color: UbuntuColors.coolGrey 123 | height: root.headerHeight 124 | verticalAlignment: Text.AlignVCenter 125 | } 126 | } 127 | } 128 | 129 | Repeater { 130 | model: root.rowCount 131 | 132 | delegate: Column { 133 | anchors { 134 | left: parent.left 135 | right: parent.right 136 | } 137 | 138 | property int row: index 139 | 140 | Rectangle { 141 | anchors { 142 | left: parent.left 143 | right: parent.right 144 | leftMargin: index === 0 ? root.headerWidth : 0 145 | } 146 | 147 | height: 1 148 | color: UbuntuColors.warmGrey 149 | } 150 | 151 | Row { 152 | Item { 153 | width: root.headerWidth 154 | height: root.cellHeight 155 | 156 | Label { 157 | text: rowHeaders[index] 158 | anchors.centerIn: parent 159 | color: UbuntuColors.coolGrey 160 | rotation: -90 161 | } 162 | } 163 | 164 | Repeater { 165 | id: rowRepeater 166 | 167 | model: columnCount 168 | 169 | delegate: Item { 170 | height: root.cellHeight 171 | width: root.cellWidth 172 | 173 | property bool done: false 174 | 175 | MouseArea { 176 | anchors.fill: parent 177 | onClicked: done = !done 178 | } 179 | 180 | Label { 181 | anchors.fill: parent 182 | 183 | horizontalAlignment: Text.AlignHCenter 184 | verticalAlignment: Text.AlignVCenter 185 | text: root.model[row][index] 186 | color: UbuntuColors.coolGrey 187 | 188 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere 189 | opacity: done ? 0.2 : 1 190 | 191 | Behavior on opacity { 192 | UbuntuNumberAnimation {} 193 | } 194 | } 195 | 196 | Rectangle { 197 | anchors.centerIn: parent 198 | rotation: -180/Math.PI * Math.atan(parent.height/parent.width) 199 | width: Math.sqrt(parent.height * parent.height + parent.width * parent.width) 200 | height: 1 201 | color: UbuntuColors.warmGrey 202 | antialiasing: true 203 | smooth: true 204 | opacity: done ? 1 : 0 205 | 206 | Behavior on opacity { 207 | UbuntuNumberAnimation {} 208 | } 209 | } 210 | 211 | // Rectangle { 212 | // anchors.centerIn: parent 213 | // rotation: 180/Math.PI * Math.atan(parent.height/parent.width) 214 | // width: Math.sqrt(parent.height * parent.height + parent.width * parent.width) 215 | // height: 1 216 | // color: UbuntuColors.warmGrey 217 | // antialiasing: true 218 | // smooth: true 219 | // visible: done 220 | // } 221 | } 222 | } 223 | } 224 | } 225 | } 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /TimePicker.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 26 | 27 | UbuntuShape { 28 | color: Qt.rgba(0.5,0.5,0.5,0.4) 29 | 30 | width: units.gu(20) 31 | height: units.gu(18) 32 | 33 | Item { 34 | id: rectangle 35 | //color: Qt.rgba(0.2,0.2,0.2,0.2) 36 | 37 | anchors { 38 | fill: parent 39 | //left: parent.left 40 | //right: parent.right 41 | //top: header.bottom 42 | } 43 | 44 | Spinner { 45 | anchors { 46 | left: parent.left 47 | right: parent.horizontalCenter 48 | top: parent.top 49 | bottom: parent.bottom 50 | } 51 | 52 | minValue: 1 53 | value: 3 54 | maxValue: 12 55 | } 56 | VerticalDivider { 57 | anchors.horizontalCenter: parent.horizontalCenter 58 | anchors.margins: 1 59 | } 60 | 61 | Spinner { 62 | anchors { 63 | left: parent.horizontalCenter 64 | right: parent.right 65 | top: parent.top 66 | bottom: parent.bottom 67 | } 68 | 69 | minValue: 0 70 | maxValue: 59 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /UndoStack.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | 26 | Object { 27 | /* 28 | * Format for property changes is: 29 | * {message, type:"property", obj, prop, oldValue, newValue} 30 | * Format for actions is: 31 | * {message, type:"action", func, undoFunc, args} 32 | */ 33 | property var stack: [] 34 | 35 | function setProperty(message, obj, prop, value, oldValue) { 36 | if (oldValue === undefined) 37 | oldValue = obj[prop] 38 | obj[prop] = value 39 | stack.push({ 40 | message: message, 41 | type: "property", 42 | obj: obj, 43 | prop: prop, 44 | oldValue: oldValue, 45 | newValue: value 46 | }) 47 | } 48 | 49 | function doAction(message, func, undoFunc, args) { 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /VerticalDivider.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.ListItems 1.0 26 | import QtQuick 2.0 27 | 28 | Rectangle { 29 | id: root 30 | property string mode: "left" // or right 31 | 32 | color: "transparent" 33 | 34 | ThinDivider { 35 | id: divider 36 | rotation: mode === "left" ? 90 : -90 37 | visible: root.color.a === 0 38 | 39 | width: parent.height 40 | 41 | anchors { 42 | left: undefined 43 | right: undefined 44 | centerIn: parent 45 | } 46 | } 47 | width: divider.visible ? divider.height : units.dp(1) 48 | 49 | anchors { 50 | top: parent ? parent.top : undefined 51 | bottom: parent ? parent.bottom : undefined 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Walkthough.qml: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | import QtQuick 2.0 24 | import Ubuntu.Components 1.1 25 | import Ubuntu.Components.Popups 1.0 26 | import Ubuntu.Components.ListItems 1.0 as ListItem 27 | 28 | Page { 29 | id: root 30 | 31 | property list model 32 | 33 | property string appName 34 | property color completedPage 35 | property color incompletePage 36 | 37 | property bool exitable: false 38 | property bool swipingEnabled: true 39 | 40 | signal finished 41 | 42 | property bool showSkipButton: true 43 | property bool showFooter: true 44 | 45 | property alias currentIndex: listView.currentIndex 46 | property alias currentItem: listView.currentItem 47 | property alias pageCount: listView.count 48 | 49 | onFinished: { 50 | if (exitable) { 51 | pageStack.pop() 52 | } else { 53 | hideAnimation.start() 54 | } 55 | } 56 | 57 | SequentialAnimation { 58 | id: hideAnimation 59 | 60 | UbuntuNumberAnimation { 61 | duration: UbuntuAnimation.SlowDuration * 1/2 62 | target: root 63 | property: "opacity" 64 | from: 1; to: 0; 65 | } 66 | 67 | ScriptAction { 68 | script: { 69 | pageStack.pop(root) 70 | } 71 | } 72 | } 73 | 74 | Component.onCompleted: mainView.forceActiveFocus() 75 | 76 | Keys.onLeftPressed: { 77 | if (list.currentIndex > 0) 78 | list.currentIndex-- 79 | } 80 | 81 | Keys.onRightPressed: { 82 | if (list.currentIndex < list.count - 1) 83 | list.currentIndex++ 84 | } 85 | 86 | // Label to skip the walkthrough. Only visible on the first slide 87 | Label { 88 | id: skipLabel 89 | objectName:"skipButton" 90 | 91 | opacity: 0.5 92 | fontSize: "small" 93 | width: contentWidth 94 | text: listView.currentIndex === 0 ? i18n.tr("Already used %1? Skip the tutorial").arg(appName) : i18n.tr("Skip") 95 | 96 | visible: showSkipButton 97 | 98 | anchors { 99 | top: parent.top 100 | left: parent.left 101 | margins: units.gu(2) 102 | } 103 | 104 | MouseArea { 105 | anchors.fill: parent 106 | onClicked: root.finished() 107 | } 108 | } 109 | 110 | ListView { 111 | id: listView 112 | anchors { 113 | left: parent.left 114 | right: parent.right 115 | top: showSkipButton ? skipLabel.bottom : parent.top 116 | bottom: divider.top 117 | } 118 | 119 | model: root.model 120 | snapMode: ListView.SnapOneItem 121 | orientation: Qt.Horizontal 122 | highlightMoveDuration: UbuntuAnimation.FastDuration 123 | highlightRangeMode: ListView.StrictlyEnforceRange 124 | highlightFollowsCurrentItem: true 125 | interactive: swipingEnabled 126 | 127 | delegate: Item { 128 | width: listView.width 129 | height: listView.height 130 | clip: true 131 | 132 | Loader { 133 | anchors { 134 | fill: parent 135 | margins: units.gu(2) 136 | } 137 | 138 | sourceComponent: modelData 139 | } 140 | } 141 | } 142 | 143 | ListItem.ThinDivider { 144 | id: divider 145 | anchors.bottom: footer.top 146 | } 147 | 148 | Row { 149 | id: footer 150 | anchors.bottom: parent.bottom 151 | anchors.horizontalCenter: parent.horizontalCenter 152 | height: units.gu(6) 153 | 154 | anchors.bottomMargin: showFooter ? 0 : -(footer.height + divider.height) 155 | 156 | Behavior on anchors.bottomMargin { 157 | UbuntuNumberAnimation { 158 | duration: UbuntuAnimation.SlowDuration 159 | } 160 | } 161 | 162 | spacing: (height - size)/2 163 | 164 | property real size: units.gu(2) 165 | 166 | Repeater { 167 | model: listView.count 168 | delegate: Rectangle { 169 | anchors.verticalCenter: parent.verticalCenter 170 | width: footer.size 171 | height: width 172 | radius: width/2 173 | 174 | color: /*listView.currentIndex == index ? Qt.rgba(0,0,0,0.4) : */listView.currentIndex >= index ? colors["green"] : colors["default"] 175 | 176 | Behavior on color { 177 | ColorAnimation { 178 | duration: UbuntuAnimation.FastDuration 179 | } 180 | } 181 | 182 | MouseArea { 183 | anchors.fill: parent 184 | 185 | onClicked: { 186 | listView.currentIndex = index 187 | } 188 | } 189 | } 190 | } 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /header.in: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Whatsoever ye do in word or deed, do all in the name of the * 3 | * Lord Jesus, giving thanks to God and the Father by him. * 4 | * - Colossians 3:17 * 5 | * * 6 | * Ubuntu UI Extras - A collection of QML widgets not available * 7 | * in the default Ubuntu UI Toolkit * 8 | * Copyright (C) 2013 Michael Spencer * 9 | * * 10 | * This program is free software: you can redistribute it and/or modify * 11 | * it under the terms of the GNU General Public License as published by * 12 | * the Free Software Foundation, either version 2 of the License, or * 13 | * (at your option) any later version. * 14 | * * 15 | * This program is distributed in the hope that it will be useful, * 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 | * GNU General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU General Public License * 21 | * along with this program. If not, see . * 22 | ***************************************************************************/ 23 | -------------------------------------------------------------------------------- /ubuntu-ui-extras.qmlproject: -------------------------------------------------------------------------------- 1 | /* File generated by Qt Creator (with Ubuntu Plugin), version 2.7.1 */ 2 | 3 | import QmlProject 1.1 4 | 5 | Project { 6 | // mainFile: "tasks-app.qml" 7 | 8 | /* Include .qml, .js, and image files from current directory and subdirectories */ 9 | QmlFiles { 10 | directory: "." 11 | } 12 | JavaScriptFiles { 13 | directory: "." 14 | } 15 | ImageFiles { 16 | directory: "." 17 | } 18 | Files { 19 | directory: "icons/" 20 | filter: "*" 21 | } 22 | Files { 23 | directory: "tests/" 24 | filter: "*" 25 | } 26 | Files { 27 | directory: "debian" 28 | filter: "*" 29 | } 30 | Files { 31 | filter: "COPYING" 32 | } 33 | Files { 34 | filter: "*.md" 35 | } 36 | 37 | /* List of plugin directories passed to QML runtime */ 38 | importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ] 39 | } 40 | --------------------------------------------------------------------------------