From 96592943598151ea3f64364eab3475904931ca16 Mon Sep 17 00:00:00 2001 From: ck Date: Wed, 11 Nov 2009 14:35:17 +0100 Subject: Assistant: Update documentation for remote commands. - Assistant understands a newline character as well as '\0' to mark the end of a remote command. Since the former is considerably less complicated to do and to explain, the documentation now uses that approach. - The related examples have been updated accordingly. - The qdoc file now uses the encoding it promises in the header. Reviewed-by: kh1 Reviewed-by: David Boddie --- doc/src/development/assistant-manual.qdoc | 6 +++--- doc/src/snippets/code/doc_src_assistant-manual.qdoc | 8 +++----- examples/help/remotecontrol/remotecontrol.cpp | 2 +- examples/help/simpletextviewer/assistant.cpp | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index 8de500e..3ecadc7 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -672,9 +672,6 @@ to make Assistant listen to your application, turn on its remote control functionality by passing the \c{-enableRemoteControl} command line option. - \warning The trailing '\0' must be appended separately to the QByteArray, - e.g., \c{QByteArray("command" + '\0')}. - The following example shows how this can be done: \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 2 @@ -685,6 +682,9 @@ \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 3 + Note that the trailing newline character is required to mark the end + of the input. + The following commands can be used to control \QA: \table diff --git a/doc/src/snippets/code/doc_src_assistant-manual.qdoc b/doc/src/snippets/code/doc_src_assistant-manual.qdoc index 24870b4..700d755 100644 --- a/doc/src/snippets/code/doc_src_assistant-manual.qdoc +++ b/doc/src/snippets/code/doc_src_assistant-manual.qdoc @@ -58,7 +58,7 @@ assistant -collectionFile file mycompany/myapplication About My Application - Über meine Applikation... + Ãœber meine Applikation... about.txt @@ -95,8 +95,7 @@ if (!process->waitForStarted()) //! [3] QByteArray ba; -ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html"); -ba.append('\0'); +ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html\n"); process->write(ba); //! [3] @@ -105,8 +104,7 @@ process->write(ba); QByteArray ba; ba.append("hide bookmarks;"); ba.append("hide index;"); -ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html"); -ba.append('\0'); +ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html\n"); process->write(ba); //! [4] diff --git a/examples/help/remotecontrol/remotecontrol.cpp b/examples/help/remotecontrol/remotecontrol.cpp index adb92d0..9dc166e 100644 --- a/examples/help/remotecontrol/remotecontrol.cpp +++ b/examples/help/remotecontrol/remotecontrol.cpp @@ -123,7 +123,7 @@ void RemoteControl::sendCommand(const QString &cmd) { if (process->state() != QProcess::Running) return; - process->write(cmd.toLocal8Bit() + '\0'); + process->write(cmd.toLocal8Bit() + '\n'); } void RemoteControl::on_indexButton_clicked() diff --git a/examples/help/simpletextviewer/assistant.cpp b/examples/help/simpletextviewer/assistant.cpp index ab20f3e..2807365 100644 --- a/examples/help/simpletextviewer/assistant.cpp +++ b/examples/help/simpletextviewer/assistant.cpp @@ -73,7 +73,7 @@ void Assistant::showDocumentation(const QString &page) QByteArray ba("SetSource "); ba.append("qthelp://com.trolltech.examples.simpletextviewer/doc/"); - proc->write(ba + page.toLocal8Bit() + '\0'); + proc->write(ba + page.toLocal8Bit() + '\n'); } //! [1] -- cgit v0.12