[kde-doc-english] [kwave] /: new command sync(): wait for commands scheduled with delayed(...)
Thomas Eschenbacher
Thomas.Eschenbacher at gmx.de
Sat Feb 21 07:46:28 UTC 2015
Git commit 9810f149f0455af0a4053f4cdf3e81ae1bfc8596 by Thomas Eschenbacher.
Committed on 21/02/2015 at 07:46.
Pushed by eschenbacher into branch 'master'.
new command sync(): wait for commands scheduled with delayed(...)
M +1 -1 CHANGES
M +21 -0 doc/en/index.docbook
M +8 -3 kwave/FileContext.cpp
http://commits.kde.org/kwave/9810f149f0455af0a4053f4cdf3e81ae1bfc8596
diff --git a/CHANGES b/CHANGES
index 1900474..bd753fc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,12 +5,12 @@
* handbook: added text command reference
* make system: new target "update-handbook" (updates command cross reference)
* make system: fixed dependency problem in translation
- * i18n: implemented filter for non-translatable pot entries
* new commands: "window:sendkey", "window:screenshot", "window:close"
and "window:resize"
* built-in variable ${LANG} for kwave commands
* support for delayed command execution
* debug plugin: always compiled in, but only visible in debug build
+ * new command sync(): wait for commands scheduled with delayed
0.8.99-2 [2015-01-02]
diff --git a/doc/en/index.docbook b/doc/en/index.docbook
index 45169a8..c9ee25c 100644
--- a/doc/en/index.docbook
+++ b/doc/en/index.docbook
@@ -105,6 +105,7 @@
<!ENTITY no-i18n-cmd_selectvisible "selectvisible">
<!ENTITY no-i18n-cmd_start "start">
<!ENTITY no-i18n-cmd_stop "stop">
+ <!ENTITY no-i18n-cmd_sync "sync">
<!ENTITY no-i18n-cmd_undo "undo">
<!ENTITY no-i18n-cmd_undo_all "undo_all">
<!ENTITY no-i18n-cmd_view_scroll_end "view:scroll_end">
@@ -3032,6 +3033,7 @@
<indexentry><primaryie><link linkend="cmd_sect_selectvisible" endterm="cmd_title_selectvisible"/></primaryie></indexentry>
<indexentry><primaryie><link linkend="cmd_sect_start" endterm="cmd_title_start"/></primaryie></indexentry>
<indexentry><primaryie><link linkend="cmd_sect_stop" endterm="cmd_title_stop"/></primaryie></indexentry>
+ <indexentry><primaryie><link linkend="cmd_sect_sync" endterm="cmd_title_sync"/></primaryie></indexentry>
</indexdiv>
<indexdiv><title>u</title>
<indexentry><primaryie><link linkend="cmd_sect_undo" endterm="cmd_title_undo"/></primaryie></indexentry>
@@ -3235,6 +3237,7 @@
</tbody></tgroup></informaltable></simplesect>
<simplesect><title>See also</title>
<para>
+ <link linkend="cmd_sect_sync"><command>&no-i18n-tag;&no-i18n-cmd_sync;</command>()</link>,
<link linkend="cmd_sect_window_resize"><command>&no-i18n-tag;&no-i18n-cmd_window_resize;</command>()</link>,
<link linkend="cmd_sect_window_click"><command>&no-i18n-tag;&no-i18n-cmd_window_click;</command>()</link>,
<link linkend="cmd_sect_window_sendkey"><command>&no-i18n-tag;&no-i18n-cmd_window_sendkey;</command>()</link>,
@@ -4409,6 +4412,24 @@
</para>
</simplesect>
</sect2>
+
+ <!-- @COMMAND@ sync() -->
+ <sect2 id="cmd_sect_sync"><title id="cmd_title_sync">&no-i18n-cmd_sync;</title>
+ <simplesect>
+ <title>&i18n-cmd_syntax;<command>&no-i18n-tag;&no-i18n-cmd_sync;</command>()</title>
+ <para>
+ Waits until all commands which have been started asynchronously
+ have finished. If nothing is currently queued for delayed
+ execution this command has no effect.
+ </para>
+ </simplesect>
+ <simplesect><title>See also</title>
+ <para>
+ <link linkend="cmd_sect_delayed"><command>&no-i18n-tag;&no-i18n-cmd_delayed;</command>()</link>
+ </para>
+ </simplesect>
+ </sect2>
+
</sect1>
<sect1 id="commands_u"><title>&no-i18n-tag;u</title>
diff --git a/kwave/FileContext.cpp b/kwave/FileContext.cpp
index da735da..108084f 100644
--- a/kwave/FileContext.cpp
+++ b/kwave/FileContext.cpp
@@ -319,9 +319,6 @@ int Kwave::FileContext::executeCommand(const QString &line)
if (command.trimmed().startsWith(_("#")))
return 0; // only a comment
- // log all commands to the log file if enabled
- Kwave::Logger::log(this, Kwave::Logger::Info, _("CMD: ") + line);
-
// special case: if the command contains ";" it is a list of
// commands -> macro !
Kwave::Parser parse_list(command);
@@ -359,6 +356,9 @@ int Kwave::FileContext::executeCommand(const QString &line)
}
}
+ // log all commands to the log file if enabled
+ Kwave::Logger::log(this, Kwave::Logger::Info, _("CMD: ") + line);
+
// parse one single command
Kwave::Parser parser(command);
QString cmd = parser.command();
@@ -434,6 +434,11 @@ int Kwave::FileContext::executeCommand(const QString &line)
result = saveFileAs(parser.nextParam(), false);
CASE_COMMAND("saveselect")
result = saveFileAs(QString(), true);
+ CASE_COMMAND("sync")
+ while (!m_delayed_command_queue.isEmpty()) {
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+ }
+ result = 0;
CASE_COMMAND("window:click")
return delegateCommand("debug", parser, 3);
CASE_COMMAND("window:close")
More information about the kde-doc-english
mailing list