[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeexamples/plasma/javascript/plasmoids/enumerateAPI/contents/code
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2009-11-27 3:12:29
Message-ID: 1259291549.516166.12072.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1054900 by aseigo:
more api
M +123 -78 main.js
--- trunk/KDE/kdeexamples/plasma/javascript/plasmoids/enumerateAPI/contents/code/main.js \
#1054899:1054900 @@ -1,3 +1,5 @@
+var text = true
+
classNames = new Array()
classNames.push('BusyWidget')
classNames.push('CheckBox')
@@ -26,87 +28,103 @@
classNames.push('VideoWidget')
classNames.push('WebView')
-// ScrollWidget
-
var commonProperties = new Array
-commonProperties.push("objectName" )
-commonProperties.push("parent" )
-commonProperties.push("id" )
-commonProperties.push("opacity" )
-commonProperties.push("enabled" )
-commonProperties.push("visible" )
-commonProperties.push("pos" )
-commonProperties.push("x" )
-commonProperties.push("y" )
-commonProperties.push("z" )
-commonProperties.push("rotation" )
-commonProperties.push("scale" )
-commonProperties.push("transformOriginPoint" )
-commonProperties.push("palette" )
-commonProperties.push("font" )
-commonProperties.push("layoutDirection" )
-commonProperties.push("size" )
-commonProperties.push("focusPolicy" )
-commonProperties.push("windowFlags" )
-commonProperties.push("windowTitle" )
-commonProperties.push("geometry" )
-commonProperties.push("parentWidget" )
-commonProperties.push("stylesheet" )
-commonProperties.push("nativeWidget" )
-commonProperties.push("destroyed(QObject*)" )
-commonProperties.push("destroyed()" )
-commonProperties.push("deleteLater()" )
-commonProperties.push("parentChanged()" )
-commonProperties.push("opacityChanged()" )
-commonProperties.push("visibleChanged()" )
-commonProperties.push("enabledChanged()" )
-commonProperties.push("xChanged()" )
-commonProperties.push("yChanged()" )
-commonProperties.push("zChanged()" )
-commonProperties.push("rotationChanged()" )
-commonProperties.push("scaleChanged()" )
-commonProperties.push("close()" )
-commonProperties.push("newProxyWidget(const QWidget*)" )
+commonProperties.push("objectName")
+commonProperties.push("parent")
+commonProperties.push("id")
+commonProperties.push("opacity")
+commonProperties.push("enabled")
+commonProperties.push("visible")
+commonProperties.push("pos")
+commonProperties.push("x")
+commonProperties.push("y")
+commonProperties.push("z")
+commonProperties.push("rotation")
+commonProperties.push("scale")
+commonProperties.push("transformOriginPoint")
+commonProperties.push("palette")
+commonProperties.push("font")
+commonProperties.push("layoutDirection")
+commonProperties.push("size")
+commonProperties.push("focusPolicy")
+commonProperties.push("windowFlags")
+commonProperties.push("windowTitle")
+commonProperties.push("geometry")
+commonProperties.push("parentWidget")
+commonProperties.push("stylesheet")
+commonProperties.push("nativeWidget")
+commonProperties.push("destroyed(QObject*)")
+commonProperties.push("destroyed()")
+commonProperties.push("deleteLater()")
+commonProperties.push("parentChanged()")
+commonProperties.push("opacityChanged()")
+commonProperties.push("visibleChanged()")
+commonProperties.push("enabledChanged()")
+commonProperties.push("xChanged()")
+commonProperties.push("yChanged()")
+commonProperties.push("zChanged()")
+commonProperties.push("rotationChanged()")
+commonProperties.push("scaleChanged()")
+commonProperties.push("close()")
+commonProperties.push("newProxyWidget(const QWidget*)")
commonProperties.push("styleSheet()")
commonProperties.push("timerEvent(QTimerEvent*)")
-var apihtml = ''
-var apitext = ''
-for (index in classNames) {
- apihtml += '<p><b>' + classNames[index] + "</b><ul>\n";
- apitext += classNames[index] + '\n';
- widget = new this[classNames[index]]
- for (i in widget) {
- if (commonProperties.indexOf(i) == -1) {
- apihtml += '<li>'
- apitext += ' * '
- if (i.substr(i.length - 1, 1) != ')') {
- detail = typeof widget[i] + " " + i
- apihtml += detail
- apitext += detail + '\n'
+function enumerateObject(name, obj, excludeCommon)
+{
+ var rv
+ if (text) {
+ rv = name + '\n';
+ } else {
+ rv = '<p><b>' + name + "</b><ul>\n";
+ }
+
+ for (i in obj) {
+ if (excludeCommon && commonProperties.indexOf(i) != -1) {
+ continue;
+ }
+
+ if (text) {
+ rv += ' * '
+ } else {
+ rv += '<li>'
+ }
+
+ if (i.substr(i.length - 1, 1) != ')') {
+ rv += typeof obj[i] + " " + i
+ if (text) {
+ rv += "\n"
+ }
+ } else {
+ openbracket = i.lastIndexOf('(')
+ objname = i.substr(0, openbracket)
+ if (text) {
+ rv += 'function ' + i + '\n'
} else {
- openbracket = i.lastIndexOf('(')
- objname = i.substr(0, openbracket)
- //print(typeof widget[objname]['connect'] + ' <-------- see? ' + \
classNames[index] + '::' + i)
- /*
- print("checking " + objname)
- for (j in widget[objname]) {
- print("is " + j)
- }
- if (typeof widget[objname]['connect'] == "function") {
- apihtml += "<i>signal</i> " + i
- apitext += 'signal ' + i + '\n'
- } else {
- */
- apihtml += "<i>function</i> " + i
- apitext += 'function ' + i + '\n'
- //}
+ rv += "<i>function</i> " + i
}
- apihtml += "</li>\n"
}
+
+ if (!text) {
+ rv += "</li>\n"
+ }
}
- apihtml += "</ul>"
- apitext += '\n'
+
+ if (text) {
+ rv += "\n"
+ } else {
+ rv += "</ul>"
+ }
+
+ return rv
+}
+
+
+var widgetApi = ''
+for (index in classNames) {
+ var widgetName = classNames[index]
+ var widget = new this[widgetName]
+ widgetApi += enumerateObject(widgetName, widget, true)
widget.deleteLater()
}
@@ -114,13 +132,40 @@
tabbar = new TabBar
display = new TextEdit
display.readOnly = true
-display.text = apihtml
-tabbar.addTab(i18n("HTML"), display)
+display.text = widgetApi
+tabbar.addTab(i18n("Widgets"), display)
-bg = new ItemBackground
+fsvg = new FrameSvg('panel-background')
+var imageApi = enumerateObject('FrameSvg', fsvg, false)
+svg = new Svg('panel-background')
+imageApi += enumerateObject('Svg', svg, false)
+pixmap = new QPixmap
+imageApi += enumerateObject('QPixmap', pixmap, false)
+
display = new TextEdit
display.readOnly = true
-display.text = apitext
-tabbar.addTab(i18n("Text"), display)
+display.text = imageApi
+tabbar.addTab(i18n("Images"), display)
+
+var p = new QPainter
+var paintingApi = enumerateObject('QPainter', p, false)
+p = new QColor
+paintingApi += enumerateObject('QColor', p, false)
+p = new QFont
+paintingApi += enumerateObject('QFont', p, false)
+p = new QPoint
+paintingApi += enumerateObject('QPoint', p, false)
+p = new QRectF
+paintingApi += enumerateObject('QRectF', p, false)
+p = new QSizeF(2,2)
+paintingApi += enumerateObject('QSizeF ' + p.width, p, false)
+
+display = new TextEdit
+display.readOnly = true
+display.text = paintingApi
+tabbar.addTab(i18n("Painting"), display)
+
+
layout.addItem(tabbar)
+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic