[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/parley/src
From: Avgoustinos Kadis <avgoustinos.kadis () kdemail ! net>
Date: 2008-08-18 0:15:43
Message-ID: 1219018543.292566.11368.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 848525 by kadis:
Documentation updated
M +1 -9 parley.cpp
M +1 -7 scripts/script.cpp
M +6 -13 scripts/script.h
M +14 -8 scripts/scripting/identifier.h
M +0 -46 scripts/scripting/parley.h
M +13 -11 scripts/scriptmanager.cpp
M +18 -13 scripts/scriptmanager.h
--- trunk/KDE/kdeedu/parley/src/parley.cpp #848524:848525
@@ -937,6 +937,7 @@
m_document->document()->lesson()->resetGrades(-1, KEduVocContainer::Recursive);
}
+
void ParleyApp::initScripts()
{
m_scriptManager = new ScriptManager(this);
@@ -948,15 +949,6 @@
}
-///@todo move it in KEduVocDocument
-int indexOfIdentifier(KEduVocDocument* document, const QString& locale) {
- for (int i = 0; i < document->identifierCount(); i++)
- if (document->identifier(i).locale() == locale)
- return i;
- return -1;
-}
-
-
void ParleyApp::setShowWelcomeScreen(bool show)
{
QStackedWidget* central = qobject_cast<QStackedWidget*>(centralWidget());
--- trunk/KDE/kdeedu/parley/src/scripts/script.cpp #848524:848525
@@ -68,19 +68,13 @@
action->addObject ( i.value() , i.key(), \
Kross::ChildrenInterface::AutoConnectSignals ); }
- // Set the file we like to execute.
+ // Set the file to be execute
action->setFile ( m_file );
// Execute the script.
action->trigger();
- /// @todo add error handling somewhere here
- // Now we emit the init(QTimer*,int) signal which in turn
- // should call our connected init(timer,interval) scripting
- // function if available.
-// myobject->callInit();
m_activated = !action->isFinalized();
- /// @todo Add code to specify if activated or not
if (!m_activated)
kDebug() << "Script not activated";
}
--- trunk/KDE/kdeedu/parley/src/scripts/script.h #848524:848525
@@ -33,29 +33,22 @@
Q_OBJECT
public:
/**
- * Script class constructor. Activates the @p file. In case of failure
- * sets the m_activated
+ * Script class constructor
+ *
* @param file The path to the script file to be activated (executed)
*/
Script ( QString file );
-
- /**
- * Deletes the m_object that was dynam
- */
~Script();
/**
- * Returns if the script was successfully activated. If not, Script object \
should
- * be destroyed.
+ * Returns true if the script was successfully activated; false otherwise
*/
bool isActivated();
/**
* Activates the script
- *
- * @param scriptFilePath The path to the script file to be activated \
(executed)
*/
void activate();
/**
- * Deactivate the running script
+ * Deactivate the script
*/
void deactivate();
/**
@@ -72,12 +65,12 @@
QString fileName();
/**
* Add an object to be accessible by the script
- * @param name
+ * @param name Name to appear in the script
* @param object Object to be accessible by the script
*/
void addObject ( QString name, QObject * object );
/**
- *
+ * Adds more than one scripting Objects to the script
* @param objects Map of the objects to add
*/
void addObjects ( QMap<QString, QObject*> objects );
--- trunk/KDE/kdeedu/parley/src/scripts/scripting/identifier.h #848524:848525
@@ -101,20 +101,26 @@
// KEduVocArticle article() const;
/**
- * Returns the article in the given @p number, definiteness (@p \
definite) and @p gender
- * @param number Article number. Values: "Singular", "Dual", "Plural"
- * @param definite Article definiteness. Values: "Definite", \
"Indefinite"
- * @param gender Article gender. Values: "Masculine", "Feminine", \
"Neuter" + * Returns the article in the given number, definiteness and \
gender flags: + *
+ * - Number flags: Parley.Singular, Parley.Dual, Parley.Plural
+ * - Definiteness flags: Parley.Definite, Parley.Indefinite
+ * - Gender flags: Parley.Masculine, Parley.Feninine, Parley.Neuter
+ *
+ * @param flags Flags to indicate which article to return
* @return A string containing the requested article. Empty string if \
does not exist
*/
QString article ( const KEduVocWordFlags& flags );
/**
- * Sets the article in the given @p number, definiteness (@p definite) \
and @p gender + * Sets the @p article in the given number, definiteness \
and gender flags: + *
+ * - Number flags: Parley.Singular, Parley.Dual, Parley.Plural
+ * - Definiteness flags: Parley.Definite, Parley.Indefinite
+ * - Gender flags: Parley.Masculine, Parley.Feninine, Parley.Neuter
+ *
* @param article The article to set
- * @param number Article number. Values: "Singular", "Dual", "Plural"
- * @param definite Article definiteness. Values: "Definite", \
"Indefinite"
- * @param gender Article gender. Values: "Masculine", "Feminine", \
"Neuter" + * @param flags Flags to indicate which article to set
*/
void setArticle ( const QString& article, const KEduVocWordFlags& flags \
);
--- trunk/KDE/kdeedu/parley/src/scripts/scripting/parley.h #848524:848525
@@ -206,52 +206,6 @@
Irregular = 0x20000000
};
- ///Conjugation/Declension number
-// enum Number
-// {
-// Singular = 0,
-// Dual,
-// Plural
-// };
-
- ///Declension case
-// enum Case
-// {
-// Nominative = 0,
-// Genitive,
-// Dative,
-// Accusative,
-// Ablative,
-// Locative,
-// Vocative
-// };
-
- ///Conjugation Person
-// enum Person
-// {
-// First,
-// Second,
-// ThirdMale,
-// ThirdFemale,
-// // ThirdNeutralCommon
-// Third ///use this for Third Neutral form as well
-// };
-
- ///Conjugation gender
-// enum Gender
-// {
-// Masculine,
-// Feminine,
-// Neutral
-// };
-
- ///Article Definiteness
-// enum Definiteness
-// {
-// Definite,
-// Indefinite
-// };
-
Parley ( ParleyApp * parley );
~Parley();
--- trunk/KDE/kdeedu/parley/src/scripts/scriptmanager.cpp #848524:848525
@@ -25,12 +25,12 @@
#include <kross/core/action.h>
#include <kross/core/manager.h>
-ScriptManager::ScriptManager(ParleyApp * parleyApp)
- : m_parleyApp(parleyApp)
+ScriptManager::ScriptManager ( ParleyApp * parleyApp )
+ : m_parleyApp ( parleyApp )
{
//add Scripting::Parley
- m_scriptObjectParley = new Scripting::Parley(parleyApp);
- addObject ( m_scriptObjectParley,"Parley" );
+ m_scriptingParley = new Scripting::Parley ( parleyApp );
+ addObject ( m_scriptingParley,"Parley" );
}
@@ -118,8 +118,8 @@
s->activate();
m_scripts.push_back ( s );
//inform with a message box when a script could not be activated
- if (!s->isActivated())
- KMessageBox::information(m_parleyApp,QString("The following script could \
not be activated due to errors in the script:\n")+script,"Script Activation"); + \
if ( !s->isActivated() ) + KMessageBox::information ( m_parleyApp,QString \
( "The following script could not be activated due to errors in the script:\n" ) \
+script,"Script Activation" ); }
}
@@ -134,24 +134,26 @@
{
//deactivate (delete) all the active scripts
foreach ( Script * s, m_scripts )
- if ( s ) delete s;
+ {
+ if ( s ) delete s;
+ }
m_scripts.clear();
//reload the scripts menu
- m_parleyApp->unplugActionList("scripts_actionlist");
+ m_parleyApp->unplugActionList ( "scripts_actionlist" );
m_scriptActions.clear();
- m_parleyApp->plugActionList("scripts_actionlist",m_scriptActions);
+ m_parleyApp->plugActionList ( "scripts_actionlist",m_scriptActions );
//load all the enabled scripts
loadScripts();
}
-void ScriptManager::addScriptAction (const QString & name, KAction * action )
+void ScriptManager::addScriptAction ( const QString & name, KAction * action )
{
//unplug action list (orelse it will add twice the same entries
m_parleyApp->unplugActionList ( "scripts_actionlist" );
-
+
//add to action collection
m_parleyApp->actionCollection()->addAction ( name,action );
--- trunk/KDE/kdeedu/parley/src/scripts/scriptmanager.h #848524:848525
@@ -22,9 +22,9 @@
#include <QStringList>
/**
-This class finds the scripts installed in the application folder and manages loading \
and unloading of plugin scripts
-
- @author Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
+ * This class finds the scripts installed in the application directory and manages \
loading and unloading of the scripts. For each script an instance of Script class is \
created. + *
+ * @author Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
*/
class ScriptManager : public QObject
{
@@ -32,20 +32,25 @@
ScriptManager ( ParleyApp * parleyApp );
~ScriptManager();
+
/**
* Finds all the available desktop files in {PARLEY_DATA_FOLDER}/plugins
*
* @return The list of desktop filenames available for parley
*/
static QStringList getDesktopFiles();
+
/**
* Returns a QMap (from from categories codenames to categories display \
label)
* to be used in KPluginSelector (ScriptDialog) for displaying the various
* categories
*
+ * @note this function is not used later on (categories are disabled)
+ *
* @return the QMap described above
*/
static QMap<QString, QString> categories();
+
/**
* Parses the desktop @p desktopFile given and returns the value of "Script" \
entry.
*
@@ -53,18 +58,20 @@
* @return The value of "Script" entry. Empty string of no "Script" entry is \
found
*/
static QString getScriptEntry ( QString desktopFile );
+
/**
* Returns the full path to the script name given in the @p desktopFile.
*
* @param desktopFile The desktop file for the parley plugin
* @return The full-path to the script
*/
+ QString getScriptFileName ( QString desktopFile );
- QString getScriptFileName ( QString desktopFile );
/**
* Returns a list of filenames (full path) of enabled scripts
*/
QStringList enabledScripts();
+
/**
* Modify the parleyrc configuration so it disables the @p dektopFile \
plugin.
* This function is to be used when the plugin is invalid (wrong script \
name, @@ -73,22 +80,25 @@
* @param desktopFile
*/
void disablePlugin ( QString desktopFile );
- QStringList availableScripts();
+
/**
* Loads (activates) all the available scripts and notifies the user if any
* script was not activated (due to errors in the script)
*/
void loadScripts();
+
/**
* Adds a QObject as a module for the script
* @param obj The QObject to be added to the script
* @param name The name of the object as it will appear in the script
*/
void addObject ( QObject * obj, const QString & name );
+
/**
* Reloads all the scripts
*/
void reloadScripts();
+
/**
* Add a KAction to the Scripts menu
* @param name The action name
@@ -96,11 +106,8 @@
*/
void addScriptAction ( const QString & name, KAction * action );
- /**
- *
- * @return
- */
- Translator * translator() { return m_scriptObjectParley->translator(); }
+ /** returns the Translator object the Scripting::Parley */
+ Translator * translator() { return m_scriptingParley->translator(); }
private:
ParleyApp * m_parleyApp;
@@ -109,9 +116,7 @@
QList<QAction*> m_scriptActions;
///script objects (objects that will be used from inside the scripts)
- Scripting::Parley* m_scriptObjectParley;
-
-// friend class Scripting::Parley;
+ Scripting::Parley* m_scriptingParley;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic