ktutorial-commits Mailing List for KTutorial (Page 9)
Status: Alpha
Brought to you by:
danxuliu
You can subscribe to this list here.
2010 |
Jan
(1) |
Feb
(36) |
Mar
(117) |
Apr
(11) |
May
(8) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(21) |
Oct
(16) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(1) |
Feb
|
Mar
(6) |
Apr
(6) |
May
(15) |
Jun
(15) |
Jul
(6) |
Aug
|
Sep
(1) |
Oct
(4) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(10) |
Jul
(4) |
Aug
(29) |
Sep
(4) |
Oct
|
Nov
|
Dec
(2) |
From: <dan...@us...> - 2010-03-24 19:18:13
|
Revision: 187 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=187&view=rev Author: danxuliu Date: 2010-03-24 19:18:06 +0000 (Wed, 24 Mar 2010) Log Message: ----------- Minor handbook fixes Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook trunk/ktutorial/ktutorial-editor/doc/en/using.docbook Modified: trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook 2010-03-23 22:22:03 UTC (rev 186) +++ trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook 2010-03-24 19:18:06 UTC (rev 187) @@ -117,7 +117,7 @@ </term> <listitem> <para> - <action>Opens the dialog to add a new step to the tutorial</action> + <action>Opens the dialog to add a new step to the tutorial.</action> </para> </listitem> </varlistentry> Modified: trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook 2010-03-23 22:22:03 UTC (rev 186) +++ trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook 2010-03-24 19:18:06 UTC (rev 187) @@ -38,7 +38,7 @@ <prompt>$</prompt> <userinput><command>make</command></userinput> </screen> - <para>That will create a <filename>build</filename> directory, change to it, prepare the build directory to build KTutorial on it and finally build KTutorial. If <command>cmake</command> complains, you have to install the required dependencies asked in the error message.</para> + <para>That will create a <filename class="directory">build</filename> directory, change to it, prepare the build directory to build KTutorial on it and finally build KTutorial. If <command>cmake</command> complains, you have to install the required dependencies asked in the error message.</para> <para>To install KTutorial, become root user and run:</para> Modified: trunk/ktutorial/ktutorial-editor/doc/en/using.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/using.docbook 2010-03-23 22:22:03 UTC (rev 186) +++ trunk/ktutorial/ktutorial-editor/doc/en/using.docbook 2010-03-24 19:18:06 UTC (rev 187) @@ -36,11 +36,11 @@ <para>On the other hand, scripted tutorials are external data to the application. When an application that supports KTutorial starts, it looks for scripted tutorials in some specific directories and loads those found. If you add new scripted tutorials to the directories, the next time the application starts they will be available. You don't have to compile again the application, not even to reinstall it.</para> - <para>Scripted tutorials are looked for in the <filename>tutorials/</filename> subdirectory of the application data directory. The application data directory is <filename>KDE_PREFIX/share/apps/applicationName/</filename>. Special cases aside, the <emphasis>KDE_PREFIX</emphasis> can be the KDE installation prefix (usually <filename>/usr/</filename>) or the user KDE4 configuration directory (<filename>/home/userName/.kde4/</filename>).</para> + <para>Scripted tutorials are looked for in the <filename class="directory">tutorials/</filename> subdirectory of the application data directory. The application data directory is <filename class="directory">KDE_PREFIX/share/apps/applicationName/</filename>. Special cases aside, the <emphasis>KDE_PREFIX</emphasis> can be the &kde; installation prefix (usually <filename class="directory">/usr/</filename>) or the user &kde; configuration directory (<filename class="directory">/home/userName/.kde4/</filename>).</para> <para>When the scripted tutorial is part of an application (it is installed with the rest of the application data when the application is installed), the strings in the scripted tutorial can be extracted to be localized before the installation like any other string in the C++ code, as explained in KTutorial documentation. Scripted tutorials that are added after the application was installed, however, can not be localized, as KTutorial uses the same translation file as the rest of the application where it is used.</para> - <para>As you may have guessed already, KTutorial editor creates scripted tutorials. Right now, only Javascript is supported, as KDE libraries offer out of the box support for Javascript scripts. Python or Ruby, on the other hand, require some specific packages to be installed in the system.</para> + <para>As you may have guessed already, &ktutorial-editor; creates scripted tutorials. Right now, only Javascript is supported, as &kde; libraries offer out of the box support for Javascript scripts. Python or Ruby, on the other hand, require some specific packages to be installed in the system.</para> </sect1> <sect1 id="main-window"> @@ -114,7 +114,7 @@ <sect2 id="edition-dialogs-step"> <title>Step edition</title> - <para>The step data dialog is used to set the id and text of a tutorial. The id and text are mandatory properties, as the id is used by other steps to change to this step, and the text is shown to the user to explain him what must be done. Thus, the id must be unique for every step in the same tutorial.</para> + <para>The step data dialog is used to set the id and text of a step. The id and text are mandatory properties, as the id is used by other steps to change to this step, and the text is shown to the user to explain him what must be done. Thus, the id must be unique for every step in the same tutorial.</para> <para>The step data dialog is also shown when a new step is added. If the dialog is accepted, the step is added. If the dialog is cancelled, the step is not added.</para> <para>Also note that, in every tutorial, there must be one step with id <emphasis>start</emphasis>, so KTutorial knows where to start the tutorial.</para> @@ -137,7 +137,7 @@ <sect2 id="edition-dialogs-reaction"> <title>Reaction edition</title> - <para>The reaction dialog is used to set the trigger and response of a step. The trigger and response are mandatory properties, as they define how the reaction behaves.</para> + <para>The reaction dialog is used to set the trigger and response of a reaction. The trigger and response are mandatory properties, as they define how the reaction behaves.</para> <para>The trigger can be either an option selected or a condition met, but not both. If the trigger type is the option, its name will be shown to the user in the step and the response will be executed when the user selects it. If the type is the condition, the response will be executed when the condition is met.</para> <para>Likely, the response can be changing to another step or executing some custom code, but not both. If the response type is the custom code, it will be used as the body of a function called when the reaction is triggered. Again, the signature of the function is automatically provided and you have to set only the body.</para> @@ -158,7 +158,7 @@ <para>The condition that acts as a trigger of a reaction can be a simple condition or a composed condition. Simple conditions wait for something to happen, like a signal emitted by an object. Composed conditions wait for its child conditions. For example, waiting until a signal is emitted by an object or an event is received in another object, whatever comes first.</para> <para>Due to this, conditions are represented in a tree, and it also affects how they are edited.</para> - <para>A condition can be added as the root condition when there are no other conditions set, or as a child of the selected composed condition, but not when a simple condition is selected. When a new condition is added, you must select its type. Note that the type of the condition can not be changed later, you will have to remove the condition.</para> + <para>A condition can be added as the root condition when there are no other conditions set, or as a child of the selected composed condition, but not when a simple condition is selected. When a new condition is added, you must select its type. Note that the type of the condition can not be changed later, you will have to remove the condition and set a new one.</para> <screenshot> <screeninfo>The dialog to select the type of the new condition to add</screeninfo> @@ -184,7 +184,7 @@ <title>Exporting the tutorial</title> <para>Once you have finished designing the tutorial you can export it to a scripted tutorial. To do this, just use <menuchoice><guimenu>File</guimenu><guimenuitem>Export...</guimenuitem></menuchoice>, select where to save the file and you are done. Remember that you have to export the file to some specific directory to be found by KTutorial, as explained in <xref linkend="understanding-ktutorial"/>.</para> - <para>The export dialog supports exporting to remote directories (via FTP, SSH, etc), although it will be very strange that you need to use that.</para> + <para>The export dialog supports exporting to remote directories (via <acronym>FTP</acronym>, <acronym>SSH</acronym>, etc), although it will be very strange that you need to use that.</para> </sect1> <sect1 id="command-line-options"> @@ -193,7 +193,7 @@ <para>Though &ktutorial-editor; will be usually started from the &kde; program menu, or a desktop icon, it can also be opened from the command line prompt of a terminal window. There are a few options that are available when doing this.</para> <sect2 id="other-command-line-options"> - <title>Default KDE4 Command Line Options</title> + <title>Default &kde; Command Line Options</title> <para>The following command line help options are available:</para> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-23 22:22:11
|
Revision: 186 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=186&view=rev Author: danxuliu Date: 2010-03-23 22:22:03 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Add KTutorial editor English handbook Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/CMakeLists.txt Added Paths: ----------- trunk/ktutorial/ktutorial-editor/doc/ trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt trunk/ktutorial/ktutorial-editor/doc/en/ trunk/ktutorial/ktutorial-editor/doc/en/CMakeLists.txt trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook trunk/ktutorial/ktutorial-editor/doc/en/index.docbook trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook trunk/ktutorial/ktutorial-editor/doc/en/main-window.png trunk/ktutorial/ktutorial-editor/doc/en/new-condition.png trunk/ktutorial/ktutorial-editor/doc/en/set-reaction-data.png trunk/ktutorial/ktutorial-editor/doc/en/set-step-data.png trunk/ktutorial/ktutorial-editor/doc/en/set-tutorial-information.png trunk/ktutorial/ktutorial-editor/doc/en/using.docbook Modified: trunk/ktutorial/ktutorial-editor/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/CMakeLists.txt 2010-03-23 08:02:59 UTC (rev 185) +++ trunk/ktutorial/ktutorial-editor/CMakeLists.txt 2010-03-23 22:22:03 UTC (rev 186) @@ -4,6 +4,7 @@ include(KDE4Defaults) +add_subdirectory(doc) add_subdirectory(po) add_subdirectory(src) add_subdirectory(tests) Added: trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt 2010-03-23 22:22:03 UTC (rev 186) @@ -0,0 +1 @@ +add_subdirectory(en) Property changes on: trunk/ktutorial/ktutorial-editor/doc/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/ktutorial/ktutorial-editor/doc/en/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/CMakeLists.txt (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/en/CMakeLists.txt 2010-03-23 22:22:03 UTC (rev 186) @@ -0,0 +1,3 @@ +########### install files ################ + +kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR ktutorial-editor) Property changes on: trunk/ktutorial/ktutorial-editor/doc/en/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/en/commands.docbook 2010-03-23 22:22:03 UTC (rev 186) @@ -0,0 +1,356 @@ +<!--<?xml version="1.0" ?> +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd"> --> +<!-- Uncomment the previous two lines to validate this document --> +<!-- standalone. Be sure to recomment them before attempting to --> +<!-- process index.docbook --> + +<chapter id="commands"> + <title>Command Reference</title> + + <sect1 id="commands-mainwindow"> + <title>The main &ktutorial-editor; window</title> + + <sect2> + <title>The <guimenu>File</guimenu> Menu</title> + <para> + <variablelist> + <varlistentry> + <term> + <menuchoice> + <guimenu>File</guimenu> + <guimenuitem>Export...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Exports the tutorial to a script.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <shortcut> + <keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Quit</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Quits &ktutorial-editor;.</action> + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect2> + + <sect2> + <title>The <guimenu>Edit</guimenu> Menu</title> + <para> + <variablelist> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Tutorial</guimenu> + <guimenuitem>Set information...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the name and description of the tutorial.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Tutorial</guimenu> + <guimenuitem>Set license...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the license text of the tutorial.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Tutorial</guimenu> + <guimenuitem>Set setup code...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the custom code to be executed when the tutorial starts.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Tutorial</guimenu> + <guimenuitem>Set tear down code...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the custom code to be executed when the tutorial finishes.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Step</guimenu> + <guimenuitem>Add step...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to add a new step to the tutorial</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Step</guimenu> + <guimenuitem>Set data...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the name and text of the currently selected step.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Step</guimenu> + <guimenuitem>Set setup code...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the custom code to be executed when the tutorial passes to the currently selected step.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Step</guimenu> + <guimenuitem>Set tear down code...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the custom code to be executed when the tutorial changes from the currently selected step to another step.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Step</guimenu> + <guimenuitem>Remove step</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Removes the currently selected step from the tutorial.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Reaction</guimenu> + <guimenuitem>Add reaction...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to add a new reaction to the selected step.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Reaction</guimenu> + <guimenuitem>Set data...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens the dialog to set the trigger and response of the currently selected reaction.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Edit</guimenu> + <guimenu>Reaction</guimenu> + <guimenuitem>Remove reaction</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Removes the currently selected reaction from its step.</action> + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect2> + + <sect2> + <title>The <guimenu>View</guimenu> Menu</title> + <para> + <variablelist> + <varlistentry> + <term> + <menuchoice> + <guimenu>View</guimenu> + <guimenuitem>Panels</guimenuitem> + <guimenuitem>Edit tutorial</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Shows or hides the panel with the shorcuts to tutorial edition actions.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>View</guimenu> + <guimenuitem>Panels</guimenuitem> + <guimenuitem>Edit step</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Shows or hides the panel with the shorcuts to step edition actions.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>View</guimenu> + <guimenuitem>Panels</guimenuitem> + <guimenuitem>Edit reaction</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Shows or hides the panel with the shorcuts to reaction edition actions.</action> + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect2> + + <sect2> + <title>The <guimenu>Settings</guimenu> Menu</title> + <para> + <variablelist> + <varlistentry> + <term> + <menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Show Toolbar</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Shows or hides the main toolbar.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Show Statusbar</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Shows or hides the statusbar.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Configure Shortcuts...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens a configure dialog for binding keys to actions.</action> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Configure Toolbars...</guimenuitem> + </menuchoice> + </term> + <listitem> + <para> + <action>Opens a configure dialog for selecting the actions to show in the toolbar.</action> + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect2> + + <sect2> + <title>The <guimenu>Help</guimenu> Menu</title> + + &help.menu.documentation; + + </sect2> + </sect1> +</chapter> + +<!-- +Local Variables: +mode: xml +sgml-minimize-attributes:nil +sgml-general-insert-case:lower +sgml-indent-step:0 +sgml-indent-data:nil +End: + +vim:tabstop=4:shiftwidth=4:expandtab +kate: space-indent on; indent-width 4; tab-width 4; indent-mode none; +--> Added: trunk/ktutorial/ktutorial-editor/doc/en/index.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/index.docbook (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/en/index.docbook 2010-03-23 22:22:03 UTC (rev 186) @@ -0,0 +1,125 @@ +<?xml version="1.0" ?> +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [ + <!ENTITY ktutorial-editor "<application>KTutorial editor</application>"> + <!ENTITY kappname "&ktutorial-editor;"> + <!ENTITY package "kde-module"> + <!ENTITY % addindex "IGNORE"> + <!ENTITY % English "INCLUDE"> + + <!ENTITY using SYSTEM "using.docbook"> + <!ENTITY commands SYSTEM "commands.docbook"> + <!ENTITY installation SYSTEM "installation.docbook"> +]> + +<!-- ................................................................ --> + +<book lang="&language;"> + +<!-- This header contains all of the meta-information for the document such +as Authors, publish date, the abstract, and Keywords --> + +<bookinfo> + <title>The &ktutorial-editor; Handbook</title> + + <authorgroup> + <author> + <personname> + <firstname>Daniel</firstname> + <surname>Calviño Sánchez</surname> + </personname> + <email>dan...@gm...</email> + </author> + </authorgroup> + + <!-- TRANS:ROLES_OF_TRANSLATORS --> + + <copyright> + <year>2010</year> + <holder>Daniel Calviño Sánchez</holder> + </copyright> + <!-- Translators: put here the copyright notice of the translation --> + <!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook + and in the FDL itself on how to use it. --> + <legalnotice>&FDLNotice;</legalnotice> + + <!-- Date and version information of the documentation + Don't forget to include this last date and this last revision number, we + need them for translation coordination ! + Please respect the format of the date (YYYY-MM-DD) and of the version + (V.MM.LL), it could be used by automation scripts. + Do NOT change these in the translation. --> + + <date>2010-03-23</date> + <releaseinfo>0.1</releaseinfo> + + <!-- Abstract about this handbook --> + + <abstract> + <para>&ktutorial-editor; is a graphical editor for KTutorial tutorials.</para> + </abstract> + + <keywordset> + <keyword>KDE</keyword> + <keyword>KTutorial editor</keyword> + <keyword>KTutorial</keyword> + <keyword>tutorial</keyword> + <keyword>editor</keyword> + </keywordset> + +</bookinfo> + +<chapter id="introduction"> + <title>Introduction</title> + + <para>&ktutorial-editor; is a graphical editor for KTutorial tutorials.</para> + <para>KTutorial is a interactive tutorial system for KDE 4. You can get more information about KTutorial in its webpage: <ulink url="http://ktutorial.sourceforge.net">http://ktutorial.sourceforge.net</ulink>.</para> + <para>Using &ktutorial-editor; you can design a tutorial for some application specifying the steps that it will be composed of. For each step, you can specify how the tutorial will react, for example, when the user selects an option, closes a dialog, writes some text...</para> + <para>Once the tutorial has been designed, it can be exported by &ktutorial-editor; to a scripted tutorial. Once the scripted tutorial is placed in the appropriate directory, it can be read by KTutorial library and started by the user of the application. </para> + <para>Tutorials created by &ktutorial-editor; are not as powerful as fully hand made tutorials. However, they are way easier to create and the generated source code can be used as a skeleton to be manually completed if the tutorial requires something not supported by &ktutorial-editor;.</para> +</chapter> + +&using; +&commands; + +<chapter id="credits"> + + <!-- Include credits for the programmers, documentation writers, and + contributors here. --> + + <title>Credits and License</title> + + <para> + &ktutorial-editor; + </para> + <para> + Program Copyright 2010 Daniel Calviño Sánchez <email>dan...@gm...</email> + </para> + + <para> + Documentation Copyright 2010 Daniel Calviño Sánchez <email>dan...@gm...</email> + </para> + + <!-- TRANS:CREDIT_FOR_TRANSLATORS --> + + &underFDL; + &underGPL; + +</chapter> + +&installation; + +&documentation.index; +</book> + +<!-- +Local Variables: +mode: xml +sgml-minimize-attributes:nil +sgml-general-insert-case:lower +sgml-indent-step:0 +sgml-indent-data:nil +End: + +vim:tabstop=4:shiftwidth=4:expandtab +kate: space-indent on; indent-width 4; tab-width 4; indent-mode none; +--> Added: trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/en/installation.docbook 2010-03-23 22:22:03 UTC (rev 186) @@ -0,0 +1,97 @@ +<!--<?xml version="1.0" ?> +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd"> --> +<!-- Uncomment the previous two lines to validate this document --> +<!-- standalone. Be sure to recomment them before attempting to --> +<!-- process index.docbook --> + +<appendix id="installation"> + <title>Installation</title> + + <sect1 id="getting-klusi"> + <title>How to obtain &ktutorial-editor;</title> + + <para>&ktutorial-editor; is part of KTutorial package, which is hosted at <ulink url="http://sourceforge.net/">SourceForge.net</ulink>.</para> + + <para>KTutorial can be downloaded from the <ulink url="http://sourceforge.net/projects/ktutorial/files/">files section</ulink> of the <ulink url="http://sourceforge.net/projects/ktutorial/">KTutorial project in SourceForge.net</ulink>.</para> + + <para>You are encouraged to visit, however, the <ulink url="http://ktutorial.sourceforge.net/download.html">download section</ulink> of the <ulink url="http://ktutorial.sourceforge.net/">webpage</ulink>, as a lot more information can be found there apart of only the files.</para> + + <para>If you are brave enough, in the download section you will also find instructions to install KTutorial from <acronym>SVN</acronym>. However, this is only recommended for developers.</para> + </sect1> + + <sect1 id="requirements"> + <title>Requirements</title> + + <para>In order to successfully build and use KTutorial, you need &kde; (at least version 4.3) and, therefore, &Qt; (at least version 4.5.3).</para> + + <para>Also, <application>CMake</application> build system is required to build KTutorial, as required to build any other &kde; application.</para> + </sect1> + + <sect1 id="compilation"> + <title>Compilation and Installation</title> + + <para>In order to compile KTutorial on your system, extract the KTutorial package you downloaded and type the following in the base directory of the extracted package:</para> + + <screen> + <prompt>$</prompt> <userinput><command>mkdir</command> build && <command>cd</command> build</userinput> + <prompt>$</prompt> <userinput><command>cmake</command> ..</userinput> + <prompt>$</prompt> <userinput><command>make</command></userinput> + </screen> + + <para>That will create a <filename>build</filename> directory, change to it, prepare the build directory to build KTutorial on it and finally build KTutorial. If <command>cmake</command> complains, you have to install the required dependencies asked in the error message.</para> + + <para>To install KTutorial, become root user and run:</para> + + <screen> + <prompt>#</prompt> <userinput><command>make</command> install</userinput> + </screen> + + <tip> + <title>Installing &ktutorial-editor; in <filename class="directory">/usr/local/</filename></title> + + <para>In order to keep a proper organization of your system and not mess up the packages installed by your distribution package manager and those installed manually by you, you are encouraged to install KTutorial in <filename class="directory">/usr/local/</filename>.</para> + + <para>This is the directory that should be used for manually installed packages. To do this, instead of executing <command>cmake</command> as stated before, execute this:</para> + + <screen> + <prompt>$</prompt> <userinput><command>cmake</command> <parameter class="command">-DCMAKE_INSTALL_PREFIX=<filename class="directory">/usr/local/</filename></parameter></userinput> + </screen> + </tip> + </sect1> + + <sect1 id="configuration"> + <title>Configuration</title> + + <para>Depending on your distribution and where KTutorial was installed (if you installed it from sourcecode), you may need a last step before being able to make KTutorial run properly.</para> + + <para>To check this, launch &ktutorial-editor; and take a look to the help. If &ktutorial-editor; manual cannot be found, go on reading to know what must be configured. If the manual is shown, congratulations, just enjoy! :)</para> + + <para>If the manual wasn't found, you must configure your &kde; prefixes. To do this, create the file <filename>/etc/kderc</filename> and add the following content:</para> + +<programlisting> +[Directories] +prefixes=/the/prefix/where/ktutorial/was/installed/ +</programlisting> + + <para>If <filename>/etc/kderc</filename> already existed and had a prefixes rule, add the prefix of KTutorial separating it from the previous prefixes with a "," like this:</para> + +<programlisting> +[Directories] +prefixes=/previous/prefixes/,/the/prefix/where/ktutorial/was/installed/ +</programlisting> + </sect1> +</appendix> + +<!-- +Local Variables: +mode: xml +sgml-minimize-attributes:nil +sgml-general-insert-case:lower +sgml-indent-step:0 +sgml-indent-data:nil +End: + +vim:tabstop=4:shiftwidth=4:expandtab +kate: space-indent on; indent-width 4; tab-width 4; indent-mode none; +--> + Added: trunk/ktutorial/ktutorial-editor/doc/en/main-window.png =================================================================== (Binary files differ) Property changes on: trunk/ktutorial/ktutorial-editor/doc/en/main-window.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/ktutorial/ktutorial-editor/doc/en/new-condition.png =================================================================== (Binary files differ) Property changes on: trunk/ktutorial/ktutorial-editor/doc/en/new-condition.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/ktutorial/ktutorial-editor/doc/en/set-reaction-data.png =================================================================== (Binary files differ) Property changes on: trunk/ktutorial/ktutorial-editor/doc/en/set-reaction-data.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/ktutorial/ktutorial-editor/doc/en/set-step-data.png =================================================================== (Binary files differ) Property changes on: trunk/ktutorial/ktutorial-editor/doc/en/set-step-data.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/ktutorial/ktutorial-editor/doc/en/set-tutorial-information.png =================================================================== (Binary files differ) Property changes on: trunk/ktutorial/ktutorial-editor/doc/en/set-tutorial-information.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/ktutorial/ktutorial-editor/doc/en/using.docbook =================================================================== --- trunk/ktutorial/ktutorial-editor/doc/en/using.docbook (rev 0) +++ trunk/ktutorial/ktutorial-editor/doc/en/using.docbook 2010-03-23 22:22:03 UTC (rev 186) @@ -0,0 +1,279 @@ +<!--<?xml version="1.0" ?> +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd"> --> +<!-- Uncomment the previous two lines to validate this document --> +<!-- standalone. Be sure to recomment them before attempting to --> +<!-- process index.docbook --> + +<chapter id="using"> + <title>Using &ktutorial-editor;</title> + + <para>In this chapter you should find all the information you need to use &ktutorial-editor;. However, some general information about KTutorial is also given here, as it is needed to fully understand the purpose of &ktutorial-editor;.</para> + + <tip> + <title>Getting extended information</title> + + <para>You can also get extended information about a lot of widgets throughout &ktutorial-editor; using the <emphasis>What's This?</emphasis> help. <emphasis>What's This?</emphasis> help can be shown with the keyboard shortcut <keycombo action="simul">&Shift;<keycap>F1</keycap></keycombo>, selecting <guimenuitem>What's This?</guimenuitem> from the <guimenu>Help</guimenu> menu or, with some window decorations, clicking on the What's This? button in the window's titlebar (usually a question mark), and then clicking on the widget to get its extended help.</para> + </tip> + + <sect1 id="understanding-ktutorial"> + <title>Understanding KTutorial</title> + + <para>&ktutorial-editor; is just a graphical editor to create tutorials to be used by KTutorial. That is why you should at least have some little notions of how KTutorial works to fully understand the purpose of &ktutorial-editor;.</para> + + <para>A tutorial is a little guide to help the user to learn how to use an application. For example, it shows the user how some feature works, or how to accomplish some task. A tutorial is composed of several steps, each one containing a bit of information.</para> + + <para>The most interesting feature is that, with KTutorial, applications can explain to the user how to do something in an interactive way. Each step contains one or more reactions. A reaction is composed by a trigger and a response: when the reaction is triggered, the response is executed.</para> + + <para>There are two types of triggers: options and conditions to wait for. Options are shown to the user as buttons below the text of the step, and the response is executed when the user selects the option. Conditions to wait for are not show in any way to the user, and the response is executed when the condition is met. For example, when an object receives an event, or when an object emits a signal.</para> + + <para>There are also two types of responses: changing to another step, or executing some custom code.</para> + + <para>Finally, KTutorial provides a system to execute some actions when a tutorial starts or finishes, or when the tutorial enters or exists from a step.</para> + + <para>All this abstract concepts are fine but, how do you tell KTutorial all those things? KTutorial is a software package, how does it know that it has to wait for something to happen, or show the user some text, or whatever? KTutorial tutorials are specified as source code, be it C++ or a script language.</para> + + <para>C++ tutorials must be embedded in the application source code itself, and they have to be compiled with it when the application is compiled.</para> + + <para>On the other hand, scripted tutorials are external data to the application. When an application that supports KTutorial starts, it looks for scripted tutorials in some specific directories and loads those found. If you add new scripted tutorials to the directories, the next time the application starts they will be available. You don't have to compile again the application, not even to reinstall it.</para> + + <para>Scripted tutorials are looked for in the <filename>tutorials/</filename> subdirectory of the application data directory. The application data directory is <filename>KDE_PREFIX/share/apps/applicationName/</filename>. Special cases aside, the <emphasis>KDE_PREFIX</emphasis> can be the KDE installation prefix (usually <filename>/usr/</filename>) or the user KDE4 configuration directory (<filename>/home/userName/.kde4/</filename>).</para> + + <para>When the scripted tutorial is part of an application (it is installed with the rest of the application data when the application is installed), the strings in the scripted tutorial can be extracted to be localized before the installation like any other string in the C++ code, as explained in KTutorial documentation. Scripted tutorials that are added after the application was installed, however, can not be localized, as KTutorial uses the same translation file as the rest of the application where it is used.</para> + + <para>As you may have guessed already, KTutorial editor creates scripted tutorials. Right now, only Javascript is supported, as KDE libraries offer out of the box support for Javascript scripts. Python or Ruby, on the other hand, require some specific packages to be installed in the system.</para> + </sect1> + + <sect1 id="main-window"> + <title>Main Window</title> + + <para>&ktutorial-editor; main window shows the tutorial being worked on, and provides actions to modify it.</para> + + <para>A tutorial can be seen as a hierarchical structure: a tutorial contains several steps, each step may contain several reactions, and each reaction may contain a composed condition. Also, tutorial, step and reactions contain other properties, like the name in a tutorial or the response code in a reaction, that can be seen as children of their element. With all this, a tutorial is shown as a tree in the main window.</para> + + <para>The tree only shows properties already set. For example, if there is no custom setup code for a step, no item is shown, not even to say that there is no setup code. The exception to this behavior happens when a property is mandatory, for example, the id of a step. In that case, if the property is not set, an item with a warning is shown.</para> + + <para>The actions to modify the tutorial and its elements can be always accessed from the <guimenu>Edit</guimenu> menu. Most actions will open a edition dialog to edit the desired element, which means that, in some cases, you have to select an element before being able to use an action. For example, to use <action>Set reaction data</action>, you first have to select the reaction to edit in the tutorial. Otherwise, the action will be disabled and it could not be executed (which is logical, as it will not know which reaction to edit).</para> + + <para>As well as being shown in the <guimenu>Edit</guimenu> menu, the actions to edit a tutorial, a step and a reaction are shown in three panels provided for convenience. The panels can be shown or hidden from <guimenu>View</guimenu> menu, and can be docked to the top, bottom, right or left side of the main window. If desired, they can also be dragged out of the window to make them floating panels.</para> + + <screenshot> + <screeninfo>The main window of &ktutorial-editor; with a tutorial being worked on</screeninfo> + <mediaobject> + <imageobject> + <imagedata fileref="main-window.png" format="PNG"/> + </imageobject> + <textobject> + <phrase>&ktutorial-editor; Main Window</phrase> + </textobject> + </mediaobject> + </screenshot> + </sect1> + + <sect1 id="edition-dialogs"> + <title>Edition dialogs</title> + + <para>There are several edition dialogs, each one to set some property or properties of an element.</para> + + <sect2 id="edition-dialogs-tutorial"> + <title>Tutorial edition</title> + + <para>The tutorial information dialog is used to set the name and description of a tutorial. The name and description are mandatory properties, as through the name the user can identify a tutorial and with the description he can know the purpose of the tutorial.</para> + + <screenshot> + <screeninfo>The dialog to set the name and description of a tutorial</screeninfo> + <mediaobject> + <imageobject> + <imagedata fileref="set-tutorial-information.png" format="PNG"/> + </imageobject> + <textobject> + <phrase>Tutorial information edition dialog</phrase> + </textobject> + </mediaobject> + </screenshot> + + <para>The license text dialog is used to set a license for the tutorial, for example, if the exported scripted tutorial is going to be distributed with its application. When the tutorial is exported, the license text is automatically wrapped in comments appropriate for the script language. For example, the following license text: +<programlisting>The license text, which should be +wrapped +</programlisting> is exported to Javascript as: +<programlisting>/***************************************** + * The license text, which should be * + * wrapped * + *****************************************/ +</programlisting> + </para> + + <para>The setup and tear down code dialogs just provide a text editor to write the custom code to be executed when the tutorial starts or finishes. Note that you have to provide just the body of the function, as the signature is automatically written when exported. For example, the following setup code: +<programlisting>alert("Hello world!");</programlisting> is exported to Javascript as: +<programlisting>function tutorialSetup(tutorial) { + alert("Hello world!"); +} +</programlisting> + </para> + </sect2> + + <sect2 id="edition-dialogs-step"> + <title>Step edition</title> + + <para>The step data dialog is used to set the id and text of a tutorial. The id and text are mandatory properties, as the id is used by other steps to change to this step, and the text is shown to the user to explain him what must be done. Thus, the id must be unique for every step in the same tutorial.</para> + <para>The step data dialog is also shown when a new step is added. If the dialog is accepted, the step is added. If the dialog is cancelled, the step is not added.</para> + <para>Also note that, in every tutorial, there must be one step with id <emphasis>start</emphasis>, so KTutorial knows where to start the tutorial.</para> + + <screenshot> + <screeninfo>The dialog to set the id and text of a step</screeninfo> + <mediaobject> + <imageobject> + <imagedata fileref="set-step-data.png" format="PNG"/> + </imageobject> + <textobject> + <phrase>Step data edition dialog</phrase> + </textobject> + </mediaobject> + </screenshot> + + <para>The setup and tear down code dialogs behave like the tutorial ones. The only difference is that the code is executed when the tutorial changes to the step or when the tutorial changes from this step to another one.</para> + <para>Also note that the exported scripted tutorial creates all the reactions in the setup method of a step. The custom setup code is added after that code.</para> + </sect2> + + <sect2 id="edition-dialogs-reaction"> + <title>Reaction edition</title> + + <para>The reaction dialog is used to set the trigger and response of a step. The trigger and response are mandatory properties, as they define how the reaction behaves.</para> + <para>The trigger can be either an option selected or a condition met, but not both. If the trigger type is the option, its name will be shown to the user in the step and the response will be executed when the user selects it. If the type is the condition, the response will be executed when the condition is met.</para> + <para>Likely, the response can be changing to another step or executing some custom code, but not both. If the response type is the custom code, it will be used as the body of a function called when the reaction is triggered. Again, the signature of the function is automatically provided and you have to set only the body.</para> + + <screenshot> + <screeninfo>The dialog to set the trigger and response of a reaction</screeninfo> + <mediaobject> + <imageobject> + <imagedata fileref="set-reaction-data.png" format="PNG"/> + </imageobject> + <textobject> + <phrase>Set reaction data edition dialog</phrase> + </textobject> + </mediaobject> + </screenshot> + + <sect3 id="edition-dialogs-reaction-condition"> + <title>Condition edition</title> + + <para>The condition that acts as a trigger of a reaction can be a simple condition or a composed condition. Simple conditions wait for something to happen, like a signal emitted by an object. Composed conditions wait for its child conditions. For example, waiting until a signal is emitted by an object or an event is received in another object, whatever comes first.</para> + <para>Due to this, conditions are represented in a tree, and it also affects how they are edited.</para> + <para>A condition can be added as the root condition when there are no other conditions set, or as a child of the selected composed condition, but not when a simple condition is selected. When a new condition is added, you must select its type. Note that the type of the condition can not be changed later, you will have to remove the condition.</para> + + <screenshot> + <screeninfo>The dialog to select the type of the new condition to add</screeninfo> + <mediaobject> + <imageobject> + <imagedata fileref="new-condition.png" format="PNG"/> + </imageobject> + <textobject> + <phrase>New condition dialog</phrase> + </textobject> + </mediaobject> + </screenshot> + + <para>Only simple conditions (waiting for an event and waiting for a signal) can be edited, showing specific dialogs for it. Composed conditions only group other conditions, so they don't have properties to be edited.</para> + <para>Any condition can be removed from its parent composed condition, or from the reaction if it is the root condition.</para> + + <para>There is a special type of condition that verifies that its negated condition wasn't met which purpose is to be used only as a child of a composed condition that waits until all its child conditions were met. The idea is that, when the negated condition wasn't met, the special condition is met. When the negated condition is met, the special condition is no longer met. It can be used, for example, to make a reaction wait for the user to write something in a text line, provided he has not pressed a button before. Note that a fallback reaction should be added in cases like this one.</para> + </sect3> + </sect2> + </sect1> + + <sect1 id="export-tutorial"> + <title>Exporting the tutorial</title> + + <para>Once you have finished designing the tutorial you can export it to a scripted tutorial. To do this, just use <menuchoice><guimenu>File</guimenu><guimenuitem>Export...</guimenuitem></menuchoice>, select where to save the file and you are done. Remember that you have to export the file to some specific directory to be found by KTutorial, as explained in <xref linkend="understanding-ktutorial"/>.</para> + <para>The export dialog supports exporting to remote directories (via FTP, SSH, etc), although it will be very strange that you need to use that.</para> + </sect1> + + <sect1 id="command-line-options"> + <title>Command Line Options</title> + + <para>Though &ktutorial-editor; will be usually started from the &kde; program menu, or a desktop icon, it can also be opened from the command line prompt of a terminal window. There are a few options that are available when doing this.</para> + + <sect2 id="other-command-line-options"> + <title>Default KDE4 Command Line Options</title> + + <para>The following command line help options are available:</para> + + <variablelist> + <varlistentry> + <term> + <command>ktutorial-editor <option>--help</option></command> + </term> + <listitem> + <para>This lists the most basic options available at the command line.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>ktutorial-editor <option>--help-qt</option></command> + </term> + <listitem> + <para>This lists the options available for changing the way &ktutorial-editor; interacts with &Qt;.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>ktutorial-editor <option>--help-kde</option></command> + </term> + <listitem> + <para>This lists the options available for changing the way &ktutorial-editor; interacts with &kde;.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>ktutorial-editor <option>--help-all</option></command> + </term> + <listitem> + <para>This lists all of the command line options.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>ktutorial-editor <option>--author</option></command> + </term> + <listitem> + <para>Lists &ktutorial-editor;'s author in the terminal window.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>ktutorial-editor <option>--version</option></command> + </term> + <listitem> + <para>Lists version information for &Qt;, &kde;, and &ktutorial-editor;. Also available through <command>ktutorial-editor <option>-v</option></command>.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>ktutorial-editor <option>--license</option></command> + </term> + <listitem> + <para>Shows &ktutorial-editor;'s license text in the terminal window.</para> + </listitem> + </varlistentry> + </variablelist> + </sect2> + </sect1> +</chapter> + +<!-- +Local Variables: +mode: xml +sgml-minimize-attributes:nil +sgml-general-insert-case:lower +sgml-indent-step:0 +sgml-indent-data:nil +End: + +vim:tabstop=4:shiftwidth=4:expandtab +kate: space-indent on; indent-width 4; tab-width 4; indent-mode none; +--> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-23 08:03:06
|
Revision: 185 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=185&view=rev Author: danxuliu Date: 2010-03-23 08:02:59 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Remove svn:executable property from text files (I don't know how, when or why I added it...) Property Changed: ---------------- trunk/ktutorial/ktutorial-editor/CMakeLists.txt trunk/ktutorial/ktutorial-editor/po/CMakeLists.txt trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc trunk/ktutorial/ktutorial-editor/src/main.cpp trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt trunk/ktutorial/ktutorial-editor/src/view/EditionDialog.cpp trunk/ktutorial/ktutorial-editor/src/view/EditionDialog.h trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt trunk/ktutorial/ktutorial-editor/tests/unit/view/CMakeLists.txt trunk/ktutorial/ktutorial-library/CMakeLists.txt trunk/ktutorial/ktutorial-library/po/CMakeLists.txt trunk/ktutorial/ktutorial-library/po/es.po trunk/ktutorial/ktutorial-library/po/ktutorial.pot trunk/ktutorial/ktutorial-library/src/CMakeLists.txt trunk/ktutorial/ktutorial-library/src/KTutorial.cpp trunk/ktutorial/ktutorial-library/src/KTutorial.h trunk/ktutorial/ktutorial-library/src/Option.cpp trunk/ktutorial/ktutorial-library/src/Option.h trunk/ktutorial/ktutorial-library/src/Step.cpp trunk/ktutorial/ktutorial-library/src/Step.h trunk/ktutorial/ktutorial-library/src/Tutorial.cpp trunk/ktutorial/ktutorial-library/src/Tutorial.h trunk/ktutorial/ktutorial-library/src/TutorialInformation.cpp trunk/ktutorial/ktutorial-library/src/TutorialInformation.h trunk/ktutorial/ktutorial-library/src/TutorialManager.cpp trunk/ktutorial/ktutorial-library/src/TutorialManager.h trunk/ktutorial/ktutorial-library/src/WaitFor.cpp trunk/ktutorial/ktutorial-library/src/WaitFor.h trunk/ktutorial/ktutorial-library/src/WaitForAnd.cpp trunk/ktutorial/ktutorial-library/src/WaitForAnd.h trunk/ktutorial/ktutorial-library/src/WaitForComposed.cpp trunk/ktutorial/ktutorial-library/src/WaitForComposed.h trunk/ktutorial/ktutorial-library/src/WaitForNot.cpp trunk/ktutorial/ktutorial-library/src/WaitForNot.h trunk/ktutorial/ktutorial-library/src/WaitForOr.cpp trunk/ktutorial/ktutorial-library/src/WaitForOr.h trunk/ktutorial/ktutorial-library/src/WaitForSignal.cpp trunk/ktutorial/ktutorial-library/src/WaitForSignal.h trunk/ktutorial/ktutorial-library/src/ktutorial_export.h trunk/ktutorial/ktutorial-library/src/ktutorialui.rc trunk/ktutorial/ktutorial-library/src/scripting/CMakeLists.txt trunk/ktutorial/ktutorial-library/src/tutorials/CMakeLists.txt trunk/ktutorial/ktutorial-library/src/tutorials/UsingKTutorial.cpp trunk/ktutorial/ktutorial-library/src/tutorials/UsingKTutorial.h trunk/ktutorial/ktutorial-library/src/view/CMakeLists.txt trunk/ktutorial/ktutorial-library/src/view/StepWidget.cpp trunk/ktutorial/ktutorial-library/src/view/StepWidget.h trunk/ktutorial/ktutorial-library/src/view/StepWidget.ui trunk/ktutorial/ktutorial-library/src/view/TutorialListModel.cpp trunk/ktutorial/ktutorial-library/src/view/TutorialListModel.h trunk/ktutorial/ktutorial-library/src/view/TutorialManagerDialog.cpp trunk/ktutorial/ktutorial-library/src/view/TutorialManagerDialog.h trunk/ktutorial/ktutorial-library/src/view/TutorialManagerDialog.ui trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/scripting/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/view/CMakeLists.txt trunk/ktutorial/ktutorial-test-app/CMakeLists.txt trunk/ktutorial/ktutorial-test-app/TestApp.cpp trunk/ktutorial/ktutorial-test-app/TestApp.h trunk/ktutorial/ktutorial-test-app/TutorialClearText.cpp trunk/ktutorial/ktutorial-test-app/TutorialClearText.h trunk/ktutorial/ktutorial-test-app/TutorialClearText.js trunk/ktutorial/ktutorial-test-app/TutorialClearText.py trunk/ktutorial/ktutorial-test-app/TutorialMoveText.cpp trunk/ktutorial/ktutorial-test-app/TutorialMoveText.h trunk/ktutorial/ktutorial-test-app/TutorialMoveText.py trunk/ktutorial/ktutorial-test-app/ktutorial-test-appui.rc trunk/ktutorial/ktutorial-test-app/main.cpp trunk/ktutorial/ktutorial-test-app/po/CMakeLists.txt trunk/ktutorial/ktutorial-test-app/po/es.po trunk/ktutorial/ktutorial-test-app/po/ktutorial-test-app.pot Property changes on: trunk/ktutorial/ktutorial-editor/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/po/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/main.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/view/EditionDialog.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/src/view/EditionDialog.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-editor/tests/unit/view/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/po/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/po/es.po ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/po/ktutorial.pot ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/KTutorial.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/KTutorial.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/Option.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/Option.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/Step.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/Step.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/Tutorial.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/Tutorial.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/TutorialInformation.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/TutorialInformation.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/TutorialManager.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/TutorialManager.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitFor.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitFor.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForAnd.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForAnd.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForComposed.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForComposed.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForNot.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForNot.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForOr.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForOr.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForSignal.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/WaitForSignal.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/ktutorial_export.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/ktutorialui.rc ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/scripting/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/src/tutorials/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/src/tutorials/UsingKTutorial.cpp ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/src/tutorials/UsingKTutorial.h ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/src/view/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/StepWidget.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/StepWidget.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/StepWidget.ui ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/TutorialListModel.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/TutorialListModel.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/TutorialManagerDialog.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/TutorialManagerDialog.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/src/view/TutorialManagerDialog.ui ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/tests/scripting/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-library/tests/view/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-test-app/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TestApp.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TestApp.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialClearText.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialClearText.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialClearText.js ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialClearText.py ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialMoveText.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialMoveText.h ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/TutorialMoveText.py ___________________________________________________________________ Deleted: svn:executable - * Property changes on: trunk/ktutorial/ktutorial-test-app/ktutorial-test-appui.rc ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/main.cpp ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/po/CMakeLists.txt ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/po/es.po ___________________________________________________________________ Deleted: svn:executable - Property changes on: trunk/ktutorial/ktutorial-test-app/po/ktutorial-test-app.pot ___________________________________________________________________ Deleted: svn:executable - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-23 07:32:01
|
Revision: 184 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=184&view=rev Author: danxuliu Date: 2010-03-23 07:31:55 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Add desktop file for KTutorial editor Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt Added Paths: ----------- trunk/ktutorial/ktutorial-editor/src/ktutorial-editor.desktop Modified: trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-03-23 00:56:41 UTC (rev 183) +++ trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-03-23 07:31:55 UTC (rev 184) @@ -33,4 +33,5 @@ ####### Install the editor ####### install(TARGETS ktutorial-editor DESTINATION ${BIN_INSTALL_DIR}) +install(FILES ktutorial-editor.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES ktutorial-editorui.rc DESTINATION ${DATA_INSTALL_DIR}/ktutorial-editor) Added: trunk/ktutorial/ktutorial-editor/src/ktutorial-editor.desktop =================================================================== --- trunk/ktutorial/ktutorial-editor/src/ktutorial-editor.desktop (rev 0) +++ trunk/ktutorial/ktutorial-editor/src/ktutorial-editor.desktop 2010-03-23 07:31:55 UTC (rev 184) @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=KTutorial editor +Name[es]=KTutorial editor +GenericName=Editor for KTutorial tutorials +GenericName[es]=Editor para tutoriales de KTutorial +Exec=ktutorial-editor +Type=Application +Categories=Qt;KDE;Development;Documentation; +Terminal=false This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-23 00:56:47
|
Revision: 183 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=183&view=rev Author: danxuliu Date: 2010-03-23 00:56:41 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Fix Krazy2 endswithnewline issue Modified Paths: -------------- trunk/ktutorial/ktutorial-library/src/WaitForEvent.h Modified: trunk/ktutorial/ktutorial-library/src/WaitForEvent.h =================================================================== --- trunk/ktutorial/ktutorial-library/src/WaitForEvent.h 2010-03-22 23:42:41 UTC (rev 182) +++ trunk/ktutorial/ktutorial-library/src/WaitForEvent.h 2010-03-23 00:56:41 UTC (rev 183) @@ -151,4 +151,4 @@ }; -#endif \ No newline at end of file +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 23:42:47
|
Revision: 182 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=182&view=rev Author: danxuliu Date: 2010-03-22 23:42:41 +0000 (Mon, 22 Mar 2010) Log Message: ----------- Update translation template and Spanish translation. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/po/es.po trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot Modified: trunk/ktutorial/ktutorial-editor/po/es.po =================================================================== --- trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-22 23:34:39 UTC (rev 181) +++ trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-22 23:42:41 UTC (rev 182) @@ -7,10 +7,10 @@ msgid "" msgstr "" "Project-Id-Version: ktutorial-editor\n" -"Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" -"group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-22 23:59+0100\n" -"PO-Revision-Date: 2010-03-22 20:22-0400\n" +"Report-Msgid-Bugs-To: http://sourceforge." +"net/tracker/?group_id=301227&atid=1270278\n" +"POT-Creation-Date: 2010-03-23 00:32+0100\n" +"PO-Revision-Date: 2010-03-23 00:32-0400\n" "Last-Translator: Daniel Calviño Sánchez <dan...@gm...>\n" "Language-Team: Spanish <>\n" "MIME-Version: 1.0\n" @@ -29,7 +29,7 @@ msgid "Edit step" msgstr "Editar paso" -#: KTutorialEditor.cpp:95 rc.cpp:52 +#: KTutorialEditor.cpp:95 rc.cpp:55 msgctxt "@title" msgid "Edit reaction" msgstr "Editar reacción" @@ -469,11 +469,16 @@ msgstr "Paneles" #: rc.cpp:15 +msgctxt "@title:menu" +msgid "Main Toolbar" +msgstr "Barra de herramientas principal" + +#: rc.cpp:18 msgctxt "@title" msgid "Set tutorial license" msgstr "Establecer licencia del tutorial" -#: rc.cpp:18 +#: rc.cpp:21 msgctxt "@info:whatsthis" msgid "" "<para>Set the license of the tutorial.</para>\n" @@ -492,57 +497,57 @@ "se encargará de añadirle los caracteres necesarios en cada línea para " "indicar que son comentarios en lugar de código fuente.</para>" -#: rc.cpp:22 +#: rc.cpp:25 msgctxt "@title" msgid "License text" msgstr "Texto de la licencia" -#: rc.cpp:25 +#: rc.cpp:28 msgctxt "@title" msgid "New condition to wait for" msgstr "Nueva condición por la que esperar" -#: rc.cpp:28 +#: rc.cpp:31 msgctxt "@info:whatsthis" msgid "<para>Selects the type of the new condition.</para>" msgstr "<para>Selecciona el tipo de la nueva condición.</para>" -#: rc.cpp:31 +#: rc.cpp:34 msgctxt "@title" msgid "Condition to wait for type" msgstr "Tipo de la condición por la que esperar" -#: rc.cpp:34 +#: rc.cpp:37 msgctxt "@label:listbox" msgid "Type:" msgstr "Tipo:" -#: rc.cpp:37 +#: rc.cpp:40 msgctxt "@item:inlistbox" msgid "All the contained conditions must match" msgstr "Todas las condiciones contenidas deben cumplirse" -#: rc.cpp:40 +#: rc.cpp:43 msgctxt "@item:inlistbox" msgid "Any of the contained conditions must match" msgstr "Alguna de las condiciones contenidas debe cumplirse" -#: rc.cpp:43 +#: rc.cpp:46 msgctxt "@item:inlistbox" msgid "The contained condition can't match" msgstr "La condición contenida no puede cumplirse" -#: rc.cpp:46 +#: rc.cpp:49 msgctxt "@item:inlistbox" msgid "The specified signal is emitted" msgstr "Se emite la señal especificada" -#: rc.cpp:49 +#: rc.cpp:52 msgctxt "@item:inlistbox" msgid "The specified event is received" msgstr "Se recibe el evento especificado" -#: rc.cpp:55 +#: rc.cpp:58 msgctxt "@info:whatsthis" msgid "" "<para>Edit the response of a step to certain trigger.</para>\n" @@ -557,17 +562,17 @@ "seleccionada por el usuario, o una condición que se cumplió. La respuesta " "puede ser cambiar a otro paso, o ejecutar cierto código propio.</para>" -#: rc.cpp:59 +#: rc.cpp:62 msgctxt "@title:group Something that causes a response" msgid "Trigger" msgstr "Activador" -#: rc.cpp:62 +#: rc.cpp:65 msgctxt "@option:radio" msgid "Option:" msgstr "Opción:" -#: rc.cpp:65 +#: rc.cpp:68 msgctxt "@info:whatsthis" msgid "" "<para>The name of the option.</para>\n" @@ -578,32 +583,32 @@ "<para>Una opción con ese nombre se añadirá al paso, por lo que el mismo " "nombre establecido aquí será el mostrado al usuario.</para>" -#: rc.cpp:69 +#: rc.cpp:72 msgctxt "@option:radio" msgid "Condition met:" msgstr "Condición cumplida:" -#: rc.cpp:72 +#: rc.cpp:75 msgctxt "@title:group" msgid "Response" msgstr "Respuesta" -#: rc.cpp:75 +#: rc.cpp:78 msgctxt "@option:radio" msgid "Change to step:" msgstr "Cambiar al paso:" -#: rc.cpp:78 +#: rc.cpp:81 msgctxt "@info:whatsthis" msgid "<para>The id of the step to change to.</para>" msgstr "<para>El identificador del paso al que cambiar.</para>" -#: rc.cpp:81 +#: rc.cpp:84 msgctxt "@option:radio" msgid "Custom response code:" msgstr "Código propio de respuesta:" -#: rc.cpp:84 +#: rc.cpp:87 msgctxt "@info:whatsthis" msgid "" "<para>The custom code to execute.</para>\n" @@ -621,12 +626,12 @@ "<para>Además, ten en cuenta que sólo tienes que especificar el cuerpo de la " "función. La signatura se genera automáticamente.</para>" -#: rc.cpp:89 +#: rc.cpp:92 msgctxt "@title" msgid "Set step data" msgstr "Establecer datos del paso" -#: rc.cpp:92 +#: rc.cpp:95 msgctxt "@info:whatsthis" msgid "" "<para>Set the id and the text of the step</para>\n" @@ -643,27 +648,27 @@ "muestra al usuario. Se utiliza para identificar los pasos en el tutorial " "cuando tiene que cambiar de un paso a otro.</para>" -#: rc.cpp:97 +#: rc.cpp:100 msgctxt "@title" msgid "Step data" msgstr "Datos del paso" -#: rc.cpp:100 +#: rc.cpp:103 msgctxt "@label:textbox" msgid "Id:" msgstr "Identificador:" -#: rc.cpp:103 +#: rc.cpp:106 msgctxt "@label:textbox" msgid "Text:" msgstr "Texto:" -#: rc.cpp:106 +#: rc.cpp:109 msgctxt "@title" msgid "Set tutorial information" msgstr "Establecer información del tutorial" -#: rc.cpp:109 +#: rc.cpp:112 msgctxt "@info:whatsthis" msgid "" "<para>Set the name and description of the tutorial.</para>\n" @@ -674,48 +679,48 @@ "<para>El nombre y la descripción se muestran en el diálogo en el que se " "selecciona qué tutorial se empezará.</para>" -#: rc.cpp:113 +#: rc.cpp:116 msgctxt "@title" msgid "Tutorial information" msgstr "Información del tutorial" -#: rc.cpp:116 +#: rc.cpp:119 msgctxt "@label:textbox Noun, the name of a tutorial" msgid "Name:" msgstr "Nombre:" -#: rc.cpp:119 +#: rc.cpp:122 msgctxt "@label:textbox" msgid "Description:" msgstr "Descripción:" -#: rc.cpp:122 +#: rc.cpp:125 msgctxt "@title" msgid "Edit event to wait for" msgstr "Editar el evento por el que esperar" -#: rc.cpp:125 +#: rc.cpp:128 msgctxt "@info:whatsthis" msgid "<para>Set the receiver name and the event to wait for.</para>" msgstr "" "<para>Establece el nombre del receptor y el evento por el que esperar.</para>" -#: rc.cpp:128 +#: rc.cpp:131 msgctxt "@title:group" msgid "Wait for event" msgstr "Esperar por el evento" -#: rc.cpp:131 +#: rc.cpp:134 msgctxt "@label:textbox" msgid "Receiver name:" msgstr "Nombre del receptor:" -#: rc.cpp:134 +#: rc.cpp:137 msgctxt "@label:textbox" msgid "Event name:" msgstr "Nombre del evento:" -#: rc.cpp:137 +#: rc.cpp:140 msgctxt "@info:whatsthis" msgid "" "<para>The name of the QObject that receives the event.</para>\n" @@ -726,7 +731,7 @@ "<para>Ten en cuenta que el nombre no es la clase del objeto, sino la cadena " "devuelta por su método objectName().</para>" -#: rc.cpp:141 +#: rc.cpp:144 msgctxt "@info:whatsthis" msgid "" "<para>The name of the event.</para>\n" @@ -737,33 +742,33 @@ "<para>El nombre no debe contener el prefijo \"QEvent::\", sólo el nombre " "puro del evento.</para>" -#: rc.cpp:145 +#: rc.cpp:148 msgctxt "@title" msgid "Edit signal to wait for" msgstr "Editar la señal por la que esperar" -#: rc.cpp:148 +#: rc.cpp:151 msgctxt "@info:whatsthis" msgid "<para>Set the emitter name and the signal to wait for.</para>" msgstr "" "<para>Establece el nombre del emisor y la señal por la que esperar.</para>" -#: rc.cpp:151 +#: rc.cpp:154 msgctxt "@title:group" msgid "Wait for signal" msgstr "Esperar por la señal" -#: rc.cpp:154 +#: rc.cpp:157 msgctxt "@label:textbox" msgid "Emitter name:" msgstr "Nombre del emisor:" -#: rc.cpp:157 +#: rc.cpp:160 msgctxt "@label:textbox" msgid "Signal name:" msgstr "Nombre de la señal:" -#: rc.cpp:160 +#: rc.cpp:163 msgctxt "@info:whatsthis" msgid "" "<para>The name of the QObject that emits the signal.</para>\n" @@ -774,7 +779,7 @@ "<para>Ten en cuenta que el nombre no es la clase del objeto, sino la cadena " "devuelta por su método objectName().</para>" -#: rc.cpp:164 +#: rc.cpp:167 msgctxt "@info:whatsthis" msgid "" "<para>The name of the signal.</para>\n" @@ -787,12 +792,12 @@ "(TipoDelPrimerArgumento, TipoDelSegundoArgumento, TipoDelTercerArgumento...)" "</em>, sin estar envuelto en el texto <em>SIGNAL()</em>.</para>" -#: rc.cpp:168 +#: rc.cpp:171 msgctxt "@title" msgid "Edit condition to wait for" msgstr "Editar la condición por la que esperar" -#: rc.cpp:171 +#: rc.cpp:174 msgctxt "@info:whatsthis" msgid "" "<para>Edit a condition to wait for until it is met.</para>\n" @@ -812,12 +817,12 @@ "esperan hasta que todas las condiciones que contienen se hayan cumplido.</" "para>" -#: rc.cpp:175 +#: rc.cpp:178 msgctxt "@info:tooltip" msgid "Add a new condition" msgstr "Añadir una nueva condición" -#: rc.cpp:178 +#: rc.cpp:181 msgctxt "@info:whatsthis" msgid "" "<para>Adds a new condition.</para>\n" @@ -830,17 +835,17 @@ "condiciones que contienen otras condiciones, o como la condición base cuando " "no hay más condiciones.</para>" -#: rc.cpp:182 +#: rc.cpp:185 msgctxt "@action:button" msgid "Add..." msgstr "Añadir..." -#: rc.cpp:185 +#: rc.cpp:188 msgctxt "@info:tooltip" msgid "Edit the selected condition" msgstr "Editar la condición seleccionada" -#: rc.cpp:188 +#: rc.cpp:191 msgctxt "@info:whatsthis" msgid "" "<para>Edits the selected condition.</para>\n" @@ -851,32 +856,32 @@ "<para>Sólo las condiciones simples, es decir, las condiciones que no están " "compuestas por otras condiciones, pueden editarse.</para>" -#: rc.cpp:192 +#: rc.cpp:195 msgctxt "@action:button" msgid "Edit..." msgstr "Editar..." -#: rc.cpp:195 +#: rc.cpp:198 msgctxt "@info:tooltip" msgid "Remove the selected condition" msgstr "Eliminar la condición seleccionada" -#: rc.cpp:198 +#: rc.cpp:201 msgctxt "@info:whatsthis" msgid "Removes the selected condition." msgstr "Elimina la condición seleccionada." -#: rc.cpp:201 +#: rc.cpp:204 msgctxt "@action:button" msgid "Remove" msgstr "Eliminar" -#: rc.cpp:202 +#: rc.cpp:205 msgctxt "NAME OF TRANSLATORS" msgid "Your names" msgstr "Daniel Calviño Sánchez" -#: rc.cpp:203 +#: rc.cpp:206 msgctxt "EMAIL OF TRANSLATORS" msgid "Your emails" msgstr "dan...@gm..." Modified: trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot =================================================================== --- trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-22 23:34:39 UTC (rev 181) +++ trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-22 23:42:41 UTC (rev 182) @@ -9,7 +9,7 @@ "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" "group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-22 23:59+0100\n" +"POT-Creation-Date: 2010-03-23 00:32+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -27,7 +27,7 @@ msgid "Edit step" msgstr "" -#: KTutorialEditor.cpp:95 rc.cpp:52 +#: KTutorialEditor.cpp:95 rc.cpp:55 msgctxt "@title" msgid "Edit reaction" msgstr "" @@ -437,11 +437,16 @@ msgstr "" #: rc.cpp:15 +msgctxt "@title:menu" +msgid "Main Toolbar" +msgstr "" + +#: rc.cpp:18 msgctxt "@title" msgid "Set tutorial license" msgstr "" -#: rc.cpp:18 +#: rc.cpp:21 msgctxt "@info:whatsthis" msgid "" "<para>Set the license of the tutorial.</para>\n" @@ -453,57 +458,57 @@ "para>" msgstr "" -#: rc.cpp:22 +#: rc.cpp:25 msgctxt "@title" msgid "License text" msgstr "" -#: rc.cpp:25 +#: rc.cpp:28 msgctxt "@title" msgid "New condition to wait for" msgstr "" -#: rc.cpp:28 +#: rc.cpp:31 msgctxt "@info:whatsthis" msgid "<para>Selects the type of the new condition.</para>" msgstr "" -#: rc.cpp:31 +#: rc.cpp:34 msgctxt "@title" msgid "Condition to wait for type" msgstr "" -#: rc.cpp:34 +#: rc.cpp:37 msgctxt "@label:listbox" msgid "Type:" msgstr "" -#: rc.cpp:37 +#: rc.cpp:40 msgctxt "@item:inlistbox" msgid "All the contained conditions must match" msgstr "" -#: rc.cpp:40 +#: rc.cpp:43 msgctxt "@item:inlistbox" msgid "Any of the contained conditions must match" msgstr "" -#: rc.cpp:43 +#: rc.cpp:46 msgctxt "@item:inlistbox" msgid "The contained condition can't match" msgstr "" -#: rc.cpp:46 +#: rc.cpp:49 msgctxt "@item:inlistbox" msgid "The specified signal is emitted" msgstr "" -#: rc.cpp:49 +#: rc.cpp:52 msgctxt "@item:inlistbox" msgid "The specified event is received" msgstr "" -#: rc.cpp:55 +#: rc.cpp:58 msgctxt "@info:whatsthis" msgid "" "<para>Edit the response of a step to certain trigger.</para>\n" @@ -513,17 +518,17 @@ "step, or executing some custom code.</para>" msgstr "" -#: rc.cpp:59 +#: rc.cpp:62 msgctxt "@title:group Something that causes a response" msgid "Trigger" msgstr "" -#: rc.cpp:62 +#: rc.cpp:65 msgctxt "@option:radio" msgid "Option:" msgstr "" -#: rc.cpp:65 +#: rc.cpp:68 msgctxt "@info:whatsthis" msgid "" "<para>The name of the option.</para>\n" @@ -531,32 +536,32 @@ "set here will be shown to the user.</para>" msgstr "" -#: rc.cpp:69 +#: rc.cpp:72 msgctxt "@option:radio" msgid "Condition met:" msgstr "" -#: rc.cpp:72 +#: rc.cpp:75 msgctxt "@title:group" msgid "Response" msgstr "" -#: rc.cpp:75 +#: rc.cpp:78 msgctxt "@option:radio" msgid "Change to step:" msgstr "" -#: rc.cpp:78 +#: rc.cpp:81 msgctxt "@info:whatsthis" msgid "<para>The id of the step to change to.</para>" msgstr "" -#: rc.cpp:81 +#: rc.cpp:84 msgctxt "@option:radio" msgid "Custom response code:" msgstr "" -#: rc.cpp:84 +#: rc.cpp:87 msgctxt "@info:whatsthis" msgid "" "<para>The custom code to execute.</para>\n" @@ -567,12 +572,12 @@ "signature is automatically generated.</para>" msgstr "" -#: rc.cpp:89 +#: rc.cpp:92 msgctxt "@title" msgid "Set step data" msgstr "" -#: rc.cpp:92 +#: rc.cpp:95 msgctxt "@info:whatsthis" msgid "" "<para>Set the id and the text of the step</para>\n" @@ -583,27 +588,27 @@ "change from one to step to another.</para>" msgstr "" -#: rc.cpp:97 +#: rc.cpp:100 msgctxt "@title" msgid "Step data" msgstr "" -#: rc.cpp:100 +#: rc.cpp:103 msgctxt "@label:textbox" msgid "Id:" msgstr "" -#: rc.cpp:103 +#: rc.cpp:106 msgctxt "@label:textbox" msgid "Text:" msgstr "" -#: rc.cpp:106 +#: rc.cpp:109 msgctxt "@title" msgid "Set tutorial information" msgstr "" -#: rc.cpp:109 +#: rc.cpp:112 msgctxt "@info:whatsthis" msgid "" "<para>Set the name and description of the tutorial.</para>\n" @@ -611,47 +616,47 @@ "tutorial to be started is selected.</para>" msgstr "" -#: rc.cpp:113 +#: rc.cpp:116 msgctxt "@title" msgid "Tutorial information" msgstr "" -#: rc.cpp:116 +#: rc.cpp:119 msgctxt "@label:textbox Noun, the name of a tutorial" msgid "Name:" msgstr "" -#: rc.cpp:119 +#: rc.cpp:122 msgctxt "@label:textbox" msgid "Description:" msgstr "" -#: rc.cpp:122 +#: rc.cpp:125 msgctxt "@title" msgid "Edit event to wait for" msgstr "" -#: rc.cpp:125 +#: rc.cpp:128 msgctxt "@info:whatsthis" msgid "<para>Set the receiver name and the event to wait for.</para>" msgstr "" -#: rc.cpp:128 +#: rc.cpp:131 msgctxt "@title:group" msgid "Wait for event" msgstr "" -#: rc.cpp:131 +#: rc.cpp:134 msgctxt "@label:textbox" msgid "Receiver name:" msgstr "" -#: rc.cpp:134 +#: rc.cpp:137 msgctxt "@label:textbox" msgid "Event name:" msgstr "" -#: rc.cpp:137 +#: rc.cpp:140 msgctxt "@info:whatsthis" msgid "" "<para>The name of the QObject that receives the event.</para>\n" @@ -659,7 +664,7 @@ "returned by its objectName() method.</para>" msgstr "" -#: rc.cpp:141 +#: rc.cpp:144 msgctxt "@info:whatsthis" msgid "" "<para>The name of the event.</para>\n" @@ -667,32 +672,32 @@ "of the event.</para>" msgstr "" -#: rc.cpp:145 +#: rc.cpp:148 msgctxt "@title" msgid "Edit signal to wait for" msgstr "" -#: rc.cpp:148 +#: rc.cpp:151 msgctxt "@info:whatsthis" msgid "<para>Set the emitter name and the signal to wait for.</para>" msgstr "" -#: rc.cpp:151 +#: rc.cpp:154 msgctxt "@title:group" msgid "Wait for signal" msgstr "" -#: rc.cpp:154 +#: rc.cpp:157 msgctxt "@label:textbox" msgid "Emitter name:" msgstr "" -#: rc.cpp:157 +#: rc.cpp:160 msgctxt "@label:textbox" msgid "Signal name:" msgstr "" -#: rc.cpp:160 +#: rc.cpp:163 msgctxt "@info:whatsthis" msgid "" "<para>The name of the QObject that emits the signal.</para>\n" @@ -700,7 +705,7 @@ "returned by its objectName() method.</para>" msgstr "" -#: rc.cpp:164 +#: rc.cpp:167 msgctxt "@info:whatsthis" msgid "" "<para>The name of the signal.</para>\n" @@ -709,12 +714,12 @@ "<em>SIGNAL()</em> wrapping text.</para>" msgstr "" -#: rc.cpp:168 +#: rc.cpp:171 msgctxt "@title" msgid "Edit condition to wait for" msgstr "" -#: rc.cpp:171 +#: rc.cpp:174 msgctxt "@info:whatsthis" msgid "" "<para>Edit a condition to wait for until it is met.</para>\n" @@ -726,12 +731,12 @@ "para>" msgstr "" -#: rc.cpp:175 +#: rc.cpp:178 msgctxt "@info:tooltip" msgid "Add a new condition" msgstr "" -#: rc.cpp:178 +#: rc.cpp:181 msgctxt "@info:whatsthis" msgid "" "<para>Adds a new condition.</para>\n" @@ -740,17 +745,17 @@ "there is no other condition.</para>" msgstr "" -#: rc.cpp:182 +#: rc.cpp:185 msgctxt "@action:button" msgid "Add..." msgstr "" -#: rc.cpp:185 +#: rc.cpp:188 msgctxt "@info:tooltip" msgid "Edit the selected condition" msgstr "" -#: rc.cpp:188 +#: rc.cpp:191 msgctxt "@info:whatsthis" msgid "" "<para>Edits the selected condition.</para>\n" @@ -758,32 +763,32 @@ "other conditions, can be edited.</para>" msgstr "" -#: rc.cpp:192 +#: rc.cpp:195 msgctxt "@action:button" msgid "Edit..." msgstr "" -#: rc.cpp:195 +#: rc.cpp:198 msgctxt "@info:tooltip" msgid "Remove the selected condition" msgstr "" -#: rc.cpp:198 +#: rc.cpp:201 msgctxt "@info:whatsthis" msgid "Removes the selected condition." msgstr "" -#: rc.cpp:201 +#: rc.cpp:204 msgctxt "@action:button" msgid "Remove" msgstr "" -#: rc.cpp:202 +#: rc.cpp:205 msgctxt "NAME OF TRANSLATORS" msgid "Your names" msgstr "" -#: rc.cpp:203 +#: rc.cpp:206 msgctxt "EMAIL OF TRANSLATORS" msgid "Your emails" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 23:34:45
|
Revision: 181 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=181&view=rev Author: danxuliu Date: 2010-03-22 23:34:39 +0000 (Mon, 22 Mar 2010) Log Message: ----------- Add a tool bar with "Export" action. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc Modified: trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc =================================================================== --- trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc 2010-03-22 23:02:27 UTC (rev 180) +++ trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc 2010-03-22 23:34:39 UTC (rev 181) @@ -37,4 +37,8 @@ </Menu> </Menu> </MenuBar> + <ToolBar name="mainToolBar"> + <Text context="@title:menu">Main Toolbar</Text> + <Action name="exportTutorial"/> + </ToolBar> </gui> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 23:02:34
|
Revision: 180 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=180&view=rev Author: danxuliu Date: 2010-03-22 23:02:27 +0000 (Mon, 22 Mar 2010) Log Message: ----------- Rename "Set reaction data" action to "Set data" to keep consistency with other action names Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/po/es.po trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp Modified: trunk/ktutorial/ktutorial-editor/po/es.po =================================================================== --- trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-22 19:24:36 UTC (rev 179) +++ trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-22 23:02:27 UTC (rev 180) @@ -7,9 +7,9 @@ msgid "" msgstr "" "Project-Id-Version: ktutorial-editor\n" -"Report-Msgid-Bugs-To: http://sourceforge." -"net/tracker/?group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-22 20:21+0100\n" +"Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" +"group_id=301227&atid=1270278\n" +"POT-Creation-Date: 2010-03-22 23:59+0100\n" "PO-Revision-Date: 2010-03-22 20:22-0400\n" "Last-Translator: Daniel Calviño Sánchez <dan...@gm...>\n" "Language-Team: Spanish <>\n" @@ -96,7 +96,7 @@ msgid "Add a new step to the tutorial." msgstr "Añadir un nuevo paso al tutorial." -#: KTutorialEditor.cpp:165 +#: KTutorialEditor.cpp:165 KTutorialEditor.cpp:219 msgctxt "@action" msgid "Set data..." msgstr "Establecer datos..." @@ -144,11 +144,6 @@ msgid "Add a new reaction to the selected step." msgstr "Añadir una nueva reacción al paso seleccionado actualmente." -#: KTutorialEditor.cpp:219 -msgctxt "@action" -msgid "Set reaction data..." -msgstr "Establecer datos de la reacción..." - #: KTutorialEditor.cpp:220 msgctxt "@info:status" msgid "Set the trigger and the response of the currently selected reaction." @@ -886,6 +881,10 @@ msgid "Your emails" msgstr "dan...@gm..." +#~ msgctxt "@action" +#~ msgid "Set reaction data..." +#~ msgstr "Establecer datos de la reacción..." + #~ msgctxt "@item Noun, a step in a tutorial" #~ msgid "Step" #~ msgstr "Paso" Modified: trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot =================================================================== --- trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-22 19:24:36 UTC (rev 179) +++ trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-22 23:02:27 UTC (rev 180) @@ -9,7 +9,7 @@ "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" "group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-22 20:21+0100\n" +"POT-Creation-Date: 2010-03-22 23:59+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -92,7 +92,7 @@ msgid "Add a new step to the tutorial." msgstr "" -#: KTutorialEditor.cpp:165 +#: KTutorialEditor.cpp:165 KTutorialEditor.cpp:219 msgctxt "@action" msgid "Set data..." msgstr "" @@ -136,11 +136,6 @@ msgid "Add a new reaction to the selected step." msgstr "" -#: KTutorialEditor.cpp:219 -msgctxt "@action" -msgid "Set reaction data..." -msgstr "" - #: KTutorialEditor.cpp:220 msgctxt "@info:status" msgid "Set the trigger and the response of the currently selected reaction." Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 19:24:36 UTC (rev 179) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 23:02:27 UTC (rev 180) @@ -216,7 +216,7 @@ actionListWidget->addAction(action); action = new KAction(this); - action->setText(i18nc("@action", "Set reaction data...")); + action->setText(i18nc("@action", "Set data...")); action->setStatusTip(i18nc("@info:status", "Set the trigger and the " "response of the currently selected reaction.")); action->setIcon(KIcon("document-edit")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 19:24:43
|
Revision: 179 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=179&view=rev Author: danxuliu Date: 2010-03-22 19:24:36 +0000 (Mon, 22 Mar 2010) Log Message: ----------- Update translation template and Spanish translation. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/po/es.po trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot Modified: trunk/ktutorial/ktutorial-editor/po/es.po =================================================================== --- trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-22 19:19:36 UTC (rev 178) +++ trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-22 19:24:36 UTC (rev 179) @@ -9,8 +9,8 @@ "Project-Id-Version: ktutorial-editor\n" "Report-Msgid-Bugs-To: http://sourceforge." "net/tracker/?group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-19 20:04+0100\n" -"PO-Revision-Date: 2010-03-19 20:05-0400\n" +"POT-Creation-Date: 2010-03-22 20:21+0100\n" +"PO-Revision-Date: 2010-03-22 20:22-0400\n" "Last-Translator: Daniel Calviño Sánchez <dan...@gm...>\n" "Language-Team: Spanish <>\n" "MIME-Version: 1.0\n" @@ -166,18 +166,18 @@ msgid "Removes the currently selected reaction from its step." msgstr "Elimina de su paso la reacción seleccionada actualmente." -#: KTutorialEditor.cpp:292 +#: KTutorialEditor.cpp:294 msgctxt "@title" msgid "Export Tutorial" msgstr "Exportar tutorial" -#: KTutorialEditor.cpp:304 +#: KTutorialEditor.cpp:306 msgctxt "@label" msgid "There was a problem when trying to save the exported tutorial:<nl/>%1" msgstr "" "Ocurrió un problema cuando se intentaba guardar el tutorial exportado:<nl/>%1" -#: KTutorialEditor.cpp:306 +#: KTutorialEditor.cpp:308 msgctxt "@title:window" msgid "Exported tutorial could not be saved" msgstr "El tutorial exportado no pudo guardarse" @@ -298,27 +298,32 @@ "editor. Esto quiere decir que el código debe estar escrito en el mismo " "lenguaje de programación que en el que se exportará el tutorial.</para>" -#: view/StepTreeItem.cpp:54 -msgctxt "@item Noun, a step in a tutorial" -msgid "Step" -msgstr "Paso" +#: view/StepTreeItem.cpp:56 +msgctxt "@item" +msgid "(id not set)" +msgstr "(identificador no establecido)" -#: view/StepTreeItem.cpp:57 +#: view/StepTreeItem.cpp:59 msgctxt "@item Noun, a step in a tutorial" msgid "Step %1" msgstr "Paso %1" -#: view/StepTreeItem.cpp:96 +#: view/StepTreeItem.cpp:94 msgctxt "@item" +msgid "(text not set)" +msgstr "(texto no establecido)" + +#: view/StepTreeItem.cpp:98 +msgctxt "@item" msgid "Text: %1" msgstr "Texto: %1" -#: view/StepTreeItem.cpp:105 view/TutorialTreeItem.cpp:120 +#: view/StepTreeItem.cpp:106 view/TutorialTreeItem.cpp:119 msgctxt "@item" msgid "Setup:" msgstr "Inicialización:" -#: view/StepTreeItem.cpp:115 view/TutorialTreeItem.cpp:130 +#: view/StepTreeItem.cpp:116 view/TutorialTreeItem.cpp:129 msgctxt "@item" msgid "Tear down:" msgstr "Finalización:" @@ -373,27 +378,37 @@ "quiere decir que el código debe estar escrito en el mismo lenguaje de " "programación que en el que se exportará el tutorial.</para>" -#: view/TutorialTreeItem.cpp:55 +#: view/TutorialTreeItem.cpp:57 msgctxt "@item" msgid "Tutorial" msgstr "Tutorial" -#: view/TutorialTreeItem.cpp:58 +#: view/TutorialTreeItem.cpp:60 msgctxt "@item" msgid "Tutorial %1" msgstr "Tutorial %1" -#: view/TutorialTreeItem.cpp:88 +#: view/TutorialTreeItem.cpp:80 +msgctxt "@item" +msgid "(name not set)" +msgstr "(nombre no establecido)" + +#: view/TutorialTreeItem.cpp:93 msgctxt "@item Noun, the name of a tutorial" msgid "Name: %1" msgstr "Nombre: %1" -#: view/TutorialTreeItem.cpp:100 +#: view/TutorialTreeItem.cpp:97 msgctxt "@item" +msgid "(description not set)" +msgstr "(descripción no establecida)" + +#: view/TutorialTreeItem.cpp:101 +msgctxt "@item" msgid "Description: %1" msgstr "Descripción: %1" -#: view/TutorialTreeItem.cpp:110 +#: view/TutorialTreeItem.cpp:109 msgctxt "@item" msgid "License:" msgstr "Licencia:" @@ -871,6 +886,10 @@ msgid "Your emails" msgstr "dan...@gm..." +#~ msgctxt "@item Noun, a step in a tutorial" +#~ msgid "Step" +#~ msgstr "Paso" + #~ msgctxt "@item" #~ msgid "Steps:" #~ msgstr "Pasos:" Modified: trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot =================================================================== --- trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-22 19:19:36 UTC (rev 178) +++ trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-22 19:24:36 UTC (rev 179) @@ -9,7 +9,7 @@ "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" "group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-19 20:04+0100\n" +"POT-Creation-Date: 2010-03-22 20:21+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -156,17 +156,17 @@ msgid "Removes the currently selected reaction from its step." msgstr "" -#: KTutorialEditor.cpp:292 +#: KTutorialEditor.cpp:294 msgctxt "@title" msgid "Export Tutorial" msgstr "" -#: KTutorialEditor.cpp:304 +#: KTutorialEditor.cpp:306 msgctxt "@label" msgid "There was a problem when trying to save the exported tutorial:<nl/>%1" msgstr "" -#: KTutorialEditor.cpp:306 +#: KTutorialEditor.cpp:308 msgctxt "@title:window" msgid "Exported tutorial could not be saved" msgstr "" @@ -276,27 +276,32 @@ "the tutorial will be exported to.</para>" msgstr "" -#: view/StepTreeItem.cpp:54 -msgctxt "@item Noun, a step in a tutorial" -msgid "Step" +#: view/StepTreeItem.cpp:56 +msgctxt "@item" +msgid "(id not set)" msgstr "" -#: view/StepTreeItem.cpp:57 +#: view/StepTreeItem.cpp:59 msgctxt "@item Noun, a step in a tutorial" msgid "Step %1" msgstr "" -#: view/StepTreeItem.cpp:96 +#: view/StepTreeItem.cpp:94 msgctxt "@item" +msgid "(text not set)" +msgstr "" + +#: view/StepTreeItem.cpp:98 +msgctxt "@item" msgid "Text: %1" msgstr "" -#: view/StepTreeItem.cpp:105 view/TutorialTreeItem.cpp:120 +#: view/StepTreeItem.cpp:106 view/TutorialTreeItem.cpp:119 msgctxt "@item" msgid "Setup:" msgstr "" -#: view/StepTreeItem.cpp:115 view/TutorialTreeItem.cpp:130 +#: view/StepTreeItem.cpp:116 view/TutorialTreeItem.cpp:129 msgctxt "@item" msgid "Tear down:" msgstr "" @@ -341,27 +346,37 @@ "will be exported to.</para>" msgstr "" -#: view/TutorialTreeItem.cpp:55 +#: view/TutorialTreeItem.cpp:57 msgctxt "@item" msgid "Tutorial" msgstr "" -#: view/TutorialTreeItem.cpp:58 +#: view/TutorialTreeItem.cpp:60 msgctxt "@item" msgid "Tutorial %1" msgstr "" -#: view/TutorialTreeItem.cpp:88 +#: view/TutorialTreeItem.cpp:80 +msgctxt "@item" +msgid "(name not set)" +msgstr "" + +#: view/TutorialTreeItem.cpp:93 msgctxt "@item Noun, the name of a tutorial" msgid "Name: %1" msgstr "" -#: view/TutorialTreeItem.cpp:100 +#: view/TutorialTreeItem.cpp:97 msgctxt "@item" +msgid "(description not set)" +msgstr "" + +#: view/TutorialTreeItem.cpp:101 +msgctxt "@item" msgid "Description: %1" msgstr "" -#: view/TutorialTreeItem.cpp:110 +#: view/TutorialTreeItem.cpp:109 msgctxt "@item" msgid "License:" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 19:19:42
|
Revision: 178 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=178&view=rev Author: danxuliu Date: 2010-03-22 19:19:36 +0000 (Mon, 22 Mar 2010) Log Message: ----------- Fix spacer height hint Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui trunk/ktutorial/ktutorial-editor/src/view/WaitForEventWidget.ui trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui Modified: trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui 2010-03-22 18:39:46 UTC (rev 177) +++ trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui 2010-03-22 19:19:36 UTC (rev 178) @@ -79,7 +79,7 @@ <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>215</height> + <height>20</height> </size> </property> </spacer> Modified: trunk/ktutorial/ktutorial-editor/src/view/WaitForEventWidget.ui =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/WaitForEventWidget.ui 2010-03-22 18:39:46 UTC (rev 177) +++ trunk/ktutorial/ktutorial-editor/src/view/WaitForEventWidget.ui 2010-03-22 19:19:36 UTC (rev 178) @@ -84,7 +84,7 @@ <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>182</height> + <height>20</height> </size> </property> </spacer> Modified: trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui 2010-03-22 18:39:46 UTC (rev 177) +++ trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui 2010-03-22 19:19:36 UTC (rev 178) @@ -84,7 +84,7 @@ <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>182</height> + <height>20</height> </size> </property> </spacer> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 18:39:52
|
Revision: 177 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=177&view=rev Author: danxuliu Date: 2010-03-22 18:39:46 +0000 (Mon, 22 Mar 2010) Log Message: ----------- After a second thought, the behavior in the previous commit was rather silly. Instead of always adding and removing when cancelled, only add when accepted! Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:30:57 UTC (rev 176) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:39:46 UTC (rev 177) @@ -332,10 +332,11 @@ void KTutorialEditor::addStep() { Step* step = new Step(); - mTutorial->addStep(step); - if (showEditionDialog(new StepDataWidget(step)) == QDialog::Rejected) { - mTutorial->removeStep(step); + if (showEditionDialog(new StepDataWidget(step)) == QDialog::Accepted) { + mTutorial->addStep(step); + } else { + delete step; } } @@ -370,10 +371,11 @@ Q_ASSERT(mCurrentStep); Reaction* reaction = new Reaction(); - mCurrentStep->addReaction(reaction); - if (showEditionDialog(new ReactionWidget(reaction)) == QDialog::Rejected) { - mCurrentStep->removeReaction(reaction); + if (showEditionDialog(new ReactionWidget(reaction)) == QDialog::Accepted) { + mCurrentStep->addReaction(reaction); + } else { + delete reaction; } } Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:30:57 UTC (rev 176) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:39:46 UTC (rev 177) @@ -149,8 +149,8 @@ void setTutorialTearDown(); /** - * Adds a new step to the tutorial and shows a StepDataWidget for it. - * The step is removed if the dialog is cancelled. + * Adds a new step to the tutorial after showing a StepDataWidget for it. + * The step isn't added if the dialog is cancelled. */ void addStep(); @@ -175,9 +175,9 @@ void removeStep(); /** - * Adds a new reaction to the current step and shows a ReactionWidget for - * it. - * The reaction is removed if the dialog is cancelled. + * Adds a new reaction to the current step after showing a ReactionWidget + * for it. + * The reaction isn't added if the dialog is cancelled. */ void addReaction(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 18:31:04
|
Revision: 176 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=176&view=rev Author: danxuliu Date: 2010-03-22 18:30:57 +0000 (Mon, 22 Mar 2010) Log Message: ----------- When a step or reaction is added, if the dialog to set the data is cancelled the step or the reaction is removed. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:13:49 UTC (rev 175) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:30:57 UTC (rev 176) @@ -245,11 +245,13 @@ mReactionActionDock->toggleViewAction()); } -void KTutorialEditor::showEditionDialog(EditionWidget* editionWidget) { +int KTutorialEditor::showEditionDialog(EditionWidget* editionWidget) { EditionDialog* dialog = new EditionDialog(editionWidget, this); dialog->setObjectName("editionDialog"); - dialog->exec(); + int dialogCode = dialog->exec(); dialog->deleteLater(); + + return dialogCode; } //private slots: @@ -332,7 +334,9 @@ Step* step = new Step(); mTutorial->addStep(step); - showEditionDialog(new StepDataWidget(step)); + if (showEditionDialog(new StepDataWidget(step)) == QDialog::Rejected) { + mTutorial->removeStep(step); + } } void KTutorialEditor::setStepData() { @@ -368,7 +372,9 @@ Reaction* reaction = new Reaction(); mCurrentStep->addReaction(reaction); - showEditionDialog(new ReactionWidget(reaction)); + if (showEditionDialog(new ReactionWidget(reaction)) == QDialog::Rejected) { + mCurrentStep->removeReaction(reaction); + } } void KTutorialEditor::setReactionData() { Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:13:49 UTC (rev 175) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:30:57 UTC (rev 176) @@ -98,8 +98,10 @@ * Shows an EditionDialog for the given EditionWidget. * * @param editionWidget The EditionWidget to wrap. + * @return QDialog::Accepted if the dialog was accepted, or + * QDialog::Rejected if the dialog was rejected. */ - void showEditionDialog(EditionWidget* editionWidget); + int showEditionDialog(EditionWidget* editionWidget); private Q_SLOTS: @@ -148,6 +150,7 @@ /** * Adds a new step to the tutorial and shows a StepDataWidget for it. + * The step is removed if the dialog is cancelled. */ void addStep(); @@ -174,6 +177,7 @@ /** * Adds a new reaction to the current step and shows a ReactionWidget for * it. + * The reaction is removed if the dialog is cancelled. */ void addReaction(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-22 18:13:57
|
Revision: 175 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=175&view=rev Author: danxuliu Date: 2010-03-22 18:13:49 +0000 (Mon, 22 Mar 2010) Log Message: ----------- When mandatory data in tutorial and step isn't set (name and information in tutorial, and id and text in step), show a placeholder instead of completly hidding it in the tree view to keep consistency with how mandatory data is shown in reactions and conditions to wait for. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.cpp trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.h trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.cpp trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.h trunk/ktutorial/ktutorial-editor/tests/unit/view/StepTreeItemTest.cpp trunk/ktutorial/ktutorial-editor/tests/unit/view/TutorialTreeItemTest.cpp Modified: trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.cpp 2010-03-21 16:08:40 UTC (rev 174) +++ trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.cpp 2010-03-22 18:13:49 UTC (rev 175) @@ -32,7 +32,8 @@ mStep(step) { Q_ASSERT(step); - mTextItem = 0; + mTextItem = new TextTreeItem(this); + appendChild(mTextItem); mSetupItem = 0; mTearDownItem = 0; @@ -50,11 +51,12 @@ } QString StepTreeItem::text() const { + QString id = mStepId; if (mStepId.isEmpty()) { - return i18nc("@item Noun, a step in a tutorial", "Step"); + id = i18nc("@item", "(id not set)"); } - return i18nc("@item Noun, a step in a tutorial", "Step %1", mStepId); + return i18nc("@item Noun, a step in a tutorial", "Step %1", id); } Step* StepTreeItem::step() const { @@ -77,8 +79,6 @@ //private slots: void StepTreeItem::update(Step* step) { - int childIndex = 0; - if (step->id().isEmpty()) { if (!mStepId.isEmpty()) { mStepId.clear(); @@ -89,15 +89,16 @@ emit dataChanged(this); } + QString text; if (step->text().isEmpty()) { - TreeItemUtil::removeFlatItemIfNeeded(mTextItem); + text = i18nc("@item", "(text not set)"); } else { - TreeItemUtil::addFlatItemIfNeeded(this, mTextItem, childIndex); - mTextItem->setText(i18nc("@item", "Text: %1", step->text())); - - childIndex++; + text = step->text(); } + mTextItem->setText(i18nc("@item", "Text: %1", text)); + int childIndex = 1; + if (step->customSetupCode().isEmpty()) { TreeItemUtil::removeNestedItemIfNeeded(mSetupItem); } else { Modified: trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.h 2010-03-21 16:08:40 UTC (rev 174) +++ trunk/ktutorial/ktutorial-editor/src/view/StepTreeItem.h 2010-03-22 18:13:49 UTC (rev 175) @@ -41,9 +41,13 @@ * | ... * ... * - * The items only appear if they have some data to show. For example, if only - * the text of the Step is set, its representation is: - * Step + * If the id or the text aren't set yet, a placeholder is used instead. Id + * placeholder is "(id not set)", and the text placeholder is "(text not set)" + * (without quotes, but with parenthesis). + * + * The other items only appear if they have some data to show. For example, if + * only the text of the Step is set, its representation is: + * Step (id not set) * -The text * * Note that composed elements like custom setup code don't appear at all, not @@ -53,8 +57,8 @@ * are updated as needed. * * Also note that the order of the child elements is always the same. Even if, - * for example, the setup code is set first and then the text, the text item - * will appear first and then the setup code item. + * for example, the tear down code is set first and then the setup code, the + * setup code item will appear first and then the tear down code item. * * @see ReactionTreeItem */ @@ -72,8 +76,8 @@ explicit StepTreeItem(Step* step, TreeItem* parent = 0); /** - * Returns "Step " and the id of the step, or just "Step" if - * there is no id. + * Returns "Step " and the id of the step, or "Step (id not set)" if there + * is no id. * * @return The text for this TreeItem. */ Modified: trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.cpp 2010-03-21 16:08:40 UTC (rev 174) +++ trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.cpp 2010-03-22 18:13:49 UTC (rev 175) @@ -31,8 +31,10 @@ TreeItem(parent) { Q_ASSERT(tutorial); - mNameItem = 0; - mDescriptionItem = 0; + mNameItem = new TextTreeItem(this); + appendChild(mNameItem); + mDescriptionItem = new TextTreeItem(this); + appendChild(mDescriptionItem); mLicenseItem = 0; mSetupItem = 0; mTearDownItem = 0; @@ -73,36 +75,33 @@ //private slots: void TutorialTreeItem::update(Tutorial* tutorial) { - int childIndex = 0; - + QString name; if (tutorial->name().isEmpty()) { - TreeItemUtil::removeFlatItemIfNeeded(mNameItem); + name = i18nc("@item", "(name not set)"); if (!mTutorialId.isEmpty()) { mTutorialId.clear(); emit dataChanged(this); } } else { - TreeItemUtil::addFlatItemIfNeeded(this, mNameItem, childIndex); - mNameItem->setText(i18nc("@item Noun, the name of a tutorial", - "Name: %1", tutorial->name())); + name = tutorial->name(); mTutorialId = tutorial->id(); emit dataChanged(this); - - childIndex++; } + mNameItem->setText(i18nc("@item Noun, the name of a tutorial", + "Name: %1", name)); + QString description; if (tutorial->description().isEmpty()) { - TreeItemUtil::removeFlatItemIfNeeded(mDescriptionItem); + description = i18nc("@item", "(description not set)"); } else { - TreeItemUtil::addFlatItemIfNeeded(this, mDescriptionItem, childIndex); - mDescriptionItem->setText(i18nc("@item", "Description: %1", - tutorial->description())); - - childIndex++; + description = tutorial->description(); } + mDescriptionItem->setText(i18nc("@item", "Description: %1", description)); + int childIndex = 2; + if (tutorial->licenseText().isEmpty()) { TreeItemUtil::removeNestedItemIfNeeded(mLicenseItem); } else { Modified: trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.h 2010-03-21 16:08:40 UTC (rev 174) +++ trunk/ktutorial/ktutorial-editor/src/view/TutorialTreeItem.h 2010-03-22 18:13:49 UTC (rev 175) @@ -44,10 +44,15 @@ * | ... * ... * - * The items only appear if they have some data to show. For example, if only - * the name of the Tutorial is set, its representation is: - * Tutorial theId + * If the name or the description aren't set yet, a placeholder is used instead. + * Name placeholder is "(name not set)", and the description placeholder is + * "(description not set)" (without quotes, but with parenthesis). + * + * The other items only appear if they have some data to show. For example, if + * only the name of the Tutorial is set, its representation is: + * Tutorial theName * -Name: the name + * -Description: (description not set) * * Note that composed elements like license don't appear at all, not even the * parent item with just "License:". @@ -56,8 +61,8 @@ * are updated as needed. * * Also note that the order of the child elements is always the same. Even if, - * for example, the setup code is set first and then the name, the name item - * will appear first and then the setup code item. + * for example, the tear down code is set first and then the license, the + * license item will appear first and then the tear down code item. * * @see StepTreeItem */ Modified: trunk/ktutorial/ktutorial-editor/tests/unit/view/StepTreeItemTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/view/StepTreeItemTest.cpp 2010-03-21 16:08:40 UTC (rev 174) +++ trunk/ktutorial/ktutorial-editor/tests/unit/view/StepTreeItemTest.cpp 2010-03-22 18:13:49 UTC (rev 175) @@ -63,6 +63,7 @@ int mTreeItemStarType; + void assertEmptyText(TreeItem* textItem) const; void assertText(TreeItem* textItem, const QString& licenseText) const; void assertCustomSetupCode(TreeItem* setupItem, const QString& code) const; void assertCustomTearDownCode(TreeItem* tearDownItem, @@ -93,9 +94,10 @@ StepTreeItem item(&step, &parent); QCOMPARE(item.parent(), &parent); - QCOMPARE(item.text(), i18nc("@item", "Step")); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); QCOMPARE(item.step(), &step); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); } void StepTreeItemTest::testConstructorFullStep() { @@ -139,7 +141,8 @@ step.setId("The id"); QCOMPARE(item.text(), i18nc("@item", "Step %1", "The id")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); QCOMPARE(dataChangedSpy.count(), 1); assertDataChanged(dataChangedSpy, 0, &item); } @@ -155,7 +158,8 @@ step.setId("The id changed"); QCOMPARE(item.text(), i18nc("@item", "Step %1", "The id changed")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); QCOMPARE(dataChangedSpy.count(), 1); assertDataChanged(dataChangedSpy, 0, &item); } @@ -170,8 +174,9 @@ step.setId(""); - QCOMPARE(item.text(), i18nc("@item", "Step")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); QCOMPARE(dataChangedSpy.count(), 1); assertDataChanged(dataChangedSpy, 0, &item); } @@ -180,10 +185,14 @@ Step step; StepTreeItem item(&step); + QSignalSpy dataChangedSpy(item.child(0), SIGNAL(dataChanged(TreeItem*))); + step.setText("The text"); QCOMPARE(item.childCount(), 1); assertText(item.child(0), "The text"); + QCOMPARE(dataChangedSpy.count(), 1); + assertDataChanged(dataChangedSpy, 0, item.child(0)); } void StepTreeItemTest::testStepSetTextChange() { @@ -207,9 +216,15 @@ StepTreeItem item(&step); step.setText("The text"); + + QSignalSpy dataChangedSpy(item.child(0), SIGNAL(dataChanged(TreeItem*))); + step.setText(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); + QCOMPARE(dataChangedSpy.count(), 1); + assertDataChanged(dataChangedSpy, 0, item.child(0)); } void StepTreeItemTest::testStepSetCustomSetupCode() { @@ -218,8 +233,9 @@ step.setCustomSetupCode("The setup code"); - QCOMPARE(item.childCount(), 1); - assertCustomSetupCode(item.child(0), "The setup code"); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code"); } void StepTreeItemTest::testStepSetCustomSetupCodeChange() { @@ -228,15 +244,16 @@ step.setCustomSetupCode("The setup code"); - QSignalSpy dataChangedSpy(item.child(0)->child(0), + QSignalSpy dataChangedSpy(item.child(1)->child(0), SIGNAL(dataChanged(TreeItem*))); step.setCustomSetupCode("The setup code changed"); - QCOMPARE(item.childCount(), 1); - assertCustomSetupCode(item.child(0), "The setup code changed"); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code changed"); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, item.child(0)->child(0)); + assertDataChanged(dataChangedSpy, 0, item.child(1)->child(0)); } void StepTreeItemTest::testStepSetCustomSetupCodeEmpty() { @@ -246,7 +263,8 @@ step.setCustomSetupCode("The setup code"); step.setCustomSetupCode(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); } void StepTreeItemTest::testStepSetCustomTearDownCode() { @@ -255,8 +273,9 @@ step.setCustomTearDownCode("The tear down code"); - QCOMPARE(item.childCount(), 1); - assertCustomTearDownCode(item.child(0), "The tear down code"); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertCustomTearDownCode(item.child(1), "The tear down code"); } void StepTreeItemTest::testStepSetCustomTearDownCodeChange() { @@ -265,15 +284,16 @@ step.setCustomTearDownCode("The tear down code"); - QSignalSpy dataChangedSpy(item.child(0)->child(0), + QSignalSpy dataChangedSpy(item.child(1)->child(0), SIGNAL(dataChanged(TreeItem*))); step.setCustomTearDownCode("The tear down code changed"); - QCOMPARE(item.childCount(), 1); - assertCustomTearDownCode(item.child(0), "The tear down code changed"); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertCustomTearDownCode(item.child(1), "The tear down code changed"); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, item.child(0)->child(0)); + assertDataChanged(dataChangedSpy, 0, item.child(1)->child(0)); } void StepTreeItemTest::testStepSetCustomTearDownCodeEmpty() { @@ -283,7 +303,8 @@ step.setCustomTearDownCode("The tear down code"); step.setCustomTearDownCode(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); } void StepTreeItemTest::testStepAddReaction() { @@ -293,8 +314,9 @@ Reaction* reaction = new Reaction(); step.addReaction(reaction); - QCOMPARE(item.childCount(), 1); - assertReaction(item.child(0), reaction); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertReaction(item.child(1), reaction); } void StepTreeItemTest::testStepRemoveReaction() { @@ -307,7 +329,8 @@ step.addReaction(&reaction); step.removeReaction(&reaction); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); } void StepTreeItemTest::testChildOrderWhenSettingDataInStep() { @@ -316,13 +339,14 @@ step.setCustomSetupCode("The setup code"); - QCOMPARE(item.text(), i18nc("@item", "Step")); - QCOMPARE(item.childCount(), 1); - assertCustomSetupCode(item.child(0), "The setup code"); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code"); step.setText("The text"); - QCOMPARE(item.text(), i18nc("@item", "Step")); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); QCOMPARE(item.childCount(), 2); assertText(item.child(0), "The text"); assertCustomSetupCode(item.child(1), "The setup code"); @@ -330,7 +354,7 @@ Reaction* reaction1 = new Reaction(); step.addReaction(reaction1); - QCOMPARE(item.text(), i18nc("@item", "Step")); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); QCOMPARE(item.childCount(), 3); assertText(item.child(0), "The text"); assertCustomSetupCode(item.child(1), "The setup code"); @@ -338,7 +362,7 @@ step.setCustomTearDownCode("The tear down code"); - QCOMPARE(item.text(), i18nc("@item", "Step")); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); QCOMPARE(item.childCount(), 4); assertText(item.child(0), "The text"); assertCustomSetupCode(item.child(1), "The setup code"); @@ -348,7 +372,7 @@ Reaction* reaction2 = new Reaction(); step.addReaction(reaction2); - QCOMPARE(item.text(), i18nc("@item", "Step")); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); QCOMPARE(item.childCount(), 5); assertText(item.child(0), "The text"); assertCustomSetupCode(item.child(1), "The setup code"); @@ -385,48 +409,58 @@ step.setText(""); QCOMPARE(item.text(), i18nc("@item", "Step %1", "The id")); - QCOMPARE(item.childCount(), 4); - assertCustomSetupCode(item.child(0), "The setup code"); - assertCustomTearDownCode(item.child(1), "The tear down code"); - assertReaction(item.child(2), &reaction1); - assertReaction(item.child(3), &reaction2); + QCOMPARE(item.childCount(), 5); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code"); + assertCustomTearDownCode(item.child(2), "The tear down code"); + assertReaction(item.child(3), &reaction1); + assertReaction(item.child(4), &reaction2); step.removeReaction(&reaction1); QCOMPARE(item.text(), i18nc("@item", "Step %1", "The id")); - QCOMPARE(item.childCount(), 3); - assertCustomSetupCode(item.child(0), "The setup code"); - assertCustomTearDownCode(item.child(1), "The tear down code"); - assertReaction(item.child(2), &reaction2); + QCOMPARE(item.childCount(), 4); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code"); + assertCustomTearDownCode(item.child(2), "The tear down code"); + assertReaction(item.child(3), &reaction2); step.setCustomTearDownCode(""); QCOMPARE(item.text(), i18nc("@item", "Step %1", "The id")); - QCOMPARE(item.childCount(), 2); - assertCustomSetupCode(item.child(0), "The setup code"); - assertReaction(item.child(1), &reaction2); + QCOMPARE(item.childCount(), 3); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code"); + assertReaction(item.child(2), &reaction2); step.setId(""); - QCOMPARE(item.text(), i18nc("@item", "Step")); - QCOMPARE(item.childCount(), 2); - assertCustomSetupCode(item.child(0), "The setup code"); - assertReaction(item.child(1), &reaction2); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); + QCOMPARE(item.childCount(), 3); + assertEmptyText(item.child(0)); + assertCustomSetupCode(item.child(1), "The setup code"); + assertReaction(item.child(2), &reaction2); step.setCustomSetupCode(""); - QCOMPARE(item.text(), i18nc("@item", "Step")); - QCOMPARE(item.childCount(), 1); - assertReaction(item.child(0), &reaction2); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); + QCOMPARE(item.childCount(), 2); + assertEmptyText(item.child(0)); + assertReaction(item.child(1), &reaction2); step.removeReaction(&reaction2); - QCOMPARE(item.text(), i18nc("@item", "Step")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.text(), i18nc("@item", "Step (id not set)")); + QCOMPARE(item.childCount(), 1); + assertEmptyText(item.child(0)); } /////////////////////////////////// Helpers //////////////////////////////////// +void StepTreeItemTest::assertEmptyText(TreeItem* textItem) const { + QCOMPARE(textItem->text(), i18nc("@item", "Text: (text not set)")); +} + void StepTreeItemTest::assertText(TreeItem* textItem, const QString& name) const { QCOMPARE(textItem->text(), i18nc("@item", "Text: %1", name)); Modified: trunk/ktutorial/ktutorial-editor/tests/unit/view/TutorialTreeItemTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/view/TutorialTreeItemTest.cpp 2010-03-21 16:08:40 UTC (rev 174) +++ trunk/ktutorial/ktutorial-editor/tests/unit/view/TutorialTreeItemTest.cpp 2010-03-22 18:13:49 UTC (rev 175) @@ -67,7 +67,9 @@ int mTreeItemStarType; + void assertEmptyName(TreeItem* nameItem) const; void assertName(TreeItem* nameItem, const QString& name) const; + void assertEmptyDescription(TreeItem* descriptionItem) const; void assertDescription(TreeItem* descriptionItem, const QString& description) const; void assertLicenseText(TreeItem* licenseItem, @@ -102,7 +104,9 @@ QCOMPARE(item.parent(), &parent); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); } void TutorialTreeItemTest::testConstructorFullTutorial() { @@ -145,15 +149,19 @@ //Setting the name changes the data returned by text() in the //TutorialTreeItem itself, as the id is based on the name - QSignalSpy dataChangedSpy(&item, SIGNAL(dataChanged(TreeItem*))); + QSignalSpy dataChangedRootSpy(&item, SIGNAL(dataChanged(TreeItem*))); + QSignalSpy dataChangedSpy(item.child(0), SIGNAL(dataChanged(TreeItem*))); tutorial.setName("The name"); QCOMPARE(item.text(), i18nc("@item", "Tutorial %1", "theName")); - QCOMPARE(item.childCount(), 1); + QCOMPARE(item.childCount(), 2); assertName(item.child(0), "The name"); + assertEmptyDescription(item.child(1)); + QCOMPARE(dataChangedRootSpy.count(), 1); + assertDataChanged(dataChangedRootSpy, 0, &item); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, &item); + assertDataChanged(dataChangedSpy, 0, item.child(0)); } void TutorialTreeItemTest::testTutorialSetNameChange() { @@ -168,8 +176,9 @@ tutorial.setName("The name changed"); QCOMPARE(item.text(), i18nc("@item", "Tutorial %1", "theNameChanged")); - QCOMPARE(item.childCount(), 1); + QCOMPARE(item.childCount(), 2); assertName(item.child(0), "The name changed"); + assertEmptyDescription(item.child(1)); QCOMPARE(dataChangedRootSpy.count(), 1); assertDataChanged(dataChangedRootSpy, 0, &item); QCOMPARE(dataChangedSpy.count(), 1); @@ -182,24 +191,34 @@ tutorial.setName("The name"); - QSignalSpy dataChangedSpy(&item, SIGNAL(dataChanged(TreeItem*))); + QSignalSpy dataChangedRootSpy(&item, SIGNAL(dataChanged(TreeItem*))); + QSignalSpy dataChangedSpy(item.child(0), SIGNAL(dataChanged(TreeItem*))); tutorial.setName(""); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + QCOMPARE(dataChangedRootSpy.count(), 1); + assertDataChanged(dataChangedRootSpy, 0, &item); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, &item); + assertDataChanged(dataChangedSpy, 0, item.child(0)); } void TutorialTreeItemTest::testTutorialSetDescription() { Tutorial tutorial; TutorialTreeItem item(&tutorial); + QSignalSpy dataChangedSpy(item.child(1), SIGNAL(dataChanged(TreeItem*))); + tutorial.setDescription("The description"); - QCOMPARE(item.childCount(), 1); - assertDescription(item.child(0), "The description"); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + QCOMPARE(dataChangedSpy.count(), 1); + assertDataChanged(dataChangedSpy, 0, item.child(1)); } void TutorialTreeItemTest::testTutorialSetDescriptionChange() { @@ -208,14 +227,15 @@ tutorial.setDescription("The description"); - QSignalSpy dataChangedSpy(item.child(0), SIGNAL(dataChanged(TreeItem*))); + QSignalSpy dataChangedSpy(item.child(1), SIGNAL(dataChanged(TreeItem*))); tutorial.setDescription("The description changed"); - QCOMPARE(item.childCount(), 1); - assertDescription(item.child(0), "The description changed"); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description changed"); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, item.child(0)); + assertDataChanged(dataChangedSpy, 0, item.child(1)); } void TutorialTreeItemTest::testTutorialSetDescriptionEmpty() { @@ -223,9 +243,16 @@ TutorialTreeItem item(&tutorial); tutorial.setDescription("The description"); + + QSignalSpy dataChangedSpy(item.child(1), SIGNAL(dataChanged(TreeItem*))); + tutorial.setDescription(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + QCOMPARE(dataChangedSpy.count(), 1); + assertDataChanged(dataChangedSpy, 0, item.child(1)); } void TutorialTreeItemTest::testTutorialSetLicenseText() { @@ -234,8 +261,10 @@ tutorial.setLicenseText("The license text"); - QCOMPARE(item.childCount(), 1); - assertLicenseText(item.child(0), "The license text"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertLicenseText(item.child(2), "The license text"); } void TutorialTreeItemTest::testTutorialSetLicenseTextChange() { @@ -244,15 +273,17 @@ tutorial.setLicenseText("The license text"); - QSignalSpy dataChangedSpy(item.child(0)->child(0), + QSignalSpy dataChangedSpy(item.child(2)->child(0), SIGNAL(dataChanged(TreeItem*))); tutorial.setLicenseText("The license text changed"); - QCOMPARE(item.childCount(), 1); - assertLicenseText(item.child(0), "The license text changed"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertLicenseText(item.child(2), "The license text changed"); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, item.child(0)->child(0)); + assertDataChanged(dataChangedSpy, 0, item.child(2)->child(0)); } void TutorialTreeItemTest::testTutorialSetLicenseTextEmpty() { @@ -262,7 +293,9 @@ tutorial.setLicenseText("The license text"); tutorial.setLicenseText(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); } void TutorialTreeItemTest::testTutorialSetCustomSetupCode() { @@ -271,8 +304,10 @@ tutorial.setCustomSetupCode("The setup code"); - QCOMPARE(item.childCount(), 1); - assertCustomSetupCode(item.child(0), "The setup code"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertCustomSetupCode(item.child(2), "The setup code"); } void TutorialTreeItemTest::testTutorialSetCustomSetupCodeChange() { @@ -281,15 +316,17 @@ tutorial.setCustomSetupCode("The setup code"); - QSignalSpy dataChangedSpy(item.child(0)->child(0), + QSignalSpy dataChangedSpy(item.child(2)->child(0), SIGNAL(dataChanged(TreeItem*))); tutorial.setCustomSetupCode("The setup code changed"); - QCOMPARE(item.childCount(), 1); - assertCustomSetupCode(item.child(0), "The setup code changed"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertCustomSetupCode(item.child(2), "The setup code changed"); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, item.child(0)->child(0)); + assertDataChanged(dataChangedSpy, 0, item.child(2)->child(0)); } void TutorialTreeItemTest::testTutorialSetCustomSetupCodeEmpty() { @@ -299,7 +336,9 @@ tutorial.setCustomSetupCode("The setup code"); tutorial.setCustomSetupCode(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); } void TutorialTreeItemTest::testTutorialSetCustomTearDownCode() { @@ -308,8 +347,10 @@ tutorial.setCustomTearDownCode("The tear down code"); - QCOMPARE(item.childCount(), 1); - assertCustomTearDownCode(item.child(0), "The tear down code"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertCustomTearDownCode(item.child(2), "The tear down code"); } void TutorialTreeItemTest::testTutorialSetCustomTearDownCodeChange() { @@ -318,15 +359,17 @@ tutorial.setCustomTearDownCode("The tear down code"); - QSignalSpy dataChangedSpy(item.child(0)->child(0), + QSignalSpy dataChangedSpy(item.child(2)->child(0), SIGNAL(dataChanged(TreeItem*))); tutorial.setCustomTearDownCode("The tear down code changed"); - QCOMPARE(item.childCount(), 1); - assertCustomTearDownCode(item.child(0), "The tear down code changed"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertCustomTearDownCode(item.child(2), "The tear down code changed"); QCOMPARE(dataChangedSpy.count(), 1); - assertDataChanged(dataChangedSpy, 0, item.child(0)->child(0)); + assertDataChanged(dataChangedSpy, 0, item.child(2)->child(0)); } void TutorialTreeItemTest::testTutorialSetCustomTearDownCodeEmpty() { @@ -336,7 +379,9 @@ tutorial.setCustomTearDownCode("The tear down code"); tutorial.setCustomTearDownCode(""); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); } void TutorialTreeItemTest::testTutorialAddStep() { @@ -347,8 +392,10 @@ step->setId("Step id"); tutorial.addStep(step); - QCOMPARE(item.childCount(), 1); - assertStep(item.child(0), "Step id"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertStep(item.child(2), "Step id"); } void TutorialTreeItemTest::testTutorialRemoveStep() { @@ -362,7 +409,9 @@ tutorial.addStep(&step); tutorial.removeStep(&step); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); } void TutorialTreeItemTest::testChildOrderWhenSettingDataInTutorial() { @@ -372,34 +421,39 @@ tutorial.setCustomSetupCode("The setup code"); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 1); - assertCustomSetupCode(item.child(0), "The setup code"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertCustomSetupCode(item.child(2), "The setup code"); tutorial.setDescription("The description"); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 2); - assertDescription(item.child(0), "The description"); - assertCustomSetupCode(item.child(1), "The setup code"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + assertCustomSetupCode(item.child(2), "The setup code"); tutorial.setCustomTearDownCode("The tear down code"); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 3); - assertDescription(item.child(0), "The description"); - assertCustomSetupCode(item.child(1), "The setup code"); - assertCustomTearDownCode(item.child(2), "The tear down code"); + QCOMPARE(item.childCount(), 4); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + assertCustomSetupCode(item.child(2), "The setup code"); + assertCustomTearDownCode(item.child(3), "The tear down code"); Step* step1 = new Step(); step1->setId("First step"); tutorial.addStep(step1); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 4); - assertDescription(item.child(0), "The description"); - assertCustomSetupCode(item.child(1), "The setup code"); - assertCustomTearDownCode(item.child(2), "The tear down code"); - assertStep(item.child(3), "First step"); + QCOMPARE(item.childCount(), 5); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + assertCustomSetupCode(item.child(2), "The setup code"); + assertCustomTearDownCode(item.child(3), "The tear down code"); + assertStep(item.child(4), "First step"); tutorial.setName("The name"); @@ -471,56 +525,75 @@ tutorial.setName(""); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 5); - assertDescription(item.child(0), "The description"); - assertCustomSetupCode(item.child(1), "The setup code"); - assertCustomTearDownCode(item.child(2), "The tear down code"); - assertStep(item.child(3), "First step"); - assertStep(item.child(4), "Second step"); + QCOMPARE(item.childCount(), 6); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + assertCustomSetupCode(item.child(2), "The setup code"); + assertCustomTearDownCode(item.child(3), "The tear down code"); + assertStep(item.child(4), "First step"); + assertStep(item.child(5), "Second step"); tutorial.removeStep(&step1); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 4); - assertDescription(item.child(0), "The description"); - assertCustomSetupCode(item.child(1), "The setup code"); - assertCustomTearDownCode(item.child(2), "The tear down code"); - assertStep(item.child(3), "Second step"); + QCOMPARE(item.childCount(), 5); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + assertCustomSetupCode(item.child(2), "The setup code"); + assertCustomTearDownCode(item.child(3), "The tear down code"); + assertStep(item.child(4), "Second step"); tutorial.setCustomTearDownCode(""); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 3); - assertDescription(item.child(0), "The description"); - assertCustomSetupCode(item.child(1), "The setup code"); - assertStep(item.child(2), "Second step"); + QCOMPARE(item.childCount(), 4); + assertEmptyName(item.child(0)); + assertDescription(item.child(1), "The description"); + assertCustomSetupCode(item.child(2), "The setup code"); + assertStep(item.child(3), "Second step"); tutorial.setDescription(""); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 2); - assertCustomSetupCode(item.child(0), "The setup code"); - assertStep(item.child(1), "Second step"); + QCOMPARE(item.childCount(), 4); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertCustomSetupCode(item.child(2), "The setup code"); + assertStep(item.child(3), "Second step"); tutorial.setCustomSetupCode(""); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 1); - assertStep(item.child(0), "Second step"); + QCOMPARE(item.childCount(), 3); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); + assertStep(item.child(2), "Second step"); tutorial.removeStep(&step2); QCOMPARE(item.text(), i18nc("@item", "Tutorial")); - QCOMPARE(item.childCount(), 0); + QCOMPARE(item.childCount(), 2); + assertEmptyName(item.child(0)); + assertEmptyDescription(item.child(1)); } /////////////////////////////////// Helpers //////////////////////////////////// +void TutorialTreeItemTest::assertEmptyName(TreeItem* nameItem) const { + QCOMPARE(nameItem->text(), i18nc("@item", "Name: (name not set)")); +} + void TutorialTreeItemTest::assertName(TreeItem* nameItem, const QString& name) const { QCOMPARE(nameItem->text(), i18nc("@item", "Name: %1", name)); } +void TutorialTreeItemTest::assertEmptyDescription( + TreeItem* descriptionItem) const { + QCOMPARE(descriptionItem->text(), + i18nc("@item", "Description: (description not set)")); +} + void TutorialTreeItemTest::assertDescription(TreeItem* descriptionItem, const QString& description) const { QCOMPARE(descriptionItem->text(), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-21 16:08:46
|
Revision: 174 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=174&view=rev Author: danxuliu Date: 2010-03-21 16:08:40 +0000 (Sun, 21 Mar 2010) Log Message: ----------- Fix typo Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/view/WaitForWidget.cpp Modified: trunk/ktutorial/ktutorial-editor/src/view/WaitForWidget.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/WaitForWidget.cpp 2010-03-21 03:12:26 UTC (rev 173) +++ trunk/ktutorial/ktutorial-editor/src/view/WaitForWidget.cpp 2010-03-21 16:08:40 UTC (rev 174) @@ -255,7 +255,7 @@ //When the WaitFor is removed, mCurrentWaitFor changes because the //selected item in the tree view changes. The WaitFor to be removed must - //be stord to properly delete it. + //be stored to properly delete it. WaitFor* waitForToRemove = mCurrentWaitFor; waitForComposed->removeWaitFor(waitForToRemove); delete waitForToRemove; @@ -268,7 +268,7 @@ //When the WaitFor is removed, mCurrentWaitFor changes because the //selected item in the tree view changes. The WaitFor to be removed must - //be stord to properly delete it. + //be stored to properly delete it. WaitFor* waitForToRemove = mCurrentWaitFor; waitForNot->setNegatedWaitFor(0); delete waitForToRemove; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-21 03:12:33
|
Revision: 173 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=173&view=rev Author: danxuliu Date: 2010-03-21 03:12:26 +0000 (Sun, 21 Mar 2010) Log Message: ----------- Rename "test" directory to "tests" Modified Paths: -------------- trunk/ktutorial/ktutorial-library/CMakeLists.txt Added Paths: ----------- trunk/ktutorial/ktutorial-library/tests/ trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/StepTest.cpp trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp trunk/ktutorial/ktutorial-library/tests/WaitForEventTest.cpp trunk/ktutorial/ktutorial-library/tests/scripting/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/scripting/ScriptingModuleTest.cpp trunk/ktutorial/ktutorial-library/tests/scripting/ScriptingTest.cpp trunk/ktutorial/ktutorial-library/tests/view/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/view/StepWidgetTest.cpp trunk/ktutorial/ktutorial-library/tests/view/TutorialManagerDialogTest.cpp Removed Paths: ------------- trunk/ktutorial/ktutorial-library/test/ trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/StepTest.cpp trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp trunk/ktutorial/ktutorial-library/tests/scripting/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/scripting/ScriptingModuleTest.cpp trunk/ktutorial/ktutorial-library/tests/scripting/ScriptingTest.cpp trunk/ktutorial/ktutorial-library/tests/view/CMakeLists.txt trunk/ktutorial/ktutorial-library/tests/view/StepWidgetTest.cpp trunk/ktutorial/ktutorial-library/tests/view/TutorialManagerDialogTest.cpp Modified: trunk/ktutorial/ktutorial-library/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-library/CMakeLists.txt 2010-03-21 01:03:42 UTC (rev 172) +++ trunk/ktutorial/ktutorial-library/CMakeLists.txt 2010-03-21 03:12:26 UTC (rev 173) @@ -8,4 +8,4 @@ add_subdirectory(cmake) add_subdirectory(po) add_subdirectory(src) -add_subdirectory(test) +add_subdirectory(tests) Deleted: trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-library/test/CMakeLists.txt 2010-02-13 19:08:14 UTC (rev 88) +++ trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt 2010-03-21 03:12:26 UTC (rev 173) @@ -1,25 +0,0 @@ -add_subdirectory(scripting) -add_subdirectory(view) - -# Used by kde4_add_unit_test to set the full path to test executables -set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) - -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${ktutorial_SOURCE_DIR}/src ${KDE4_INCLUDES}) - -MACRO(UNIT_TESTS) - FOREACH(_className ${ARGN}) - set(_testName ${_className}Test) - kde4_add_unit_test(${_testName} TESTNAME ktutorial-${_testName} ${_testName}.cpp) - target_link_libraries(${_testName} ktutorial ${QT_QTTEST_LIBRARY}) - ENDFOREACH(_className) -ENDMACRO(UNIT_TESTS) - -unit_tests(Option Step Tutorial TutorialInformation TutorialManager WaitFor WaitForAnd WaitForComposed WaitForNot WaitForOr WaitForSignal) - -MACRO(MEM_TESTS) - FOREACH(_testname ${ARGN}) - add_test(ktutorial-mem-${_testname} ${CMAKE_CURRENT_SOURCE_DIR}/runMemcheck.py ${CMAKE_CURRENT_BINARY_DIR}/${_testname}Test ${CMAKE_CURRENT_BINARY_DIR}) - ENDFOREACH(_testname) -ENDMACRO(MEM_TESTS) - -mem_tests(Option Step Tutorial TutorialInformation TutorialManager WaitFor WaitForAnd WaitForComposed WaitForNot WaitForOr WaitForSignal) Copied: trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt (from rev 140, trunk/ktutorial/ktutorial-library/test/CMakeLists.txt) =================================================================== --- trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt (rev 0) +++ trunk/ktutorial/ktutorial-library/tests/CMakeLists.txt 2010-03-21 03:12:26 UTC (rev 173) @@ -0,0 +1,51 @@ +add_subdirectory(scripting) +add_subdirectory(view) + +# Used by kde4_add_unit_test to set the full path to test executables +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${ktutorial-library_SOURCE_DIR}/src ${KDE4_INCLUDES}) + +MACRO(UNIT_TESTS) + FOREACH(_className ${ARGN}) + set(_testName ${_className}Test) + kde4_add_unit_test(${_testName} TESTNAME ktutorial-${_testName} ${_testName}.cpp) + target_link_libraries(${_testName} ktutorial ${QT_QTTEST_LIBRARY}) + ENDFOREACH(_className) +ENDMACRO(UNIT_TESTS) + +unit_tests( + Option + Step + Tutorial + TutorialInformation + TutorialManager + WaitFor + WaitForAnd + WaitForComposed + WaitForEvent + WaitForNot + WaitForOr + WaitForSignal +) + +MACRO(MEM_TESTS) + FOREACH(_testname ${ARGN}) + add_test(ktutorial-mem-${_testname} ${CMAKE_CURRENT_SOURCE_DIR}/runMemcheck.py ${CMAKE_CURRENT_BINARY_DIR}/${_testname}Test ${CMAKE_CURRENT_BINARY_DIR}) + ENDFOREACH(_testname) +ENDMACRO(MEM_TESTS) + +mem_tests( + Option + Step + Tutorial + TutorialInformation + TutorialManager + WaitFor + WaitForAnd + WaitForComposed + WaitForEvent + WaitForNot + WaitForOr + WaitForSignal +) Deleted: trunk/ktutorial/ktutorial-library/tests/StepTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-library/test/StepTest.cpp 2010-02-13 19:08:14 UTC (rev 88) +++ trunk/ktutorial/ktutorial-library/tests/StepTest.cpp 2010-03-21 03:12:26 UTC (rev 173) @@ -1,551 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008-2009 by Daniel Calviño Sánchez * - * dan...@gm... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, 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 General Public License * - * along with this program; If not, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include <QtTest> - -#define protected public -#define private public -#include "Step.h" -#undef private -#undef protected - -#include "Option.h" -#include "WaitForSignal.h" - -class StepTest: public QObject { -Q_OBJECT - -public slots: - - void dummySlot() { - mDummySlotCallCount++; - } - - void anotherDummySlot() { - mAnotherDummySlotCallCount++; - } - -signals: - - void dummySignal(); - - void anotherDummySignal(); - - void thirdDummySignal(); - -private: - - int mDummySlotCallCount; - int mAnotherDummySlotCallCount; - -private slots: - - void init() { - mDummySlotCallCount = 0; - mAnotherDummySlotCallCount = 0; - } - - void testConstructor(); - - void testSetText(); - - void testSetActiveTrue(); - void testSetActiveFalse(); - - void testAddOption(); - void testAddOptionWithoutSlotMacro(); - void testAddOptionSeveralOptions(); - void testAddOptionTwice(); - void testAddOptionDifferentOptionsWithSameName(); - - void testAddWaitFor(); - void testAddWaitForWithoutSlotMacro(); - void testAddWaitForSeveralWaitFors(); - void testAddWaitForTwice(); - - void testRemoveOption(); - void testRemoveOptionSeveralOptions(); - - void testRemoveWaitFor(); - void testRemoveWaitForSeveralWaitFors(); - -}; - -class InspectedStep: public Step { -public: - - int mSetupCount; - int mTearDownCount; - - InspectedStep(const QString& id): Step(id) { - mSetupCount = 0; - mTearDownCount = 0; - } - -protected: - - virtual void setup() { - mSetupCount++; - } - - virtual void tearDown() { - mTearDownCount++; - } - -}; - -void StepTest::testConstructor() { - InspectedStep step("doSomethingConstructive"); - - QCOMPARE(step.id(), QString("doSomethingConstructive")); - QCOMPARE(step.options().size(), 0); - QCOMPARE(step.text(), QString("")); - QVERIFY(!step.isActive()); - QCOMPARE(step.mSetupCount, 0); - QCOMPARE(step.mTearDownCount, 0); -} - -void StepTest::testSetText() { - Step step("doSomethingConstructive"); - - step.setText("OK, you beat the game, now turn off your computer and do something constructive"); - - QCOMPARE(step.text(), QString("OK, you beat the game, now turn off your computer and do something constructive")); -} - -void StepTest::testSetActiveTrue() { - InspectedStep step("doSomethingConstructive"); - - step.setActive(true); - - QVERIFY(step.isActive()); - QCOMPARE(step.mSetupCount, 1); - QCOMPARE(step.mTearDownCount, 0); -} - -void StepTest::testSetActiveFalse() { - InspectedStep step("doSomethingConstructive"); - - step.setActive(false); - - QVERIFY(!step.isActive()); - QCOMPARE(step.mSetupCount, 0); - QCOMPARE(step.mTearDownCount, 1); -} - -void StepTest::testAddOption() { - Step step("doSomethingConstructive"); - - Option* option1 = new Option("Bathe your iguana"); - - step.addOption(option1, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); - - QCOMPARE(option1->parent(), &step); - QCOMPARE(step.options().count(), 1); - QVERIFY(step.options().contains(option1)); - QCOMPARE(mDummySlotCallCount, 0); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 0); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); -} - -void StepTest::testAddOptionWithoutSlotMacro() { - Step step("doSomethingConstructive"); - - Option* option1 = new Option("Bathe your iguana"); - - step.addOption(option1, this, "dummySlot()"); - connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); - - QCOMPARE(option1->parent(), &step); - QCOMPARE(step.options().count(), 1); - QVERIFY(step.options().contains(option1)); - QCOMPARE(mDummySlotCallCount, 0); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 0); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); -} - -void StepTest::testAddOptionSeveralOptions() { - Step step("doSomethingConstructive"); - - Option* option1 = new Option("Bathe your iguana"); - step.addOption(option1, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); - - Option* option2 = new Option("Feed a toucan"); - step.addOption(option2, this, SLOT(dummySlot())); - connect(this, SIGNAL(anotherDummySignal()), option2, SIGNAL(selected())); - - Option* option3 = new Option("Walk the platypus"); - step.addOption(option3, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), option3, SIGNAL(selected())); - - QCOMPARE(option1->parent(), &step); - QCOMPARE(option2->parent(), &step); - QCOMPARE(option3->parent(), &step); - QCOMPARE(step.options().count(), 3); - QVERIFY(step.options().contains(option1)); - QVERIFY(step.options().contains(option2)); - QVERIFY(step.options().contains(option3)); - QCOMPARE(mDummySlotCallCount, 0); - - emit dummySignal(); - emit anotherDummySignal(); - QCOMPARE(mDummySlotCallCount, 0); - - step.setActive(true); - emit anotherDummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 3); -} - -void StepTest::testAddOptionTwice() { - Step step("doSomethingConstructive"); - - Option* option1 = new Option("Bathe your iguana"); - step.addOption(option1, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); - - //This second option isn't really needed, but it is used to be sure that no - //strange side effects occur after adding the first option again - Option* option2 = new Option("Feed a toucan"); - step.addOption(option2, this, SLOT(dummySlot())); - - step.addOption(option1, this, SLOT(anotherDummySlot())); - - QCOMPARE(option1->parent(), &step); - QCOMPARE(option2->parent(), &step); - QCOMPARE(step.options().count(), 2); - QVERIFY(step.options().contains(option1)); - QVERIFY(step.options().contains(option2)); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); -} - -void StepTest::testAddOptionDifferentOptionsWithSameName() { - Step step("doSomethingConstructive"); - - Option* option1 = new Option("Bathe your iguana"); - step.addOption(option1, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); - - //This second option isn't really needed, but it is used to be sure that no - //strange side effects occur after adding the option with the repeated name - Option* option2 = new Option("Feed a toucan"); - step.addOption(option2, this, SLOT(dummySlot())); - - //It will not be added and thus not deleted by parent Step, so it is created - //in stack - Option option3("Bathe your iguana"); - - step.addOption(&option3, this, SLOT(anotherDummySlot())); - connect(this, SIGNAL(dummySignal()), &option3, SIGNAL(selected())); - - QCOMPARE(option1->parent(), &step); - QCOMPARE(option2->parent(), &step); - QCOMPARE(option3.parent(), (QObject*)0); - QCOMPARE(step.options().count(), 2); - QVERIFY(step.options().contains(option1)); - QVERIFY(step.options().contains(option2)); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); -} - -void StepTest::testAddWaitFor() { - Step step("doSomethingConstructive"); - - WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); - - step.addWaitFor(waitFor1, this, SLOT(dummySlot())); - - QCOMPARE(waitFor1->parent(), &step); - QCOMPARE(step.mWaitsFor.count(), 1); - QVERIFY(step.mWaitsFor.contains(waitFor1)); - QCOMPARE(mDummySlotCallCount, 0); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 0); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); -} - -void StepTest::testAddWaitForWithoutSlotMacro() { - Step step("doSomethingConstructive"); - - WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); - - step.addWaitFor(waitFor1, this, "dummySlot()"); - - QCOMPARE(waitFor1->parent(), &step); - QCOMPARE(step.mWaitsFor.count(), 1); - QVERIFY(step.mWaitsFor.contains(waitFor1)); - QCOMPARE(mDummySlotCallCount, 0); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 0); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); -} - -void StepTest::testAddWaitForSeveralWaitFors() { - Step step("doSomethingConstructive"); - - WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); - step.addWaitFor(waitFor1, this, SLOT(dummySlot())); - - WaitFor* waitFor2 = new WaitForSignal(this, SIGNAL(anotherDummySignal())); - step.addWaitFor(waitFor2, this, SLOT(dummySlot())); - - WaitFor* waitFor3 = new WaitForSignal(this, SIGNAL(thirdDummySignal())); - step.addWaitFor(waitFor3, this, SLOT(dummySlot())); - - QCOMPARE(waitFor1->parent(), &step); - QCOMPARE(waitFor2->parent(), &step); - QCOMPARE(waitFor3->parent(), &step); - QCOMPARE(step.mWaitsFor.count(), 3); - QVERIFY(step.mWaitsFor.contains(waitFor1)); - QVERIFY(step.mWaitsFor.contains(waitFor2)); - QVERIFY(step.mWaitsFor.contains(waitFor3)); - QCOMPARE(mDummySlotCallCount, 0); - - emit dummySignal(); - emit anotherDummySignal(); - emit thirdDummySignal(); - QCOMPARE(mDummySlotCallCount, 0); - - step.setActive(true); - emit anotherDummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 2); - - emit thirdDummySignal(); - QCOMPARE(mDummySlotCallCount, 3); -} - -void StepTest::testAddWaitForTwice() { - Step step("doSomethingConstructive"); - - WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); - step.addWaitFor(waitFor1, this, SLOT(dummySlot())); - - //This second WaitFor isn't really needed, but it is used to be sure that no - //strange side effects occur after adding the first WaitFor again - WaitFor* waitFor2 = new WaitForSignal(this, SIGNAL(anotherDummySignal())); - step.addWaitFor(waitFor2, this, SLOT(dummySlot())); - - step.addWaitFor(waitFor1, this, SLOT(anotherDummySlot())); - - QCOMPARE(waitFor1->parent(), &step); - QCOMPARE(waitFor2->parent(), &step); - QCOMPARE(step.mWaitsFor.count(), 2); - QVERIFY(step.mWaitsFor.contains(waitFor1)); - QVERIFY(step.mWaitsFor.contains(waitFor2)); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); -} - -void StepTest::testRemoveOption() { - Step step("doSomethingConstructive"); - - Option* option1 = new Option("Bathe your iguana"); - step.addOption(option1, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); - - //It will be removed and not deleted by parent Step, so it is created in - //stack - Option option2("Feed a toucan"); - step.addOption(&option2, this, SLOT(anotherDummySlot())); - connect(this, SIGNAL(dummySignal()), &option2, SIGNAL(selected())); - - step.removeOption(&option2); - - QCOMPARE(option1->parent(), &step); - QCOMPARE(option2.parent(), (QObject*)0); - QCOMPARE(step.options().count(), 1); - QVERIFY(step.options().contains(option1)); - QVERIFY(!step.options().contains(&option2)); - QCOMPARE(mDummySlotCallCount, 0); - QCOMPARE(mAnotherDummySlotCallCount, 0); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); -} - -void StepTest::testRemoveOptionSeveralOptions() { - Step step("doSomethingConstructive"); - - //They will be removed and not deleted by parent Step, so they are created - //in stack - Option option1("Bathe your iguana"); - step.addOption(&option1, this, SLOT(anotherDummySlot())); - connect(this, SIGNAL(dummySignal()), &option1, SIGNAL(selected())); - - Option option2("Feed a toucan"); - step.addOption(&option2, this, SLOT(dummySlot())); - connect(this, SIGNAL(dummySignal()), &option2, SIGNAL(selected())); - - Option option3("Walk the platypus"); - step.addOption(&option3, this, SLOT(anotherDummySlot())); - connect(this, SIGNAL(dummySignal()), &option3, SIGNAL(selected())); - - step.removeOption(&option1); - step.removeOption(&option3); - - QCOMPARE(option1.parent(), (QObject*)0); - QCOMPARE(option2.parent(), &step); - QCOMPARE(option3.parent(), (QObject*)0); - QCOMPARE(step.options().count(), 1); - QVERIFY(step.options().contains(&option2)); - QVERIFY(!step.options().contains(&option1)); - QVERIFY(!step.options().contains(&option3)); - QCOMPARE(mDummySlotCallCount, 0); - QCOMPARE(mAnotherDummySlotCallCount, 0); - - step.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); - - step.removeOption(&option2); - - QCOMPARE(option2.parent(), (QObject*)0); - QCOMPARE(step.options().count(), 0); - QVERIFY(!step.options().contains(&option2)); - - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); -} - -void StepTest::testRemoveWaitFor() { - Step step("doSomethingConstructive"); - - WaitForSignal* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); - step.addWaitFor(waitFor1, this, SLOT(dummySlot())); - - //It will be removed and not deleted by parent Step, so it is created in - //stack - WaitForSignal waitFor2(this, SIGNAL(anotherDummySignal())); - step.addWaitFor(&waitFor2, this, SLOT(anotherDummySlot())); - - step.setActive(true); - - step.removeWaitFor(&waitFor2); - - QCOMPARE(waitFor1->parent(), &step); - QCOMPARE(waitFor2.parent(), (QObject*)0); - QCOMPARE(step.mWaitsFor.count(), 1); - QVERIFY(step.mWaitsFor.contains(waitFor1)); - QVERIFY(!step.mWaitsFor.contains(&waitFor2)); - QVERIFY(waitFor1->isActive()); - QVERIFY(!waitFor2.isActive()); - QCOMPARE(mDummySlotCallCount, 0); - QCOMPARE(mAnotherDummySlotCallCount, 0); - - waitFor2.setActive(true); - emit dummySignal(); - emit anotherDummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); -} - -void StepTest::testRemoveWaitForSeveralWaitFors() { - Step step("doSomethingConstructive"); - - //They will be removed and not deleted by parent Step, so they are created - //in stack - WaitForSignal waitFor1(this, SIGNAL(dummySignal())); - step.addWaitFor(&waitFor1, this, SLOT(anotherDummySlot())); - - WaitForSignal waitFor2(this, SIGNAL(anotherDummySignal())); - step.addWaitFor(&waitFor2, this, SLOT(dummySlot())); - - WaitForSignal waitFor3(this, SIGNAL(thirdDummySignal())); - step.addWaitFor(&waitFor3, this, SLOT(anotherDummySlot())); - - step.setActive(true); - - step.removeWaitFor(&waitFor1); - step.removeWaitFor(&waitFor3); - - QCOMPARE(waitFor1.parent(), (QObject*)0); - QCOMPARE(waitFor2.parent(), &step); - QCOMPARE(waitFor3.parent(), (QObject*)0); - QCOMPARE(step.mWaitsFor.count(), 1); - QVERIFY(step.mWaitsFor.contains(&waitFor2)); - QVERIFY(!step.mWaitsFor.contains(&waitFor1)); - QVERIFY(!step.mWaitsFor.contains(&waitFor3)); - QVERIFY(!waitFor1.isActive()); - QVERIFY(waitFor2.isActive()); - QVERIFY(!waitFor3.isActive()); - QCOMPARE(mDummySlotCallCount, 0); - QCOMPARE(mAnotherDummySlotCallCount, 0); - - step.setActive(true); - waitFor1.setActive(true); - waitFor3.setActive(true); - emit dummySignal(); - emit anotherDummySignal(); - emit thirdDummySignal(); - QCOMPARE(mDummySlotCallCount, 1); - QCOMPARE(mAnotherDummySlotCallCount, 0); - - step.removeWaitFor(&waitFor2); - - QCOMPARE(waitFor2.parent(), (QObject*)0); - QCOMPARE(step.mWaitsFor.count(), 0); - QVERIFY(!step.mWaitsFor.contains(&waitFor2)); - QVERIFY(!waitFor2.isActive()); - - waitFor2.setActive(true); - emit dummySignal(); - QCOMPARE(mDummySlotCallCount, 1); -} - -QTEST_MAIN(StepTest) - -#include "StepTest.moc" Copied: trunk/ktutorial/ktutorial-library/tests/StepTest.cpp (from rev 108, trunk/ktutorial/ktutorial-library/test/StepTest.cpp) =================================================================== --- trunk/ktutorial/ktutorial-library/tests/StepTest.cpp (rev 0) +++ trunk/ktutorial/ktutorial-library/tests/StepTest.cpp 2010-03-21 03:12:26 UTC (rev 173) @@ -0,0 +1,939 @@ +/*************************************************************************** + * Copyright (C) 2008-2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#include <QtTest> + +#define protected public +#define private public +#include "Step.h" +#undef private +#undef protected + +#include "Option.h" +#include "WaitForSignal.h" + +class StepTest: public QObject { +Q_OBJECT + +public slots: + + void dummySlot() { + mDummySlotCallCount++; + } + + void anotherDummySlot() { + mAnotherDummySlotCallCount++; + } + +signals: + + void dummySignal(); + + void anotherDummySignal(); + + void thirdDummySignal(); + + void fourthDummySignal(); + +private: + + int mDummySlotCallCount; + int mAnotherDummySlotCallCount; + + void assertStepId(const QSignalSpy& spy, int index, const QString& stepId); + +private slots: + + void init() { + mDummySlotCallCount = 0; + mAnotherDummySlotCallCount = 0; + } + + void testConstructor(); + + void testSetText(); + + void testSetActiveTrue(); + void testSetActiveFalse(); + + void testAddOption(); + void testAddOptionWithoutSlotMacro(); + void testAddOptionAssociatedToStepId(); + void testAddOptionSeveralOptions(); + void testAddOptionDuringSetup(); + void testAddOptionNormalAndDuringSetup(); + void testAddOptionTwice(); + void testAddOptionDifferentOptionsWithSameName(); + + void testAddWaitFor(); + void testAddWaitForWithoutSlotMacro(); + void testAddWaitForAssociatedToStepId(); + void testAddWaitForSeveralWaitFors(); + void testAddWaitForDuringSetup(); + void testAddWaitForNormalAndDuringSetup(); + void testAddWaitForTwice(); + + void testRemoveOption(); + void testRemoveOptionAssociatedToStepId(); + void testRemoveOptionSeveralOptions(); + + void testRemoveWaitFor(); + void testRemoveWaitForAssociatedToStepId(); + void testRemoveWaitForSeveralWaitFors(); + +}; + +class InspectedStep: public Step { +public: + + int mSetupCount; + int mTearDownCount; + + InspectedStep(const QString& id): Step(id) { + mSetupCount = 0; + mTearDownCount = 0; + } + +protected: + + virtual void setup() { + mSetupCount++; + } + + virtual void tearDown() { + mTearDownCount++; + } + +}; + +class StepWithWaitForAddedInSetup: public Step { +public: + + StepTest* mStepTest; + WaitFor* mWaitFor; + + StepWithWaitForAddedInSetup(const QString& id, StepTest* stepTest): + Step(id), + mStepTest(stepTest), + mWaitFor(0) { + } + +protected: + + virtual void setup() { + mWaitFor = new WaitForSignal(mStepTest, SIGNAL(dummySignal())); + addWaitFor(mWaitFor, mStepTest, SLOT(dummySlot())); + } + +}; + +class StepWithOptionAddedInSetup: public Step { +public: + + StepTest* mStepTest; + Option* mOption; + + StepWithOptionAddedInSetup(const QString& id, StepTest* stepTest): + Step(id), + mStepTest(stepTest), + mOption(0) { + } + +protected: + + virtual void setup() { + mOption = new Option("Bathe your iguana"); + addOption(mOption, mStepTest, SLOT(dummySlot())); + } + +}; + +void StepTest::testConstructor() { + InspectedStep step("doSomethingConstructive"); + + QCOMPARE(step.id(), QString("doSomethingConstructive")); + QCOMPARE(step.options().size(), 0); + QCOMPARE(step.text(), QString("")); + QVERIFY(!step.isActive()); + QCOMPARE(step.mSetupCount, 0); + QCOMPARE(step.mTearDownCount, 0); +} + +void StepTest::testSetText() { + Step step("doSomethingConstructive"); + + step.setText("OK, you beat the game, now turn off your computer and do something constructive"); + + QCOMPARE(step.text(), QString("OK, you beat the game, now turn off your computer and do something constructive")); +} + +void StepTest::testSetActiveTrue() { + InspectedStep step("doSomethingConstructive"); + + step.setActive(true); + + QVERIFY(step.isActive()); + QCOMPARE(step.mSetupCount, 1); + QCOMPARE(step.mTearDownCount, 0); +} + +void StepTest::testSetActiveFalse() { + InspectedStep step("doSomethingConstructive"); + + step.setActive(false); + + QVERIFY(!step.isActive()); + QCOMPARE(step.mSetupCount, 0); + QCOMPARE(step.mTearDownCount, 1); +} + +void StepTest::testAddOption() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + + step.addOption(option1, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(option1)); + QCOMPARE(mDummySlotCallCount, 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); +} + +void StepTest::testAddOptionWithoutSlotMacro() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + + step.addOption(option1, this, "dummySlot()"); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(option1)); + QCOMPARE(mDummySlotCallCount, 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); +} + +void StepTest::testAddOptionAssociatedToStepId() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + + step.addOption(option1, "batheYourIguanaStep"); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(option1)); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + emit dummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "batheYourIguanaStep"); +} + +void StepTest::testAddOptionSeveralOptions() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + step.addOption(option1, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + Option* option2 = new Option("Feed a toucan"); + step.addOption(option2, this, SLOT(dummySlot())); + connect(this, SIGNAL(anotherDummySignal()), option2, SIGNAL(selected())); + + Option* option3 = new Option("Walk the platypus"); + step.addOption(option3, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), option3, SIGNAL(selected())); + + Option* option4 = new Option("Lull the penguin"); + step.addOption(option4, "lullThePenguinStep"); + connect(this, SIGNAL(anotherDummySignal()), option4, SIGNAL(selected())); + + Option* option5 = new Option("Pamper the Tasmanian devil"); + step.addOption(option5, "pamperTheTasmanianDevilStep"); + connect(this, SIGNAL(dummySignal()), option5, SIGNAL(selected())); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(option2->parent(), &step); + QCOMPARE(option3->parent(), &step); + QCOMPARE(option4->parent(), &step); + QCOMPARE(option5->parent(), &step); + QCOMPARE(step.options().count(), 5); + QVERIFY(step.options().contains(option1)); + QVERIFY(step.options().contains(option2)); + QVERIFY(step.options().contains(option3)); + QVERIFY(step.options().contains(option4)); + QVERIFY(step.options().contains(option5)); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + emit dummySignal(); + emit anotherDummySignal(); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + emit anotherDummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "lullThePenguinStep"); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 3); + QCOMPARE(nextStepRequestedSpy.count(), 2); + assertStepId(nextStepRequestedSpy, 1, "pamperTheTasmanianDevilStep"); +} + +void StepTest::testAddOptionDuringSetup() { + StepWithOptionAddedInSetup step("doSomethingConstructive", this); + + step.setActive(true); + + connect(this, SIGNAL(dummySignal()), step.mOption, SIGNAL(selected())); + + QCOMPARE(step.mOption->parent(), &step); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(step.mOption)); + QCOMPARE(mDummySlotCallCount, 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + + QSignalSpy destroyedSpy(step.mOption, SIGNAL(destroyed(QObject*))); + + step.setActive(false); + + QCOMPARE(step.options().count(), 0); + QCOMPARE(step.mWaitsForToBeDeletedInTearDown.count(), 0); + QCOMPARE(step.mOptionsToBeDeletedInTearDown.count(), 0); + QCOMPARE(destroyedSpy.count(), 1); +} + +void StepTest::testAddOptionNormalAndDuringSetup() { + StepWithOptionAddedInSetup step("doSomethingConstructive", this); + + Option* option1 = new Option("Feed a toucan"); + + step.addOption(option1, this, SLOT(anotherDummySlot())); + connect(this, SIGNAL(anotherDummySignal()), option1, SIGNAL(selected())); + + step.setActive(true); + + connect(this, SIGNAL(dummySignal()), step.mOption, SIGNAL(selected())); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + + emit anotherDummySignal(); + QCOMPARE(mAnotherDummySlotCallCount, 1); + + QSignalSpy destroyedSpy(step.mOption, SIGNAL(destroyed(QObject*))); + + step.setActive(false); + + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(option1)); + QCOMPARE(step.mWaitsForToBeDeletedInTearDown.count(), 0); + QCOMPARE(step.mOptionsToBeDeletedInTearDown.count(), 0); + QCOMPARE(destroyedSpy.count(), 1); +} + +void StepTest::testAddOptionTwice() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + step.addOption(option1, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + Option* option2 = new Option("Feed a toucan"); + step.addOption(option2, "feedAToucanStep"); + connect(this, SIGNAL(dummySignal()), option2, SIGNAL(selected())); + + step.addOption(option1, this, SLOT(anotherDummySlot())); + step.addOption(option2, "feedAPigeonStep"); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(option2->parent(), &step); + QCOMPARE(step.options().count(), 2); + QVERIFY(step.options().contains(option1)); + QVERIFY(step.options().contains(option2)); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "feedAToucanStep"); +} + +void StepTest::testAddOptionDifferentOptionsWithSameName() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + step.addOption(option1, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + Option* option2 = new Option("Feed a toucan"); + step.addOption(option2, "feedAToucanStep"); + connect(this, SIGNAL(dummySignal()), option2, SIGNAL(selected())); + + //They will not be added and thus not deleted by parent Step, so they are + //created in stack + Option option3("Bathe your iguana"); + Option option4("Feed a toucan"); + + step.addOption(&option3, this, SLOT(anotherDummySlot())); + connect(this, SIGNAL(dummySignal()), &option3, SIGNAL(selected())); + + step.addOption(&option4, "feedAToucanStep2"); + connect(this, SIGNAL(dummySignal()), &option4, SIGNAL(selected())); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(option2->parent(), &step); + QCOMPARE(option3.parent(), (QObject*)0); + QCOMPARE(option4.parent(), (QObject*)0); + QCOMPARE(step.options().count(), 2); + QVERIFY(step.options().contains(option1)); + QVERIFY(step.options().contains(option2)); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "feedAToucanStep"); +} + +void StepTest::testAddWaitFor() { + Step step("doSomethingConstructive"); + + WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + + step.addWaitFor(waitFor1, this, SLOT(dummySlot())); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QCOMPARE(mDummySlotCallCount, 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); +} + +void StepTest::testAddWaitForWithoutSlotMacro() { + Step step("doSomethingConstructive"); + + WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + + step.addWaitFor(waitFor1, this, "dummySlot()"); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QCOMPARE(mDummySlotCallCount, 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); +} + +void StepTest::testAddWaitForAssociatedToStepId() { + Step step("doSomethingConstructive"); + + WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + + step.addWaitFor(waitFor1, "batheYourIguanaStep"); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + emit dummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "batheYourIguanaStep"); +} + +void StepTest::testAddWaitForSeveralWaitFors() { + Step step("doSomethingConstructive"); + + WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + step.addWaitFor(waitFor1, this, SLOT(dummySlot())); + + WaitFor* waitFor2 = new WaitForSignal(this, SIGNAL(anotherDummySignal())); + step.addWaitFor(waitFor2, this, SLOT(dummySlot())); + + WaitFor* waitFor3 = new WaitForSignal(this, SIGNAL(thirdDummySignal())); + step.addWaitFor(waitFor3, "batheYourIguanaStep"); + + WaitFor* waitFor4 = new WaitForSignal(this, SIGNAL(fourthDummySignal())); + step.addWaitFor(waitFor4, "feedAToucanStep"); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(waitFor2->parent(), &step); + QCOMPARE(waitFor3->parent(), &step); + QCOMPARE(waitFor4->parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 4); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QVERIFY(step.mWaitsFor.contains(waitFor2)); + QVERIFY(step.mWaitsFor.contains(waitFor3)); + QVERIFY(step.mWaitsFor.contains(waitFor4)); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + emit dummySignal(); + emit anotherDummySignal(); + emit thirdDummySignal(); + emit fourthDummySignal(); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + emit anotherDummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 2); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + emit thirdDummySignal(); + QCOMPARE(mDummySlotCallCount, 2); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "batheYourIguanaStep"); + + emit fourthDummySignal(); + QCOMPARE(mDummySlotCallCount, 2); + QCOMPARE(nextStepRequestedSpy.count(), 2); + assertStepId(nextStepRequestedSpy, 1, "feedAToucanStep"); +} + +void StepTest::testAddWaitForDuringSetup() { + StepWithWaitForAddedInSetup step("doSomethingConstructive", this); + + step.setActive(true); + + QCOMPARE(step.mWaitFor->parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(step.mWaitFor)); + QCOMPARE(mDummySlotCallCount, 0); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + + QSignalSpy destroyedSpy(step.mWaitFor, SIGNAL(destroyed(QObject*))); + + step.setActive(false); + + QCOMPARE(step.mWaitsFor.count(), 0); + QCOMPARE(step.mWaitsForToBeDeletedInTearDown.count(), 0); + QCOMPARE(step.mOptionsToBeDeletedInTearDown.count(), 0); + QCOMPARE(destroyedSpy.count(), 1); +} + +void StepTest::testAddWaitForNormalAndDuringSetup() { + StepWithWaitForAddedInSetup step("doSomethingConstructive", this); + + WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(anotherDummySignal())); + + step.addWaitFor(waitFor1, this, SLOT(anotherDummySlot())); + + step.setActive(true); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + + emit anotherDummySignal(); + QCOMPARE(mAnotherDummySlotCallCount, 1); + + QSignalSpy destroyedSpy(step.mWaitFor, SIGNAL(destroyed(QObject*))); + + step.setActive(false); + + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QCOMPARE(step.mWaitsForToBeDeletedInTearDown.count(), 0); + QCOMPARE(step.mOptionsToBeDeletedInTearDown.count(), 0); + QCOMPARE(destroyedSpy.count(), 1); +} + +void StepTest::testAddWaitForTwice() { + Step step("doSomethingConstructive"); + + WaitFor* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + step.addWaitFor(waitFor1, this, SLOT(dummySlot())); + + WaitFor* waitFor2 = new WaitForSignal(this, SIGNAL(anotherDummySignal())); + step.addWaitFor(waitFor2, "batheYourIguanaStep"); + + step.addWaitFor(waitFor1, this, SLOT(anotherDummySlot())); + step.addWaitFor(waitFor2, "batheYourChameleonStep"); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(waitFor2->parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 2); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QVERIFY(step.mWaitsFor.contains(waitFor2)); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + emit anotherDummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "batheYourIguanaStep"); +} + +void StepTest::testRemoveOption() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + step.addOption(option1, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + //It will be removed and not deleted by parent Step, so it is created in + //stack + Option option2("Feed a toucan"); + step.addOption(&option2, this, SLOT(anotherDummySlot())); + connect(this, SIGNAL(dummySignal()), &option2, SIGNAL(selected())); + + step.removeOption(&option2); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(option2.parent(), (QObject*)0); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(option1)); + QVERIFY(!step.options().contains(&option2)); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(mAnotherDummySlotCallCount, 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); +} + +void StepTest::testRemoveOptionAssociatedToStepId() { + Step step("doSomethingConstructive"); + + Option* option1 = new Option("Bathe your iguana"); + step.addOption(option1, "batheYourIguanaStep"); + connect(this, SIGNAL(dummySignal()), option1, SIGNAL(selected())); + + //It will be removed and not deleted by parent Step, so it is created in + //stack + Option option2("Feed a toucan"); + step.addOption(&option2, "feedAToucanStep"); + connect(this, SIGNAL(dummySignal()), &option2, SIGNAL(selected())); + + step.removeOption(&option2); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + QCOMPARE(option1->parent(), &step); + QCOMPARE(option2.parent(), (QObject*)0); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(option1)); + QVERIFY(!step.options().contains(&option2)); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "batheYourIguanaStep"); +} + +void StepTest::testRemoveOptionSeveralOptions() { + Step step("doSomethingConstructive"); + + //They will be removed and not deleted by parent Step, so they are created + //in stack + Option option1("Bathe your iguana"); + step.addOption(&option1, this, SLOT(anotherDummySlot())); + connect(this, SIGNAL(dummySignal()), &option1, SIGNAL(selected())); + + Option option2("Feed a toucan"); + step.addOption(&option2, this, SLOT(dummySlot())); + connect(this, SIGNAL(dummySignal()), &option2, SIGNAL(selected())); + + Option option3("Walk the platypus"); + step.addOption(&option3, this, SLOT(anotherDummySlot())); + connect(this, SIGNAL(dummySignal()), &option3, SIGNAL(selected())); + + Option option4("Lull the penguin"); + step.addOption(&option4, "lullThePenguinStep"); + connect(this, SIGNAL(dummySignal()), &option4, SIGNAL(selected())); + + Option option5("Pamper the Tasmanian Devil"); + step.addOption(&option5, "pamperTheTasmanianDevilStep"); + connect(this, SIGNAL(dummySignal()), &option5, SIGNAL(selected())); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + step.removeOption(&option1); + step.removeOption(&option3); + step.removeOption(&option5); + + QCOMPARE(option1.parent(), (QObject*)0); + QCOMPARE(option2.parent(), &step); + QCOMPARE(option3.parent(), (QObject*)0); + QCOMPARE(option4.parent(), &step); + QCOMPARE(option5.parent(), (QObject*)0); + QCOMPARE(step.options().count(), 2); + QVERIFY(step.options().contains(&option2)); + QVERIFY(step.options().contains(&option4)); + QVERIFY(!step.options().contains(&option1)); + QVERIFY(!step.options().contains(&option3)); + QVERIFY(!step.options().contains(&option5)); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "lullThePenguinStep"); + + step.removeOption(&option2); + + QCOMPARE(option2.parent(), (QObject*)0); + QCOMPARE(step.options().count(), 1); + QVERIFY(step.options().contains(&option4)); + QVERIFY(!step.options().contains(&option2)); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 2); + assertStepId(nextStepRequestedSpy, 1, "lullThePenguinStep"); + + step.removeOption(&option4); + + QCOMPARE(option4.parent(), (QObject*)0); + QCOMPARE(step.options().count(), 0); + QVERIFY(!step.options().contains(&option4)); + + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 2); +} + +void StepTest::testRemoveWaitFor() { + Step step("doSomethingConstructive"); + + WaitForSignal* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + step.addWaitFor(waitFor1, this, SLOT(dummySlot())); + + //It will be removed and not deleted by parent Step, so it is created in + //stack + WaitForSignal waitFor2(this, SIGNAL(anotherDummySignal())); + step.addWaitFor(&waitFor2, this, SLOT(anotherDummySlot())); + + step.setActive(true); + + step.removeWaitFor(&waitFor2); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(waitFor2.parent(), (QObject*)0); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QVERIFY(!step.mWaitsFor.contains(&waitFor2)); + QVERIFY(waitFor1->isActive()); + QVERIFY(!waitFor2.isActive()); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(mAnotherDummySlotCallCount, 0); + + waitFor2.setActive(true); + emit dummySignal(); + emit anotherDummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); +} + +void StepTest::testRemoveWaitForAssociatedToStepId() { + Step step("doSomethingConstructive"); + + WaitForSignal* waitFor1 = new WaitForSignal(this, SIGNAL(dummySignal())); + step.addWaitFor(waitFor1, "batheYourIguanaStep"); + + //It will be removed and not deleted by parent Step, so it is created in + //stack + WaitForSignal waitFor2(this, SIGNAL(anotherDummySignal())); + step.addWaitFor(&waitFor2, "feedAToucanStep"); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + step.setActive(true); + + step.removeWaitFor(&waitFor2); + + QCOMPARE(waitFor1->parent(), &step); + QCOMPARE(waitFor2.parent(), (QObject*)0); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(waitFor1)); + QVERIFY(!step.mWaitsFor.contains(&waitFor2)); + QVERIFY(waitFor1->isActive()); + QVERIFY(!waitFor2.isActive()); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + waitFor2.setActive(true); + emit dummySignal(); + emit anotherDummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "batheYourIguanaStep"); +} + +void StepTest::testRemoveWaitForSeveralWaitFors() { + Step step("doSomethingConstructive"); + + //They will be removed and not deleted by parent Step, so they are created + //in stack + WaitForSignal waitFor1(this, SIGNAL(dummySignal())); + step.addWaitFor(&waitFor1, this, SLOT(anotherDummySlot())); + + WaitForSignal waitFor2(this, SIGNAL(anotherDummySignal())); + step.addWaitFor(&waitFor2, this, SLOT(dummySlot())); + + WaitForSignal waitFor3(this, SIGNAL(thirdDummySignal())); + step.addWaitFor(&waitFor3, "batheYourIguanaStep"); + + WaitForSignal waitFor4(this, SIGNAL(fourthDummySignal())); + step.addWaitFor(&waitFor4, "feedAToucanStep"); + + QSignalSpy nextStepRequestedSpy(&step, SIGNAL(nextStepRequested(QString))); + + step.setActive(true); + + step.removeWaitFor(&waitFor1); + step.removeWaitFor(&waitFor3); + + QCOMPARE(waitFor1.parent(), (QObject*)0); + QCOMPARE(waitFor2.parent(), &step); + QCOMPARE(waitFor3.parent(), (QObject*)0); + QCOMPARE(waitFor4.parent(), &step); + QCOMPARE(step.mWaitsFor.count(), 2); + QVERIFY(step.mWaitsFor.contains(&waitFor2)); + QVERIFY(step.mWaitsFor.contains(&waitFor4)); + QVERIFY(!step.mWaitsFor.contains(&waitFor1)); + QVERIFY(!step.mWaitsFor.contains(&waitFor3)); + QVERIFY(!waitFor1.isActive()); + QVERIFY(waitFor2.isActive()); + QVERIFY(!waitFor3.isActive()); + QVERIFY(waitFor4.isActive()); + QCOMPARE(mDummySlotCallCount, 0); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 0); + + step.setActive(true); + waitFor1.setActive(true); + waitFor3.setActive(true); + emit dummySignal(); + emit anotherDummySignal(); + emit thirdDummySignal(); + emit fourthDummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + QCOMPARE(mAnotherDummySlotCallCount, 0); + QCOMPARE(nextStepRequestedSpy.count(), 1); + assertStepId(nextStepRequestedSpy, 0, "feedAToucanStep"); + + step.removeWaitFor(&waitFor2); + + QCOMPARE(waitFor2.parent(), (QObject*)0); + QCOMPARE(step.mWaitsFor.count(), 1); + QVERIFY(step.mWaitsFor.contains(&waitFor4)); + QVERIFY(!step.mWaitsFor.contains(&waitFor2)); + QVERIFY(!waitFor2.isActive()); + + waitFor2.setActive(true); + emit dummySignal(); + QCOMPARE(mDummySlotCallCount, 1); + + step.removeWaitFor(&waitFor4); + + QCOMPARE(waitFor4.parent(), (QObject*)0); + QCOMPARE(step.mWaitsFor.count(), 0); + QVERIFY(!step.mWaitsFor.contains(&waitFor4)); + QVERIFY(!waitFor4.isActive()); + + waitFor4.setActive(true); + emit fourthDummySignal(); + QCOMPARE(nextStepRequestedSpy.count(), 1); +} + +/////////////////////////////////// Helpers //////////////////////////////////// + +void StepTest::assertStepId(const QSignalSpy& spy, int index, + const QString& stepId) { + QVariant argument = spy.at(index).at(0); + QCOMPARE(argument.type(), QVariant::String); + QCOMPARE(argument.toString(), stepId); +} + +QTEST_MAIN(StepTest) + +#include "StepTest.moc" Deleted: trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-library/test/TutorialTest.cpp 2010-02-13 19:08:14 UTC (rev 88) +++ trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp 2010-03-21 03:12:26 UTC (rev 173) @@ -1,360 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009-2010 by Daniel Calviño Sánchez * - * dan...@gm... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, 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 General Public License * - * along with this program; If not, see <http://www.gnu.org/licenses/>. * - ***************************************************************************/ - -#include <QtTest> -#include <qtest_kde.h> - -#define protected public -#define private public -#include "Tutorial.h" -#undef private -#undef protected - -#include "Step.h" -#include "TutorialInformation.h" - -class TutorialTest: public QObject { -Q_OBJECT - -private slots: - - void testConstructor(); - - void testAddStep(); - void testAddStepSeveralSteps(); - void testAddStepTwice(); - void testAddStepDifferentStepWithSameId(); - - void testStart(); - void testStartNoStartStep(); - - void testNextStepId(); - void testNextStepIdWithInvalidId(); - - void testNextStepStep(); - void testNextStepStepWithInvalidStep(); - - void testFinish(); - -}; - -class MockTutorial: public Tutorial { -public: - - int mSetupCount; - int mTearDownCount; - - MockTutorial(TutorialInformation* tutorialInformation): - Tutorial(tutorialInformation) { - mSetupCount = 0; - mTearDownCount = 0; - } - -protected: - - virtual void setup() { - mSetupCount++; - } - - virtual void tearDown() { - mTearDownCount++; - } - -}; - -void TutorialTest::testConstructor() { - TutorialInformation* tutorialInformation = - new TutorialInformation("pearlOrientation"); - Tutorial tutorial(tutorialInformation); - - QCOMPARE(tutorial.tutorialInformation(), tutorialInformation); - QCOMPARE(tutorial.mCurrentStep, (Step*)0); -} - -void TutorialTest::testAddStep() { - Tutorial tutorial(new TutorialInformation("pearlOrientation")); - - Step* step1 = new Step("record"); - - tutorial.addStep(step1); - - QCOMPARE(step1->parent(), &tutorial); - QCOMPARE(tutorial.mSteps.size(), 1); - QCOMPARE(tutorial.mSteps.value("record"), step1); - QCOMPARE(tutorial.mCurrentStep, (Step*)0); -} - -void TutorialTest::testAddStepSeveralSteps() { - Tutorial tutorial(new TutorialInformation("pearlOrientation")); - - Step* step1 = new Step("record"); - tutorial.addStep(step1); - - Step* step2 = new Step("roll"); - tutorial.addStep(step2); - - Step* step3 = new Step("send"); - tutorial.addStep(step3); - - QCOMPARE(step1->parent(), &tutorial); - QCOMPARE(step2->parent(), &tutorial); - QCOMPARE(step3->parent(), &tutorial); - QCOMPARE(tutorial.mSteps.size(), 3); - QCOMPARE(tutorial.mSteps.value("record"), step1); - QCOMPARE(tutorial.mSteps.value("roll"), step2); - QCOMPARE(tutorial.mSteps.value("send"), step3); - QCOMPARE(tutorial.mCurrentStep, (Step*)0); -} - -void TutorialTest::testAddStepTwice() { - Tutorial tutorial(new TutorialInformation("pearlOrientation")); - - Step* step1 = new Step("record"); - tutorial.addStep(step1); - - Step* step2 = new Step("roll"); - tutorial.addStep(step2); - - Step* step3 = new Step("send"); - tutorial.addStep(step3); - - tutorial.addStep(step1); - - QCOMPARE(step1->parent(), &tutorial); - QCOMPARE(step2->parent(), &tutorial); - QCOMPARE(step3->parent(), &tutorial); - QCOMPARE(tutorial.mSteps.size(), 3); - QCOMPARE(tutorial.mSteps.value("record"), step1); - QCOMPARE(tutorial.mSteps.value("roll"), step2); - QCOMPARE(tutorial.mSteps.value("send"), step3); - QCOMPARE(tutorial.mCurrentStep, (Step*)0); -} - -void TutorialTest::testAddStepDifferentStepWithSameId() { - Tutorial tutorial(new TutorialInformation("pearlOrientation")); - - Step* step1 = new Step("record"); - tutorial.addStep(step1); - - Step* step2 = new Step("roll"); - tutorial.addStep(step2); - - Step* step3 = new Step("send"); - tutorial.addStep(step3); - - //It will not be added and thus not deleted by parent Tutorial, so it is - //created in stack - Step step4("roll"); - tutorial.addStep(&step4); - - QCOMPARE(step1->parent(), &tutorial); - QCOMPARE(step2->parent(), &tutorial); - QCOMPARE(step3->parent(), &tutorial); - QCOMPARE(tutorial.mSteps.size(), 3); - QCOMPARE(tutorial.mSteps.value("record"), step1); - QCOMPARE(tutorial.mSteps.value("roll"), step2); - QCOMPARE(tutorial.mSteps.value("send"), step3); - QCOMPARE(tutorial.mCurrentStep, (Step*)0); -} - -//Step* must be declared as a metatype to be used in qvariant_cast -Q_DECLARE_METATYPE(... [truncated message content] |
From: <dan...@us...> - 2010-03-21 01:03:49
|
Revision: 172 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=172&view=rev Author: danxuliu Date: 2010-03-21 01:03:42 +0000 (Sun, 21 Mar 2010) Log Message: ----------- Fix unescaped sequences in Javascript code when the source string contained quote, tabulator or new line characters. Also ensure that generated function and variable names contain only letters, digits or underscores. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 19:06:00 UTC (rev 171) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-21 01:03:42 UTC (rev 172) @@ -81,14 +81,14 @@ out() << "//Error: Tutorial without name!\n"; } else { out() << "tutorial.tutorialInformationAsObject().setName(t.i18n(\"" - << tutorial->name() <<"\"));\n"; + << escape(tutorial->name()) <<"\"));\n"; } if (tutorial->description().isEmpty()) { out() << "//Error: Tutorial without description!\n"; } else { out() << "tutorial.tutorialInformationAsObject().setDescription(" - << "t.i18n(\"" << tutorial->description() <<"\"));\n"; + << "t.i18n(\"" << escape(tutorial->description()) <<"\"));\n"; } mOut << "\n"; @@ -131,14 +131,14 @@ out() << "//Step " << step->id() << "\n"; QString stepVariable = toLowerCamelCase(step->id()) + "Step"; - out() << stepVariable << " = ktutorial.newStep(\"" << step->id() + out() << stepVariable << " = ktutorial.newStep(\"" << escape(step->id()) << "\");\n"; if (step->text().isEmpty()) { out() << "//Error: Step without text!\n"; } else { out() << stepVariable << ".setText(t.i18nc(\"@info\", \"" - << step->text() << "\"));\n"; + << escape(step->text()) << "\"));\n"; } mOut << '\n'; @@ -218,8 +218,8 @@ if (reaction->triggerType() == Reaction::OptionSelected && reaction->responseType() == Reaction::NextStep) { out() << "step.addOption(ktutorial.newOption(\"" - << reaction->optionName() << "\"), \"" << reaction->nextStepId() - << "\");\n"; + << escape(reaction->optionName()) << "\"), \"" + << escape(reaction->nextStepId()) << "\");\n"; return; } @@ -229,8 +229,8 @@ toUpperCamelCase(reaction->optionName()) + "OptionSelected"; out() << "step.addOption(ktutorial.newOption(\"" - << reaction->optionName() << "\"), self, \"" << functionName - << "()\");\n"; + << escape(reaction->optionName()) << "\"), self, \"" + << functionName << "()\");\n"; addFunction(functionName, reaction->customCode()); return; } @@ -242,7 +242,7 @@ if (reaction->responseType() == Reaction::NextStep) { out() << "step.addWaitFor(" << variableName << ", \"" - << reaction->nextStepId() << "\");\n"; + << escape(reaction->nextStepId()) << "\");\n"; return; } @@ -313,8 +313,8 @@ out() << variable << " = ktutorial.newWaitFor(\"WaitForEvent\");\n"; out() << variable << ".setEvent(ktutorial.findObject(\"" - << waitForEvent->receiverName() << "\"), \"" - << waitForEvent->eventName() << "\");\n"; + << escape(waitForEvent->receiverName()) << "\"), \"" + << escape(waitForEvent->eventName()) << "\");\n"; return variable; } @@ -356,8 +356,8 @@ out() << variable << " = ktutorial.newWaitFor(\"WaitForSignal\");\n"; out() << variable << ".setSignal(ktutorial.findObject(\"" - << waitForSignal->emitterName() << "\"), \"" - << waitForSignal->signalName() << "\");\n"; + << escape(waitForSignal->emitterName()) << "\"), \"" + << escape(waitForSignal->signalName()) << "\");\n"; return variable; } @@ -407,6 +407,14 @@ return variable + QString().setNum(mVariables.value(variable)); } +QString JavascriptExporter::escape(QString text) { + text.replace('\n', "\\n"); + text.replace('\t', "\\t"); + text.replace('"', "\\\""); + + return text; +} + QString JavascriptExporter::toIndentedCode(const QString& code) { if (code.isEmpty()) { return ""; @@ -439,11 +447,12 @@ return lowerCamelCase; } -QString JavascriptExporter::toUpperCamelCase(const QString& text) const { +QString JavascriptExporter::toUpperCamelCase(QString text) const { if (text.isEmpty()) { return ""; } + text.replace(QRegExp("[^\\w ]"), ""); QStringList words = text.split(' ', QString::SkipEmptyParts); QString upperCamelCase; Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-19 19:06:00 UTC (rev 171) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-21 01:03:42 UTC (rev 172) @@ -263,6 +263,16 @@ QString addVariable(const QString& variable); /** + * Returns the same text, but with Javascript escape sequences where needed. + * Some special characters (new line, tab and quotes) are written as their + * escape squence. + * + * @param text The text to escape. + * @return The Javascript text. + */ + QString escape(QString text); + + /** * Returns the same code, but with each line indented and ending in a new * line. * @@ -273,6 +283,8 @@ /** * Returns the lowerCamelCase version of the given text. + * Note that the returned text contains only letters, digits or underscores. + * Any other character is removed. * * @param text The string to get its lowerCamelCase version. * @return The lowerCamelCase version of the text. @@ -281,11 +293,13 @@ /** * Returns the UpperCamelCase version of the given text. + * Note that the returned text contains only letters, digits or underscores. + * Any other character is removed. * * @param text The string to get its UpperCamelCase version. * @return The UpperCamelCase version of the text. */ - QString toUpperCamelCase(const QString& text) const; + QString toUpperCamelCase(QString text) const; }; Modified: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp 2010-03-19 19:06:00 UTC (rev 171) +++ trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp 2010-03-21 01:03:42 UTC (rev 172) @@ -57,11 +57,13 @@ void testTutorialLicense(); void testTutorialInformation(); + void testTutorialInformationWithEscapeSequences(); void testTutorialSetupCode(); void testTutorialTearDownCode(); void testTutorialWithSeveralSteps(); void testStep(); + void testStepWithEscapeSequences(); void testStepSetupCode(); void testStepSetupCodeWithReactions(); void testStepTearDownCode(); @@ -69,17 +71,23 @@ void testStepWithSeveralReactions(); void testReactionOptionNextStep(); + void testReactionOptionNextStepWithEscapeSequences(); void testReactionOptionNextStepWithoutOptionNameOrStepId(); void testReactionOptionCustomCode(); + void testReactionOptionCustomCodeWithEscapeSequences(); void testReactionOptionCustomCodeWithoutOptionNameOrCustomCode(); void testReactionConditionNextStep(); + void testReactionConditionNextStepWithEscapeSequences(); void testReactionConditionNextStepWithoutConditionOrStepId(); void testReactionConditionCustomCode(); + void testReactionConditionCustomCodeWithEscapeSequences(); void testReactionConditionCustomCodeWithoutConditionOrCustomCode(); void testWaitForEvent(); + void testWaitForEventWithEscapeSequences(); void testWaitForEventWithoutReceiverNameOrEventName(); void testWaitForSignal(); + void testWaitForSignalWithEscapeSequences(); void testWaitForSignalWithoutEmitterNameOrSignalName(); void testWaitForComposed(); void testWaitForComposedWithInvalidChildWaitFor(); @@ -126,6 +134,25 @@ QCOMPARE(exportedTutorial, expected); } +void JavascriptExporterTest::testTutorialInformationWithEscapeSequences() { + Tutorial tutorial; + tutorial.setName("The \"name\""); + tutorial.setDescription("The\tdescription\nwith \"escape\" sequences"); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +"t = Kross.module(\"kdetranslation\");\n" +"\n" +"tutorial.tutorialInformationAsObject().setName(t.i18n(\"The \\\"name\\\"\"));\n" +"tutorial.tutorialInformationAsObject().setDescription(\ +t.i18n(\"The\\tdescription\\nwith \\\"escape\\\" sequences\"));\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + void JavascriptExporterTest::testTutorialSetupCode() { Tutorial tutorial; tutorial.setCustomSetupCode("The custom setup\ncode"); @@ -278,6 +305,29 @@ QCOMPARE(exportedTutorial, expected); } +void JavascriptExporterTest::testStepWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The \"id\""); + step->setText("The\ttext\nwith \"escape\" sequences"); + tutorial.addStep(step); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +"//Step The \"id\"\n" +"theIdStep = ktutorial.newStep(\"The \\\"id\\\"\");\n" +"theIdStep.setText(t.i18nc(\"@info\", \ +\"The\\ttext\\nwith \\\"escape\\\" sequences\"));\n" +"\n" +"tutorial.addStep(theIdStep);\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + void JavascriptExporterTest::testStepSetupCode() { Tutorial tutorial; Step* step = new Step(); @@ -477,6 +527,35 @@ QCOMPARE(exportedTutorial, expected); } +void JavascriptExporterTest::testReactionOptionNextStepWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setOptionName("The \"option\" name"); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another \"step\""); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" step.addOption(ktutorial.newOption(\"The \\\"option\\\" name\"), \ +\"Another \\\"step\\\"\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + void JavascriptExporterTest:: testReactionOptionNextStepWithoutOptionNameOrStepId() { Tutorial tutorial; @@ -553,6 +632,40 @@ QCOMPARE(exportedTutorial, expected); } +void JavascriptExporterTest::testReactionOptionCustomCodeWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setOptionName("The \"option\" name"); + reaction->setResponseType(Reaction::CustomCode); + reaction->setCustomCode("The custom\ncode"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" step.addOption(ktutorial.newOption(\"The \\\"option\\\" name\"), self, \ +\"theIdStepTheOptionNameOptionSelected()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepTheOptionNameOptionSelected() {\n" +" The custom\n" +" code\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + void JavascriptExporterTest:: testReactionOptionCustomCodeWithoutOptionNameOrCustomCode() { Tutorial tutorial; @@ -638,6 +751,46 @@ } void JavascriptExporterTest:: + testReactionConditionNextStepWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The \"emitter\" name"); + waitForSignal->setSignalName("\"theSignalName\"(Argument1Type, " + "Argument2Type)"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForSignal); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another \"step\""); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The \\\"emitter\\\" name\"), \ +\"\\\"theSignalName\\\"(Argument1Type, Argument2Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, \ +\"Another \\\"step\\\"\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest:: testReactionConditionNextStepWithoutConditionOrStepId() { Tutorial tutorial; Step* step = new Step(); @@ -726,6 +879,51 @@ } void JavascriptExporterTest:: + testReactionConditionCustomCodeWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The \"emitter\" name"); + waitForSignal->setSignalName("\"theSignalName\"(Argument1Type, " + "Argument2Type)"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForSignal); + reaction->setResponseType(Reaction::CustomCode); + reaction->setCustomCode("The custom\ncode"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The \\\"emitter\\\" name\"), \ +\"\\\"theSignalName\\\"(Argument1Type, Argument2Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, self, \ +\"theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet() {\n" +" The custom\n" +" code\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest:: testReactionConditionCustomCodeWithoutConditionOrCustomCode() { Tutorial tutorial; Step* step = new Step(); @@ -817,6 +1015,43 @@ QCOMPARE(exportedTutorial, expected); } +void JavascriptExporterTest::testWaitForEventWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForEvent* waitForEvent = new WaitForEvent(); + waitForEvent->setReceiverName("The \"receiver\" name"); + waitForEvent->setEventName("\"TheEventName\""); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForEvent); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheEventNameInTheReceiverName = \ +ktutorial.newWaitFor(\"WaitForEvent\");\n" +" waitForTheEventNameInTheReceiverName.setEvent(\ +ktutorial.findObject(\"The \\\"receiver\\\" name\"), \ +\"\\\"TheEventName\\\"\");\n" +" step.addWaitFor(waitForTheEventNameInTheReceiverName, \"Another step\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + void JavascriptExporterTest::testWaitForEventWithoutReceiverNameOrEventName() { Tutorial tutorial; Step* step = new Step(); @@ -899,6 +1134,44 @@ QCOMPARE(exportedTutorial, expected); } +void JavascriptExporterTest::testWaitForSignalWithEscapeSequences() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The \"emitter\" name"); + waitForSignal->setSignalName("\"theSignalName\"(Argument1Type, " + "Argument2Type)"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForSignal); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The \\\"emitter\\\" name\"), \ +\"\\\"theSignalName\\\"(Argument1Type, Argument2Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, \"Another step\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + void JavascriptExporterTest::testWaitForSignalWithoutEmitterNameOrSignalName() { Tutorial tutorial; Step* step = new Step(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 19:06:08
|
Revision: 171 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=171&view=rev Author: danxuliu Date: 2010-03-19 19:06:00 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Update translation template and Spanish translation. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/po/es.po trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot Modified: trunk/ktutorial/ktutorial-editor/po/es.po =================================================================== --- trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-19 18:46:23 UTC (rev 170) +++ trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-19 19:06:00 UTC (rev 171) @@ -9,8 +9,8 @@ "Project-Id-Version: ktutorial-editor\n" "Report-Msgid-Bugs-To: http://sourceforge." "net/tracker/?group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-16 06:44+0100\n" -"PO-Revision-Date: 2010-03-16 07:21-0400\n" +"POT-Creation-Date: 2010-03-19 20:04+0100\n" +"PO-Revision-Date: 2010-03-19 20:05-0400\n" "Last-Translator: Daniel Calviño Sánchez <dan...@gm...>\n" "Language-Team: Spanish <>\n" "MIME-Version: 1.0\n" @@ -19,84 +19,94 @@ "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Lokalize 1.0\n" -#: KTutorialEditor.cpp:81 +#: KTutorialEditor.cpp:86 msgctxt "@title" msgid "Edit tutorial" msgstr "Editar tutorial" -#: KTutorialEditor.cpp:86 +#: KTutorialEditor.cpp:91 msgctxt "@title" msgid "Edit step" msgstr "Editar paso" -#: KTutorialEditor.cpp:90 rc.cpp:52 +#: KTutorialEditor.cpp:95 rc.cpp:52 msgctxt "@title" msgid "Edit reaction" msgstr "Editar reacción" #: KTutorialEditor.cpp:103 msgctxt "@action" +msgid "Export..." +msgstr "Exportar..." + +#: KTutorialEditor.cpp:104 +msgctxt "@info:status" +msgid "Exports the tutorial to a script." +msgstr "Exporta el tutorial a un script." + +#: KTutorialEditor.cpp:116 +msgctxt "@action" msgid "Set information..." msgstr "Establecer información..." -#: KTutorialEditor.cpp:104 +#: KTutorialEditor.cpp:117 msgctxt "@info:status" msgid "Set the name and description of the tutorial." msgstr "Establecer el nombre y la descripción del tutorial." -#: KTutorialEditor.cpp:113 +#: KTutorialEditor.cpp:126 msgctxt "@action" msgid "Set license..." msgstr "Establecer licencia..." -#: KTutorialEditor.cpp:114 +#: KTutorialEditor.cpp:127 msgctxt "@info:status" msgid "Set the license text of the tutorial." msgstr "Establecer el texto de licencia del tutorial." -#: KTutorialEditor.cpp:122 KTutorialEditor.cpp:162 +#: KTutorialEditor.cpp:135 KTutorialEditor.cpp:175 msgctxt "@action" msgid "Set setup code..." msgstr "Establecer código de inicialización..." -#: KTutorialEditor.cpp:123 +#: KTutorialEditor.cpp:136 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial starts." msgstr "" "Establecer el código propio para ser ejecutado cuando comience el tutorial." -#: KTutorialEditor.cpp:131 KTutorialEditor.cpp:172 +#: KTutorialEditor.cpp:144 KTutorialEditor.cpp:185 msgctxt "@action" msgid "Set tear down code..." msgstr "Establecer el código de finalización..." -#: KTutorialEditor.cpp:132 +#: KTutorialEditor.cpp:145 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial finishes." msgstr "" "Establecer el código propio para ser ejecutado cuando termine el tutorial." -#: KTutorialEditor.cpp:143 +#: KTutorialEditor.cpp:156 msgctxt "@action" msgid "Add step..." msgstr "Añadir paso..." -#: KTutorialEditor.cpp:144 +#: KTutorialEditor.cpp:157 msgctxt "@info:status" msgid "Add a new step to the tutorial." msgstr "Añadir un nuevo paso al tutorial." -#: KTutorialEditor.cpp:152 +#: KTutorialEditor.cpp:165 msgctxt "@action" msgid "Set data..." msgstr "Establecer datos..." -#: KTutorialEditor.cpp:153 +#: KTutorialEditor.cpp:166 msgctxt "@info:status" msgid "Set the name and text of the currently selected step." msgstr "Establecer el nombre y el texto del paso seleccionado actualmente." -#: KTutorialEditor.cpp:163 +#: KTutorialEditor.cpp:176 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial passes to the currently " @@ -105,7 +115,7 @@ "Establecer el código propio para ser ejecutado cuando el tutorial cambie al " "paso seleccionado actualmente." -#: KTutorialEditor.cpp:173 +#: KTutorialEditor.cpp:186 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial changes from the " @@ -114,48 +124,64 @@ "Establecer el código propio para ser ejecutado cuando el tutorial cambie del " "paso seleccionado actualmente a otro paso." -#: KTutorialEditor.cpp:183 +#: KTutorialEditor.cpp:196 msgctxt "@action" msgid "Remove step" msgstr "Eliminar paso" -#: KTutorialEditor.cpp:184 +#: KTutorialEditor.cpp:197 msgctxt "@info:status" msgid "Removes the currently selected step from the tutorial." msgstr "Elimina del tutorial el paso seleccionado actualmente." -#: KTutorialEditor.cpp:196 +#: KTutorialEditor.cpp:209 msgctxt "@action" msgid "Add reaction..." msgstr "Añadir reacción..." -#: KTutorialEditor.cpp:197 +#: KTutorialEditor.cpp:210 msgctxt "@info:status" msgid "Add a new reaction to the selected step." msgstr "Añadir una nueva reacción al paso seleccionado actualmente." -#: KTutorialEditor.cpp:206 +#: KTutorialEditor.cpp:219 msgctxt "@action" msgid "Set reaction data..." msgstr "Establecer datos de la reacción..." -#: KTutorialEditor.cpp:207 +#: KTutorialEditor.cpp:220 msgctxt "@info:status" msgid "Set the trigger and the response of the currently selected reaction." msgstr "" "Establecer el activador y la respuesta de la reacción seleccionada " "actualmente." -#: KTutorialEditor.cpp:216 +#: KTutorialEditor.cpp:229 msgctxt "@action" msgid "Remove reaction" msgstr "Eliminar reacción" -#: KTutorialEditor.cpp:217 +#: KTutorialEditor.cpp:230 msgctxt "@info:status" msgid "Removes the currently selected reaction from its step." msgstr "Elimina de su paso la reacción seleccionada actualmente." +#: KTutorialEditor.cpp:292 +msgctxt "@title" +msgid "Export Tutorial" +msgstr "Exportar tutorial" + +#: KTutorialEditor.cpp:304 +msgctxt "@label" +msgid "There was a problem when trying to save the exported tutorial:<nl/>%1" +msgstr "" +"Ocurrió un problema cuando se intentaba guardar el tutorial exportado:<nl/>%1" + +#: KTutorialEditor.cpp:306 +msgctxt "@title:window" +msgid "Exported tutorial could not be saved" +msgstr "El tutorial exportado no pudo guardarse" + #: main.cpp:27 msgctxt "@title" msgid "KTutorial editor" @@ -182,6 +208,11 @@ msgid "Main developer" msgstr "Desarrollador principal" +#: serialization/Serialization.cpp:69 +msgctxt "@item:inlistbox A KFileDialog filter" +msgid "*.js|Javascript file" +msgstr "*.js|Archivo Javascript" + #: view/ReactionTreeItem.cpp:50 msgctxt "@item" msgid "Reaction" @@ -472,6 +503,7 @@ msgstr "Tipo de la condición por la que esperar" #: rc.cpp:34 +msgctxt "@label:listbox" msgid "Type:" msgstr "Tipo:" @@ -712,10 +744,12 @@ msgstr "Esperar por la señal" #: rc.cpp:154 +msgctxt "@label:textbox" msgid "Emitter name:" msgstr "Nombre del emisor:" #: rc.cpp:157 +msgctxt "@label:textbox" msgid "Signal name:" msgstr "Nombre de la señal:" @@ -739,10 +773,9 @@ "<em>SIGNAL()</em> wrapping text.</para>" msgstr "" "<para>El nombre de la señal.</para>\n" -"<para>El nombre debe estar escrito como <em>" -"nombreDeLaSeñal(TipoDelPrimerArgumento, TipoDelSegundoArgumento, " -"TipoDelTercerArgumento...)</em>, sin estar envuelto en el texto <em>" -"SIGNAL()</em>.</para>" +"<para>El nombre debe estar escrito como <em>nombreDeLaSeñal" +"(TipoDelPrimerArgumento, TipoDelSegundoArgumento, TipoDelTercerArgumento...)" +"</em>, sin estar envuelto en el texto <em>SIGNAL()</em>.</para>" #: rc.cpp:168 msgctxt "@title" @@ -761,12 +794,13 @@ "para>" msgstr "" "<para>Editar la condición por la que esperar hasta que se cumpla.</para>\n" -"<para>Una condición puede ser una condición simple o una condición compuesta." -" Las condiciones simples esperan hasta que algo concreto ocurra, por " -"ejemplo, esperan hasta que se emita una señal. Las condiciones compuestas " -"contienen otras condiciones (simples o también compuestas) y esperan hasta " -"que algo ocurra en las condiciones que contienen, por ejemplo, esperan hasta " -"que todas las condiciones que contienen se hayan cumplido.</para>" +"<para>Una condición puede ser una condición simple o una condición " +"compuesta. Las condiciones simples esperan hasta que algo concreto ocurra, " +"por ejemplo, esperan hasta que se emita una señal. Las condiciones " +"compuestas contienen otras condiciones (simples o también compuestas) y " +"esperan hasta que algo ocurra en las condiciones que contienen, por ejemplo, " +"esperan hasta que todas las condiciones que contienen se hayan cumplido.</" +"para>" #: rc.cpp:175 msgctxt "@info:tooltip" Modified: trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot =================================================================== --- trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-19 18:46:23 UTC (rev 170) +++ trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-19 19:06:00 UTC (rev 171) @@ -9,7 +9,7 @@ "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" "group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-16 06:44+0100\n" +"POT-Creation-Date: 2010-03-19 20:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -17,135 +17,160 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: KTutorialEditor.cpp:81 +#: KTutorialEditor.cpp:86 msgctxt "@title" msgid "Edit tutorial" msgstr "" -#: KTutorialEditor.cpp:86 +#: KTutorialEditor.cpp:91 msgctxt "@title" msgid "Edit step" msgstr "" -#: KTutorialEditor.cpp:90 rc.cpp:52 +#: KTutorialEditor.cpp:95 rc.cpp:52 msgctxt "@title" msgid "Edit reaction" msgstr "" #: KTutorialEditor.cpp:103 msgctxt "@action" -msgid "Set information..." +msgid "Export..." msgstr "" #: KTutorialEditor.cpp:104 msgctxt "@info:status" +msgid "Exports the tutorial to a script." +msgstr "" + +#: KTutorialEditor.cpp:116 +msgctxt "@action" +msgid "Set information..." +msgstr "" + +#: KTutorialEditor.cpp:117 +msgctxt "@info:status" msgid "Set the name and description of the tutorial." msgstr "" -#: KTutorialEditor.cpp:113 +#: KTutorialEditor.cpp:126 msgctxt "@action" msgid "Set license..." msgstr "" -#: KTutorialEditor.cpp:114 +#: KTutorialEditor.cpp:127 msgctxt "@info:status" msgid "Set the license text of the tutorial." msgstr "" -#: KTutorialEditor.cpp:122 KTutorialEditor.cpp:162 +#: KTutorialEditor.cpp:135 KTutorialEditor.cpp:175 msgctxt "@action" msgid "Set setup code..." msgstr "" -#: KTutorialEditor.cpp:123 +#: KTutorialEditor.cpp:136 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial starts." msgstr "" -#: KTutorialEditor.cpp:131 KTutorialEditor.cpp:172 +#: KTutorialEditor.cpp:144 KTutorialEditor.cpp:185 msgctxt "@action" msgid "Set tear down code..." msgstr "" -#: KTutorialEditor.cpp:132 +#: KTutorialEditor.cpp:145 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial finishes." msgstr "" -#: KTutorialEditor.cpp:143 +#: KTutorialEditor.cpp:156 msgctxt "@action" msgid "Add step..." msgstr "" -#: KTutorialEditor.cpp:144 +#: KTutorialEditor.cpp:157 msgctxt "@info:status" msgid "Add a new step to the tutorial." msgstr "" -#: KTutorialEditor.cpp:152 +#: KTutorialEditor.cpp:165 msgctxt "@action" msgid "Set data..." msgstr "" -#: KTutorialEditor.cpp:153 +#: KTutorialEditor.cpp:166 msgctxt "@info:status" msgid "Set the name and text of the currently selected step." msgstr "" -#: KTutorialEditor.cpp:163 +#: KTutorialEditor.cpp:176 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial passes to the currently " "selected step." msgstr "" -#: KTutorialEditor.cpp:173 +#: KTutorialEditor.cpp:186 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial changes from the " "currently selected step to another step." msgstr "" -#: KTutorialEditor.cpp:183 +#: KTutorialEditor.cpp:196 msgctxt "@action" msgid "Remove step" msgstr "" -#: KTutorialEditor.cpp:184 +#: KTutorialEditor.cpp:197 msgctxt "@info:status" msgid "Removes the currently selected step from the tutorial." msgstr "" -#: KTutorialEditor.cpp:196 +#: KTutorialEditor.cpp:209 msgctxt "@action" msgid "Add reaction..." msgstr "" -#: KTutorialEditor.cpp:197 +#: KTutorialEditor.cpp:210 msgctxt "@info:status" msgid "Add a new reaction to the selected step." msgstr "" -#: KTutorialEditor.cpp:206 +#: KTutorialEditor.cpp:219 msgctxt "@action" msgid "Set reaction data..." msgstr "" -#: KTutorialEditor.cpp:207 +#: KTutorialEditor.cpp:220 msgctxt "@info:status" msgid "Set the trigger and the response of the currently selected reaction." msgstr "" -#: KTutorialEditor.cpp:216 +#: KTutorialEditor.cpp:229 msgctxt "@action" msgid "Remove reaction" msgstr "" -#: KTutorialEditor.cpp:217 +#: KTutorialEditor.cpp:230 msgctxt "@info:status" msgid "Removes the currently selected reaction from its step." msgstr "" +#: KTutorialEditor.cpp:292 +msgctxt "@title" +msgid "Export Tutorial" +msgstr "" + +#: KTutorialEditor.cpp:304 +msgctxt "@label" +msgid "There was a problem when trying to save the exported tutorial:<nl/>%1" +msgstr "" + +#: KTutorialEditor.cpp:306 +msgctxt "@title:window" +msgid "Exported tutorial could not be saved" +msgstr "" + #: main.cpp:27 msgctxt "@title" msgid "KTutorial editor" @@ -171,6 +196,11 @@ msgid "Main developer" msgstr "" +#: serialization/Serialization.cpp:69 +msgctxt "@item:inlistbox A KFileDialog filter" +msgid "*.js|Javascript file" +msgstr "" + #: view/ReactionTreeItem.cpp:50 msgctxt "@item" msgid "Reaction" @@ -434,6 +464,7 @@ msgstr "" #: rc.cpp:34 +msgctxt "@label:listbox" msgid "Type:" msgstr "" @@ -642,10 +673,12 @@ msgstr "" #: rc.cpp:154 +msgctxt "@label:textbox" msgid "Emitter name:" msgstr "" #: rc.cpp:157 +msgctxt "@label:textbox" msgid "Signal name:" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 18:46:36
|
Revision: 170 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=170&view=rev Author: danxuliu Date: 2010-03-19 18:46:23 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Fix Krazy2 spelling issues Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h trunk/ktutorial/ktutorial-editor/src/view/ReactionTreeItem.cpp Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 18:37:33 UTC (rev 169) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 18:46:23 UTC (rev 170) @@ -419,7 +419,7 @@ indentedCode += indentation() + lines[i] + '\n'; } - //If the code ends with '\n', the splitted code will contain an empty end + //If the code ends with '\n', the split code will contain an empty end //element that should be ignored if (!code.endsWith('\n')) { indentedCode += indentation() + lines[lines.count()-1] + '\n'; Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-19 18:37:33 UTC (rev 169) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-19 18:46:23 UTC (rev 170) @@ -89,7 +89,7 @@ QHash<QString, int> mVariables; /** - * The curren indentation level. + * The current indentation level. * Increment and decrement it when entering and exiting a code block. */ int mIndentationLevel; @@ -237,7 +237,7 @@ * Adds a new function to mPendingFunctions. * The body will be automatically indented. * - * It is used to queue the writting of functions with custom code specified + * It is used to queue the writing of functions with custom code specified * in reactions, as reactions are written into the setup function of its * step. * Modified: trunk/ktutorial/ktutorial-editor/src/view/ReactionTreeItem.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/ReactionTreeItem.cpp 2010-03-19 18:37:33 UTC (rev 169) +++ trunk/ktutorial/ktutorial-editor/src/view/ReactionTreeItem.cpp 2010-03-19 18:46:23 UTC (rev 170) @@ -37,7 +37,7 @@ mResponseCustomCodeItem = 0; mResponseNextStepItem = 0; - //Add two dummy childs, as update method expects always to child items + //Add two dummy children, as update method expects always to child items appendChild(new TextTreeItem(this)); appendChild(new TextTreeItem(this)); update(reaction); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 18:37:39
|
Revision: 169 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=169&view=rev Author: danxuliu Date: 2010-03-19 18:37:33 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Fix Krazy2 i18ncheckarg issues Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui Modified: trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp 2010-03-19 18:31:07 UTC (rev 168) +++ trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp 2010-03-19 18:37:33 UTC (rev 169) @@ -65,7 +65,7 @@ QStringList Serialization::availableExporterTypeList() { QStringList types; - types << i18nc("@item:combobox A KFileDialog filter", + types << i18nc("@item:inlistbox A KFileDialog filter", "*.js|Javascript file"); return types; } Modified: trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui 2010-03-19 18:31:07 UTC (rev 168) +++ trunk/ktutorial/ktutorial-editor/src/view/NewWaitForWidget.ui 2010-03-19 18:37:33 UTC (rev 169) @@ -26,7 +26,7 @@ <item> <widget class="QLabel" name="waitForTypeLabel"> <property name="text"> - <string>Type:</string> + <string comment="@label:listbox">Type:</string> </property> <property name="buddy"> <cstring>waitForTypeComboBox</cstring> Modified: trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui 2010-03-19 18:31:07 UTC (rev 168) +++ trunk/ktutorial/ktutorial-editor/src/view/WaitForSignalWidget.ui 2010-03-19 18:37:33 UTC (rev 169) @@ -28,7 +28,7 @@ <item> <widget class="QLabel" name="emitterNameLabel"> <property name="text"> - <string>Emitter name:</string> + <string comment="@label:textbox">Emitter name:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -41,7 +41,7 @@ <item> <widget class="QLabel" name="signalNameLabel"> <property name="text"> - <string>Signal name:</string> + <string comment="@label:textbox">Signal name:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 18:31:14
|
Revision: 168 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=168&view=rev Author: danxuliu Date: 2010-03-19 18:31:07 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Fix Kraxy2 foreach issues Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 18:15:55 UTC (rev 167) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 18:31:07 UTC (rev 168) @@ -61,7 +61,7 @@ QStringList lines = tutorial->licenseText().split('\n'); int maximumLineLength = 0; - foreach (QString line, lines) { + foreach (const QString& line, lines) { if (line.size() > maximumLineLength) { maximumLineLength = line.size(); } @@ -173,7 +173,7 @@ out() << "connect(" << stepVariable << ", \"setup(QObject*)\",\n" << " this, \"" << stepVariable << "Setup(QObject*)\");\n\n"; - foreach (QString function, mPendingFunctions) { + foreach (const QString& function, mPendingFunctions) { mOut << function << '\n'; } mPendingFunctions.clear(); @@ -287,7 +287,7 @@ QString variable = addVariable("waitFor" + type); out() << variable << " = ktutorial.newWaitFor(\"WaitFor" << type << "\");\n"; - foreach (QString childVariable, childVariables) { + foreach (const QString& childVariable, childVariables) { if (!childVariable.isEmpty()) { out() << variable << ".add(" << childVariable << ");\n"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 18:16:01
|
Revision: 167 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=167&view=rev Author: danxuliu Date: 2010-03-19 18:15:55 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Add action to export a tutorial from the File menu. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc Modified: trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-03-19 18:14:11 UTC (rev 166) +++ trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-03-19 18:15:55 UTC (rev 167) @@ -25,10 +25,10 @@ # As everything but a tiny initialization code is in a library, the build system # for the tests can be easily set up. kde4_add_library(ktutorial_editor ${ktutorial_editor_SRCS}) -target_link_libraries(ktutorial_editor ktutorial_editor_serialization ktutorial_editor_view) +target_link_libraries(ktutorial_editor ktutorial_editor_serialization ktutorial_editor_view ${KDE4_KIO_LIBS}) kde4_add_executable(ktutorial-editor main.cpp) -target_link_libraries(ktutorial-editor ktutorial_editor ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) +target_link_libraries(ktutorial-editor ktutorial_editor) ####### Install the editor ####### Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-19 18:14:11 UTC (rev 166) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-19 18:15:55 UTC (rev 167) @@ -24,11 +24,16 @@ #include <KAction> #include <KActionCollection> #include <KApplication> +#include <KFileDialog> +#include <KFileFilterCombo> #include <KLocalizedString> +#include <KMessageBox> +#include <KIO/NetAccess> #include "Reaction.h" #include "Step.h" #include "Tutorial.h" +#include "serialization/Serialization.h" #include "view/ActionListWidget.h" #include "view/EditionDialog.h" #include "view/LicenseWidget.h" @@ -94,12 +99,20 @@ } void KTutorialEditor::setupActions() { + KAction* action = new KAction(this); + action->setText(i18nc("@action", "Export...")); + action->setStatusTip(i18nc("@info:status", "Exports the tutorial to a " +"script.")); + action->setIcon(KIcon("document-export")); + actionCollection()->addAction("exportTutorial", action); + connect(action, SIGNAL(triggered(bool)), this, SLOT(exportTutorial())); + KStandardAction::quit(kapp, SLOT(quit()), actionCollection()); ActionListWidget* actionListWidget = new ActionListWidget(mTutorialActionDock); - KAction* action = new KAction(this); + action = new KAction(this); action->setText(i18nc("@action", "Set information...")); action->setStatusTip(i18nc("@info:status", "Set the name and description " "of the tutorial.")); @@ -271,6 +284,32 @@ } } +void KTutorialEditor::exportTutorial() { + KUrl url; + QPointer<KFileDialog> dialog = new KFileDialog(url, QString(), this); + + dialog->setSelection(mTutorial->id()); + dialog->setCaption(i18nc("@title", "Export Tutorial")); + dialog->setOperationMode(KFileDialog::Saving); + dialog->setConfirmOverwrite(true); + dialog->setFilter(Serialization::availableExporterTypes()); + dialog->filterWidget()->setEditable(false); + + if (dialog->exec() == QDialog::Rejected) { + return; + } + + if (!Serialization::exportTutorial(mTutorial, dialog->currentFilter(), + dialog->selectedUrl())) { + QString text = i18nc("@label", "There was a problem when trying to " +"save the exported tutorial:<nl/>%1", KIO::NetAccess::lastErrorString()); + QString caption = i18nc("@title:window", "Exported tutorial could not " +"be saved"); + KMessageBox::error(this, text, caption); + return; + } +} + void KTutorialEditor::setTutorialInformation() { showEditionDialog(new TutorialInformationWidget(mTutorial)); } Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-19 18:14:11 UTC (rev 166) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-19 18:15:55 UTC (rev 167) @@ -121,6 +121,12 @@ void selectReaction(Reaction* reaction); /** + * Shows a KFileDialog to select the file to save the exported tutorial in. + * An error message is shown if the tutorial couldn't be saved. + */ + void exportTutorial(); + + /** * Shows a TutorialInformationWidget for the tutorial. */ void setTutorialInformation(); Modified: trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc =================================================================== --- trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc 2010-03-19 18:14:11 UTC (rev 166) +++ trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc 2010-03-19 18:15:55 UTC (rev 167) @@ -2,6 +2,9 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> <gui name="ktutorial-editor" version="1"> <MenuBar> + <Menu name="file"> + <Action name="exportTutorial"/> + </Menu> <Menu name="edit"> <Menu name="editTutorials"> <Text context="@title:menu">Tutorial</Text> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 18:14:22
|
Revision: 166 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=166&view=rev Author: danxuliu Date: 2010-03-19 18:14:11 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Add Serialization class to act as a facade for the serialization subsystem. Right now it only abstracts exporting a tutorial to some file, but in the future it will provide a way to load and save tutorials. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt Added Paths: ----------- trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.h trunk/ktutorial/ktutorial-editor/tests/unit/serialization/SerializationTest.cpp Modified: trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt 2010-03-19 07:12:21 UTC (rev 165) +++ trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt 2010-03-19 18:14:11 UTC (rev 166) @@ -2,6 +2,7 @@ set(ktutorial_editor_serialization_SRCS JavascriptExporter.cpp + Serialization.cpp ) kde4_add_library(ktutorial_editor_serialization ${ktutorial_editor_serialization_SRCS}) Added: trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp (rev 0) +++ trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp 2010-03-19 18:14:11 UTC (rev 166) @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#include "Serialization.h" + +#include <KLocalizedString> +#include <KTemporaryFile> +#include <KUrl> +#include <KIO/NetAccess> + +#include "JavascriptExporter.h" + +//public: + +QString Serialization::availableExporterTypes() { + QStringList typeList = availableExporterTypeList(); + + QString types; + for (int i=0; i<typeList.count() - 1; ++i) { + types += typeList[i] + '\n'; + } + types += typeList[typeList.count()-1]; + + return types; +} + +bool Serialization::exportTutorial(const Tutorial* tutorial, + const QString& type, const KUrl& url) { + Q_ASSERT(tutorial); + Q_ASSERT(url.isValid()); + + QString exportedCode; + if (type == "*.js") { + exportedCode = JavascriptExporter().exportTutorial(tutorial); + } else { + Q_ASSERT(false); + } + + KTemporaryFile temporaryFile; + temporaryFile.open(); + QTextStream out(&temporaryFile); + out << exportedCode; + out.flush(); + temporaryFile.close(); + + return KIO::NetAccess::upload(temporaryFile.fileName(), url, 0); +} + +//private: + +QStringList Serialization::availableExporterTypeList() { + QStringList types; + types << i18nc("@item:combobox A KFileDialog filter", + "*.js|Javascript file"); + return types; +} Property changes on: trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.h (rev 0) +++ trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.h 2010-03-19 18:14:11 UTC (rev 166) @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (C) 2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#ifndef SERIALIZATION_H +#define SERIALIZATION_H + +#include <QStringList> + +class KUrl; +class Tutorial; + +/** + * Facade for serialization system. + * It provides the methods needed to know the available exporters and export a + * tutorial using one of them. + */ +class Serialization { +public: + + /** + * Returns the available exporter types. + * The string has the format expected by KFileDialog setFilter method, that + * is, "*.fileExtension1|Human readable name1\n*.fileExtension2|Human + * readable name2\n...". + * The first type in the list is the default type, Javascript. + * + * @return The available exporter types. + */ + static QString availableExporterTypes(); + + /** + * Exports the tutorial to the file specified by the url using the given + * exporter type. + * The type must be the extension fragment of one of the types returned by + * availableExporterTypes(). It is the value returned by KDialog + * currentFilter() method. + * + * The url can be local or remote. If the file can't be saved, false is + * returned. In that case, KIO::NetAccess can be asked for the error code + * and string. + * + * @param tutorial The tutorial to export. + * @param type The type of the exporter to use. + * @param url The url to save the script file to. + * @return True if the exported tutorial was saved, false otherwise. + */ + static bool exportTutorial(const Tutorial* tutorial, const QString& type, + const KUrl& url); + +private: + + /** + * Returns a list of strings with the available exporter types. + * + * @return A list with the available exporter types. + */ + static QStringList availableExporterTypeList(); + +}; + +#endif Property changes on: trunk/ktutorial/ktutorial-editor/src/serialization/Serialization.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt 2010-03-19 07:12:21 UTC (rev 165) +++ trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt 2010-03-19 18:14:11 UTC (rev 166) @@ -13,6 +13,7 @@ unit_tests( JavascriptExporter + Serialization ) MACRO(MEM_TESTS) @@ -23,4 +24,5 @@ mem_tests( JavascriptExporter + Serialization ) Added: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/SerializationTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/serialization/SerializationTest.cpp (rev 0) +++ trunk/ktutorial/ktutorial-editor/tests/unit/serialization/SerializationTest.cpp 2010-03-19 18:14:11 UTC (rev 166) @@ -0,0 +1,162 @@ +/*************************************************************************** + * Copyright (C) 2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#include <QtTest> + +#include "Serialization.h" + +#include <QFile> + +#include <KLocalizedString> +#include <KStandardDirs> +#include <KUrl> + +#include "../Tutorial.h" + +class SerializationTest: public QObject { +Q_OBJECT + +private slots: + + void init(); + void cleanup(); + + void testAvailableExporterTypes(); + + void testExportJavascript(); + + void testExportToExistingUrl(); + void testExportToUnwritableUrl(); + +private: + + QFile* mExportedFile; + + QString readFile(QFile* file); + void writeFile(QFile* file, const QString& contents); + +}; + +void SerializationTest::init() { + mExportedFile = 0; +} + +void SerializationTest::cleanup() { + if (mExportedFile) { + mExportedFile->remove(); + } + delete mExportedFile; +} + +void SerializationTest::testAvailableExporterTypes() { + QString types = Serialization::availableExporterTypes(); + + QCOMPARE(types, i18nc("@item:combobox A KFileDialog filter", + "*.js|Javascript file")); +} + +void SerializationTest::testExportJavascript() { + Tutorial tutorial; + tutorial.setName("The name"); + tutorial.setDescription("The description"); + + KUrl url = KGlobal::dirs()->saveLocation("tmp") + "/SerializationTest.js"; + + QVERIFY(Serialization::exportTutorial(&tutorial, "*.js", url)); + + mExportedFile = new QFile(url.toLocalFile()); + QVERIFY(mExportedFile->exists()); + QVERIFY(mExportedFile->open(QIODevice::ReadOnly | QIODevice::Text)); + + QString actualContents = readFile(mExportedFile); + QString expectedContents = +"t = Kross.module(\"kdetranslation\");\n" +"\n" +"tutorial.tutorialInformationAsObject().setName(t.i18n(\"The name\"));\n" +"tutorial.tutorialInformationAsObject().setDescription(" + "t.i18n(\"The description\"));\n" +"\n"; + + QCOMPARE(actualContents, expectedContents); +} + +void SerializationTest::testExportToExistingUrl() { + Tutorial tutorial; + tutorial.setName("The name"); + tutorial.setDescription("The description"); + + KUrl url = KGlobal::dirs()->saveLocation("tmp") + "/SerializationTest.js"; + mExportedFile = new QFile(url.toLocalFile()); + mExportedFile->open(QIODevice::WriteOnly | QIODevice::Text); + writeFile(mExportedFile, "Hello world!"); + + QVERIFY(Serialization::exportTutorial(&tutorial, "*.js", url)); + + QVERIFY(mExportedFile->exists()); + QVERIFY(mExportedFile->open(QIODevice::ReadOnly | QIODevice::Text)); + + QString actualContents = readFile(mExportedFile); + QString expectedContents = +"t = Kross.module(\"kdetranslation\");\n" +"\n" +"tutorial.tutorialInformationAsObject().setName(t.i18n(\"The name\"));\n" +"tutorial.tutorialInformationAsObject().setDescription(" + "t.i18n(\"The description\"));\n" +"\n"; + + QCOMPARE(actualContents, expectedContents); +} + +void SerializationTest::testExportToUnwritableUrl() { + Tutorial tutorial; + tutorial.setName("The name"); + tutorial.setDescription("The description"); + + KUrl url = KGlobal::dirs()->saveLocation("tmp") + "/SerializationTest.js"; + mExportedFile = new QFile(url.toLocalFile()); + mExportedFile->open(QIODevice::WriteOnly | QIODevice::Text); + writeFile(mExportedFile, "Hello world!"); + QVERIFY(QFile::setPermissions(mExportedFile->fileName(), 0)); + + QVERIFY(!Serialization::exportTutorial(&tutorial, "*.js", url)); +} + +/////////////////////////////////// Helpers //////////////////////////////////// + +QString SerializationTest::readFile(QFile* file) { + QString data; + + QTextStream in(file); + while (!in.atEnd()) { + data += in.readAll(); + } + file->close(); + + return data; +} + +void SerializationTest::writeFile(QFile* file, const QString& contents) { + QTextStream out(file); + out << contents; + + file->close(); +} + +QTEST_MAIN(SerializationTest) + +#include "SerializationTest.moc" Property changes on: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/SerializationTest.cpp ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 07:12:28
|
Revision: 165 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=165&view=rev Author: danxuliu Date: 2010-03-19 07:12:21 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Make arguments const, as a tutorial shouldn't be modified when exported. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 04:46:11 UTC (rev 164) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 07:12:21 UTC (rev 165) @@ -34,7 +34,7 @@ JavascriptExporter::JavascriptExporter(): mIndentationLevel(0) { } -QString JavascriptExporter::exportTutorial(Tutorial* tutorial) { +QString JavascriptExporter::exportTutorial(const Tutorial* tutorial) { QString code; mOut.setString(&code); @@ -54,7 +54,7 @@ //private: -void JavascriptExporter::writeLicense(Tutorial* tutorial) { +void JavascriptExporter::writeLicense(const Tutorial* tutorial) { if (tutorial->licenseText().isEmpty()) { return; } @@ -76,7 +76,7 @@ out() << " ****" << QString('*').repeated(maximumLineLength) << "****/\n\n"; } -void JavascriptExporter::writeInformation(Tutorial* tutorial) { +void JavascriptExporter::writeInformation(const Tutorial* tutorial) { if (tutorial->name().isEmpty()) { out() << "//Error: Tutorial without name!\n"; } else { @@ -94,7 +94,7 @@ mOut << "\n"; } -void JavascriptExporter::writeSetup(Tutorial* tutorial) { +void JavascriptExporter::writeSetup(const Tutorial* tutorial) { if (tutorial->customSetupCode().isEmpty()) { return; } @@ -108,7 +108,7 @@ << " this, \"tutorialSetup(QObject*)\");\n\n"; } -void JavascriptExporter::writeTearDown(Tutorial* tutorial) { +void JavascriptExporter::writeTearDown(const Tutorial* tutorial) { if (tutorial->customTearDownCode().isEmpty()) { return; } @@ -122,7 +122,7 @@ << " this, \"tutorialTearDown(QObject*)\");\n\n"; } -void JavascriptExporter::writeStep(Step* step) { +void JavascriptExporter::writeStep(const Step* step) { if (step->id().isEmpty()) { out() << "//Error: Step without id!\n\n"; return; @@ -148,7 +148,7 @@ out() << "tutorial.addStep(" << stepVariable << ");\n\n"; } -void JavascriptExporter::writeSetup(Step* step) { +void JavascriptExporter::writeSetup(const Step* step) { if (step->customSetupCode().isEmpty() && step->reactions().count() == 0) { return; } @@ -180,7 +180,7 @@ mVariables.clear(); } -void JavascriptExporter::writeTearDown(Step* step) { +void JavascriptExporter::writeTearDown(const Step* step) { if (step->customTearDownCode().isEmpty()) { return; } @@ -195,7 +195,8 @@ << " this, \"" << stepVariable << "TearDown(QObject*)\");\n\n"; } -void JavascriptExporter::writeReaction(Step* step, Reaction* reaction) { +void JavascriptExporter::writeReaction(const Step* step, + const Reaction* reaction) { if (reaction->triggerType() == Reaction::ConditionMet && !reaction->waitFor()) { out() << "//Error: WaitFor not set!\n"; @@ -252,24 +253,24 @@ addFunction(functionName, reaction->customCode()); } -QString JavascriptExporter::writeWaitFor(WaitFor* waitFor) { - if (qobject_cast<WaitForComposed*>(waitFor)) { - return writeWaitFor(static_cast<WaitForComposed*>(waitFor)); +QString JavascriptExporter::writeWaitFor(const WaitFor* waitFor) { + if (qobject_cast<const WaitForComposed*>(waitFor)) { + return writeWaitFor(static_cast<const WaitForComposed*>(waitFor)); } - if (qobject_cast<WaitForEvent*>(waitFor)) { - return writeWaitFor(static_cast<WaitForEvent*>(waitFor)); + if (qobject_cast<const WaitForEvent*>(waitFor)) { + return writeWaitFor(static_cast<const WaitForEvent*>(waitFor)); } - if (qobject_cast<WaitForNot*>(waitFor)) { - return writeWaitFor(static_cast<WaitForNot*>(waitFor)); + if (qobject_cast<const WaitForNot*>(waitFor)) { + return writeWaitFor(static_cast<const WaitForNot*>(waitFor)); } - if (qobject_cast<WaitForSignal*>(waitFor)) { - return writeWaitFor(static_cast<WaitForSignal*>(waitFor)); + if (qobject_cast<const WaitForSignal*>(waitFor)) { + return writeWaitFor(static_cast<const WaitForSignal*>(waitFor)); } return ""; } -QString JavascriptExporter::writeWaitFor(WaitForComposed* waitForComposed) { +QString JavascriptExporter::writeWaitFor(const WaitForComposed* waitForComposed) { QString type; if (waitForComposed->compositionType() == WaitForComposed::And) { type = "And"; @@ -295,7 +296,7 @@ return variable; } -QString JavascriptExporter::writeWaitFor(WaitForEvent* waitForEvent) { +QString JavascriptExporter::writeWaitFor(const WaitForEvent* waitForEvent) { if (waitForEvent->receiverName().isEmpty()) { out() << "//Error: WaitForEvent without receiver name!\n"; return ""; @@ -318,7 +319,7 @@ return variable; } -QString JavascriptExporter::writeWaitFor(WaitForNot* waitForNot) { +QString JavascriptExporter::writeWaitFor(const WaitForNot* waitForNot) { if (!waitForNot->negatedWaitFor()) { out() << "//Error: WaitForNot without negated WaitFor!\n"; return ""; @@ -336,7 +337,7 @@ return variable; } -QString JavascriptExporter::writeWaitFor(WaitForSignal* waitForSignal) { +QString JavascriptExporter::writeWaitFor(const WaitForSignal* waitForSignal) { if (waitForSignal->emitterName().isEmpty()) { out() << "//Error: WaitForSignal without emitter name!\n"; return ""; Modified: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-19 04:46:11 UTC (rev 164) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-19 07:12:21 UTC (rev 165) @@ -69,7 +69,7 @@ * @param tutorial The tutorial to export. * @return The Javascript code. */ - QString exportTutorial(Tutorial* tutorial); + QString exportTutorial(const Tutorial* tutorial); private: @@ -100,7 +100,7 @@ * * @param tutorial The tutorial to write its license. */ - void writeLicense(Tutorial* tutorial); + void writeLicense(const Tutorial* tutorial); /** * Writes the name and description code of a tutorial. @@ -108,7 +108,7 @@ * * @param tutorial The tutorial to write its name and description code. */ - void writeInformation(Tutorial* tutorial); + void writeInformation(const Tutorial* tutorial); /** * Writes the setup function of a tutorial and its custom code. @@ -116,7 +116,7 @@ * * @param tutorial The tutorial to write its setup function. */ - void writeSetup(Tutorial* tutorial); + void writeSetup(const Tutorial* tutorial); /** * Writes the tear down function of a tutorial and its custom code. @@ -124,7 +124,7 @@ * * @param tutorial The tutorial to write its tear down function. */ - void writeTearDown(Tutorial* tutorial); + void writeTearDown(const Tutorial* tutorial); /** * Writes the full code (step creation, setup, tear down and adding to the @@ -133,7 +133,7 @@ * * @param step The step to write its code. */ - void writeStep(Step* step); + void writeStep(const Step* step); /** * Writes the setup code (including setting up reactions) of a Step. @@ -144,7 +144,7 @@ * * @param step The step to write its setup code. */ - void writeSetup(Step* step); + void writeSetup(const Step* step); /** * Writes the tear down code of a Step. @@ -152,7 +152,7 @@ * * @param step The step to write its tear down code. */ - void writeTearDown(Step* step); + void writeTearDown(const Step* step); /** * Writes the reaction code. @@ -162,7 +162,7 @@ * @param step The step that the reaction is part of. * @param reaction The reaction to write its code. */ - void writeReaction(Step* step, Reaction* reaction); + void writeReaction(const Step* step, const Reaction* reaction); /** * Writes the code to create and set a WaitFor. @@ -171,7 +171,7 @@ * @return The name of the variable that holds the WaitFor, or an empty * string if the WaitFor data is invalid. */ - QString writeWaitFor(WaitFor* waitFor); + QString writeWaitFor(const WaitFor* waitFor); /** * Writes the code to create and set a WaitForComposed. @@ -181,7 +181,7 @@ * @param waitForComposed The WaitForComposed. * @return The name of the variable that holds the WaitFor. */ - QString writeWaitFor(WaitForComposed* waitForComposed); + QString writeWaitFor(const WaitForComposed* waitForComposed); /** * Writes the code to create and set a WaitForEvent. @@ -191,7 +191,7 @@ * @param waitForEvent The WaitForEvent. * @return The name of the variable that holds the WaitFor. */ - QString writeWaitFor(WaitForEvent* waitForEvent); + QString writeWaitFor(const WaitForEvent* waitForEvent); /** * Writes the code to create and set a WaitForNot. @@ -201,7 +201,7 @@ * @param waitForNot The WaitForNot. * @return The name of the variable that holds the WaitFor. */ - QString writeWaitFor(WaitForNot* waitForNot); + QString writeWaitFor(const WaitForNot* waitForNot); /** * Writes the code to create and set a WaitForSignal. @@ -211,7 +211,7 @@ * @param waitForSignal The WaitForSignal. * @return The name of the variable that holds the WaitFor. */ - QString writeWaitFor(WaitForSignal* waitForSignal); + QString writeWaitFor(const WaitForSignal* waitForSignal); /** * Returns the output stream after adding the identation text. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2010-03-19 04:46:23
|
Revision: 164 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=164&view=rev Author: danxuliu Date: 2010-03-19 04:46:11 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Add JavascriptExporter to write the Javascript code used by KTutorial to create a tutorial. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt Added Paths: ----------- trunk/ktutorial/ktutorial-editor/src/serialization/ trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h trunk/ktutorial/ktutorial-editor/tests/unit/serialization/ trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp Modified: trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-03-16 06:24:53 UTC (rev 163) +++ trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-03-19 04:46:11 UTC (rev 164) @@ -2,6 +2,7 @@ # In order to work, they must be compiled using -fPIC add_definitions("-fPIC") +add_subdirectory(serialization) add_subdirectory(view) include_directories(${KDE4_INCLUDES}) @@ -24,7 +25,7 @@ # As everything but a tiny initialization code is in a library, the build system # for the tests can be easily set up. kde4_add_library(ktutorial_editor ${ktutorial_editor_SRCS}) -target_link_libraries(ktutorial_editor ktutorial_editor_view) +target_link_libraries(ktutorial_editor ktutorial_editor_serialization ktutorial_editor_view) kde4_add_executable(ktutorial-editor main.cpp) target_link_libraries(ktutorial-editor ktutorial_editor ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) Added: trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt (rev 0) +++ trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt 2010-03-19 04:46:11 UTC (rev 164) @@ -0,0 +1,9 @@ +include_directories(${KDE4_INCLUDES}) + +set(ktutorial_editor_serialization_SRCS + JavascriptExporter.cpp +) + +kde4_add_library(ktutorial_editor_serialization ${ktutorial_editor_serialization_SRCS}) + +target_link_libraries(ktutorial_editor_serialization ktutorial_editor ${KDE4_LIBS}) Property changes on: trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt ___________________________________________________________________ Added: svn:executable + * Added: svn:eol-style + native Added: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp (rev 0) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp 2010-03-19 04:46:11 UTC (rev 164) @@ -0,0 +1,455 @@ +/*************************************************************************** + * Copyright (C) 2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#include "JavascriptExporter.h" + +#include <QRegExp> +#include <QStringList> + +#include "../Reaction.h" +#include "../Step.h" +#include "../Tutorial.h" +#include "../WaitForComposed.h" +#include "../WaitForEvent.h" +#include "../WaitForNot.h" +#include "../WaitForSignal.h" + +//public: + +JavascriptExporter::JavascriptExporter(): mIndentationLevel(0) { +} + +QString JavascriptExporter::exportTutorial(Tutorial* tutorial) { + QString code; + mOut.setString(&code); + + writeLicense(tutorial); + out() << "t = Kross.module(\"kdetranslation\");\n\n"; + writeInformation(tutorial); + writeSetup(tutorial); + writeTearDown(tutorial); + + foreach (Step* step, tutorial->steps()) { + writeStep(step); + } + + mOut.setString(0); + return code; +} + +//private: + +void JavascriptExporter::writeLicense(Tutorial* tutorial) { + if (tutorial->licenseText().isEmpty()) { + return; + } + + QStringList lines = tutorial->licenseText().split('\n'); + int maximumLineLength = 0; + foreach (QString line, lines) { + if (line.size() > maximumLineLength) { + maximumLineLength = line.size(); + } + } + + out() << "/****" << QString('*').repeated(maximumLineLength) << "****\n"; + foreach (QString line, lines) { + int numberOfSpaces = maximumLineLength - line.length(); + QString filling = QString(' ').repeated(numberOfSpaces); + out() << " * " + line + filling + " *\n"; + } + out() << " ****" << QString('*').repeated(maximumLineLength) << "****/\n\n"; +} + +void JavascriptExporter::writeInformation(Tutorial* tutorial) { + if (tutorial->name().isEmpty()) { + out() << "//Error: Tutorial without name!\n"; + } else { + out() << "tutorial.tutorialInformationAsObject().setName(t.i18n(\"" + << tutorial->name() <<"\"));\n"; + } + + if (tutorial->description().isEmpty()) { + out() << "//Error: Tutorial without description!\n"; + } else { + out() << "tutorial.tutorialInformationAsObject().setDescription(" + << "t.i18n(\"" << tutorial->description() <<"\"));\n"; + } + + mOut << "\n"; +} + +void JavascriptExporter::writeSetup(Tutorial* tutorial) { + if (tutorial->customSetupCode().isEmpty()) { + return; + } + + out() << "function tutorialSetup(tutorial) {\n"; + mIndentationLevel++; + mOut << toIndentedCode(tutorial->customSetupCode()); + mIndentationLevel--; + out() << "}\n"; + out() << "connect(tutorial, \"setup(QObject*)\",\n" + << " this, \"tutorialSetup(QObject*)\");\n\n"; +} + +void JavascriptExporter::writeTearDown(Tutorial* tutorial) { + if (tutorial->customTearDownCode().isEmpty()) { + return; + } + + out() << "function tutorialTearDown(tutorial) {\n"; + mIndentationLevel++; + mOut << toIndentedCode(tutorial->customTearDownCode()); + mIndentationLevel--; + out() << "}\n"; + out() << "connect(tutorial, \"tearDown(QObject*)\",\n" + << " this, \"tutorialTearDown(QObject*)\");\n\n"; +} + +void JavascriptExporter::writeStep(Step* step) { + if (step->id().isEmpty()) { + out() << "//Error: Step without id!\n\n"; + return; + } + + out() << "//Step " << step->id() << "\n"; + + QString stepVariable = toLowerCamelCase(step->id()) + "Step"; + out() << stepVariable << " = ktutorial.newStep(\"" << step->id() + << "\");\n"; + + if (step->text().isEmpty()) { + out() << "//Error: Step without text!\n"; + } else { + out() << stepVariable << ".setText(t.i18nc(\"@info\", \"" + << step->text() << "\"));\n"; + } + mOut << '\n'; + + writeSetup(step); + writeTearDown(step); + + out() << "tutorial.addStep(" << stepVariable << ");\n\n"; +} + +void JavascriptExporter::writeSetup(Step* step) { + if (step->customSetupCode().isEmpty() && step->reactions().count() == 0) { + return; + } + + QString stepVariable = toLowerCamelCase(step->id()) + "Step"; + out() << "function " << stepVariable << "Setup(step) {\n"; + mIndentationLevel++; + + for (int i=0; i<step->reactions().count(); ++i) { + Reaction* reaction = step->reactions()[i]; + writeReaction(step, reaction); + + if (i<step->reactions().count() - 1 || + !step->customSetupCode().isEmpty()) { + mOut << '\n'; + } + } + + mOut << toIndentedCode(step->customSetupCode()); + mIndentationLevel--; + out() << "}\n"; + out() << "connect(" << stepVariable << ", \"setup(QObject*)\",\n" + << " this, \"" << stepVariable << "Setup(QObject*)\");\n\n"; + + foreach (QString function, mPendingFunctions) { + mOut << function << '\n'; + } + mPendingFunctions.clear(); + mVariables.clear(); +} + +void JavascriptExporter::writeTearDown(Step* step) { + if (step->customTearDownCode().isEmpty()) { + return; + } + + QString stepVariable = toLowerCamelCase(step->id()) + "Step"; + out() << "function " << stepVariable << "TearDown(step) {\n"; + mIndentationLevel++; + mOut << toIndentedCode(step->customTearDownCode()); + mIndentationLevel--; + out() << "}\n"; + out() << "connect(" << stepVariable << ", \"tearDown(QObject*)\",\n" + << " this, \"" << stepVariable << "TearDown(QObject*)\");\n\n"; +} + +void JavascriptExporter::writeReaction(Step* step, Reaction* reaction) { + if (reaction->triggerType() == Reaction::ConditionMet && + !reaction->waitFor()) { + out() << "//Error: WaitFor not set!\n"; + return; + } + + if (reaction->triggerType() == Reaction::OptionSelected && + reaction->optionName().isEmpty()) { + out() << "//Error: Option without name!\n"; + return; + } + + if (reaction->responseType() == Reaction::NextStep && + reaction->nextStepId().isEmpty()) { + out() << "//Error: Next step id not set!\n"; + return; + } + + if (reaction->triggerType() == Reaction::OptionSelected && + reaction->responseType() == Reaction::NextStep) { + out() << "step.addOption(ktutorial.newOption(\"" + << reaction->optionName() << "\"), \"" << reaction->nextStepId() + << "\");\n"; + return; + } + + if (reaction->triggerType() == Reaction::OptionSelected && + reaction->responseType() == Reaction::CustomCode) { + QString functionName = toLowerCamelCase(step->id()) + "Step" + + toUpperCamelCase(reaction->optionName()) + + "OptionSelected"; + out() << "step.addOption(ktutorial.newOption(\"" + << reaction->optionName() << "\"), self, \"" << functionName + << "()\");\n"; + addFunction(functionName, reaction->customCode()); + return; + } + + QString variableName = writeWaitFor(reaction->waitFor()); + if (variableName.isEmpty()) { + return; + } + + if (reaction->responseType() == Reaction::NextStep) { + out() << "step.addWaitFor(" << variableName << ", \"" + << reaction->nextStepId() << "\");\n"; + return; + } + + QString functionName = toLowerCamelCase(step->id()) + "Step" + + toUpperCamelCase(variableName) + "ConditionMet"; + out() << "step.addWaitFor(" << variableName << ", self, \"" + << functionName << "()\");\n"; + addFunction(functionName, reaction->customCode()); +} + +QString JavascriptExporter::writeWaitFor(WaitFor* waitFor) { + if (qobject_cast<WaitForComposed*>(waitFor)) { + return writeWaitFor(static_cast<WaitForComposed*>(waitFor)); + } + if (qobject_cast<WaitForEvent*>(waitFor)) { + return writeWaitFor(static_cast<WaitForEvent*>(waitFor)); + } + if (qobject_cast<WaitForNot*>(waitFor)) { + return writeWaitFor(static_cast<WaitForNot*>(waitFor)); + } + if (qobject_cast<WaitForSignal*>(waitFor)) { + return writeWaitFor(static_cast<WaitForSignal*>(waitFor)); + } + + return ""; +} + +QString JavascriptExporter::writeWaitFor(WaitForComposed* waitForComposed) { + QString type; + if (waitForComposed->compositionType() == WaitForComposed::And) { + type = "And"; + } else if (waitForComposed->compositionType() == WaitForComposed::Or) { + type = "Or"; + } + + QStringList childVariables; + foreach (WaitFor* waitFor, waitForComposed->waitFors()) { + childVariables.append(writeWaitFor(waitFor)); + mOut << '\n'; + } + + QString variable = addVariable("waitFor" + type); + out() << variable << " = ktutorial.newWaitFor(\"WaitFor" << type + << "\");\n"; + foreach (QString childVariable, childVariables) { + if (!childVariable.isEmpty()) { + out() << variable << ".add(" << childVariable << ");\n"; + } + } + + return variable; +} + +QString JavascriptExporter::writeWaitFor(WaitForEvent* waitForEvent) { + if (waitForEvent->receiverName().isEmpty()) { + out() << "//Error: WaitForEvent without receiver name!\n"; + return ""; + } + + if (waitForEvent->eventName().isEmpty()) { + out() << "//Error: WaitForEvent without event name!\n"; + return ""; + } + + QString variable = "waitFor" + toUpperCamelCase(waitForEvent->eventName()) + + "In" + toUpperCamelCase(waitForEvent->receiverName()); + variable = addVariable(variable); + + out() << variable << " = ktutorial.newWaitFor(\"WaitForEvent\");\n"; + out() << variable << ".setEvent(ktutorial.findObject(\"" + << waitForEvent->receiverName() << "\"), \"" + << waitForEvent->eventName() << "\");\n"; + + return variable; +} + +QString JavascriptExporter::writeWaitFor(WaitForNot* waitForNot) { + if (!waitForNot->negatedWaitFor()) { + out() << "//Error: WaitForNot without negated WaitFor!\n"; + return ""; + } + + QString variable = addVariable("waitForNot"); + QString negatedVariable = writeWaitFor(waitForNot->negatedWaitFor()); + + mOut << '\n'; + out() << variable << " = ktutorial.newWaitFor(\"WaitForNot\");\n"; + if (!negatedVariable.isEmpty()) { + out() << variable << ".setNegatedWaitFor(" << negatedVariable << ");\n"; + } + + return variable; +} + +QString JavascriptExporter::writeWaitFor(WaitForSignal* waitForSignal) { + if (waitForSignal->emitterName().isEmpty()) { + out() << "//Error: WaitForSignal without emitter name!\n"; + return ""; + } + + if (waitForSignal->signalName().isEmpty()) { + out() << "//Error: WaitForSignal without signal name!\n"; + return ""; + } + + QString signalName = waitForSignal->signalName(); + signalName.remove(QRegExp("\\(.*")); + QString variable = "waitFor" + toUpperCamelCase(signalName) + + "By" + toUpperCamelCase(waitForSignal->emitterName()); + variable = addVariable(variable); + + out() << variable << " = ktutorial.newWaitFor(\"WaitForSignal\");\n"; + out() << variable << ".setSignal(ktutorial.findObject(\"" + << waitForSignal->emitterName() << "\"), \"" + << waitForSignal->signalName() << "\");\n"; + + return variable; +} + +QTextStream& JavascriptExporter::out() { + mOut << indentation(); + return mOut; +} + +QString JavascriptExporter::indentation() { + QString text; + for (int i=0; i<mIndentationLevel; ++i) { + text += " "; + } + + return text; +} + +void JavascriptExporter::addFunction(const QString& functionName, + const QString& code) { + int previousIndentationLevel = mIndentationLevel; + mIndentationLevel = 0; + + QString function; + function += "function " + functionName + "() {\n"; + mIndentationLevel++; + if (code.isEmpty()) { + function += toIndentedCode("//Error: No code set!\n"); + } else { + function += toIndentedCode(code); + } + mIndentationLevel--; + function += "}\n"; + + mPendingFunctions.append(function); + + mIndentationLevel = previousIndentationLevel; +} + +QString JavascriptExporter::addVariable(const QString& variable) { + if (!mVariables.contains(variable)) { + mVariables.insert(variable, 1); + return variable; + } + + mVariables.insert(variable, mVariables.value(variable) + 1); + return variable + QString().setNum(mVariables.value(variable)); +} + +QString JavascriptExporter::toIndentedCode(const QString& code) { + if (code.isEmpty()) { + return ""; + } + + QString indentedCode; + + QStringList lines = code.split('\n'); + for (int i=0; i<lines.count()-1; ++i) { + indentedCode += indentation() + lines[i] + '\n'; + } + + //If the code ends with '\n', the splitted code will contain an empty end + //element that should be ignored + if (!code.endsWith('\n')) { + indentedCode += indentation() + lines[lines.count()-1] + '\n'; + } + + return indentedCode; +} + +QString JavascriptExporter::toLowerCamelCase(const QString& text) const { + if (text.isEmpty()) { + return ""; + } + + QString lowerCamelCase = toUpperCamelCase(text); + lowerCamelCase[0] = lowerCamelCase[0].toLower(); + + return lowerCamelCase; +} + +QString JavascriptExporter::toUpperCamelCase(const QString& text) const { + if (text.isEmpty()) { + return ""; + } + + QStringList words = text.split(' ', QString::SkipEmptyParts); + + QString upperCamelCase; + for (int i=0; i<words.count(); ++i) { + words[i][0] = words[i][0].toUpper(); + upperCamelCase += words[i]; + } + + return upperCamelCase; +} Property changes on: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h (rev 0) +++ trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h 2010-03-19 04:46:11 UTC (rev 164) @@ -0,0 +1,292 @@ +/*************************************************************************** + * Copyright (C) 2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#ifndef JAVASCRIPTEXPORTER_H +#define JAVASCRIPTEXPORTER_H + +#include <QHash> +#include <QStringList> +#include <QTextStream> + +class Reaction; +class Step; +class Tutorial; +class WaitFor; +class WaitForComposed; +class WaitForEvent; +class WaitForNot; +class WaitForSignal; + +/** + * Exporter of tutorials to Javascript code. + * The generated Javascript code can be read by KTutorial from a tutorial script + * file to create and initialize a KTutorial::Tutorial from it. + * + * The general structure of the code is: + * -License (if any) + * -Tutorial information + * -Tutorial setup (if any) + * -Tutorial tear down (if any) + * -Steps + * + * For each step, the following structure is used: + * -Step initialization (id and text) + * -Step setup + * -Reactions (if any) + * -Custom setup code (if any) + * -Functions for each custom code response in the reactions (if any) + * -Step tear down (if any) + * + * If some necessary data is missing (for example, the id in a step), a comment + * explaining the error is written instead of the code for that element. + */ +class JavascriptExporter { +public: + + /** + * Creates a new JavascriptExporter. + */ + JavascriptExporter(); + + /** + * Exports the tutorial to Javascript code. + * + * @param tutorial The tutorial to export. + * @return The Javascript code. + */ + QString exportTutorial(Tutorial* tutorial); + +private: + + /** + * The text stream to write the Javascript code to. + */ + QTextStream mOut; + + /** + * The full code for the functions pending to be written. + */ + QStringList mPendingFunctions; + + /** + * Register for variable names and the number of times that it was used. + */ + QHash<QString, int> mVariables; + + /** + * The curren indentation level. + * Increment and decrement it when entering and exiting a code block. + */ + int mIndentationLevel; + + /** + * Writes the commented license text. + * Nothing is written if there is no license. + * + * @param tutorial The tutorial to write its license. + */ + void writeLicense(Tutorial* tutorial); + + /** + * Writes the name and description code of a tutorial. + * An error message is written if the name or the tutorial is missing. + * + * @param tutorial The tutorial to write its name and description code. + */ + void writeInformation(Tutorial* tutorial); + + /** + * Writes the setup function of a tutorial and its custom code. + * Nothing is written if there is no setup code. + * + * @param tutorial The tutorial to write its setup function. + */ + void writeSetup(Tutorial* tutorial); + + /** + * Writes the tear down function of a tutorial and its custom code. + * Nothing is written if there is no tear down code. + * + * @param tutorial The tutorial to write its tear down function. + */ + void writeTearDown(Tutorial* tutorial); + + /** + * Writes the full code (step creation, setup, tear down and adding to the + * tutorial) of a step. + * If the step id isn't set, an error message is written instead. + * + * @param step The step to write its code. + */ + void writeStep(Step* step); + + /** + * Writes the setup code (including setting up reactions) of a Step. + * Nothing is written if there is no custom setup code and no reactions. + * + * After the setup code all the pending functions added by custom code + * responses in reactions are written. + * + * @param step The step to write its setup code. + */ + void writeSetup(Step* step); + + /** + * Writes the tear down code of a Step. + * Nothing is written if there is no tear down code. + * + * @param step The step to write its tear down code. + */ + void writeTearDown(Step* step); + + /** + * Writes the reaction code. + * An error message is written if the WaitFor, the option name or the next + * step id is not set (and the trigger/response type needed them). + * + * @param step The step that the reaction is part of. + * @param reaction The reaction to write its code. + */ + void writeReaction(Step* step, Reaction* reaction); + + /** + * Writes the code to create and set a WaitFor. + * + * @param waitFor The WaitFor. + * @return The name of the variable that holds the WaitFor, or an empty + * string if the WaitFor data is invalid. + */ + QString writeWaitFor(WaitFor* waitFor); + + /** + * Writes the code to create and set a WaitForComposed. + * The code for the child WaitFors is added before the code for the + * WaitForComposed. + * + * @param waitForComposed The WaitForComposed. + * @return The name of the variable that holds the WaitFor. + */ + QString writeWaitFor(WaitForComposed* waitForComposed); + + /** + * Writes the code to create and set a WaitForEvent. + * If the receiver name or the event name aren't set, an error message is + * written instead, and an empty string returned. + * + * @param waitForEvent The WaitForEvent. + * @return The name of the variable that holds the WaitFor. + */ + QString writeWaitFor(WaitForEvent* waitForEvent); + + /** + * Writes the code to create and set a WaitForNot. + * If the negated WaitFor isn't set, an error message is written instead, + * and an empty string returned. + * + * @param waitForNot The WaitForNot. + * @return The name of the variable that holds the WaitFor. + */ + QString writeWaitFor(WaitForNot* waitForNot); + + /** + * Writes the code to create and set a WaitForSignal. + * If the emitter name or the signal name aren't set, an error message is + * written instead, and an empty string returned. + * + * @param waitForSignal The WaitForSignal. + * @return The name of the variable that holds the WaitFor. + */ + QString writeWaitFor(WaitForSignal* waitForSignal); + + /** + * Returns the output stream after adding the identation text. + * It is used as a shortcut to "mOut << indentation()". Use it to output any + * line that has no previous indentation. + * + * Use mOut directly to output empty new lines, pending functions, or code + * returned by indentedText + * + * @return The output stream. + */ + QTextStream& out(); + + /** + * Returns the current indentation text. + * Each level of indentation are four blank spaces. + * + @return The current indentation text. + */ + QString indentation(); + + /** + * Adds a new function to mPendingFunctions. + * The body will be automatically indented. + * + * It is used to queue the writting of functions with custom code specified + * in reactions, as reactions are written into the setup function of its + * step. + * + * @param functionName The name of the function. + * @param code The body of the function. + */ + void addFunction(const QString& functionName, const QString& code); + + /** + * Returns a unique variable name for the given variable name. + * The same variable name may be used by several WaitFors in the same step + * setup (for example, two WaitForAnd would have the same variable name). + * When a variable is added, it is ensured that there are no other variables + * with the same name. If there are, a fixed unique variable name is + * returned. + * + * The register of variables must be cleared after exiting the step setup + * generation to avoid unneeded renaming of variables in other step setups. + * + * @param variable The variable to add. + * @return The unique variable name. + */ + QString addVariable(const QString& variable); + + /** + * Returns the same code, but with each line indented and ending in a new + * line. + * + * @param code The code to indent. + * @return The indented code. + */ + QString toIndentedCode(const QString& code); + + /** + * Returns the lowerCamelCase version of the given text. + * + * @param text The string to get its lowerCamelCase version. + * @return The lowerCamelCase version of the text. + */ + QString toLowerCamelCase(const QString& text) const; + + /** + * Returns the UpperCamelCase version of the given text. + * + * @param text The string to get its UpperCamelCase version. + * @return The UpperCamelCase version of the text. + */ + QString toUpperCamelCase(const QString& text) const; + +}; + +#endif Property changes on: trunk/ktutorial/ktutorial-editor/src/serialization/JavascriptExporter.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt 2010-03-16 06:24:53 UTC (rev 163) +++ trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt 2010-03-19 04:46:11 UTC (rev 164) @@ -1,3 +1,4 @@ +add_subdirectory(serialization) add_subdirectory(view) # Used by kde4_add_unit_test to set the full path to test executables Added: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt (rev 0) +++ trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt 2010-03-19 04:46:11 UTC (rev 164) @@ -0,0 +1,26 @@ +# Used by kde4_add_unit_test to set the full path to test executables +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${ktutorial-editor_SOURCE_DIR}/src/serialization ${ktutorial-editor_BINARY_DIR}/src/serialization ${KDE4_INCLUDES}) + +MACRO(UNIT_TESTS) + FOREACH(_className ${ARGN}) + set(_testName ${_className}Test) + kde4_add_unit_test(${_testName} TESTNAME ktutorial-editor-unit-${_testName} ${_testName}.cpp) + target_link_libraries(${_testName} ktutorial_editor ktutorial_editor_serialization ${QT_QTTEST_LIBRARY}) + ENDFOREACH(_className) +ENDMACRO(UNIT_TESTS) + +unit_tests( + JavascriptExporter +) + +MACRO(MEM_TESTS) + FOREACH(_testname ${ARGN}) + add_test(ktutorial-editor-unit-mem-${_testname} ${CMAKE_CURRENT_SOURCE_DIR}/../runMemcheck.py ${CMAKE_CURRENT_BINARY_DIR}/${_testname}Test ${CMAKE_CURRENT_BINARY_DIR}) + ENDFOREACH(_testname) +ENDMACRO(MEM_TESTS) + +mem_tests( + JavascriptExporter +) Property changes on: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/CMakeLists.txt ___________________________________________________________________ Added: svn:executable + * Added: svn:eol-style + native Added: trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp (rev 0) +++ trunk/ktutorial/ktutorial-editor/tests/unit/serialization/JavascriptExporterTest.cpp 2010-03-19 04:46:11 UTC (rev 164) @@ -0,0 +1,1167 @@ +/*************************************************************************** + * Copyright (C) 2010 by Daniel Calviño Sánchez * + * dan...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, 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 General Public License * + * along with this program; If not, see <http://www.gnu.org/licenses/>. * + ***************************************************************************/ + +#include <QtTest> + +#include "JavascriptExporter.h" + +#include "../Reaction.h" +#include "../Step.h" +#include "../Tutorial.h" +#include "../WaitForComposed.h" +#include "../WaitForEvent.h" +#include "../WaitForNot.h" +#include "../WaitForSignal.h" + +#define TUTORIAL_EMPTY_INFORMATION_CODE \ +"t = Kross.module(\"kdetranslation\");\n"\ +"\n"\ +"//Error: Tutorial without name!\n"\ +"//Error: Tutorial without description!\n"\ +"\n" + +#define STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE \ +"//Step The id\n"\ +"theIdStep = ktutorial.newStep(\"The id\");\n"\ +"//Error: Step without text!\n"\ +"\n" + +#define CONNECT_STEP_SETUP \ +"connect(theIdStep, \"setup(QObject*)\",\n"\ +" this, \"theIdStepSetup(QObject*)\");\n"\ +"\n" + +#define STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE \ +"tutorial.addStep(theIdStep);\n"\ +"\n" + +class JavascriptExporterTest: public QObject { +Q_OBJECT + +private slots: + + void testTutorialLicense(); + void testTutorialInformation(); + void testTutorialSetupCode(); + void testTutorialTearDownCode(); + void testTutorialWithSeveralSteps(); + + void testStep(); + void testStepSetupCode(); + void testStepSetupCodeWithReactions(); + void testStepTearDownCode(); + void testStepWithoutId(); + void testStepWithSeveralReactions(); + + void testReactionOptionNextStep(); + void testReactionOptionNextStepWithoutOptionNameOrStepId(); + void testReactionOptionCustomCode(); + void testReactionOptionCustomCodeWithoutOptionNameOrCustomCode(); + void testReactionConditionNextStep(); + void testReactionConditionNextStepWithoutConditionOrStepId(); + void testReactionConditionCustomCode(); + void testReactionConditionCustomCodeWithoutConditionOrCustomCode(); + + void testWaitForEvent(); + void testWaitForEventWithoutReceiverNameOrEventName(); + void testWaitForSignal(); + void testWaitForSignalWithoutEmitterNameOrSignalName(); + void testWaitForComposed(); + void testWaitForComposedWithInvalidChildWaitFor(); + void testWaitForNot(); + void testWaitForNotWithInvalidNegatedWaitFor(); + void testWaitForNotWithoutNegatedWaitFor(); + +}; + +void JavascriptExporterTest::testTutorialLicense() { + Tutorial tutorial; + tutorial.setLicenseText("The license text, which should be\nwrapped"); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +"/*****************************************\n" +" * The license text, which should be *\n" +" * wrapped *\n" +" *****************************************/\n" +"\n" +TUTORIAL_EMPTY_INFORMATION_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testTutorialInformation() { + Tutorial tutorial; + tutorial.setName("The name"); + tutorial.setDescription("The description"); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +"t = Kross.module(\"kdetranslation\");\n" +"\n" +"tutorial.tutorialInformationAsObject().setName(t.i18n(\"The name\"));\n" +"tutorial.tutorialInformationAsObject().setDescription(" + "t.i18n(\"The description\"));\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testTutorialSetupCode() { + Tutorial tutorial; + tutorial.setCustomSetupCode("The custom setup\ncode"); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +"function tutorialSetup(tutorial) {\n" +" The custom setup\n" +" code\n" +"}\n" +"connect(tutorial, \"setup(QObject*)\",\n" +" this, \"tutorialSetup(QObject*)\");\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testTutorialTearDownCode() { + Tutorial tutorial; + tutorial.setCustomTearDownCode("The custom tear down\ncode"); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +"function tutorialTearDown(tutorial) {\n" +" The custom tear down\n" +" code\n" +"}\n" +"connect(tutorial, \"tearDown(QObject*)\",\n" +" this, \"tutorialTearDown(QObject*)\");\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testTutorialWithSeveralSteps() { + Tutorial tutorial; + + Step* step1 = new Step(); + step1->setId("The id1"); + step1->setText("The text1"); + tutorial.addStep(step1); + + WaitForSignal* waitForSignal1 = new WaitForSignal(); + waitForSignal1->setEmitterName("The emitter name"); + waitForSignal1->setSignalName("theSignalName(Argument1Type)"); + + Reaction* reaction1 = new Reaction(); + reaction1->setTriggerType(Reaction::ConditionMet); + reaction1->setWaitFor(waitForSignal1); + reaction1->setResponseType(Reaction::CustomCode); + reaction1->setCustomCode("The custom\ncode1"); + step1->addReaction(reaction1); + + Step* step2 = new Step(); + step2->setId("The id2"); + step2->setText("The text2"); + tutorial.addStep(step2); + + WaitForSignal* waitForSignal2 = new WaitForSignal(); + waitForSignal2->setEmitterName("The emitter name"); + waitForSignal2->setSignalName("theSignalName(Argument1Type)"); + + Reaction* reaction2 = new Reaction(); + reaction2->setTriggerType(Reaction::ConditionMet); + reaction2->setWaitFor(waitForSignal2); + reaction2->setResponseType(Reaction::CustomCode); + reaction2->setCustomCode("The custom\ncode2"); + step2->addReaction(reaction2); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +"//Step The id1\n" +"theId1Step = ktutorial.newStep(\"The id1\");\n" +"theId1Step.setText(t.i18nc(\"@info\", \"The text1\"));\n" +"\n" +"function theId1StepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The emitter name\"), \ +\"theSignalName(Argument1Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, self, \ +\"theId1StepWaitForTheSignalNameByTheEmitterNameConditionMet()\");\n" +"}\n" +"connect(theId1Step, \"setup(QObject*)\",\n" +" this, \"theId1StepSetup(QObject*)\");\n" +"\n" +"function theId1StepWaitForTheSignalNameByTheEmitterNameConditionMet() {\n" +" The custom\n" +" code1\n" +"}\n" +"\n" +"tutorial.addStep(theId1Step);\n" +"\n" +"//Step The id2\n" +"theId2Step = ktutorial.newStep(\"The id2\");\n" +"theId2Step.setText(t.i18nc(\"@info\", \"The text2\"));\n" +"\n" +"function theId2StepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The emitter name\"), \ +\"theSignalName(Argument1Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, self, \ +\"theId2StepWaitForTheSignalNameByTheEmitterNameConditionMet()\");\n" +"}\n" +"connect(theId2Step, \"setup(QObject*)\",\n" +" this, \"theId2StepSetup(QObject*)\");\n" +"\n" +"function theId2StepWaitForTheSignalNameByTheEmitterNameConditionMet() {\n" +" The custom\n" +" code2\n" +"}\n" +"\n" +"tutorial.addStep(theId2Step);\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testStep() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + step->setText("The text"); + tutorial.addStep(step); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +"//Step The id\n" +"theIdStep = ktutorial.newStep(\"The id\");\n" +"theIdStep.setText(t.i18nc(\"@info\", \"The text\"));\n" +"\n" +"tutorial.addStep(theIdStep);\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testStepSetupCode() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + step->setCustomSetupCode("The custom setup\ncode"); + tutorial.addStep(step); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" The custom setup\n" +" code\n" +"}\n" +"connect(theIdStep, \"setup(QObject*)\",\n" +" this, \"theIdStepSetup(QObject*)\");\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testStepSetupCodeWithReactions() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + step->setCustomSetupCode("The custom setup\ncode"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setOptionName("The option name"); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" step.addOption(ktutorial.newOption(\"The option name\"), \ +\"Another step\");\n" +"\n" +" The custom setup\n" +" code\n" +"}\n" +"connect(theIdStep, \"setup(QObject*)\",\n" +" this, \"theIdStepSetup(QObject*)\");\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testStepTearDownCode() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + step->setCustomTearDownCode("The custom tear down\ncode"); + tutorial.addStep(step); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepTearDown(step) {\n" +" The custom tear down\n" +" code\n" +"}\n" +"connect(theIdStep, \"tearDown(QObject*)\",\n" +" this, \"theIdStepTearDown(QObject*)\");\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testStepWithoutId() { + Tutorial tutorial; + Step* step = new Step(); + step->setText("The text"); + step->setCustomSetupCode("The custom setup\ncode"); + step->setCustomTearDownCode("The custom tear down\ncode"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setOptionName("The option name"); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +"//Error: Step without id!\n" +"\n"; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testStepWithSeveralReactions() { + Tutorial tutorial; + + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The emitter name"); + waitForSignal->setSignalName("theSignalName(Argument1Type)"); + + Reaction* reaction1 = new Reaction(); + reaction1->setTriggerType(Reaction::ConditionMet); + reaction1->setWaitFor(waitForSignal); + reaction1->setResponseType(Reaction::CustomCode); + reaction1->setCustomCode("The custom\ncode1"); + step->addReaction(reaction1); + + Reaction* reaction2 = new Reaction(); + reaction2->setTriggerType(Reaction::OptionSelected); + reaction2->setOptionName("The option name"); + reaction2->setResponseType(Reaction::CustomCode); + reaction2->setCustomCode("The custom\ncode2"); + step->addReaction(reaction2); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The emitter name\"), \ +\"theSignalName(Argument1Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, self, \ +\"theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet()\");\n" +"\n" +" step.addOption(ktutorial.newOption(\"The option name\"), self, \ +\"theIdStepTheOptionNameOptionSelected()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet() {\n" +" The custom\n" +" code1\n" +"}\n" +"\n" +"function theIdStepTheOptionNameOptionSelected() {\n" +" The custom\n" +" code2\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testReactionOptionNextStep() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setOptionName("The option name"); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" step.addOption(ktutorial.newOption(\"The option name\"), \ +\"Another step\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest:: + testReactionOptionNextStepWithoutOptionNameOrStepId() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setResponseType(Reaction::NextStep); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: Option without name!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); + + reaction->setOptionName("The option name"); + + exportedTutorial = exporter.exportTutorial(&tutorial); + + expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: Next step id not set!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testReactionOptionCustomCode() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setOptionName("The option name"); + reaction->setResponseType(Reaction::CustomCode); + reaction->setCustomCode("The custom\ncode"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" step.addOption(ktutorial.newOption(\"The option name\"), self, \ +\"theIdStepTheOptionNameOptionSelected()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepTheOptionNameOptionSelected() {\n" +" The custom\n" +" code\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest:: + testReactionOptionCustomCodeWithoutOptionNameOrCustomCode() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::OptionSelected); + reaction->setResponseType(Reaction::CustomCode); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: Option without name!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); + + reaction->setOptionName("The option name"); + + exportedTutorial = exporter.exportTutorial(&tutorial); + + expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" step.addOption(ktutorial.newOption(\"The option name\"), self, \ +\"theIdStepTheOptionNameOptionSelected()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepTheOptionNameOptionSelected() {\n" +" //Error: No code set!\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testReactionConditionNextStep() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The emitter name"); + waitForSignal->setSignalName("theSignalName(Argument1Type, Argument2Type)"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForSignal); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The emitter name\"), \ +\"theSignalName(Argument1Type, Argument2Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, \"Another step\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest:: + testReactionConditionNextStepWithoutConditionOrStepId() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setResponseType(Reaction::NextStep); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: WaitFor not set!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The emitter name"); + waitForSignal->setSignalName("theSignalName(Argument1Type, Argument2Type)"); + reaction->setWaitFor(waitForSignal); + + exportedTutorial = exporter.exportTutorial(&tutorial); + + expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: Next step id not set!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testReactionConditionCustomCode() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The emitter name"); + waitForSignal->setSignalName("theSignalName(Argument1Type, Argument2Type)"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForSignal); + reaction->setResponseType(Reaction::CustomCode); + reaction->setCustomCode("The custom\ncode"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The emitter name\"), \ +\"theSignalName(Argument1Type, Argument2Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, self, \ +\"theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet() {\n" +" The custom\n" +" code\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest:: + testReactionConditionCustomCodeWithoutConditionOrCustomCode() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setResponseType(Reaction::CustomCode); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: WaitFor not set!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The emitter name"); + waitForSignal->setSignalName("theSignalName(Argument1Type, Argument2Type)"); + reaction->setWaitFor(waitForSignal); + + exportedTutorial = exporter.exportTutorial(&tutorial); + + expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheSignalNameByTheEmitterName = \ +ktutorial.newWaitFor(\"WaitForSignal\");\n" +" waitForTheSignalNameByTheEmitterName.setSignal(\ +ktutorial.findObject(\"The emitter name\"), \ +\"theSignalName(Argument1Type, Argument2Type)\");\n" +" step.addWaitFor(waitForTheSignalNameByTheEmitterName, self, \ +\"theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet()\");\n" +"}\n" +CONNECT_STEP_SETUP +"function theIdStepWaitForTheSignalNameByTheEmitterNameConditionMet() {\n" +" //Error: No code set!\n" +"}\n" +"\n" +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testWaitForEvent() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForEvent* waitForEvent = new WaitForEvent(); + waitForEvent->setReceiverName("The receiver name"); + waitForEvent->setEventName("TheEventName"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForEvent); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" waitForTheEventNameInTheReceiverName = \ +ktutorial.newWaitFor(\"WaitForEvent\");\n" +" waitForTheEventNameInTheReceiverName.setEvent(\ +ktutorial.findObject(\"The receiver name\"), \ +\"TheEventName\");\n" +" step.addWaitFor(waitForTheEventNameInTheReceiverName, \"Another step\");\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testWaitForEventWithoutReceiverNameOrEventName() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForEvent* waitForEvent = new WaitForEvent(); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForEvent); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.exportTutorial(&tutorial); + + QString expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: WaitForEvent without receiver name!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); + + waitForEvent->setReceiverName("The receiver name"); + + exportedTutorial = exporter.exportTutorial(&tutorial); + + expected = +TUTORIAL_EMPTY_INFORMATION_CODE +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_START_CODE +"function theIdStepSetup(step) {\n" +" //Error: WaitForEvent without event name!\n" +"}\n" +CONNECT_STEP_SETUP +STEP_WITH_ID_THE_ID_AND_EMPTY_TEXT_END_CODE; + + QCOMPARE(exportedTutorial, expected); +} + +void JavascriptExporterTest::testWaitForSignal() { + Tutorial tutorial; + Step* step = new Step(); + step->setId("The id"); + tutorial.addStep(step); + + WaitForSignal* waitForSignal = new WaitForSignal(); + waitForSignal->setEmitterName("The emitter name"); + waitForSignal->setSignalName("theSignalName(Argument1Type, Argument2Type)"); + + Reaction* reaction = new Reaction(); + reaction->setTriggerType(Reaction::ConditionMet); + reaction->setWaitFor(waitForSignal); + reaction->setResponseType(Reaction::NextStep); + reaction->setNextStepId("Another step"); + step->addReaction(reaction); + + JavascriptExporter exporter; + QString exportedTutorial = exporter.e... [truncated message content] |
From: <dan...@us...> - 2010-03-16 06:24:59
|
Revision: 163 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=163&view=rev Author: danxuliu Date: 2010-03-16 06:24:53 +0000 (Tue, 16 Mar 2010) Log Message: ----------- Update translation template and Spanish translation. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/po/es.po trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot Modified: trunk/ktutorial/ktutorial-editor/po/es.po =================================================================== --- trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-16 05:42:56 UTC (rev 162) +++ trunk/ktutorial/ktutorial-editor/po/es.po 2010-03-16 06:24:53 UTC (rev 163) @@ -9,8 +9,8 @@ "Project-Id-Version: ktutorial-editor\n" "Report-Msgid-Bugs-To: http://sourceforge." "net/tracker/?group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-10 19:41+0100\n" -"PO-Revision-Date: 2010-03-10 19:41-0500\n" +"POT-Creation-Date: 2010-03-16 06:44+0100\n" +"PO-Revision-Date: 2010-03-16 07:21-0400\n" "Last-Translator: Daniel Calviño Sánchez <dan...@gm...>\n" "Language-Team: Spanish <>\n" "MIME-Version: 1.0\n" @@ -19,79 +19,84 @@ "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Lokalize 1.0\n" -#: KTutorialEditor.cpp:77 +#: KTutorialEditor.cpp:81 msgctxt "@title" msgid "Edit tutorial" msgstr "Editar tutorial" -#: KTutorialEditor.cpp:82 +#: KTutorialEditor.cpp:86 msgctxt "@title" msgid "Edit step" msgstr "Editar paso" -#: KTutorialEditor.cpp:94 +#: KTutorialEditor.cpp:90 rc.cpp:52 +msgctxt "@title" +msgid "Edit reaction" +msgstr "Editar reacción" + +#: KTutorialEditor.cpp:103 msgctxt "@action" msgid "Set information..." msgstr "Establecer información..." -#: KTutorialEditor.cpp:95 +#: KTutorialEditor.cpp:104 msgctxt "@info:status" msgid "Set the name and description of the tutorial." msgstr "Establecer el nombre y la descripción del tutorial." -#: KTutorialEditor.cpp:104 +#: KTutorialEditor.cpp:113 msgctxt "@action" msgid "Set license..." msgstr "Establecer licencia..." -#: KTutorialEditor.cpp:105 +#: KTutorialEditor.cpp:114 msgctxt "@info:status" msgid "Set the license text of the tutorial." msgstr "Establecer el texto de licencia del tutorial." -#: KTutorialEditor.cpp:113 KTutorialEditor.cpp:153 +#: KTutorialEditor.cpp:122 KTutorialEditor.cpp:162 msgctxt "@action" msgid "Set setup code..." msgstr "Establecer código de inicialización..." -#: KTutorialEditor.cpp:114 +#: KTutorialEditor.cpp:123 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial starts." msgstr "" "Establecer el código propio para ser ejecutado cuando comience el tutorial." -#: KTutorialEditor.cpp:122 KTutorialEditor.cpp:163 +#: KTutorialEditor.cpp:131 KTutorialEditor.cpp:172 msgctxt "@action" msgid "Set tear down code..." msgstr "Establecer el código de finalización..." -#: KTutorialEditor.cpp:123 +#: KTutorialEditor.cpp:132 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial finishes." msgstr "" "Establecer el código propio para ser ejecutado cuando termine el tutorial." -#: KTutorialEditor.cpp:134 +#: KTutorialEditor.cpp:143 msgctxt "@action" msgid "Add step..." msgstr "Añadir paso..." -#: KTutorialEditor.cpp:135 +#: KTutorialEditor.cpp:144 msgctxt "@info:status" msgid "Add a new step to the tutorial." msgstr "Añadir un nuevo paso al tutorial." -#: KTutorialEditor.cpp:143 +#: KTutorialEditor.cpp:152 msgctxt "@action" msgid "Set data..." msgstr "Establecer datos..." -#: KTutorialEditor.cpp:144 +#: KTutorialEditor.cpp:153 msgctxt "@info:status" msgid "Set the name and text of the currently selected step." msgstr "Establecer el nombre y el texto del paso seleccionado actualmente." -#: KTutorialEditor.cpp:154 +#: KTutorialEditor.cpp:163 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial passes to the currently " @@ -100,7 +105,7 @@ "Establecer el código propio para ser ejecutado cuando el tutorial cambie al " "paso seleccionado actualmente." -#: KTutorialEditor.cpp:164 +#: KTutorialEditor.cpp:173 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial changes from the " @@ -109,16 +114,48 @@ "Establecer el código propio para ser ejecutado cuando el tutorial cambie del " "paso seleccionado actualmente a otro paso." -#: KTutorialEditor.cpp:174 +#: KTutorialEditor.cpp:183 msgctxt "@action" msgid "Remove step" msgstr "Eliminar paso" -#: KTutorialEditor.cpp:175 +#: KTutorialEditor.cpp:184 msgctxt "@info:status" msgid "Removes the currently selected step from the tutorial." msgstr "Elimina del tutorial el paso seleccionado actualmente." +#: KTutorialEditor.cpp:196 +msgctxt "@action" +msgid "Add reaction..." +msgstr "Añadir reacción..." + +#: KTutorialEditor.cpp:197 +msgctxt "@info:status" +msgid "Add a new reaction to the selected step." +msgstr "Añadir una nueva reacción al paso seleccionado actualmente." + +#: KTutorialEditor.cpp:206 +msgctxt "@action" +msgid "Set reaction data..." +msgstr "Establecer datos de la reacción..." + +#: KTutorialEditor.cpp:207 +msgctxt "@info:status" +msgid "Set the trigger and the response of the currently selected reaction." +msgstr "" +"Establecer el activador y la respuesta de la reacción seleccionada " +"actualmente." + +#: KTutorialEditor.cpp:216 +msgctxt "@action" +msgid "Remove reaction" +msgstr "Eliminar reacción" + +#: KTutorialEditor.cpp:217 +msgctxt "@info:status" +msgid "Removes the currently selected reaction from its step." +msgstr "Elimina de su paso la reacción seleccionada actualmente." + #: main.cpp:27 msgctxt "@title" msgid "KTutorial editor" @@ -145,6 +182,41 @@ msgid "Main developer" msgstr "Desarrollador principal" +#: view/ReactionTreeItem.cpp:50 +msgctxt "@item" +msgid "Reaction" +msgstr "Reacción" + +#: view/ReactionTreeItem.cpp:78 +msgctxt "@item" +msgid "(No condition set)" +msgstr "(Condición no establecida)" + +#: view/ReactionTreeItem.cpp:98 +msgctxt "@item" +msgid "(option name not set)" +msgstr "(nombre de la opción no establecido)" + +#: view/ReactionTreeItem.cpp:104 +msgctxt "@item" +msgid "When the option %1 is selected" +msgstr "Cuando se seleccione la opción %1" + +#: view/ReactionTreeItem.cpp:110 +msgctxt "@item" +msgid "Execute the following code:" +msgstr "Ejecutar el siguiente código:" + +#: view/ReactionTreeItem.cpp:134 +msgctxt "@item" +msgid "(step id not set)" +msgstr "(identificador del paso no establecido)" + +#: view/ReactionTreeItem.cpp:140 +msgctxt "@item" +msgid "Change to step %1" +msgstr "Cambiar al paso %1" + #: view/StepCustomCodeWidget.cpp:39 msgctxt "@title" msgid "Step setup code" @@ -195,27 +267,27 @@ "editor. Esto quiere decir que el código debe estar escrito en el mismo " "lenguaje de programación que en el que se exportará el tutorial.</para>" -#: view/StepTreeItem.cpp:45 +#: view/StepTreeItem.cpp:54 msgctxt "@item Noun, a step in a tutorial" msgid "Step" msgstr "Paso" -#: view/StepTreeItem.cpp:48 +#: view/StepTreeItem.cpp:57 msgctxt "@item Noun, a step in a tutorial" msgid "Step %1" msgstr "Paso %1" -#: view/StepTreeItem.cpp:74 +#: view/StepTreeItem.cpp:96 msgctxt "@item" msgid "Text: %1" msgstr "Texto: %1" -#: view/StepTreeItem.cpp:83 view/TutorialTreeItem.cpp:120 +#: view/StepTreeItem.cpp:105 view/TutorialTreeItem.cpp:120 msgctxt "@item" msgid "Setup:" msgstr "Inicialización:" -#: view/StepTreeItem.cpp:93 view/TutorialTreeItem.cpp:130 +#: view/StepTreeItem.cpp:115 view/TutorialTreeItem.cpp:130 msgctxt "@item" msgid "Tear down:" msgstr "Finalización:" @@ -295,11 +367,46 @@ msgid "License:" msgstr "Licencia:" -#: view/TutorialTreeItem.cpp:142 +#: view/WaitForComposedTreeItem.cpp:46 msgctxt "@item" -msgid "Steps:" -msgstr "Pasos:" +msgid "When all the contained conditions match" +msgstr "Cuando todas las condiciones contenidas se cumplan" +#: view/WaitForComposedTreeItem.cpp:49 +msgctxt "@item" +msgid "When any of the contained conditions match" +msgstr "Cuando alguna de las condiciones contenidas se cumpla" + +#: view/WaitForEventTreeItem.cpp:40 view/WaitForSignalTreeItem.cpp:40 +msgctxt "@item" +msgid "(object not set)" +msgstr "(objeto no establecido)" + +#: view/WaitForEventTreeItem.cpp:47 +msgctxt "@item" +msgid "(event not set)" +msgstr "(evento no establecido)" + +#: view/WaitForEventTreeItem.cpp:52 +msgctxt "@item" +msgid "When the event %1 is received by object %2" +msgstr "Cuando se reciba el evento %1 en el objeto %2" + +#: view/WaitForNotTreeItem.cpp:39 +msgctxt "@item" +msgid "The contained condition can't have been met" +msgstr "La condición contenida no se puede haber cumplido" + +#: view/WaitForSignalTreeItem.cpp:47 +msgctxt "@item" +msgid "(signal not set)" +msgstr "(señal no establecida)" + +#: view/WaitForSignalTreeItem.cpp:52 +msgctxt "@item" +msgid "When the signal %1 is emitted by object %2" +msgstr "Cuando se emita la señal %1 por el objeto %2" + #: rc.cpp:3 msgctxt "@title:menu" msgid "Tutorial" @@ -311,16 +418,21 @@ msgstr "Paso" #: rc.cpp:9 +msgctxt "@title:menu Noun, a reaction in a step" +msgid "Reaction" +msgstr "Reacción" + +#: rc.cpp:12 msgctxt "@title:menu" msgid "Panels" msgstr "Paneles" -#: rc.cpp:12 +#: rc.cpp:15 msgctxt "@title" msgid "Set tutorial license" msgstr "Establecer licencia del tutorial" -#: rc.cpp:15 +#: rc.cpp:18 msgctxt "@info:whatsthis" msgid "" "<para>Set the license of the tutorial.</para>\n" @@ -339,17 +451,140 @@ "se encargará de añadirle los caracteres necesarios en cada línea para " "indicar que son comentarios en lugar de código fuente.</para>" -#: rc.cpp:19 +#: rc.cpp:22 msgctxt "@title" msgid "License text" msgstr "Texto de la licencia" -#: rc.cpp:22 +#: rc.cpp:25 msgctxt "@title" +msgid "New condition to wait for" +msgstr "Nueva condición por la que esperar" + +#: rc.cpp:28 +msgctxt "@info:whatsthis" +msgid "<para>Selects the type of the new condition.</para>" +msgstr "<para>Selecciona el tipo de la nueva condición.</para>" + +#: rc.cpp:31 +msgctxt "@title" +msgid "Condition to wait for type" +msgstr "Tipo de la condición por la que esperar" + +#: rc.cpp:34 +msgid "Type:" +msgstr "Tipo:" + +#: rc.cpp:37 +msgctxt "@item:inlistbox" +msgid "All the contained conditions must match" +msgstr "Todas las condiciones contenidas deben cumplirse" + +#: rc.cpp:40 +msgctxt "@item:inlistbox" +msgid "Any of the contained conditions must match" +msgstr "Alguna de las condiciones contenidas debe cumplirse" + +#: rc.cpp:43 +msgctxt "@item:inlistbox" +msgid "The contained condition can't match" +msgstr "La condición contenida no puede cumplirse" + +#: rc.cpp:46 +msgctxt "@item:inlistbox" +msgid "The specified signal is emitted" +msgstr "Se emite la señal especificada" + +#: rc.cpp:49 +msgctxt "@item:inlistbox" +msgid "The specified event is received" +msgstr "Se recibe el evento especificado" + +#: rc.cpp:55 +msgctxt "@info:whatsthis" +msgid "" +"<para>Edit the response of a step to certain trigger.</para>\n" +"<para>When a step is active, the actions of the user can trigger a response " +"in the tutorial. A trigger can be an option in the step selected by the " +"user, or a condition that was met. The response can be changing to another " +"step, or executing some custom code.</para>" +msgstr "" +"<para>Editar la respuesta de un paso ante cierto activador.</para>\n" +"<para>Cuando un paso está activo, las acciones del usuario pueden provocar " +"una respuesta en el tutorial. Un activador puede ser una opción en el paso " +"seleccionada por el usuario, o una condición que se cumplió. La respuesta " +"puede ser cambiar a otro paso, o ejecutar cierto código propio.</para>" + +#: rc.cpp:59 +msgctxt "@title:group Something that causes a response" +msgid "Trigger" +msgstr "Activador" + +#: rc.cpp:62 +msgctxt "@option:radio" +msgid "Option:" +msgstr "Opción:" + +#: rc.cpp:65 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the option.</para>\n" +"<para>An option with this name will be added to the step, so the same name " +"set here will be shown to the user.</para>" +msgstr "" +"<para>El nombre de la opción.</para>\n" +"<para>Una opción con ese nombre se añadirá al paso, por lo que el mismo " +"nombre establecido aquí será el mostrado al usuario.</para>" + +#: rc.cpp:69 +msgctxt "@option:radio" +msgid "Condition met:" +msgstr "Condición cumplida:" + +#: rc.cpp:72 +msgctxt "@title:group" +msgid "Response" +msgstr "Respuesta" + +#: rc.cpp:75 +msgctxt "@option:radio" +msgid "Change to step:" +msgstr "Cambiar al paso:" + +#: rc.cpp:78 +msgctxt "@info:whatsthis" +msgid "<para>The id of the step to change to.</para>" +msgstr "<para>El identificador del paso al que cambiar.</para>" + +#: rc.cpp:81 +msgctxt "@option:radio" +msgid "Custom response code:" +msgstr "Código propio de respuesta:" + +#: rc.cpp:84 +msgctxt "@info:whatsthis" +msgid "" +"<para>The custom code to execute.</para>\n" +"<para>The code will be written as is into a new function called when the " +"response is triggered. This means that the code must be written in the same " +"programming language the tutorial will be exported to.</para>\n" +"<para>Also note that you only have to provide the body of the function. The " +"signature is automatically generated.</para>" +msgstr "" +"<para>El código propio a ejecutar.</para>\n" +"<para>El código se escribirá tal cuál en una nueva función que se ejecutará " +"cuando se cause la respuesta. Esto quiere decir que el código debe estar " +"escrito en el mismo lenguaje de programación que en el que se exportará el " +"tutorial.</para>\n" +"<para>Además, ten en cuenta que sólo tienes que especificar el cuerpo de la " +"función. La signatura se genera automáticamente.</para>" + +#: rc.cpp:89 +msgctxt "@title" msgid "Set step data" msgstr "Establecer datos del paso" -#: rc.cpp:25 +#: rc.cpp:92 msgctxt "@info:whatsthis" msgid "" "<para>Set the id and the text of the step</para>\n" @@ -366,27 +601,27 @@ "muestra al usuario. Se utiliza para identificar los pasos en el tutorial " "cuando tiene que cambiar de un paso a otro.</para>" -#: rc.cpp:30 +#: rc.cpp:97 msgctxt "@title" msgid "Step data" msgstr "Datos del paso" -#: rc.cpp:33 +#: rc.cpp:100 msgctxt "@label:textbox" msgid "Id:" msgstr "Identificador:" -#: rc.cpp:36 +#: rc.cpp:103 msgctxt "@label:textbox" msgid "Text:" msgstr "Texto:" -#: rc.cpp:39 +#: rc.cpp:106 msgctxt "@title" msgid "Set tutorial information" msgstr "Establecer información del tutorial" -#: rc.cpp:42 +#: rc.cpp:109 msgctxt "@info:whatsthis" msgid "" "<para>Set the name and description of the tutorial.</para>\n" @@ -397,27 +632,211 @@ "<para>El nombre y la descripción se muestran en el diálogo en el que se " "selecciona qué tutorial se empezará.</para>" -#: rc.cpp:46 +#: rc.cpp:113 msgctxt "@title" msgid "Tutorial information" msgstr "Información del tutorial" -#: rc.cpp:49 +#: rc.cpp:116 msgctxt "@label:textbox Noun, the name of a tutorial" msgid "Name:" msgstr "Nombre:" -#: rc.cpp:52 +#: rc.cpp:119 msgctxt "@label:textbox" msgid "Description:" msgstr "Descripción:" -#: rc.cpp:53 +#: rc.cpp:122 +msgctxt "@title" +msgid "Edit event to wait for" +msgstr "Editar el evento por el que esperar" + +#: rc.cpp:125 +msgctxt "@info:whatsthis" +msgid "<para>Set the receiver name and the event to wait for.</para>" +msgstr "" +"<para>Establece el nombre del receptor y el evento por el que esperar.</para>" + +#: rc.cpp:128 +msgctxt "@title:group" +msgid "Wait for event" +msgstr "Esperar por el evento" + +#: rc.cpp:131 +msgctxt "@label:textbox" +msgid "Receiver name:" +msgstr "Nombre del receptor:" + +#: rc.cpp:134 +msgctxt "@label:textbox" +msgid "Event name:" +msgstr "Nombre del evento:" + +#: rc.cpp:137 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the QObject that receives the event.</para>\n" +"<para>Note that the name is not the class of the object, but the string " +"returned by its objectName() method.</para>" +msgstr "" +"<para>El nombre de QObject que recibe el evento.</para>\n" +"<para>Ten en cuenta que el nombre no es la clase del objeto, sino la cadena " +"devuelta por su método objectName().</para>" + +#: rc.cpp:141 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the event.</para>\n" +"<para>The name must not contain the \"QEvent::\" prefix, only the pure name " +"of the event.</para>" +msgstr "" +"<para>El nombre del evento.</para>\n" +"<para>El nombre no debe contener el prefijo \"QEvent::\", sólo el nombre " +"puro del evento.</para>" + +#: rc.cpp:145 +msgctxt "@title" +msgid "Edit signal to wait for" +msgstr "Editar la señal por la que esperar" + +#: rc.cpp:148 +msgctxt "@info:whatsthis" +msgid "<para>Set the emitter name and the signal to wait for.</para>" +msgstr "" +"<para>Establece el nombre del emisor y la señal por la que esperar.</para>" + +#: rc.cpp:151 +msgctxt "@title:group" +msgid "Wait for signal" +msgstr "Esperar por la señal" + +#: rc.cpp:154 +msgid "Emitter name:" +msgstr "Nombre del emisor:" + +#: rc.cpp:157 +msgid "Signal name:" +msgstr "Nombre de la señal:" + +#: rc.cpp:160 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the QObject that emits the signal.</para>\n" +"<para>Note that the name is not the class of the object, but the string " +"returned by its objectName() method.</para>" +msgstr "" +"<para>El nombre del QObject que emite la señal.</para>\n" +"<para>Ten en cuenta que el nombre no es la clase del objeto, sino la cadena " +"devuelta por su método objectName().</para>" + +#: rc.cpp:164 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the signal.</para>\n" +"<para>The name must be written as <em>signalName(TypeOfFirstArgument, " +"TypeOfSecondArgument, TypeOfThirdArgument...)</em>, without including " +"<em>SIGNAL()</em> wrapping text.</para>" +msgstr "" +"<para>El nombre de la señal.</para>\n" +"<para>El nombre debe estar escrito como <em>" +"nombreDeLaSeñal(TipoDelPrimerArgumento, TipoDelSegundoArgumento, " +"TipoDelTercerArgumento...)</em>, sin estar envuelto en el texto <em>" +"SIGNAL()</em>.</para>" + +#: rc.cpp:168 +msgctxt "@title" +msgid "Edit condition to wait for" +msgstr "Editar la condición por la que esperar" + +#: rc.cpp:171 +msgctxt "@info:whatsthis" +msgid "" +"<para>Edit a condition to wait for until it is met.</para>\n" +"<para>A condition can be a plain condition or a composed condition. Plain " +"conditions wait for some specific thing to happen, for example, they wait " +"until a signal is emitted. Composed conditions contain other conditions " +"(plain or also composed) and wait until something happens in its contained " +"conditions, for example, wait until all the contained conditions were met.</" +"para>" +msgstr "" +"<para>Editar la condición por la que esperar hasta que se cumpla.</para>\n" +"<para>Una condición puede ser una condición simple o una condición compuesta." +" Las condiciones simples esperan hasta que algo concreto ocurra, por " +"ejemplo, esperan hasta que se emita una señal. Las condiciones compuestas " +"contienen otras condiciones (simples o también compuestas) y esperan hasta " +"que algo ocurra en las condiciones que contienen, por ejemplo, esperan hasta " +"que todas las condiciones que contienen se hayan cumplido.</para>" + +#: rc.cpp:175 +msgctxt "@info:tooltip" +msgid "Add a new condition" +msgstr "Añadir una nueva condición" + +#: rc.cpp:178 +msgctxt "@info:whatsthis" +msgid "" +"<para>Adds a new condition.</para>\n" +"<para>A condition has to be added to composed conditions, that is, " +"conditions that contain other conditions, or as the root condition when " +"there is no other condition.</para>" +msgstr "" +"<para>Añade una nueva condición.</para>\n" +"<para>Una condición tiene que añadirse a condiciones compuestas, es decir, " +"condiciones que contienen otras condiciones, o como la condición base cuando " +"no hay más condiciones.</para>" + +#: rc.cpp:182 +msgctxt "@action:button" +msgid "Add..." +msgstr "Añadir..." + +#: rc.cpp:185 +msgctxt "@info:tooltip" +msgid "Edit the selected condition" +msgstr "Editar la condición seleccionada" + +#: rc.cpp:188 +msgctxt "@info:whatsthis" +msgid "" +"<para>Edits the selected condition.</para>\n" +"<para>Only plain conditions, that is, conditions that aren't composed by " +"other conditions, can be edited.</para>" +msgstr "" +"<para>Edita la condición seleccionada.</para>\n" +"<para>Sólo las condiciones simples, es decir, las condiciones que no están " +"compuestas por otras condiciones, pueden editarse.</para>" + +#: rc.cpp:192 +msgctxt "@action:button" +msgid "Edit..." +msgstr "Editar..." + +#: rc.cpp:195 +msgctxt "@info:tooltip" +msgid "Remove the selected condition" +msgstr "Eliminar la condición seleccionada" + +#: rc.cpp:198 +msgctxt "@info:whatsthis" +msgid "Removes the selected condition." +msgstr "Elimina la condición seleccionada." + +#: rc.cpp:201 +msgctxt "@action:button" +msgid "Remove" +msgstr "Eliminar" + +#: rc.cpp:202 msgctxt "NAME OF TRANSLATORS" msgid "Your names" msgstr "Daniel Calviño Sánchez" -#: rc.cpp:54 +#: rc.cpp:203 msgctxt "EMAIL OF TRANSLATORS" msgid "Your emails" msgstr "dan...@gm..." + +#~ msgctxt "@item" +#~ msgid "Steps:" +#~ msgstr "Pasos:" Modified: trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot =================================================================== --- trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-16 05:42:56 UTC (rev 162) +++ trunk/ktutorial/ktutorial-editor/po/ktutorial-editor.pot 2010-03-16 06:24:53 UTC (rev 163) @@ -9,7 +9,7 @@ "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?" "group_id=301227&atid=1270278\n" -"POT-Creation-Date: 2010-03-10 19:41+0100\n" +"POT-Creation-Date: 2010-03-16 06:44+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -17,100 +17,135 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: KTutorialEditor.cpp:77 +#: KTutorialEditor.cpp:81 msgctxt "@title" msgid "Edit tutorial" msgstr "" -#: KTutorialEditor.cpp:82 +#: KTutorialEditor.cpp:86 msgctxt "@title" msgid "Edit step" msgstr "" -#: KTutorialEditor.cpp:94 +#: KTutorialEditor.cpp:90 rc.cpp:52 +msgctxt "@title" +msgid "Edit reaction" +msgstr "" + +#: KTutorialEditor.cpp:103 msgctxt "@action" msgid "Set information..." msgstr "" -#: KTutorialEditor.cpp:95 +#: KTutorialEditor.cpp:104 msgctxt "@info:status" msgid "Set the name and description of the tutorial." msgstr "" -#: KTutorialEditor.cpp:104 +#: KTutorialEditor.cpp:113 msgctxt "@action" msgid "Set license..." msgstr "" -#: KTutorialEditor.cpp:105 +#: KTutorialEditor.cpp:114 msgctxt "@info:status" msgid "Set the license text of the tutorial." msgstr "" -#: KTutorialEditor.cpp:113 KTutorialEditor.cpp:153 +#: KTutorialEditor.cpp:122 KTutorialEditor.cpp:162 msgctxt "@action" msgid "Set setup code..." msgstr "" -#: KTutorialEditor.cpp:114 +#: KTutorialEditor.cpp:123 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial starts." msgstr "" -#: KTutorialEditor.cpp:122 KTutorialEditor.cpp:163 +#: KTutorialEditor.cpp:131 KTutorialEditor.cpp:172 msgctxt "@action" msgid "Set tear down code..." msgstr "" -#: KTutorialEditor.cpp:123 +#: KTutorialEditor.cpp:132 msgctxt "@info:status" msgid "Set the custom code to be executed when the tutorial finishes." msgstr "" -#: KTutorialEditor.cpp:134 +#: KTutorialEditor.cpp:143 msgctxt "@action" msgid "Add step..." msgstr "" -#: KTutorialEditor.cpp:135 +#: KTutorialEditor.cpp:144 msgctxt "@info:status" msgid "Add a new step to the tutorial." msgstr "" -#: KTutorialEditor.cpp:143 +#: KTutorialEditor.cpp:152 msgctxt "@action" msgid "Set data..." msgstr "" -#: KTutorialEditor.cpp:144 +#: KTutorialEditor.cpp:153 msgctxt "@info:status" msgid "Set the name and text of the currently selected step." msgstr "" -#: KTutorialEditor.cpp:154 +#: KTutorialEditor.cpp:163 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial passes to the currently " "selected step." msgstr "" -#: KTutorialEditor.cpp:164 +#: KTutorialEditor.cpp:173 msgctxt "@info:status" msgid "" "Set the custom code to be executed when the tutorial changes from the " "currently selected step to another step." msgstr "" -#: KTutorialEditor.cpp:174 +#: KTutorialEditor.cpp:183 msgctxt "@action" msgid "Remove step" msgstr "" -#: KTutorialEditor.cpp:175 +#: KTutorialEditor.cpp:184 msgctxt "@info:status" msgid "Removes the currently selected step from the tutorial." msgstr "" +#: KTutorialEditor.cpp:196 +msgctxt "@action" +msgid "Add reaction..." +msgstr "" + +#: KTutorialEditor.cpp:197 +msgctxt "@info:status" +msgid "Add a new reaction to the selected step." +msgstr "" + +#: KTutorialEditor.cpp:206 +msgctxt "@action" +msgid "Set reaction data..." +msgstr "" + +#: KTutorialEditor.cpp:207 +msgctxt "@info:status" +msgid "Set the trigger and the response of the currently selected reaction." +msgstr "" + +#: KTutorialEditor.cpp:216 +msgctxt "@action" +msgid "Remove reaction" +msgstr "" + +#: KTutorialEditor.cpp:217 +msgctxt "@info:status" +msgid "Removes the currently selected reaction from its step." +msgstr "" + #: main.cpp:27 msgctxt "@title" msgid "KTutorial editor" @@ -136,6 +171,41 @@ msgid "Main developer" msgstr "" +#: view/ReactionTreeItem.cpp:50 +msgctxt "@item" +msgid "Reaction" +msgstr "" + +#: view/ReactionTreeItem.cpp:78 +msgctxt "@item" +msgid "(No condition set)" +msgstr "" + +#: view/ReactionTreeItem.cpp:98 +msgctxt "@item" +msgid "(option name not set)" +msgstr "" + +#: view/ReactionTreeItem.cpp:104 +msgctxt "@item" +msgid "When the option %1 is selected" +msgstr "" + +#: view/ReactionTreeItem.cpp:110 +msgctxt "@item" +msgid "Execute the following code:" +msgstr "" + +#: view/ReactionTreeItem.cpp:134 +msgctxt "@item" +msgid "(step id not set)" +msgstr "" + +#: view/ReactionTreeItem.cpp:140 +msgctxt "@item" +msgid "Change to step %1" +msgstr "" + #: view/StepCustomCodeWidget.cpp:39 msgctxt "@title" msgid "Step setup code" @@ -176,27 +246,27 @@ "the tutorial will be exported to.</para>" msgstr "" -#: view/StepTreeItem.cpp:45 +#: view/StepTreeItem.cpp:54 msgctxt "@item Noun, a step in a tutorial" msgid "Step" msgstr "" -#: view/StepTreeItem.cpp:48 +#: view/StepTreeItem.cpp:57 msgctxt "@item Noun, a step in a tutorial" msgid "Step %1" msgstr "" -#: view/StepTreeItem.cpp:74 +#: view/StepTreeItem.cpp:96 msgctxt "@item" msgid "Text: %1" msgstr "" -#: view/StepTreeItem.cpp:83 view/TutorialTreeItem.cpp:120 +#: view/StepTreeItem.cpp:105 view/TutorialTreeItem.cpp:120 msgctxt "@item" msgid "Setup:" msgstr "" -#: view/StepTreeItem.cpp:93 view/TutorialTreeItem.cpp:130 +#: view/StepTreeItem.cpp:115 view/TutorialTreeItem.cpp:130 msgctxt "@item" msgid "Tear down:" msgstr "" @@ -266,11 +336,46 @@ msgid "License:" msgstr "" -#: view/TutorialTreeItem.cpp:142 +#: view/WaitForComposedTreeItem.cpp:46 msgctxt "@item" -msgid "Steps:" +msgid "When all the contained conditions match" msgstr "" +#: view/WaitForComposedTreeItem.cpp:49 +msgctxt "@item" +msgid "When any of the contained conditions match" +msgstr "" + +#: view/WaitForEventTreeItem.cpp:40 view/WaitForSignalTreeItem.cpp:40 +msgctxt "@item" +msgid "(object not set)" +msgstr "" + +#: view/WaitForEventTreeItem.cpp:47 +msgctxt "@item" +msgid "(event not set)" +msgstr "" + +#: view/WaitForEventTreeItem.cpp:52 +msgctxt "@item" +msgid "When the event %1 is received by object %2" +msgstr "" + +#: view/WaitForNotTreeItem.cpp:39 +msgctxt "@item" +msgid "The contained condition can't have been met" +msgstr "" + +#: view/WaitForSignalTreeItem.cpp:47 +msgctxt "@item" +msgid "(signal not set)" +msgstr "" + +#: view/WaitForSignalTreeItem.cpp:52 +msgctxt "@item" +msgid "When the signal %1 is emitted by object %2" +msgstr "" + #: rc.cpp:3 msgctxt "@title:menu" msgid "Tutorial" @@ -282,16 +387,21 @@ msgstr "" #: rc.cpp:9 +msgctxt "@title:menu Noun, a reaction in a step" +msgid "Reaction" +msgstr "" + +#: rc.cpp:12 msgctxt "@title:menu" msgid "Panels" msgstr "" -#: rc.cpp:12 +#: rc.cpp:15 msgctxt "@title" msgid "Set tutorial license" msgstr "" -#: rc.cpp:15 +#: rc.cpp:18 msgctxt "@info:whatsthis" msgid "" "<para>Set the license of the tutorial.</para>\n" @@ -303,17 +413,125 @@ "para>" msgstr "" -#: rc.cpp:19 +#: rc.cpp:22 msgctxt "@title" msgid "License text" msgstr "" -#: rc.cpp:22 +#: rc.cpp:25 msgctxt "@title" +msgid "New condition to wait for" +msgstr "" + +#: rc.cpp:28 +msgctxt "@info:whatsthis" +msgid "<para>Selects the type of the new condition.</para>" +msgstr "" + +#: rc.cpp:31 +msgctxt "@title" +msgid "Condition to wait for type" +msgstr "" + +#: rc.cpp:34 +msgid "Type:" +msgstr "" + +#: rc.cpp:37 +msgctxt "@item:inlistbox" +msgid "All the contained conditions must match" +msgstr "" + +#: rc.cpp:40 +msgctxt "@item:inlistbox" +msgid "Any of the contained conditions must match" +msgstr "" + +#: rc.cpp:43 +msgctxt "@item:inlistbox" +msgid "The contained condition can't match" +msgstr "" + +#: rc.cpp:46 +msgctxt "@item:inlistbox" +msgid "The specified signal is emitted" +msgstr "" + +#: rc.cpp:49 +msgctxt "@item:inlistbox" +msgid "The specified event is received" +msgstr "" + +#: rc.cpp:55 +msgctxt "@info:whatsthis" +msgid "" +"<para>Edit the response of a step to certain trigger.</para>\n" +"<para>When a step is active, the actions of the user can trigger a response " +"in the tutorial. A trigger can be an option in the step selected by the " +"user, or a condition that was met. The response can be changing to another " +"step, or executing some custom code.</para>" +msgstr "" + +#: rc.cpp:59 +msgctxt "@title:group Something that causes a response" +msgid "Trigger" +msgstr "" + +#: rc.cpp:62 +msgctxt "@option:radio" +msgid "Option:" +msgstr "" + +#: rc.cpp:65 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the option.</para>\n" +"<para>An option with this name will be added to the step, so the same name " +"set here will be shown to the user.</para>" +msgstr "" + +#: rc.cpp:69 +msgctxt "@option:radio" +msgid "Condition met:" +msgstr "" + +#: rc.cpp:72 +msgctxt "@title:group" +msgid "Response" +msgstr "" + +#: rc.cpp:75 +msgctxt "@option:radio" +msgid "Change to step:" +msgstr "" + +#: rc.cpp:78 +msgctxt "@info:whatsthis" +msgid "<para>The id of the step to change to.</para>" +msgstr "" + +#: rc.cpp:81 +msgctxt "@option:radio" +msgid "Custom response code:" +msgstr "" + +#: rc.cpp:84 +msgctxt "@info:whatsthis" +msgid "" +"<para>The custom code to execute.</para>\n" +"<para>The code will be written as is into a new function called when the " +"response is triggered. This means that the code must be written in the same " +"programming language the tutorial will be exported to.</para>\n" +"<para>Also note that you only have to provide the body of the function. The " +"signature is automatically generated.</para>" +msgstr "" + +#: rc.cpp:89 +msgctxt "@title" msgid "Set step data" msgstr "" -#: rc.cpp:25 +#: rc.cpp:92 msgctxt "@info:whatsthis" msgid "" "<para>Set the id and the text of the step</para>\n" @@ -324,27 +542,27 @@ "change from one to step to another.</para>" msgstr "" -#: rc.cpp:30 +#: rc.cpp:97 msgctxt "@title" msgid "Step data" msgstr "" -#: rc.cpp:33 +#: rc.cpp:100 msgctxt "@label:textbox" msgid "Id:" msgstr "" -#: rc.cpp:36 +#: rc.cpp:103 msgctxt "@label:textbox" msgid "Text:" msgstr "" -#: rc.cpp:39 +#: rc.cpp:106 msgctxt "@title" msgid "Set tutorial information" msgstr "" -#: rc.cpp:42 +#: rc.cpp:109 msgctxt "@info:whatsthis" msgid "" "<para>Set the name and description of the tutorial.</para>\n" @@ -352,27 +570,177 @@ "tutorial to be started is selected.</para>" msgstr "" -#: rc.cpp:46 +#: rc.cpp:113 msgctxt "@title" msgid "Tutorial information" msgstr "" -#: rc.cpp:49 +#: rc.cpp:116 msgctxt "@label:textbox Noun, the name of a tutorial" msgid "Name:" msgstr "" -#: rc.cpp:52 +#: rc.cpp:119 msgctxt "@label:textbox" msgid "Description:" msgstr "" -#: rc.cpp:53 +#: rc.cpp:122 +msgctxt "@title" +msgid "Edit event to wait for" +msgstr "" + +#: rc.cpp:125 +msgctxt "@info:whatsthis" +msgid "<para>Set the receiver name and the event to wait for.</para>" +msgstr "" + +#: rc.cpp:128 +msgctxt "@title:group" +msgid "Wait for event" +msgstr "" + +#: rc.cpp:131 +msgctxt "@label:textbox" +msgid "Receiver name:" +msgstr "" + +#: rc.cpp:134 +msgctxt "@label:textbox" +msgid "Event name:" +msgstr "" + +#: rc.cpp:137 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the QObject that receives the event.</para>\n" +"<para>Note that the name is not the class of the object, but the string " +"returned by its objectName() method.</para>" +msgstr "" + +#: rc.cpp:141 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the event.</para>\n" +"<para>The name must not contain the \"QEvent::\" prefix, only the pure name " +"of the event.</para>" +msgstr "" + +#: rc.cpp:145 +msgctxt "@title" +msgid "Edit signal to wait for" +msgstr "" + +#: rc.cpp:148 +msgctxt "@info:whatsthis" +msgid "<para>Set the emitter name and the signal to wait for.</para>" +msgstr "" + +#: rc.cpp:151 +msgctxt "@title:group" +msgid "Wait for signal" +msgstr "" + +#: rc.cpp:154 +msgid "Emitter name:" +msgstr "" + +#: rc.cpp:157 +msgid "Signal name:" +msgstr "" + +#: rc.cpp:160 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the QObject that emits the signal.</para>\n" +"<para>Note that the name is not the class of the object, but the string " +"returned by its objectName() method.</para>" +msgstr "" + +#: rc.cpp:164 +msgctxt "@info:whatsthis" +msgid "" +"<para>The name of the signal.</para>\n" +"<para>The name must be written as <em>signalName(TypeOfFirstArgument, " +"TypeOfSecondArgument, TypeOfThirdArgument...)</em>, without including " +"<em>SIGNAL()</em> wrapping text.</para>" +msgstr "" + +#: rc.cpp:168 +msgctxt "@title" +msgid "Edit condition to wait for" +msgstr "" + +#: rc.cpp:171 +msgctxt "@info:whatsthis" +msgid "" +"<para>Edit a condition to wait for until it is met.</para>\n" +"<para>A condition can be a plain condition or a composed condition. Plain " +"conditions wait for some specific thing to happen, for example, they wait " +"until a signal is emitted. Composed conditions contain other conditions " +"(plain or also composed) and wait until something happens in its contained " +"conditions, for example, wait until all the contained conditions were met.</" +"para>" +msgstr "" + +#: rc.cpp:175 +msgctxt "@info:tooltip" +msgid "Add a new condition" +msgstr "" + +#: rc.cpp:178 +msgctxt "@info:whatsthis" +msgid "" +"<para>Adds a new condition.</para>\n" +"<para>A condition has to be added to composed conditions, that is, " +"conditions that contain other conditions, or as the root condition when " +"there is no other condition.</para>" +msgstr "" + +#: rc.cpp:182 +msgctxt "@action:button" +msgid "Add..." +msgstr "" + +#: rc.cpp:185 +msgctxt "@info:tooltip" +msgid "Edit the selected condition" +msgstr "" + +#: rc.cpp:188 +msgctxt "@info:whatsthis" +msgid "" +"<para>Edits the selected condition.</para>\n" +"<para>Only plain conditions, that is, conditions that aren't composed by " +"other conditions, can be edited.</para>" +msgstr "" + +#: rc.cpp:192 +msgctxt "@action:button" +msgid "Edit..." +msgstr "" + +#: rc.cpp:195 +msgctxt "@info:tooltip" +msgid "Remove the selected condition" +msgstr "" + +#: rc.cpp:198 +msgctxt "@info:whatsthis" +msgid "Removes the selected condition." +msgstr "" + +#: rc.cpp:201 +msgctxt "@action:button" +msgid "Remove" +msgstr "" + +#: rc.cpp:202 msgctxt "NAME OF TRANSLATORS" msgid "Your names" msgstr "" -#: rc.cpp:54 +#: rc.cpp:203 msgctxt "EMAIL OF TRANSLATORS" msgid "Your emails" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |