From e9ae80694875f869892f13f4fcaf1170a00dea41 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kommander/examples/tutorial/Makefile.am | 10 + kommander/examples/tutorial/README | 123 ++++++++++++ kommander/examples/tutorial/append.kmdr | 115 ++++++++++++ kommander/examples/tutorial/arrays.kmdr | 204 ++++++++++++++++++++ kommander/examples/tutorial/calc.kmdr | 271 +++++++++++++++++++++++++++ kommander/examples/tutorial/cmdline.kmdr | 108 +++++++++++ kommander/examples/tutorial/dcop.kmdr | 139 ++++++++++++++ kommander/examples/tutorial/dialogs.kmdr | 198 +++++++++++++++++++ kommander/examples/tutorial/globals.kmdr | 96 ++++++++++ kommander/examples/tutorial/initialize.kmdr | 120 ++++++++++++ kommander/examples/tutorial/loop.kmdr | 114 +++++++++++ kommander/examples/tutorial/picview.kmdr | 148 +++++++++++++++ kommander/examples/tutorial/progressbar.kmdr | 192 +++++++++++++++++++ kommander/examples/tutorial/settings.kmdr | 177 +++++++++++++++++ kommander/examples/tutorial/slots.kmdr | 200 ++++++++++++++++++++ kommander/examples/tutorial/statusbar.kmdr | 99 ++++++++++ kommander/examples/tutorial/strings.kmdr | 206 ++++++++++++++++++++ kommander/examples/tutorial/table.kmdr | 258 +++++++++++++++++++++++++ kommander/examples/tutorial/tree.kmdr | 170 +++++++++++++++++ kommander/examples/tutorial/widgets.kmdr | 133 +++++++++++++ 20 files changed, 3081 insertions(+) create mode 100644 kommander/examples/tutorial/Makefile.am create mode 100644 kommander/examples/tutorial/README create mode 100644 kommander/examples/tutorial/append.kmdr create mode 100644 kommander/examples/tutorial/arrays.kmdr create mode 100644 kommander/examples/tutorial/calc.kmdr create mode 100644 kommander/examples/tutorial/cmdline.kmdr create mode 100644 kommander/examples/tutorial/dcop.kmdr create mode 100644 kommander/examples/tutorial/dialogs.kmdr create mode 100644 kommander/examples/tutorial/globals.kmdr create mode 100644 kommander/examples/tutorial/initialize.kmdr create mode 100644 kommander/examples/tutorial/loop.kmdr create mode 100644 kommander/examples/tutorial/picview.kmdr create mode 100644 kommander/examples/tutorial/progressbar.kmdr create mode 100644 kommander/examples/tutorial/settings.kmdr create mode 100644 kommander/examples/tutorial/slots.kmdr create mode 100644 kommander/examples/tutorial/statusbar.kmdr create mode 100644 kommander/examples/tutorial/strings.kmdr create mode 100644 kommander/examples/tutorial/table.kmdr create mode 100644 kommander/examples/tutorial/tree.kmdr create mode 100644 kommander/examples/tutorial/widgets.kmdr (limited to 'kommander/examples/tutorial') diff --git a/kommander/examples/tutorial/Makefile.am b/kommander/examples/tutorial/Makefile.am new file mode 100644 index 00000000..e654bdd2 --- /dev/null +++ b/kommander/examples/tutorial/Makefile.am @@ -0,0 +1,10 @@ +execkmdrdir = ${kde_datadir}/kmdr-editor/editor/tutorial + +execkmdr_SCRIPTS = append.kmdr calc.kmdr dcop.kmdr globals.kmdr loop.kmdr progressbar.kmdr slots.kmdr \ + strings.kmdr tree.kmdr arrays.kmdr cmdline.kmdr dialogs.kmdr initialize.kmdr picview.kmdr settings.kmdr \ + statusbar.kmdr table.kmdr widgets.kmdr + + +tutorialdir = ${kde_datadir}/kmdr-editor/editor/tutorial +tutorial_DATA = README + diff --git a/kommander/examples/tutorial/README b/kommander/examples/tutorial/README new file mode 100644 index 00000000..658503e0 --- /dev/null +++ b/kommander/examples/tutorial/README @@ -0,0 +1,123 @@ +Those example illustrate various Kommander features. + +In the future they would be used together with Kommander tutorials. +For now, only brief information is available + + +* GLOBALS.KMDR +Shows using global and setGlobal DCOP calls to provide global +variables for script. +Functions/concepts: +- global +- setGlobal +- changeWidgetText + +* DCOP.KMDR +Shows how to use both local and external DCOP calls to communicate +with external application (here: KMail). +Functions/concepts: +- external DCOP +- addListItem +- enableWidget +- @selectedWidgetText +- @widgetText + +* SLOTS.KMDR +Shows how to use connections/slots to handle events. Both population and +standard slots are used. +- slots/connections +- populate() + +* SETTINGS.KMDR +Shows how to use @readSetting and @writeSetting functions to write/restore +widget content. Also, shows how to use populate() slot to initialize widget +content. +Functions/concepts: +- @readSetting +- @writeSetting +- populate() +- slots/connections +- destroy + +* APPEND.KMDR +Shows how you can append text to TextEdit, and how you can use it to display +formatted text. +Functions/concepts: +- changeWidetText +- RichTextEdit + +* CMDLINE.KMDR +Shows how you can pass parameters to Kommander dialog via command-line. +Also, shows how to change list content and button text. +Functions/concepts: +- command-line arguments +- global +- changeWidgetText +- addListItem +- clearList + +* INITIALIZE.KMDR +Shows how you can use 'initialization' and 'destroy' scripts of main +dialog to initialize and store some settings. +Functions/concepts: +- initialization +- destroy +- readSetting +- writeSetting + +* ARRAY.KMDR +Shows how to use assocative arrays to store and restore information +associated with container items. +Functions/concepts: +- @Array functions + +* STRINGS.KMDR +Shows how to use string-handling functions +Functions/concepts: +- @String functions +- rich text editor + +* TREE.KMDR +Shows how to use tree widget +- tree widget +- FileSelector +- initialization +- env + +* WIDGETS.KMDR +Shows how to get widget information +- type method +- children method + +* STATUSBAR.KMDR +Shows how to use statusbar widget +- statusbar widget +- populate + +* LOOP.KMDR +Shows how to use internal loops +- for +- forEach + +* CALC.KMDR +Shows how to use @expr function to do some calculations +- expr +- String.replace + +* PICVIEW.KMDR +Shows how to use PixmapLabel widget using populate() function +- PixmapLabel +- populate +- FileSelector +- slots/connections + +* TABLE.KMDR +Shows how to use Table widget +- insertRow +- insertColumn +- currentRow +- currentColumn +- setColumnCaption +- setRowCaption +- removeRow +- removeColumn diff --git a/kommander/examples/tutorial/append.kmdr b/kommander/examples/tutorial/append.kmdr new file mode 100644 index 00000000..fe22a4c3 --- /dev/null +++ b/kommander/examples/tutorial/append.kmdr @@ -0,0 +1,115 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 379 + 272 + + + + Append date + + + + + + + + + unnamed + + + 11 + + + 6 + + + + TextEdit1 + + + + @widgetText + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + Insert date + + + + DATE="Button pressed: <i>`date`</i>" +TEXT='@TextEdit1'"$DATE" +dcop @dcopid KommanderIf changeWidgetText TextEdit1 "$TEXT" + + + + + true + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + + diff --git a/kommander/examples/tutorial/arrays.kmdr b/kommander/examples/tutorial/arrays.kmdr new file mode 100644 index 00000000..dd4b18c6 --- /dev/null +++ b/kommander/examples/tutorial/arrays.kmdr @@ -0,0 +1,204 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 386 + 206 + + + + Program array + + + + + @Array.setValue(Programs, kcalc, KDE calculator) +@Array.setValue(Programs, kwrite, Advanced editor) +@Array.setValue(Programs, ark, Archive tool) +@Array.setValue(Programs, kdict, Interface to online dictonaries) + + + + + + + unnamed + + + 11 + + + 6 + + + + TextLabel2 + + + Programs: + + + + + + kwrite + + + + + kcalc + + + + + kdict + + + + + ark + + + + ListBox1 + + + + @selectedWidgetText + + + + + + LineEdit1 + + + ParentOrigin + + + true + + + @Array.value(Programs, @ListBox1) + + + + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + Spacer6 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + + 0 + 0 + 0 + 0 + + + + &Run + + + + @exec(ListBox1) + + + + + + + + ExecButton1_2 + + + + 0 + 0 + 0 + 0 + + + + Run &All + + + + + + + @Array.keys(Programs) + + + + + + Spacer5 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + + + ListBox1 + selectionChanged() + LineEdit1 + populate() + + + + diff --git a/kommander/examples/tutorial/calc.kmdr b/kommander/examples/tutorial/calc.kmdr new file mode 100644 index 00000000..5e0082f4 --- /dev/null +++ b/kommander/examples/tutorial/calc.kmdr @@ -0,0 +1,271 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 577 + 305 + + + + Simple calculator + + + + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout7 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + History: + + + + + ListBox1 + + + + 5 + 7 + 0 + 0 + + + + + 200 + 0 + + + + + 250 + 32767 + + + + + + LineEdit2 + + + + 5 + 0 + 0 + 0 + + + + + 250 + 32767 + + + + + 233 + 233 + 233 + + + + true + + + + + ExecButton2 + + + Cl&ear + + + + @ListBox1.clear +@LineEdit2.setText("Sum: 0") + + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + Expression: + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + &Calculate + + + false + + + true + + + + @ListBox1.insertItem(@expr(@LineEdit1.text), -1) +@LineEdit1.clear +@LineEdit2.setText("Sum: @expr(@String.replace(@ListBox1.text, "\n", "+"))") + + + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + LineEdit1 + + + + + Spacer3_2 + + + Vertical + + + Expanding + + + + 0 + 91 + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 0 + 91 + + + + + + + + + LineEdit1 + ExecButton1 + ExecButton2 + ListBox1 + + + diff --git a/kommander/examples/tutorial/cmdline.kmdr b/kommander/examples/tutorial/cmdline.kmdr new file mode 100644 index 00000000..0db801d2 --- /dev/null +++ b/kommander/examples/tutorial/cmdline.kmdr @@ -0,0 +1,108 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 462 + 340 + + + + Form1 + + + + + + + + + unnamed + + + 11 + + + 6 + + + + + Usage: kmdr-executor cmdline.kmdr [BUTTON='title'] arg1 ... + + + + ListBox1 + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 149 + 0 + + + + + + ExecButton1 + + + Read command line + + + + # Put command-line arguments into list +dcop @dcopid KommanderIf clearList ListBox1 +VALUE=`dcop @dcopid KommanderIf global ARGS` +for i in $VALUE; do + dcop @dcopid KommanderIf addListItem ListBox1 "$i" 999 +done + +ARGS=`dcop @dcopid KommanderIf global ARGCOUNT` +dcop @dcopid KommanderIf addListItem ListBox1 "Arguments count: $ARGS" 999 + + +# Read button text +BUTTONTEXT=`dcop @dcopid KommanderIf global BUTTON` +if [ "$BUTTONTEXT" ]; then + dcop @dcopid KommanderIf changeWidgetText ExecButton1 "$BUTTONTEXT" +fi + + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 148 + 0 + + + + + + + diff --git a/kommander/examples/tutorial/dcop.kmdr b/kommander/examples/tutorial/dcop.kmdr new file mode 100644 index 00000000..9ceae259 --- /dev/null +++ b/kommander/examples/tutorial/dcop.kmdr @@ -0,0 +1,139 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 399 + 247 + + + + KMail communication + + + + unnamed + + + 11 + + + 6 + + + + AccountListBox + + + + @selectedWidgetText + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + AccountButton + + + Get accounts + + + + # Get list of accounts from KMail +LIST=`dcop kmail KMailIface accounts` + +# Add each account to the list and enable 'Check Account' button +if [ "$LIST" ]; then + for i in $LIST; do + dcop @dcopid KommanderIf addListItem AccountListBox "$i" 1000; + done + dcop @dcopid KommanderIf enableWidget CheckButton true +fi + + + + + true + + + + + CheckButton + + + false + + + Check account + + + + # Get current account +# Look at AccountListBox script to see how @AccountListBox is calculated + +dcop kmail KMailIface checkAccount @AccountListBox + + + + true + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + + diff --git a/kommander/examples/tutorial/dialogs.kmdr b/kommander/examples/tutorial/dialogs.kmdr new file mode 100644 index 00000000..62c97bc0 --- /dev/null +++ b/kommander/examples/tutorial/dialogs.kmdr @@ -0,0 +1,198 @@ + +DialogTest +This is my program +MichaƂ Rudolf +GPL +0.1 + + + DialogTest + + + + 0 + 0 + 600 + 428 + + + + Test of Dialogs + + + + + + + + + + true + + + + unnamed + + + 11 + + + 6 + + + + ExecButton1 + + + Run dialogs... + + + + message_info("This is a demonstration of various KDE dialogs", "Demo") +message_error("Cannot enter 3D mode") +if message_question("Do you want to continue?") <> 1 then + debug("Cancelled") +endif +if message_warning("Are you sure you want to continue?") <> 1 then + debug("Aborted") +endif + + +echo("Hello world!") +a = input_text("Input text", "Text", "Default text") +LineEdit1.setText(a) + +a = input_color +LineEdit2.setText(a) + +a = input_value("Input value", "Value", 10, 1, 100) +LineEdit3.setText(a) + +a = input_openfile +LineEdit4.setText(a) + +echo("This is a test too") +a = input_savefile +LineEdit5.setText(a) + +a = input_directory +LineEdit6.setText(a) + +a = input_openfiles +ListBox1.setText(a) + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Label6 + + + File to save: + + + + + Label2 + + + Color: + + + + + ListBox1 + + + + + Label5 + + + Files to open: + + + + + Label7 + + + Directory: + + + + + Label3 + + + Value: + + + + + LineEdit1 + + + + + Label4 + + + File to open: + + + + + LineEdit3 + + + + + LineEdit4 + + + + + LineEdit5 + + + + + LineEdit2 + + + + + LineEdit6 + + + + + Label1 + + + Text: + + + + + + + + diff --git a/kommander/examples/tutorial/globals.kmdr b/kommander/examples/tutorial/globals.kmdr new file mode 100644 index 00000000..71cfad17 --- /dev/null +++ b/kommander/examples/tutorial/globals.kmdr @@ -0,0 +1,96 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 250 + 122 + + + + Global variables demo + + + + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + + + + + + + + ExecButton1 + + + Store current date + + + + @setGlobal(TEMPSIZE, "@exec(date)") + + + + true + + + + + ExecButton2 + + + Restore date + + + + @LineEdit1.setText("@global(TEMPSIZE)") + + + + true + + + + + + + + diff --git a/kommander/examples/tutorial/initialize.kmdr b/kommander/examples/tutorial/initialize.kmdr new file mode 100644 index 00000000..16ed360d --- /dev/null +++ b/kommander/examples/tutorial/initialize.kmdr @@ -0,0 +1,120 @@ + +InitializationDemo + + + InitializationDemo + + + + 0 + 0 + 461 + 108 + + + + Initialization and Destroy + + + + + dcop @dcopid KommanderIf changeWidgetText OpenLabel "Opened: `date`" +CLOSE="@readSetting("CloseLabel", "Previously closed: never")" +dcop @dcopid KommanderIf changeWidgetText CloseLabel "$CLOSE" + + @writeSetting("CloseLabel", "Previously closed: @exec("date")") + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + CloseButton1 + + + &Close + + + + + + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + OpenLabel + + + Opened: + + + + + CloseLabel + + + Previously closed: + + + + + + diff --git a/kommander/examples/tutorial/loop.kmdr b/kommander/examples/tutorial/loop.kmdr new file mode 100644 index 00000000..4aa799f1 --- /dev/null +++ b/kommander/examples/tutorial/loop.kmdr @@ -0,0 +1,114 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + Looooop! + + + + unnamed + + + 11 + + + 6 + + + + ExecButton1 + + + Enter loop! + + + + @forEach(i, @exec(ls)) + @TreeWidget1.insertItem(@i\t@exec(wc -c "@i" | cut -f 1 -d ' '), -1) +@end + +@for(olymp, 1900, 2006, 4) + @ListBox1.insertItem(@olymp, -1) +@end + + + + + + + File + + + true + + + true + + + + + Size + + + true + + + true + + + + TreeWidget1 + + + true + + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Olympiads: + + + + + ListBox1 + + + + + + + + diff --git a/kommander/examples/tutorial/picview.kmdr b/kommander/examples/tutorial/picview.kmdr new file mode 100644 index 00000000..be75af7b --- /dev/null +++ b/kommander/examples/tutorial/picview.kmdr @@ -0,0 +1,148 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 618 + 436 + + + + Picture viewer + + + true + + + + unnamed + + + 11 + + + 6 + + + + Label1 + + + Directory: + + + + + Label2 + + + Images: + + + + + FileSelector1 + + + Directory + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + ListBox1 + + + + 0 + 7 + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 32767 + + + + @exec(cd @FileSelector1.text && find * -name "*.jpg" -o -name "*.png" -o -name "*.gif" -o -name "*.bmp") + + + + + + + + + + PixmapLabel1 + + + + 2 + 2 + 0 + 0 + + + + Box + + + true + + + @FileSelector1.text/@ListBox1.selection + + + + + + + + + + + + + + FileSelector1 + widgetTextChanged(const QString&) + ListBox1 + populate() + + + ListBox1 + highlighted(int) + PixmapLabel1 + populate() + + + + diff --git a/kommander/examples/tutorial/progressbar.kmdr b/kommander/examples/tutorial/progressbar.kmdr new file mode 100644 index 00000000..397410cb --- /dev/null +++ b/kommander/examples/tutorial/progressbar.kmdr @@ -0,0 +1,192 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 565 + 390 + + + + ProgressBar Demo + + + + + @ProgressBar1.setVisible(false) + + + + + + unnamed + + + 11 + + + 6 + + + + ProgressBar1 + + + + + + + + + + + Source Tree + + + true + + + true + + + + + + + + + + + + TreeWidget1 + + + false + + + true + + + true + + + + + + + + + + + + + FileSelector1 + + + Directory + + + + + StatusBar1 + + + + + Spacer10 + + + Horizontal + + + Expanding + + + + 191 + 0 + + + + + + Spacer11 + + + Horizontal + + + Expanding + + + + 191 + 0 + + + + + + progressLoop + + + + @# set up a loop using loop variable named "file" +@forEach(file, @exec(cd @FileSelector1.text && find * -maxdepth 0)) + @# set the scale using the generated @[loopvar]_count + @ProgressBar1.setMaximum(@file_count) + @# show file name in statusbar + @StatusBar1.setText(@file) + @TreeWidget1.insertItems(@exec(cd @FileSelector1.text && find @file -name "*"), -1) + @# use the generated @[loopvar]_index to update progressbar + @ProgressBar1.setText(@file_index) +@end + + + + + + + ExecButton25 + + + Get Source Tree + + + + @TreeWidget1.clear + +@if(@String.isEmpty(@FileSelector1.text)) + @exec(kdialog --error "please select a directory, preferably not home as it will take time") +@endif + +@if(!@String.isEmpty(@FileSelector1.text)) + @ProgressBar1.setVisible(true) + @progressLoop.execute + @# this fails on kdewebdev 3.3.0 so leave off ".execute" + @ProgressBar1.setVisible(false) + @StatusBar1.setText("Source Tree Listed") +@endif + + + + Button + + + + + Label1 + + + Select a directory to list it's tree ($HOME NOT recommended for time reasons) + + + + + + diff --git a/kommander/examples/tutorial/settings.kmdr b/kommander/examples/tutorial/settings.kmdr new file mode 100644 index 00000000..3079d6f9 --- /dev/null +++ b/kommander/examples/tutorial/settings.kmdr @@ -0,0 +1,177 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 389 + 91 + + + + Storing settings + + + + + + @writeSetting("LastCommand", "@LineEdit1") + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Command: + + + + + LineEdit1 + + + @readSetting("LastCommand", "kcalc") + + + + @widgetText + + + + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + + 60 + 0 + + + + &Run + + + + + + + @LineEdit1 + + + + true + + + + + CloseButton1 + + + + 60 + 0 + + + + &Close + + + + + + + + + + Spacer4 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + + + LineEdit1 + widgetOpened() + LineEdit1 + populate() + + + + diff --git a/kommander/examples/tutorial/slots.kmdr b/kommander/examples/tutorial/slots.kmdr new file mode 100644 index 00000000..23ab2d09 --- /dev/null +++ b/kommander/examples/tutorial/slots.kmdr @@ -0,0 +1,200 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 396 + 386 + + + + Archive viewer + + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Archive name: + + + + + FileSelector + + + + @widgetText + + + + *.tar.gz + Tar archives + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + List of files: + + + + + FileListBox + + + @exec("tar tzf @FileSelector") + + + + @selectedWidgetText + + + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + View + + + + if [ "@FileSelector" -a "@FileListBox" ]; then + tar xzf "@FileSelector" -C /tmp "@FileListBox" + konqueror "/tmp/@FileListBox" +fi + + + + + + + CloseButton1 + + + &Close + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + + + FileSelector + widgetTextChanged(const QString&) + FileListBox + populate() + + + FileListBox + doubleClicked(QListBoxItem*) + ExecButton1 + startProcess() + + + + diff --git a/kommander/examples/tutorial/statusbar.kmdr b/kommander/examples/tutorial/statusbar.kmdr new file mode 100644 index 00000000..d4f96e05 --- /dev/null +++ b/kommander/examples/tutorial/statusbar.kmdr @@ -0,0 +1,99 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 536 + 225 + + + + StatusBar example + + + + + @StatusBar2.setText(Welcome in this StatusBar demo...) + + + + + + unnamed + + + 11 + + + 6 + + + + StatusBar2 + + + @ListBox1.selection selected. + + + + + + + + + + + Some item + + + + + Some other item + + + + + Another Item + + + + + One more Item + + + + ListBox1 + + + + + ExecButton1 + + + Update status bar + + + + @StatusBar2.insertItem(This one was updated, 0) +@StatusBar2.insertItem(User: @exec(whoami), 1) +@StatusBar2.insertItem(@exec(date), 2) + + + + + + + + ListBox1 + clicked(QListBoxItem*,const QPoint&) + StatusBar2 + populate() + + + + diff --git a/kommander/examples/tutorial/strings.kmdr b/kommander/examples/tutorial/strings.kmdr new file mode 100644 index 00000000..1ef6a953 --- /dev/null +++ b/kommander/examples/tutorial/strings.kmdr @@ -0,0 +1,206 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 522 + 447 + + + + String functions + + + + + + + + + + + unnamed + + + 11 + + + 6 + + + + TextEdit1 + + + true + + + @Array.setValue(Bool, 1, yes) +@Array.setValue(Bool, 0, no) + +<h2>Kommander string functions</h2> +<b>Length:</b> @String.length("@LineEdit1")<br> +<b>First 5 chars:</b> @String.left("@LineEdit1", 5)<br> +<b>Last 5 chars:</b> @String.right("@LineEdit1", 5)<br> +<b>Chars from 6th to 10th:</b> @String.mid("@LineEdit1", 6, 5)<br> +<b>Remove spaces:</b> @String.remove("@LineEdit1", " ")<br> +<b>Replace spaces with *</b>: @String.replace("@LineEdit1", " ", *)<br> +<b>Uppercase:</b> @String.upper("@LineEdit1")<br> +<b>Lowercase:</b> @String.lower("@LineEdit1")<br> +<b>Is a number?:</b> @Array.value(Bool, @String.isNumber("@LineEdit1"))<br> +<b>Is empty?</b> @Array.value(Bool, @String.isEmpty("@LineEdit1"))<br> +<b>Contains "Kommander"?:</b> @String.contains("@LineEdit1", "Kommander")<br> +<b>Position of "Kommander":</b> @String.find("@LineEdit1", "Kommander")<br> +<b>Compare with "Kommander":</b> +@execBegin +if [ @String.compare("@LineEdit1", "Kommander") -lt 0 ];then + echo "Less than Kommander<br>" +elif [ @String.compare("@LineEdit1", "Kommander") -gt 0 ];then + echo "Greater than Kommander <br>" +elif [ @String.compare("@LineEdit1", "Kommander") -eq 0 ];then + echo "Equals Kommander <br>" +fi +@execEnd +<b>Case insensitive match with "Kommander":</b> +@execBegin +if [ @String.compare(@String.lower("@LineEdit1"), "kommander") -eq 0 ];then + echo "Match found<br>" +else + echo "Match failed<br>" +fi +@execEnd + + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Enter str&ing here: + + + LineEdit1 + + + + + LineEdit1 + + + I love Kommander! + + + + @widgetText + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + &Test + + + + + + + + + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + + + ExecButton1 + clicked() + TextEdit1 + populate() + + + + LineEdit1 + ExecButton1 + TextEdit1 + + + diff --git a/kommander/examples/tutorial/table.kmdr b/kommander/examples/tutorial/table.kmdr new file mode 100644 index 00000000..a2c5986b --- /dev/null +++ b/kommander/examples/tutorial/table.kmdr @@ -0,0 +1,258 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 629 + 313 + + + + Table Demo + + + + + 0 + + + + + 1 + + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + Table + + + + 10 + 10 + 400 + 240 + + + + AutoOneFit + + + 5 + + + 2 + + + + + + + + + + Layout3 + + + + 470 + 10 + 135 + 160 + + + + + unnamed + + + 0 + + + 6 + + + + AddRowButton + + + Add row + + + + @Table.insertRow(@Table.currentRow, 1) + + + + + + AddColButton + + + Add column + + + + @Table.insertColumn(@Table.currentColumn, 1) + + + + + + ExecButton5 + + + Remove row + + + + @Table.removeRow(@Table.currentRow, 1) + + + + + + ExecButton6 + + + Remove Column + + + + @Table.removeColumn(@Table.currentColumn, 1) + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 30 + + + + + + + + Layout4 + + + + 20 + 270 + 585 + 28 + + + + + unnamed + + + 0 + + + 6 + + + + GetButton + + + Get text + + + + @CellText.setText(@Table.cellText(@Table.currentRow, + @Table.currentColumn)) + + + + + + CellText + + + + + SetButton + + + Set text + + + + @Table.setCellText(@Table.currentRow, @Table.currentColumn, + @CellText.text) + + + + + + ColumnCaptionButton + + + Set column name + + + + @Table.setColumnCaption(@Table.currentColumn, @CellText.text) + + + + + + RowCaptionButton + + + Set row name + + + + @Table.setRowCaption(@Table.currentRow, @CellText.text) + + + + + + + + diff --git a/kommander/examples/tutorial/tree.kmdr b/kommander/examples/tutorial/tree.kmdr new file mode 100644 index 00000000..bed87709 --- /dev/null +++ b/kommander/examples/tutorial/tree.kmdr @@ -0,0 +1,170 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 528 + + + + File Tree + + + + + @FileSelector1.setText(@env(HOME)) +@TreeWidget1.setText(@readSetting(FileTree, "")) + @writeSetting(FileTree, @TreeWidget1.text) + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + ExecButton1 + + + Add files from selected directory + + + true + + + + @TreeWidget1.clear +@TreeWidget1.insertItems(@exec(cd @FileSelector1.text && find * -name "*.kmdr"), -1) + + + + + + ExecButton2 + + + Remove selected file from the list + + + + @TreeWidget1.removeItem(@TreeWidget1.currentItem) + + + + + + + + + File + + + true + + + true + + + + TreeWidget1 + + + true + + + NoColumn + + + true + + + + + + + + + + TextLabel1 + + + Select directory: + + + + + FileSelector1 + + + + + + + + Directory + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + ExecButton3 + + + Find file: + + + + @TreeWidget1.setCurrentItem(@TreeWidget1.findItem(@LineEdit2.text)) + + + + + + LineEdit2 + + + + + + + + diff --git a/kommander/examples/tutorial/widgets.kmdr b/kommander/examples/tutorial/widgets.kmdr new file mode 100644 index 00000000..9e6781c6 --- /dev/null +++ b/kommander/examples/tutorial/widgets.kmdr @@ -0,0 +1,133 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 483 + + + + Widgets and types + + + + unnamed + + + 11 + + + 6 + + + + GroupBox1 + + + Widgets + + + + unnamed + + + 11 + + + 6 + + + + SpinBoxInt1 + + + + + LineEdit1 + + + + + RichTextEditor1 + + + + + + + WidgetShow + + + Show widgets + + + + @WidgetList.setText(@Form1.children(true)) + + + + + + WidgetList + + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Type: + + + + + WidgetType + + + @exec(dcop @dcopid KommanderIf type "@WidgetList.selection") + + + + + + + + + + + + + + WidgetList + highlighted(int) + WidgetType + populate() + + + + -- cgit v1.2.1