add a bunch of test applets that already work

This commit is contained in:
Marco Martin 2013-09-04 11:38:14 +02:00
parent 8f74e67f9d
commit ea2af90699
27 changed files with 2935 additions and 1 deletions

View File

@ -1,4 +1,10 @@
plasma_install_package(localegallery org.kde.example.locale)
plasma_install_package(widgetgallery org.kde.example.widgetgallery)
plasma_install_package(qmltasks org.kde.example.tasks)
plasma_install_package(windowlist org.kde.example.windowlist)
plasma_install_package(conditionalloader org.kde.example.conditionalloader)
plasma_install_package(testcomponents org.kde.example.testcomponents)
plasma_install_package(testshaders org.kde.example.testshaders)
plasma_install_package(helloworld org.kde.examples.helloworld)
plasma_install_package(compactrepresentation org.kde.examples.compactrepresentation)

View File

@ -0,0 +1,38 @@
// -*- coding: iso-8859-1 -*-
/*
* Copyright 2012 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
property int minimumWidth: 200
property int minimumHeight: 300
property Component compactRepresentation: Component {
PlasmaComponents.Button {
text: i18n("Click me")
onClicked: plasmoid.expanded = !plasmoid.expanded
}
}
PlasmaComponents.Label {
text: i18n("Hello world")
}
}

View File

@ -0,0 +1,20 @@
[Desktop Entry]
Comment=
Encoding=UTF-8
Keywords=
Name=hello world
Type=Service
Icon=package_toys
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=Miscellaneous
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.examples.compactrepresentation
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet
X-Plasma-API=declarativeappletscript
X-Plasma-DefaultSize=200,100
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=

View File

@ -0,0 +1,32 @@
// -*- coding: iso-8859-1 -*-
/*
* Copyright 2012 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
property int minimumWidth: 200
property int minimumHeight: 300
PlasmaComponents.Label {
text: i18n("Hello world")
}
}

View File

@ -0,0 +1,20 @@
[Desktop Entry]
Comment=
Encoding=UTF-8
Keywords=
Name=hello world
Type=Service
Icon=package_toys
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=Miscellaneous
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.examples.helloworld
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet
X-Plasma-API=declarativeappletscript
X-Plasma-DefaultSize=200,100
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=

View File

@ -0,0 +1,482 @@
// -*- coding: iso-8859-1 -*-
/*
* Author: Giorgos Tsiapaliwkas <terietor@gmail.com>
* Date: Wed Feb 15 2012, 18:28:32
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.locale 2.0 as PlasmaLocale
Rectangle {
id: root
property int minimumHeight: 200
property int minimumWidth: 500
Column {
id: column
width: parent.width
height: parent.height
anchors.horizontalCenter: root.horizontalCenter
spacing: 20
PlasmaComponents.Label {
id: text1
width: parent.width
wrapMode: Text.WordWrap
text: "<B>This is a test plasmoid for the locale bindings</B>"
}
PlasmaComponents.Label {
id: text2
width: parent.width
wrapMode: Text.WordWrap
text: "<B>If you see this text,that means that every " +
" non printable property/method has been already set. And it works!!</B>"
}
PlasmaComponents.Button {
id: bt1
anchors.horizontalCenter: column.horizontalCenter
text: "click in order to test the Locale component"
onClicked:{
console.log("=====Locale Component====")
console.log("country:" + locale.country)
locale.binaryUnitDialect = PlasmaLocale.Locale.IECBinaryDialect
locale.calendarSystem = PlasmaLocale.Locale.CopticCalendar
locale.countryDivisionCode = "AL"
console.log("countryDivisionCode:" + locale.countryDivisionCode)
console.log("currencyCode:" + locale.currencyCode)
locale.currencySymbol = "$"
console.log("currencySymbol:" + locale.currencySymbol)
locale.dateTimeDigitSet = PlasmaLocale.Locale.EasternArabicIndicDigits
console.log(locale.formatLocaleTime( "11:12:13", Locale.TimeWithoutAmPm|Locale.TimeWithoutSeconds ))
console.log(locale.formatDateTime("2013-04-12", Locale.ShortDate ,Locale.Seconds ))
locale.dateFormat = "Y"
console.log("dateFormat:" + locale.dateFormat)
locale.dateFormatShort = "Y"
console.log("dateFormatShort:" + locale.dateFormatShort)
locale.dateMonthNamePossessive = false
console.log("dateMonthNamePossessive:" + locale.dateMonthNamePossessive)
locale.decimalPlaces = 2
console.log("decimalPlaces:" + locale.decimalPlaces)
locale.decimalSymbol = "."
console.log("decimalSymbol:" + locale.decimalSymbol)
locale.digitSet = PlasmaLocale.Locale.EasternArabicIndicDigits
console.log("digitSet:" + locale.digitSet)
console.log("language:" + locale.language)
locale.measureSystem = PlasmaLocale.Locale.Imperial
locale.monetaryDecimalPlaces = 3
console.log("monetaryDecimalPlaces:" + locale.monetaryDecimalPlaces)
locale.monetaryDecimalSymbol = "."
console.log("monetaryDecimalSymbol:" + locale.monetaryDecimalSymbol)
locale.monetaryDigitSet = PlasmaLocale.Locale.EasternArabicIndicDigits
locale.monetaryThousandsSeparator = "."
console.log("monetaryThousandsSeparator:" + locale.monetaryThousandsSeparator)
locale.negativeMonetarySignPosition = PlasmaLocale.Locale.AfterMoney
locale.negativePrefixCurrencySymbol = false
console.log("negativePrefixCurrencySymbol:" + locale.negativePrefixCurrencySymbol)
locale.negativeSign = "-"
console.log("negativeSign:" + locale.negativeSign)
locale.pageSize = 6
console.log("pageSize:" + locale.pageSize)
locale.positiveMonetarySignPosition = PlasmaLocale.Locale.AfterMoney
locale.positivePrefixCurrencySymbol = false
console.log("positivePrefixCurrencySymbol:" + locale.positivePrefixCurrencySymbol)
locale.positiveSign = "+"
console.log("positiveSign:" + locale.positiveSign)
locale.thousandsSeparator = "."
console.log("thousandsSeparator:" + locale.thousandsSeparator)
locale.weekDayOfPray = 10
console.log("weekDayOfPray:" + locale.weekDayOfPray)
locale.weekNumberSystem = PlasmaLocale.Locale.FirstFullWeek
locale.weekStartDay = 3
console.log("weekStartDay:" + locale.weekStartDay)
locale.workingWeekEndDay = 6
console.log("workingWeekEndDay:" + locale.workingWeekEndDay)
locale.workingWeekStartDay = 2
console.log("workingWeekStartDay:" + locale.workingWeekEndDay)
console.log("use12Clock:" + locale.use12Clock)
console.log("defaultLanguage:" + locale.defaultLanguage)
console.log("defaultCountry:" + locale.defaultCountry)
console.log("defaultCurrencyCode:" + locale.defaultCurrencyCode)
for (var i in locale.languageList) {
console.log("languageList:" + locale.languageList[i])
}
for (var i in locale.currencyCodeList) {
console.log("currencyCodeList:" + locale.currencyCodeList[i])
}
for (var i in locale.installedLanguages) {
console.log("installedLanguages:" + locale.installedLanguages[i])
}
for (var i in locale.allCountriesList) {
console.log("allCountriesList:" + locale.allCountriesList[i])
}
console.log("formatDate:" + locale.formatDate("2010-05-05"))
console.log("formatDateTime:" + locale.formatDateTime("2010-05-05"))
console.log("formatMoney:" + locale.formatMoney(10))
console.log("formatLong:" + locale.formatLong(10))
console.log("formatByteSize:" + locale.formatByteSize(10))
console.log("formatDuration:" + locale.formatDuration(10))
console.log("prettyFormatDuration:" + locale.prettyFormatDuration(10))
console.log("formatLocaleTime:" + locale.formatLocaleTime("11:12:13"))
console.log("dayPeriodText:" + locale.dayPeriodText("11:22:33"))
console.log("readMoney:" + locale.readMoney("$ 21"))
console.log("readNumber:" + locale.readNumber(10.0,3))
console.log("readDate:" + locale.readDate("2004-02-01", PlasmaLocale.Locale.IsoFormat))
console.log("readTime:" + locale.readTime("11:22:33 AM"))
console.log("readLocaleTime:" + locale.readLocaleTime("11:12:13 AM"))
console.log("fileEncodingMib:" + locale.fileEncodingMib)
console.log("languageCodeToName:" + locale.languageCodeToName("en_US"))
console.log("isApplicationTranslatedInto:" + locale.isApplicationTranslatedInto("en_US"))
console.log("removeAcceleratorMarker:" + locale.removeAcceleratorMarker("&*hello"))
console.log("convertDigits:" + locale.convertDigits(locale.digitSet, PlasmaLocale.Locale.ArabicDigits))
for (var i in locale.allDigitSetsList) {
console.log("allDigitSetsList:" + locale.allDigitSetsList[i])
}
console.log("===========end===========")
}
}
PlasmaComponents.Button {
id: bt2
property variant hash
anchors.horizontalCenter: column.horizontalCenter
text: "click in order to test the CalendarSystem component"
onClicked:{
console.log("=====CalendarSystem Component====")
console.log("calendarLabel:" + calendar.calendarLabel)
console.log("epoch:" + calendar.epoch)
console.log("earliestValidDate:" + calendar.earliestValidDate)
console.log("latestValidDate:" + calendar.latestValidDate)
console.log("shortYearWindowStartYear:" + calendar.shortYearWindowStartYear)
console.log("weekStartDay:" + locale.weekStartDay)
console.log("isLunar:" + calendar.isLunar)
console.log("isLunisolar:" + calendar.isLunisolar)
console.log("isSolar:" + calendar.isSolar)
console.log("isProleptic:" + calendar.isProleptic)
//Q_INVOKABLE methods
console.log("isValidIsoWeekDate:" + calendar.isValidIsoWeekDate(2012, 2, 3))
console.log("isValid:" + calendar.isValid("2012-02-03"))
console.log("year:" + calendar.year("2012-02-03"))
console.log("month:" + calendar.month("2012-02-03"))
console.log("day:" + calendar.day("2012-02-03"))
console.log("eraName:" + calendar.eraName("2012-02-03"))
console.log("eraYear:" + calendar.eraYear("2012-02-03"))
console.log("yearInEra:" + calendar.yearInEra("2012-02-03"))
console.log("addYears:" + calendar.addYears("2012-02-03", 3))
console.log("addMonthss:" + calendar.addMonths("2012-02-03", 3))
console.log("addDays:" + calendar.addDays("2012-02-03", 3))
console.log("yearsDifference:" + calendar.yearsDifference("2010-02-03", "2012-02-03"))
console.log("monthsDifference:" + calendar.monthsDifference("2012-02-03", "2012-04-03"))
console.log("daysDifference:" + calendar.daysDifference("2012-02-03", "2012-02-13"))
console.log("monthsInYear:" + calendar.monthsInYear(2012))
console.log("weeksInYear:" + calendar.weeksInYear(2012, PlasmaLocale.CalendarSystem.SimpleWeek))
console.log("daysInYear:" + calendar.daysInYear("2012-02-03"))
console.log("daysInMonth:" + calendar.daysInMonth(2012, 8))
console.log("daysInWeek:" + calendar.daysInWeek("2012-02-03"))
console.log("dayOfYear:" + calendar.dayOfYear("2012-02-03"))
console.log("week:" + calendar.week("2012-02-03", PlasmaLocale.CalendarSystem.SimpleWeek))
console.log("isLeapYear:" + calendar.isLeapYear(2012))
console.log("firstDayOfYear:" + calendar.firstDayOfYear(2012))
console.log("lastDayOfYear:" + calendar.lastDayOfYear(2012))
console.log("firstDayOfMonth:" + calendar.firstDayOfMonth(2012, 02))
console.log("lastDayOfMonth:" + calendar.lastDayOfMonth(2012, 02))
console.log("monthName:" + calendar.monthName(02, 2012))
console.log("weekDayName:" + calendar.weekDayName(3))
console.log("formatDate:" + calendar.formatDate("2012-02-03", PlasmaLocale.CalendarSystem.Year, PlasmaLocale.CalendarSystem.ShortNumber, PlasmaLocale.CalendarSystem.SimpleWeek))
console.log("readDate:" + calendar.readDate("2012-02-03", PlasmaLocale.CalendarSystem.IsoFormat))
console.log("applyShortYearWindow:" + calendar.applyShortYearWindow(50))
console.log("calendarSystem:" + calendar.calendarSystem)
console.log("getDate:")
hash = calendar.getDate("2012-02-03")
for (var i in hash) {
console.log(" " + i, "=", hash[i])
}
console.log("dateDifference:")
hash = calendar.dateDifference("2012-01-01", "2014-03-03")
for (var i in hash) {
console.log(" " + i, "=", hash[i])
}
for (var i in calendar.calendarSystemsList) {
console.log("calendarSystemsList:" + calendar.calendarSystemsList[i])
}
console.log("===============end===============")
}
}
PlasmaLocale.Locale {
id: locale
binaryUnitDialect: PlasmaLocale.Locale.DefaultBinaryUnits
onBinaryUnitDialectChanged: {
console.log("the binaryUnitDialect property has been changed")
}
calendarSystem: PlasmaLocale.Locale.QDateCalendar
onCalendarSystemChanged: {
console.log("the calendarSystem property has been changed")
}
onCurrencyCodeChanged: {
console.log("the currencyCode property has been changed")
}
currencySymbol: "$"
onCurrencySymbolChanged: {
console.log("the currencySymbol property has been changed")
}
countryDivisionCode: "AD"
onCountryDivisionCodeChanged: {
console.log("the countryDivisionCode property has been changed")
}
dateFormat: "y"
onDateFormatChanged: {
console.log("the dateFormat property has been changed")
}
dateFormatShort: "y"
onDateFormatShortChanged: {
console.log("the dateFormatShort property has been changed")
}
dateMonthNamePossessive: true
onDateMonthNamePossessiveChanged: {
console.log("the dateMonthNamePossessive property has been changed")
}
dateTimeDigitSet: PlasmaLocale.Locale.ArabicDigits
onDateTimeDigitSetChanged: {
console.log("the dateTimeDigitSet property has been changed")
}
decimalPlaces: 1
onDecimalPlacesChanged: {
console.log("the decimalPlaces property has been changed")
}
decimalSymbol: ","
onDecimalSymbolChanged: {
console.log("the decimalSymbol property has been changed")
}
digitSet: PlasmaLocale.Locale.ArabicDigits
onDigitSetChanged: {
console.log("the digitSet property has been changed")
}
measureSystem: PlasmaLocale.Locale.Metric
onMeasureSystemChanged: {
console.log("the measureSystem property has been changed")
}
monetaryDecimalPlaces: 2
onMonetaryDecimalPlacesChanged: {
console.log("the monetaryDecimalPlaces property has been changed")
}
monetaryDecimalSymbol: ","
onMonetaryDecimalSymbolChanged: {
console.log("the monetaryDecimalSymbol property has been changed")
}
monetaryDigitSet: PlasmaLocale.Locale.ArabicDigits
onMonetaryDigitSetChanged: {
console.log("the monetaryDigitSet property has been changed")
}
monetaryThousandsSeparator: ","
onMonetaryThousandsSeparatorChanged: {
console.log("the monetaryThousandsSeparator property has been changed")
}
negativeMonetarySignPosition: PlasmaLocale.Locale.ParensAround
onNegativeMonetarySignPositionChanged: {
console.log("the negativeMonetarySignPosition property has been changed")
}
negativePrefixCurrencySymbol: true
onNegativePrefixCurrencySymbolChanged: {
console.log("the negativePrefixCurrencySymbol property has been changed")
}
negativeSign: "-----"
onNegativeSignChanged: {
console.log("the negativeSign property has been changed")
}
pageSize: 5
onPageSizeChanged: {
console.log("the pageSign property has been changed")
}
positiveMonetarySignPosition: PlasmaLocale.Locale.ParensAround
onPositiveMonetarySignPositionChanged: {
console.log("the positiveMonetarySignPosition property has been changed")
}
positivePrefixCurrencySymbol: true
onPositivePrefixCurrencySymbolChanged: {
console.log("the positivePrefixCurrencySymbol property has been changed")
}
positiveSign: " "
onPositiveSignChanged: {
console.log("the positiveSign property has been changed")
}
thousandsSeparator: ","
onThousandsSeparatorChanged: {
console.log("the thousandsSeparator property has been changed")
}
weekDayOfPray: 20
onWeekDayOfPrayChanged: {
console.log("the weekDayOfPray property has been changed")
}
weekNumberSystem: PlasmaLocale.Locale.IsoWeekNumber
onWeekNumberSystemChanged: {
console.log("the weekNumberSystem property has been changed")
}
weekStartDay: 2
onWeekStartDayChanged: {
console.log("the weekStartDay property has been changed")
}
workingWeekEndDay: 5
onWorkingWeekEndDayChanged: {
console.log("the workingWeekEndDay property has been changed")
}
workingWeekStartDay: 1
onWorkingWeekStartDayChanged: {
console.log("the workingWeekStartDay property has been changed")
}
}
PlasmaLocale.CalendarSystem {
id: calendar
}
}
}

View File

@ -0,0 +1,18 @@
[Desktop Entry]
Encoding=UTF-8
Name=Locale gallery
Comment=gallery of KLocale QML Bindings
Type=Service
ServiceTypes=Plasma/Applet
Icon=preferences-desktop-theme
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-KDE-PluginInfo-Author=Giorgos Tsiapaliwkas
X-KDE-PluginInfo-Email=terietor@gmail.com
X-KDE-PluginInfo-Name=org.kde.example.locale
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Examples
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true

View File

@ -0,0 +1,74 @@
// -*- coding: iso-8859-1 -*-
/*
* Author: Marco Martin <mart@kde.org>
* Date: Sun Nov 7 2010, 18:51:24
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
width: 400
height: 32
property bool fillWidth: true
property bool fillHeight: true
PlasmaCore.DataSource {
id: tasksSource
dataEngine: "tasks"
interval: 0
onSourceAdded: {
connectSource(source)
}
Component.onCompleted: {
connectedSources = sources
}
}
function performOperation(src, what) {
var service = tasksSource.serviceForSource(src);
var operation = service.operationDescription(what);
return service.startOperationCall(operation);
}
ListView {
//clip: true
id: tasksList
anchors.fill: parent
orientation: ListView.Horizontal
model: PlasmaCore.DataModel {
dataSource: tasksSource
}
delegate: PlasmaComponents.ToolButton {
width: (tasksList.width / (tasksSource.connectedSources.length))
height: parent.height
minimumWidth: 24
minimumHeight: 24
iconSource: icon
text: visibleName
onClicked: {
performOperation(model["DataEngineSource"], "activate");
}
}
}
}

View File

@ -0,0 +1,20 @@
[Desktop Entry]
Name=Poor Man's Tasks
Comment=Example showing how to write your own tasks Widget
Icon=preferences-system-windows
Encoding=UTF-8
Keywords=
Type=Service
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=Windows and Tasks
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.example.tasks
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-Plasma-DefaultSize=180,240
X-Plasma-MainScript=ui/qmltasks.qml
X-Plasma-RemoteLocation=

View File

@ -0,0 +1,137 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
PlasmaComponents.Page {
height: childrenRect.height
property int implicitHeight: childrenRect.height
tools: PlasmaComponents.ToolBarLayout {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaComponents.ProgressBar {
value: 0.3
}
PlasmaComponents.TextField {
clearButtonShown: true
text: "Busy widgets"
}
}
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label {
font.pixelSize: 20
text: "Busy Indicator"
}
PlasmaComponents.BusyIndicator { }
PlasmaComponents.BusyIndicator { running: true }
PlasmaComponents.Label {
font.pixelSize: 20
text: "Progress Bar"
}
PlasmaComponents.Label { text: "Horizontal" }
PlasmaComponents.ProgressBar {
value: 0.3
}
PlasmaComponents.ProgressBar {
indeterminate: true
}
PlasmaComponents.ProgressBar {
minimumValue: 0
maximumValue: 100
value: 30
}
PlasmaComponents.Label { text: "Vertical" }
Row {
spacing: 20
PlasmaComponents.ProgressBar {
value: 0.3
orientation: Qt.Vertical
width: 20
height: 100
}
PlasmaComponents.ProgressBar {
value: 0.4
orientation: Qt.Vertical
width: 20
height: 120
}
PlasmaComponents.ProgressBar {
orientation: Qt.Vertical
width: 20
height: 100
indeterminate: true
}
}
}
}
}
PlasmaComponents.ScrollBar {
id: horizontalScrollBar
flickableItem: flickable
orientation: Qt.Horizontal
anchors {
left: parent.left
right: verticalScrollBar.left
bottom: parent.bottom
}
}
PlasmaComponents.ScrollBar {
id: verticalScrollBar
orientation: Qt.Vertical
flickableItem: flickable
anchors {
top: parent.top
right: parent.right
bottom: horizontalScrollBar.top
}
}
}

View File

@ -0,0 +1,178 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
PlasmaComponents.Page {
height: childrenRect.height
tools: PlasmaComponents.ToolBarLayout {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaComponents.Button {
text: "Button"
}
PlasmaComponents.TextField {
clearButtonShown: true
}
}
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label {
font.pixelSize: 20
text: "Buttons"
}
PlasmaComponents.Button {
id: bt1
text: "Button"
onClicked: {
console.log("Clicked");
pageStack.push(Qt.createComponent(plasmoid.file("ui", "Scrollers.qml")))
}
Keys.onTabPressed: bt2.forceActiveFocus();
}
PlasmaComponents.Button {
id: bt2
text: "Checkable Button"
checkable: true
onCheckedChanged: {
if (checked)
console.log("Button Checked");
else
console.log("Button Unchecked");
}
Keys.onTabPressed: bt3.forceActiveFocus();
}
PlasmaComponents.Button {
id: bt3
text: "Different Font"
font {
pointSize: 20
family: "Helvetica"
}
Keys.onTabPressed: bt4.forceActiveFocus();
}
PlasmaComponents.Button {
id: bt4
text: "Icon Button"
iconSource: "konqueror"
Keys.onTabPressed: bt5.forceActiveFocus();
}
PlasmaComponents.Button {
id: bt5
iconSource: "plasma"
Keys.onTabPressed: bt1.forceActiveFocus();
}
PlasmaComponents.Button {
text: "Disabled Button"
enabled: false
}
PlasmaComponents.ToolButton {
text: "ToolButton"
}
PlasmaComponents.ToolButton {
text: "ToolButton not flat"
flat: false
}
PlasmaComponents.ToolButton {
text: "Icon ToolButton"
iconSource: "konqueror"
}
PlasmaComponents.ToolButton {
iconSource: "plasma"
}
PlasmaComponents.ToolButton {
iconSource: "plasma"
flat: false
}
PlasmaComponents.ToolButton {
text: "Disabled ToolButton"
enabled: false
}
}
}
}
PlasmaComponents.ScrollBar {
id: horizontalScrollBar
flickableItem: flickable
orientation: Qt.Horizontal
anchors {
left: parent.left
right: verticalScrollBar.left
bottom: parent.bottom
}
}
PlasmaComponents.ScrollBar {
id: verticalScrollBar
orientation: Qt.Vertical
flickableItem: flickable
anchors {
top: parent.top
right: parent.right
bottom: horizontalScrollBar.top
}
}
}

View File

@ -0,0 +1,165 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
PlasmaComponents.Page {
tools: PlasmaComponents.ToolBarLayout {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaComponents.CheckBox {
text: "Checkbox in the toolbar"
}
PlasmaComponents.TextField {
clearButtonShown: true
text: "hello"
}
}
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label {
font.pixelSize: 20
text: "Check Box"
}
PlasmaComponents.CheckBox {
width: 140
height: 30
text: "Check Box 1"
onCheckedChanged: {
if (checked)
console.log("CheckBox checked");
else
console.log("CheckBox unchecked");
}
onClicked: {
console.log("CheckBox clicked");
}
}
PlasmaComponents.CheckBox {
height: 30
text: "Disabled"
enabled: false
}
PlasmaComponents.CheckBox {
height: 30
text: ""
}
PlasmaComponents.CheckBox {
height: 30
text: "A loooooooooooooong text"
}
PlasmaComponents.Label {
font.pixelSize: 20
text: "Radio Button"
}
PlasmaComponents.RadioButton {
width: 140
height: 30
text: "RadioButton"
onCheckedChanged: {
if (checked)
console.log("RadioButton Checked");
else
console.log("RadioButton Unchecked");
}
}
PlasmaComponents.Switch { }
PlasmaComponents.Label {
font.pixelSize: 20
text: "Button Row"
}
PlasmaComponents.ButtonRow {
spacing: 20
PlasmaComponents.RadioButton { text: "A" }
PlasmaComponents.RadioButton { text: "B" }
PlasmaComponents.RadioButton { text: "C" }
}
PlasmaComponents.Label {
font.pixelSize: 20
text: "Button Column"
}
PlasmaComponents.ButtonColumn {
spacing: 20
PlasmaComponents.RadioButton { text: "Alice" }
PlasmaComponents.RadioButton { text: "Bob" }
PlasmaComponents.RadioButton { text: "Charles" }
}
}
}
}
PlasmaComponents.ScrollBar {
id: horizontalScrollBar
flickableItem: flickable
orientation: Qt.Horizontal
anchors {
left: parent.left
right: verticalScrollBar.left
bottom: parent.bottom
}
}
PlasmaComponents.ScrollBar {
id: verticalScrollBar
orientation: Qt.Vertical
flickableItem: flickable
anchors {
top: parent.top
right: parent.right
bottom: horizontalScrollBar.top
}
}
}

View File

@ -0,0 +1,86 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
* Copyright (C) 2011 by Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0
Page {
ListView {
id: pageSelector
clip: true
anchors.fill: parent
model: ListModel {
id: pagesModel
ListElement {
page: "Buttons.qml"
title: "Buttons"
}
ListElement {
page: "CheckableButtons.qml"
title: "Checkable buttons"
}
ListElement {
page: "Busy.qml"
title: "Busy indicators"
}
ListElement {
page: "Sliders.qml"
title: "Sliders"
}
ListElement {
page: "Scrollers.qml"
title: "Scrollers"
}
ListElement {
page: "Texts.qml"
title: "Text elements"
}
ListElement {
page: "Typography.qml"
title: "Typography"
}
ListElement {
page: "Misc.qml"
title: "Misc stuff"
}
}
delegate: ListItem {
enabled: true
Column {
Label {
text: title
}
}
onClicked: pageStack.push(Qt.createComponent(plasmoid.file("ui", page)))
}
}
ScrollBar {
id: verticalScrollBar
orientation: Qt.Vertical
flickableItem: pageSelector
anchors {
top: parent.top
right: parent.right
bottom: parent.bottom
}
}
}

View File

@ -0,0 +1,672 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Components project.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.0
import org.kde.plasma.components 2.0
import org.kde.plasma.extras 2.0 as PlasmaExtras
Page {
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
tools: Row {
spacing: 5
ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
Button {
text: "Button"
}
}
PlasmaExtras.ScrollArea {
anchors.fill: parent
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
// for demonstration and testing purposes each component needs to
// set its inverted state explicitly
property bool childrenInverted: false
property bool windowInverted: false
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: "Qt Components " + (enabled ? "(enabled)" : "(disabled)")
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Push me"
width: parent.width - parent.spacing
}
TextField {
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: "TextField"
width: parent.width - parent.spacing
}
TextField {
id: clearable
clearButtonShown: true
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: "Clearable TextField"
text: "Clearable TextField"
width: parent.width - parent.spacing
}
TextField {
id: customOperation
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: "Custom operation"
width: parent.width - parent.spacing
Image {
id: addText
anchors { top: parent.top; right: parent.right }
smooth: true
fillMode: Image.PreserveAspectFit
source: "qrc:ok.svg"
height: parent.height; width: parent.height
scale: LayoutMirroring.enabled ? -1 : 1
MouseArea {
id: add
anchors.fill: parent
onClicked: textSelection.open()
}
SelectionDialog {
id: textSelection
titleText: "Preset Texts"
selectedIndex: -1
model: ListModel {
ListElement { name: "Lorem ipsum." }
ListElement { name: "Lorem ipsum dolor sit amet." }
ListElement { name: "Lorem ipsum dolor sit amet ipsum." }
}
onAccepted: {
customOperation.text = textSelection.model.get(textSelection.selectedIndex).name
customOperation.forceActiveFocus()
}
onRejected: selectedIndex = -1
}
}
}
TextArea {
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: "This is a\n multiline control."
width: parent.width - parent.spacing; height: 280
}
Slider {
anchors.horizontalCenter: parent.horizontalCenter
value: 50
}
ButtonRow {
anchors.horizontalCenter: parent.horizontalCenter
spacing: parent.spacing
exclusive: true
RadioButton {
}
RadioButton {
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: parent.spacing
CheckBox {
}
CheckBox {
checked: true
}
}
Switch {
anchors.horizontalCenter: parent.horizontalCenter
}
ProgressBar {
anchors.horizontalCenter: parent.horizontalCenter
Timer {
running: true
repeat: true
interval: 25
onTriggered: parent.value = (parent.value + 1) % 1.1
}
}
ProgressBar {
anchors.horizontalCenter: parent.horizontalCenter
indeterminate: true
}
Component {
id: dialogComponent
CommonDialog {
id: dialog
titleText: "CommonDialog"
buttonTexts: ["Ok", "Cancel"]
content: Label {
text: "This is the content"
font { bold: true; pixelSize: 16 }
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
Button {
property CommonDialog dialog
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - parent.spacing
text: "CommonDialog"
onClicked: {
if (!dialog)
dialog = dialogComponent.createObject(column)
dialog.open()
}
}
Component {
id: singleSelectionDialogComponent
SelectionDialog {
titleText: "Select background color"
selectedIndex: 1
model: ListModel {
id: colorModel
ListElement { name: "Red" }
ListElement { name: "Blue" }
ListElement { name: "Green" }
ListElement { name: "Yellow" }
ListElement { name: "Black" }
ListElement { name: "White" }
ListElement { name: "Grey" }
ListElement { name: "Orange" }
ListElement { name: "Pink" }
}
onAccepted: { selectionDialogButton.parent.color = colorModel.get(selectedIndex).name }
}
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
height: selectionDialogButton.height
width: parent.width - parent.spacing
radius: 10
Button {
id: selectionDialogButton
property SelectionDialog singleSelectionDialog
anchors.centerIn: parent
text: "Selection Dialog"
onClicked: {
if (!singleSelectionDialog)
singleSelectionDialog = singleSelectionDialogComponent.createObject(column)
singleSelectionDialog.open()
}
}
}
Button {
property QueryDialog queryDialog
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - parent.spacing
text: "QueryDialog"
onClicked: {
if (!queryDialog)
queryDialog = queryDialogComponent.createObject(column)
queryDialog.open()
}
}
Component {
id: queryDialogComponent
QueryDialog {
titleText: "Query Dialog"
// Arabic character in the beginning to test right-to-left UI alignment
message: (LayoutMirroring.enabled ? "\u062a" : "") + "Lorem ipsum dolor sit amet, consectetur adipisici elit,"
+ "sed eiusmod tempor incidunt ut labore et dolore magna aliqua."
+ "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris"
+ "nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit"
+ "in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
+ "Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui"
+ "officia deserunt mollit anim id est laborum."
acceptButtonText: "Ok"
rejectButtonText: "Cancel"
titleIcon: "kmail"
}
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
height: contentMenuButton.height
width: parent.width - parent.spacing
radius: 10
Button {
id: contentMenuButton
property ContextMenu contextMenu
anchors.horizontalCenter: parent.horizontalCenter
text: "ContextMenu"
onClicked: {
if (!contextMenu)
contextMenu = contextMenuComponent.createObject(contentMenuButton)
contextMenu.open()
}
}
}
Component {
id: contextMenuComponent
ContextMenu {
visualParent: contentMenuButton
MenuItem {
text: "White"
onClicked: contentMenuButton.parent.color = "White"
}
MenuItem {
text: "Red"
onClicked: contentMenuButton.parent.color = "Red"
}
MenuItem {
text: "LightBlue"
onClicked: contentMenuButton.parent.color = "LightBlue"
}
MenuItem {
text: "LightGreen"
onClicked: contentMenuButton.parent.color = "LightGreen"
}
}
}
ListView {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - parent.spacing; height: 120
clip: true
delegate: listDelegate
model: listModel
header: listHeading
}
ListModel {
id: listModel
ListElement {
titleText: "Title"
subTitleText: "SubTitle"
}
ListElement {
titleText: "Title2"
subTitleText: "SubTitle"
}
ListElement {
titleText: "Title3"
subTitleText: "SubTitle"
}
}
Component {
id: listHeading
Label {
text: "Heading"
}
}
Component {
id: listDelegate
ListItem {
id: listItem
Column {
Label {
text: titleText
}
Label {
text: subTitleText
}
}
}
}
Label {
property SelectionDialog selectionDialog
text: {
if (selectionDialog) {
if (selectionDialog.selectedIndex >= 0)
return selectionDialog.model.get(selectionDialog.selectedIndex).name
}
return "Three"
}
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - parent.spacing
MouseArea {
anchors.fill: parent
onClicked: {
if (!selectionDialog)
selectionDialog = selectionDialogComponent.createObject(column)
selectionDialog.open()
}
}
Component {
id: selectionDialogComponent
SelectionDialog {
titleText: "Select"
selectedIndex: 2
model: ListModel {
ListElement { name: "One" }
ListElement { name: "Two" }
ListElement { name: "Three" }
ListElement { name: "Four" }
ListElement { name: "Five" }
ListElement { name: "Six" }
ListElement { name: "Seven" }
ListElement { name: "Eight" }
ListElement { name: "Nine" }
}
}
}
}
TabBar {
//width: parent.width - parent.spacing
//height: 50
anchors.horizontalCenter: parent.horizontalCenter
TabButton { tab: tab1content; text: "1"; iconSource: "qrc:close_stop.svg"}
TabButton { tab: tab2content; text: "2"; iconSource: "konqueror"}
TabButton { tab: tab3content; text: "3"}
}
TabGroup {
height: 100
width: parent.width - parent.spacing
Button { id: tab1content; text: "tab1" }
Label {
id: tab2content
text: "tab2"
horizontalAlignment: "AlignHCenter"
verticalAlignment: "AlignVCenter"
}
Page {
id: tab3content
width: 50
height: 32
CheckBox { anchors.fill: parent; text: "tab3"}
}
}
ToolButton {
id: toolButton
text: "ToolButton"
iconSource: "konqueror"
}
ToolButton {
id: toolButton2
flat: true
iconSource: "qrc:ok.svg"
}
ToolButton {
id: toolButton3
text: "ToolButton"
iconSource: "qrc:close_stop.svg"
}
Row {
spacing: 5
BusyIndicator {
id: busyInd1
width: 20
height: 20
running: true
}
BusyIndicator {
// default width/height is 40
id: busyInd2
running: true
}
BusyIndicator {
id: busyInd3
width: 60
height: 60
running: true
}
Button {
text: "Toggle"
onClicked: {
busyInd1.running = !busyInd1.running
busyInd2.running = !busyInd2.running
busyInd3.running = !busyInd3.running
}
}
}
Button {
property CommonDialog sectionScroll
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - parent.spacing
text: "SectionScroller"
iconSource: "konqueror"
onClicked: {
if (!sectionScroll)
sectionScroll = sectionScrollComponent.createObject(column)
sectionScroll.open()
}
}
Component {
id: sectionScrollComponent
CommonDialog {
id: sectionScroll
titleText: "Section Scroller"
buttonTexts: ["Close"]
onButtonClicked: close()
content: Rectangle {
color: Qr.rgba(1,1,1,0.8)
width: parent.width
implicitHeight: 300
ListModel {
id: testModel
ListElement { name: "A Cat 1"; alphabet: "A" }
ListElement { name: "A Cat 2"; alphabet: "A" }
ListElement { name: "Boo 1"; alphabet: "B" }
ListElement { name: "Boo 2"; alphabet: "B" }
ListElement { name: "Cat 1"; alphabet: "C" }
ListElement { name: "Cat 2"; alphabet: "C" }
ListElement { name: "Dog 1"; alphabet: "D" }
ListElement { name: "Dog 2"; alphabet: "D" }
ListElement { name: "Dog 3"; alphabet: "D" }
ListElement { name: "Dog 4"; alphabet: "D" }
ListElement { name: "Dog 5"; alphabet: "D" }
ListElement { name: "Dog 6"; alphabet: "D" }
ListElement { name: "Dog 7"; alphabet: "D" }
ListElement { name: "Dog 8"; alphabet: "D" }
ListElement { name: "Dog 9"; alphabet: "D" }
ListElement { name: "Dog 10"; alphabet: "D" }
ListElement { name: "Dog 11"; alphabet: "D" }
ListElement { name: "Dog 12"; alphabet: "D" }
ListElement { name: "Elephant 1"; alphabet: "E" }
ListElement { name: "Elephant 2"; alphabet: "E" }
ListElement { name: "FElephant 1"; alphabet: "F" }
ListElement { name: "FElephant 2"; alphabet: "F" }
ListElement { name: "Guinea pig"; alphabet: "G" }
ListElement { name: "Goose"; alphabet: "G" }
ListElement { name: "Horse"; alphabet: "H" }
ListElement { name: "Horse"; alphabet: "H" }
ListElement { name: "Parrot"; alphabet: "P" }
ListElement { name: "Parrot"; alphabet: "P" }
}
PlasmaExtras.ScrollArea {
anchors.fill: parent
ListView {
id: list
anchors.fill: parent
clip: true
cacheBuffer: contentHeight
delegate: ListItem {
Label {
anchors {
top: parent.top; topMargin: 4
left: parent.left; leftMargin: 4
}
color: Qt.rgba(0,0,0,0.8)
text: name + " (index " + index + ")"
horizontalAlignment: Text.AlignLeft
}
}
model: testModel
section.property: "alphabet"
section.criteria: ViewSection.FullString
section.delegate: ListItem {
sectionDelegate: true
Label {
anchors {
top: parent.top; topMargin: 4
left: parent.left; leftMargin: 4
}
color: Qt.rgba(0,0,0,0.8)
text: section
horizontalAlignment: Text.AlignLeft
font { bold: true; }
}
}
}
}
}
}
}
ButtonRow {
id: buttonRow1
width: parent.width - parent.spacing
exclusive: true
checkedButton: b2
Button { text: "b1" }
Button { text: "b2" }
Button { text: "b3" }
}
ButtonRow {
id: buttonRow2
width: parent.width - parent.spacing
exclusive: true
ToolButton { text: "tb1" }
ToolButton { text: "tb2" }
}
ButtonRow {
id: buttonRow3
exclusive: true
ToolButton { flat:false; iconSource: "go-previous" }
ToolButton { flat:false; text: "tb2" }
ToolButton { flat:false; text: "tb3" }
ToolButton { flat:false; iconSource: "go-next" }
}
ButtonColumn {
id: buttonRow4
exclusive: true
ToolButton { flat:false; text: "tb1" }
ToolButton { flat:false; text: "tb2" }
ToolButton { flat:false; text: "tb3" }
ToolButton { flat:false; text: "tb4" }
}
ButtonColumn {
id: buttonColumn
width: parent.width - parent.spacing
exclusive: true
Button { text: "b4" }
Button { text: "b5" }
Button { text: "b6" }
Button { text: "b7" }
}
}
}
}
}
}

View File

@ -0,0 +1,163 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
PlasmaComponents.Page {
height: childrenRect.height
property int implicitHeight: childrenRect.height
tools: PlasmaComponents.ToolBarLayout {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaComponents.ScrollBar {
orientation: Qt.Horizontal
interactive: true
flickableItem: scrollArea
width: 200
}
PlasmaComponents.TextField {
clearButtonShown: true
text: "hello"
}
}
PlasmaExtras.ScrollArea {
anchors.fill: parent
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label {
font.pixelSize: 20
text: "Scroll Bar"
}
PlasmaExtras.ScrollArea {
width: 200
height: 200
ListView {
id: scrollList
width: 200
height: 200
clip: true
model: 20
delegate: PlasmaComponents.Label {
width: 200
height: 30
text: index
font.pixelSize: 18
}
Rectangle {
anchors.fill: parent
color: "grey"
opacity: 0.3
}
}
}
PlasmaComponents.Label {
font.pixelSize: 20
text: "Scroll Decorator"
}
Item {
width: 200
height: 200
PlasmaComponents.Highlight { anchors.fill: parent }
Flickable {
id: scrollArea
anchors.fill: parent
clip: true
contentWidth: 400
contentHeight: 400
// Flickable Contents
Rectangle {
color: "green"
width: 100
height: 100
}
Rectangle {
x: 80
y: 80
color: "blue"
width: 200
height: 200
}
Rectangle {
x: 200
y: 200
color: "red"
width: 150
height: 150
}
}
// Scroll Decorators
PlasmaComponents.ScrollBar {
orientation: Qt.Vertical
flickableItem: scrollArea
inverted: true
anchors {
top: scrollArea.top
right: scrollArea.right
bottom: scrollArea.bottom
}
PlasmaComponents.Label {
y: parent.height / 2
x: 13
rotation: -90
text: "inverted"
}
}
PlasmaComponents.ScrollBar {
orientation: Qt.Horizontal
flickableItem: scrollArea
anchors {
left: scrollArea.left
right: scrollArea.right
bottom: scrollArea.bottom
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,180 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
PlasmaComponents.Page {
height: childrenRect.height
property int implicitHeight: childrenRect.height
tools: PlasmaComponents.ToolBarLayout {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaComponents.Slider {
width: 140
enabled: true
}
PlasmaComponents.TextField {
clearButtonShown: true
text: "hello"
}
}
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label {
font.pixelSize: 20
text: "Slider"
}
Column {
spacing: 10
PlasmaComponents.Label { text: "Color Selector"; font.pixelSize: 20 }
PlasmaComponents.Label { text: "Red" }
PlasmaComponents.Slider {
id: redSlider
height: 20
width: 255
orientation: Qt.Horizontal
minimumValue: 0
maximumValue: 255
stepSize: 10
Keys.onTabPressed: greenSlider.forceActiveFocus()
}
PlasmaComponents.Label { text: "Green" }
PlasmaComponents.Slider {
id: greenSlider
height: 20
width: 255
orientation: Qt.Horizontal
minimumValue: 0
maximumValue: 255
stepSize: 10
Keys.onTabPressed: blueSlider.forceActiveFocus()
}
PlasmaComponents.Label { text: "Blue" }
PlasmaComponents.Slider {
id: blueSlider
height: 20
width: 255
orientation: Qt.Horizontal
minimumValue: 0
maximumValue: 255
stepSize: 10
Keys.onTabPressed: redSlider.forceActiveFocus()
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width / 2
height: width
color: Qt.rgba(redSlider.value / 255, greenSlider.value / 255, blueSlider.value / 255, 1)
}
}
PlasmaComponents.Label { text: "Disabled Horizontal Slider" }
PlasmaComponents.Slider {
id: horizontalSlider
width: 140
height: 20
enabled: false
}
PlasmaComponents.Label { text: "Inverted Horizontal Slider" }
PlasmaComponents.Slider {
id: invHorizontalSlider
width: 140
height: 20
inverted: true
enabled: true
}
PlasmaComponents.Label { text: "Vertical Slider" }
Row {
spacing: 30
PlasmaComponents.Slider {
id: verticalSlider
width: 20
height: 140
orientation: Qt.Vertical
minimumValue: 10
maximumValue: 1000
stepSize: 50
inverted: true
}
PlasmaComponents.Label { text: verticalSlider.value }
}
}
}
}
PlasmaComponents.ScrollBar {
id: horizontalScrollBar
flickableItem: flickable
orientation: Qt.Horizontal
anchors {
left: parent.left
right: verticalScrollBar.left
bottom: parent.bottom
}
}
PlasmaComponents.ScrollBar {
id: verticalScrollBar
orientation: Qt.Vertical
flickableItem: flickable
anchors {
top: parent.top
right: parent.right
bottom: horizontalScrollBar.top
}
}
}

View File

@ -0,0 +1,162 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
PlasmaComponents.Page {
height: childrenRect.height
property int implicitHeight: childrenRect.height
tools: PlasmaComponents.ToolBarLayout {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaComponents.Label {
text: "Text label:"
}
PlasmaComponents.TextField {
placeholderText: "Place holder text"
}
PlasmaComponents.TextField {
clearButtonShown: true
text: "Text fields page"
}
}
Flickable {
id: flickable
contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Item {
width: Math.max(flickable.width, column.width)
height: column.height
Column {
id: column
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
PlasmaComponents.Label {
text: "Text Fields"
font.pixelSize: 20
}
PlasmaComponents.Highlight {
width: 200
height: 100
Column {
spacing: 10
Row {
PlasmaComponents.Label {
text: "Username: "
anchors.verticalCenter: tf1.verticalCenter
}
PlasmaComponents.TextField {
id: tf1
placeholderText: "login"
Keys.onTabPressed: tf2.forceActiveFocus();
}
}
Row {
PlasmaComponents.Label {
text: "Password: "
anchors.verticalCenter: tf2.verticalCenter
}
PlasmaComponents.TextField {
id: tf2
width: 120
echoMode: TextInput.Password
Keys.onTabPressed: loginButton.forceActiveFocus();
}
}
PlasmaComponents.Button {
id: loginButton
text: "Login"
anchors {
right: parent.right
rightMargin: 0
}
width: 100
}
}
}
PlasmaComponents.TextField {
width: 120
placeholderText: "Disabled Text Field"
Keys.onTabPressed: loginButton.forceActiveFocus();
enabled: false
}
PlasmaComponents.Label {
text: "Text Area"
font.pixelSize: 20
}
PlasmaComponents.TextArea {
width: 200
height: 200
placeholderText: "Lorem ipsum et dolor"
wrapMode: TextEdit.WordWrap
contentMaxWidth: 400
contentMaxHeight: 400
}
PlasmaComponents.TextArea {
width: 200
height: 100
enabled: false
text: "Disabled Text Area"
}
}
}
}
PlasmaComponents.ScrollBar {
id: horizontalScrollBar
flickableItem: flickable
orientation: Qt.Horizontal
anchors {
left: parent.left
right: verticalScrollBar.left
bottom: parent.bottom
}
}
PlasmaComponents.ScrollBar {
id: verticalScrollBar
orientation: Qt.Vertical
flickableItem: flickable
anchors {
top: parent.top
right: parent.right
bottom: horizontalScrollBar.top
}
}
}

View File

@ -0,0 +1,177 @@
/*
* Copyright 2012 by Sebastian Kügler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
PlasmaComponents.Page {
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
tools: Row {
spacing: 5
PlasmaComponents.ToolButton {
visible: pageStack.depth > 1
iconSource: "go-previous"
onClicked: pageStack.pop()
}
PlasmaExtras.Title {
text: "Typography"
}
}
PlasmaExtras.ScrollArea {
anchors.fill: parent
Flickable {
id: flickable
//contentWidth: column.width
contentHeight: column.height
clip: true
anchors.fill: parent
Column {
id: column
width: parent.width
anchors {
//fill: parent
margins: 12
}
spacing: 12
PlasmaExtras.Title {
text: "A Title"
}
Repeater {
model: 5
PlasmaExtras.Heading {
level: index + 1
text: "Header level " + (index + 1)
}
}
PlasmaExtras.Heading {
level: 1
text: "Paragraphs"
}
PlasmaExtras.Paragraph {
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sit amet turpis eros, in luctus lectus. Curabitur pulvinar ligula at leo pellentesque non faucibus mauris elementum. Pellentesque convallis porttitor sodales. Maecenas risus erat, viverra blandit vestibulum eu, suscipit in est. Praesent quis mattis eros. Sed ante ante, adipiscing non gravida sed, ultrices ultrices urna. Etiam congue mattis convallis. Maecenas sollicitudin mauris at lorem aliquam in venenatis erat convallis. Fusce eleifend scelerisque porttitor. Praesent metus sapien, hendrerit ac congue eget, feugiat id enim. Morbi venenatis gravida felis, vitae varius nunc dictum a. Etiam accumsan, velit ac tempor convallis, leo nibh consequat purus, sit amet fringilla nisi mi et libero."
}
PlasmaExtras.Paragraph {
text: "Donec tincidunt justo eget nulla eleifend hendrerit. Ut eleifend erat nibh. Nunc sagittis tincidunt quam quis lobortis. Nam suscipit ultrices nulla. Suspendisse ullamcorper eleifend massa eu pharetra. Donec tempor iaculis elit, in suscipit velit tristique eu. Curabitur suscipit, lacus id pharetra dapibus, velit ante consectetur erat, ac dignissim quam arcu vitae diam. Suspendisse laoreet tortor nec dolor venenatis ultricies. Sed nunc erat, placerat non gravida sit amet, ullamcorper eu turpis. Nullam vestibulum lacus sed tellus fermentum mollis id at urna. Sed eleifend lobortis mollis. Donec lacus dolor, varius commodo gravida et, fringilla in justo. Nam gravida lorem in odio viverra elementum. Suspendisse non tellus at justo convallis placerat vel ac tellus. Nulla tristique tristique dui ut vestibulum."
}
PlasmaExtras.Heading {
level: 1
text: "TBD Components"
}
PlasmaComponents.Label {
id: menuEntry
text: "Menu entry"
}
PlasmaComponents.Label {
id: notificationHeader
text: "Notification header"
}
PlasmaComponents.Label {
id: notificationContent
text: "Menu entry"
}
PlasmaComponents.Label {
id: activeTab
text: "Active tab"
}
PlasmaComponents.Label {
id: inactiveTab
text: "Intactive tab"
}
PlasmaComponents.Label {
id: activeSelection
text: "Active selection"
}
PlasmaComponents.Label {
id: inactiveSelection
text: "Inactive selection"
}
PlasmaComponents.Label {
id: listItemPrimary
text: "List item: primary text"
}
PlasmaComponents.Label {
id: listItemSub
text: "List item: secondary text"
}
PlasmaComponents.Label {
id: listItemPrimarySelected
text: "List item: selected, primary text"
}
PlasmaComponents.Label {
id: listItemPrimarySub
text: "List item: selected, secondary text"
}
PlasmaComponents.Label {
id: widgetHeader
text: "Widget headers"
}
PlasmaComponents.Label {
id: widgetContent
text: "Widget Content"
}
PlasmaComponents.Label {
id: iconTextSelected
text: "Icon text, selected"
}
PlasmaComponents.Label {
id: iconTextUnselected
text: "Icon text, unselected"
}
PlasmaComponents.Label {
id: groupHeader
text: "Group Header"
}
PlasmaComponents.Label {
id: groupContent
text: "Group Content"
}
}
}
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0
Item {
property int minimumWidth: 300
property int minimumHeight: 400
ToolBar {
id: toolBar
z: 10
anchors {
top: parent.top
left: parent.left
right: parent.right
}
}
PageStack {
id: pageStack
toolBar: toolBar
clip: true
anchors {
top: toolBar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
initialPage: Qt.createComponent("Menu.qml")
}
}

View File

@ -0,0 +1,18 @@
[Desktop Entry]
Encoding=UTF-8
Name=Widgets gallery
Comment=gallery of widgets done with Plasma QtComponents
Type=Service
ServiceTypes=Plasma/Applet
Icon=preferences-desktop-theme
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-KDE-PluginInfo-Author=Marco MArtin
X-KDE-PluginInfo-Email=notmart@gmail.com
X-KDE-PluginInfo-Name=org.kde.example.widgetgallery
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Examples
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true

View File

@ -0,0 +1,123 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.components 2.0
Image {
property int minimumWidth: 300
property int minimumHeight: 400
source: "image://appbackgrounds/standard"
fillMode: Image.Tile
asynchronous: true
ToolBar {
id: toolBar
anchors {
top: parent.top
left: parent.left
right: parent.right
}
}
Image {
id: sidebar
source: "image://appbackgrounds/contextarea"
fillMode: Image.Tile
asynchronous: true
width: 200
z: 10
anchors {
top: toolBar.bottom
bottom: parent.bottom
}
Image {
source: "image://appbackgrounds/shadow-right"
fillMode: Image.Tile
anchors {
left: parent.right
top: parent.top
bottom: parent.bottom
leftMargin: -1
}
}
ListView {
id: pageSelector
clip: true
anchors.fill: parent
model: ListModel {
id: pagesModel
ListElement {
page: "Buttons.qml"
title: "Buttons"
}
ListElement {
page: "CheckableButtons.qml"
title: "Checkable buttons"
}
ListElement {
page: "Busy.qml"
title: "Busy indicators"
}
ListElement {
page: "Sliders.qml"
title: "Sliders"
}
ListElement {
page: "Scrollers.qml"
title: "Scrollers"
}
ListElement {
page: "Texts.qml"
title: "Text elements"
}
ListElement {
page: "Misc.qml"
title: "Misc stuff"
}
}
delegate: ListItem {
enabled: true
Column {
Label {
text: title
}
}
onClicked: pageStack.replace(Qt.createComponent(plasmoid.file("ui", page)))
}
}
}
PageStack {
id: pageStack
toolBar: toolBar
anchors {
top: toolBar.bottom
left: sidebar.right
right: parent.right
bottom: parent.bottom
}
initialPage: Qt.createComponent("Buttons.qml")
}
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
export PLASMA_CUSTOM_PREFIX_PATHS=platformcontents/application/generic/:platformcontents/application/tablet/:contents/
plasmoidviewer -graphicssystem raster org.kde.example.widgetgallery

View File

@ -0,0 +1,88 @@
// -*- coding: iso-8859-1 -*-
/*
* Author: Marco Martin <mart@kde.org>
* Date: Sun Nov 7 2010, 18:51:24
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* 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 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.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
width: 400
height: 32
property bool fillWidth: true
property bool fillHeight: true
PlasmaCore.DataSource {
id: tasksSource
dataEngine: "tasks"
interval: 0
onSourceAdded: {
connectSource(source)
}
Component.onCompleted: {
connectedSources = sources
}
}
function performOperation(src, what) {
var service = tasksSource.serviceForSource(src);
var operation = service.operationDescription(what);
return service.startOperationCall(operation);
}
PlasmaExtras.ScrollArea {
anchors.fill: parent
ListView {
//clip: true
id: tasksList
orientation: ListView.Horizontal
model: PlasmaCore.DataModel {
dataSource: tasksSource
}
delegate: MouseArea {
width: height * 1.6
height: parent.height
PlasmaCore.WindowThumbnail {
anchors.fill: parent
winId: model["DataEngineSource"]
}
PlasmaComponents.Label {
anchors.bottom: parent.bottom
text: visibleName
}
PlasmaComponents.Button {
text: "Close"
anchors.right: parent.right
}
onClicked: {
performOperation(model["DataEngineSource"], "activate");
}
}
}
}
}

View File

@ -0,0 +1,20 @@
[Desktop Entry]
Name=Example window list
Comment=Example showing how to display window thumbnails
Icon=preferences-system-windows
Encoding=UTF-8
Keywords=
Type=Service
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=Windows and Tasks
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.example.windowlist
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-Plasma-DefaultSize=180,240
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=