summaryrefslogtreecommitdiffstats
path: root/examples/helpdemo
diff options
context:
space:
mode:
Diffstat (limited to 'examples/helpdemo')
-rw-r--r--examples/helpdemo/about.txt1
-rw-r--r--examples/helpdemo/doc/handbook.pngbin0 -> 1060 bytes
-rw-r--r--examples/helpdemo/doc/helpdemo.adp27
-rw-r--r--examples/helpdemo/doc/index.html41
-rw-r--r--examples/helpdemo/doc/logo.pngbin0 -> 811 bytes
-rw-r--r--examples/helpdemo/doc/manual.html65
-rw-r--r--examples/helpdemo/helpdemo.cpp119
-rw-r--r--examples/helpdemo/helpdemo.h42
-rw-r--r--examples/helpdemo/helpdemo.pro15
-rw-r--r--examples/helpdemo/helpdemobase.ui239
-rw-r--r--examples/helpdemo/main.cpp11
11 files changed, 560 insertions, 0 deletions
diff --git a/examples/helpdemo/about.txt b/examples/helpdemo/about.txt
new file mode 100644
index 000000000..f47564d56
--- /dev/null
+++ b/examples/helpdemo/about.txt
@@ -0,0 +1 @@
+About text for the demo help example.
diff --git a/examples/helpdemo/doc/handbook.png b/examples/helpdemo/doc/handbook.png
new file mode 100644
index 000000000..3bd2b928b
--- /dev/null
+++ b/examples/helpdemo/doc/handbook.png
Binary files differ
diff --git a/examples/helpdemo/doc/helpdemo.adp b/examples/helpdemo/doc/helpdemo.adp
new file mode 100644
index 000000000..fbc0fc55d
--- /dev/null
+++ b/examples/helpdemo/doc/helpdemo.adp
@@ -0,0 +1,27 @@
+<!DOCTYPE DCF>
+
+<assistantconfig version="3.2.0">
+
+<profile>
+ <property name="name">HelpExample</property>
+ <property name="title">Help Example</property>
+ <property name="applicationicon">logo.png</property>
+ <property name="startpage">index.html</property>
+ <property name="aboutmenutext">About Help</property>
+ <property name="abouturl">../about.txt</property>
+ <property name="assistantdocs">../../../doc/html</property>
+</profile>
+
+<DCF ref="index.html" icon="handbook.png" title="Help example">
+ <section ref="./manual.html" title="How to use this Example">
+ <keyword ref="./manual.html#onlydoc">Example Profile</keyword>
+ <keyword ref="./manual.html#lineedit">Filename</keyword>
+ <keyword ref="./manual.html#hide">Hide Sidebar</keyword>
+ <keyword ref="./manual.html#openqabutton">Open Assistant</keyword>
+ <keyword ref="./manual.html#closeqabutton">Close Assistant</keyword>
+ <keyword ref="./manual.html#displaybutton">Display</keyword>
+ <keyword ref="./manual.html#closebutton">Close</keyword>
+ </section>
+</DCF>
+
+</assistantconfig>
diff --git a/examples/helpdemo/doc/index.html b/examples/helpdemo/doc/index.html
new file mode 100644
index 000000000..9f1fb212c
--- /dev/null
+++ b/examples/helpdemo/doc/index.html
@@ -0,0 +1,41 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Help example</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+ <p><h2>Help example</h2></p>
+
+ <p>
+ This example demonstrates how to use TQt Assistant as help system
+ for your own application. You can control TQt Assistant either directly
+ using e.g. the open button or indirectly by pressing F1.
+ </p>
+
+ <p>
+ This example provides a context sensitive help, i.e. pressing F1 will
+ show the help for the item under the mouse cursor.
+ </p>
+
+ <p>
+ In order to run TQt Assistant as a custom help tool for this
+ application properly you have to specify a profile. A profile
+ is a file format similar to the documentation content files
+ that assistant used up to TQt 3.1. Once such a profile has been
+ specified TQt Assistant can be run with the option <code>-profile</code>
+ and then the filename of the profile. The HelpDemo example does
+ this for you if you press the <i>Run TQt Assistant customized for
+ HelpDemo</i>.
+ </p>
+
+ <p>
+ TQt Assistant can also display arbitrary pages with the
+ <i>Display</i> button or using the context help (F1), but TQt
+ Assistant won't be customized for this example application.
+ </p>
+
+ <ul>
+ <li><a href="manual.html">How to use this example</a></li>
+ </ul>
+ </body>
+</html>
diff --git a/examples/helpdemo/doc/logo.png b/examples/helpdemo/doc/logo.png
new file mode 100644
index 000000000..16f7d1f3a
--- /dev/null
+++ b/examples/helpdemo/doc/logo.png
Binary files differ
diff --git a/examples/helpdemo/doc/manual.html b/examples/helpdemo/doc/manual.html
new file mode 100644
index 000000000..8410a99d5
--- /dev/null
+++ b/examples/helpdemo/doc/manual.html
@@ -0,0 +1,65 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>How to use this Example</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+ <p><h2>How to use this Example</h2></p>
+ <p>There are three ways to get help in this example:
+ <ul>
+ <li>
+ Press F1. Depending where your mouse position is you get either the
+ help for the item under the mouse cursor or the general help for this
+ example.
+ </li>
+ <li>
+ Press the right mouse button to invoke a context menu, then click
+ 'Help'. The displayed help page is choose as described above.
+ </li>
+ <li>
+ Use the buttons to control TQt Assistant directly. For a further
+ explanation see below.
+ </li>
+ </ul>
+
+ <br><br><br><br><br><br>
+ <p><a name="openqabutton"><h3>Open Assistant Button</h3></a></p>
+ <p>Click this button to open TQt Assistant. If it is already open nothing
+ will happen. The displayed page is the one that was last displayed.</p>
+
+ <br><br><br><br><br><br>
+ <p><a name="closeqabutton"><h3>Close Assistant Button</h3></a></p>
+ <p>Click this button to close TQt Assistant. If it is not running nothing
+ will happen.</p>
+
+ <br><br><br><br><br><br>
+ <p><a name="onlydoc"><h3>Run TQt Assistant customized for HelpDemo</h3></a></p>
+ <p>Check this item in order to run TQt Assistant as a customized help tool for
+ the HelpDemo example. Checking or unchecking has no effect if TQt
+ Assistant is already running. To apply changes you have to restart
+ TQt Assistant. Please see the <code>HelpDemo::setAssistantArguments()</code>
+ function to see how TQt Assistant can be started in customized mode.
+ </p>
+
+ <br><br><br><br><br><br>
+ <p><a name="hide"><h3>Hide Sidebar on Startup</h3></a></p>
+ <p>Check this item to run TQt Assistant with the sidebar hidden.
+ Checking or unchecking has no effect if TQt Assistant is already running.
+ To apply changes you have to restart TQt Assistant.</p>
+
+ <br><br><br><br><br><br>
+ <p><a name="lineedit"><h3>Filename</h3></a></p>
+ <p>Enter the file name of a help page you want to get displayed here. The path
+ can be specified as an absolute or relative path.</p>
+
+ <br><br><br><br><br><br>
+ <p><a name="displaybutton"><h3>Display Button</h3></a></p>
+ <p>Click this button in order to get the help page which is specified in the file name
+ line edit displayed. If TQt Assistant is currently not open, it will be
+ opened automatically.</p>
+
+ <br><br><br><br><br><br>
+ <p><a name="closebutton"><h3>Close Button</h3></a></p>
+ <p>Click this button to tquit this example application.</p>
+ </body>
+</html>
diff --git a/examples/helpdemo/helpdemo.cpp b/examples/helpdemo/helpdemo.cpp
new file mode 100644
index 000000000..835d18185
--- /dev/null
+++ b/examples/helpdemo/helpdemo.cpp
@@ -0,0 +1,119 @@
+#include <qassistantclient.h>
+#include <qmessagebox.h>
+#include <qlineedit.h>
+#include <qaction.h>
+#include <qpopupmenu.h>
+#include <qcheckbox.h>
+#include <qprocess.h>
+#include <qpushbutton.h>
+#include <qdir.h>
+
+#include "helpdemo.h"
+
+HelpDemo::HelpDemo( TQWidget *parent, const char *name )
+ : HelpDemoBase( parent, name )
+{
+ leFileName->setText( "./doc/index.html" );
+ assistant = new TQAssistantClient( TQDir( "../../bin" ).absPath(), this );
+ widgets.insert( (TQWidget*)openTQAButton, "./doc/manual.html#openqabutton" );
+ widgets.insert( (TQWidget*)closeTQAButton, "./doc/manual.html#closeqabutton" );
+ widgets.insert( (TQWidget*)checkOnlyExampleDoc, "./doc/manual.html#onlydoc" );
+ widgets.insert( (TQWidget*)checkHide, "./doc/manual.html#hide" );
+ widgets.insert( (TQWidget*)leFileName, "./doc/manual.html#lineedit" );
+ widgets.insert( (TQWidget*)displayButton, "./doc/manual.html#displaybutton" );
+ widgets.insert( (TQWidget*)closeButton, "./doc/manual.html#closebutton" );
+
+ menu = new TQPopupMenu( this );
+
+ TQAction *helpAction = new TQAction( "Show Help", TQKeySequence(tr("F1")), this );
+ helpAction->addTo( menu );
+
+ connect( helpAction, SIGNAL(activated()), this, SLOT(showHelp()) );
+ connect( assistant, SIGNAL(assistantOpened()), this, SLOT(assistantOpened()) );
+ connect( assistant, SIGNAL(assistantClosed()), this, SLOT(assistantClosed()));
+ connect( assistant, SIGNAL(error(const TQString&)),
+ this, SLOT(showAssistantErrors(const TQString&)) );
+ closeTQAButton->setEnabled(FALSE);
+}
+
+HelpDemo::~HelpDemo()
+{
+}
+
+void HelpDemo::contextMenuEvent( TQContextMenuEvent *e )
+{
+ TQWidget *w = lookForWidget();
+ if ( menu->exec( e->globalPos() ) != -1 )
+ showHelp( w );
+}
+
+TQWidget* HelpDemo::lookForWidget()
+{
+ TQPtrDictIterator<char> it( widgets );
+ TQWidget *w;
+ while ( (w = (TQWidget*)(it.currentKey())) != 0 ) {
+ ++it;
+ if ( w->hasMouse() )
+ return w;
+ }
+ return 0;
+}
+
+void HelpDemo::showHelp()
+{
+ showHelp( lookForWidget() );
+}
+
+void HelpDemo::showHelp( TQWidget *w )
+{
+ if ( w )
+ assistant->showPage( TQString( widgets[w] ) );
+ else
+ assistant->showPage( "./doc/index.html" );
+}
+
+void HelpDemo::setAssistantArguments()
+{
+ TQStringList cmdLst;
+ if ( checkHide->isChecked() )
+ cmdLst << "-hideSidebar";
+ if ( checkOnlyExampleDoc->isChecked() )
+ cmdLst << "-profile"
+ << TQString("doc") + TQDir::separator() + TQString("helpdemo.adp");
+ assistant->setArguments( cmdLst );
+}
+
+void HelpDemo::openAssistant()
+{
+ if ( !assistant->isOpen() )
+ assistant->openAssistant();
+}
+
+void HelpDemo::closeAssistant()
+{
+ if ( assistant->isOpen() )
+ assistant->closeAssistant();
+}
+
+void HelpDemo::displayPage()
+{
+ assistant->showPage( leFileName->text() );
+}
+
+void HelpDemo::showAssistantErrors( const TQString &err )
+{
+ TQMessageBox::critical( this, "Assistant Error", err );
+
+}
+
+void HelpDemo::assistantOpened()
+{
+ closeTQAButton->setEnabled( TRUE );
+ openTQAButton->setEnabled( FALSE );
+}
+
+void HelpDemo::assistantClosed()
+{
+ closeTQAButton->setEnabled( FALSE );
+ openTQAButton->setEnabled( TRUE );
+}
diff --git a/examples/helpdemo/helpdemo.h b/examples/helpdemo/helpdemo.h
new file mode 100644
index 000000000..c98f26528
--- /dev/null
+++ b/examples/helpdemo/helpdemo.h
@@ -0,0 +1,42 @@
+#ifndef HELPDEMO_H
+#define HELPDEMO_H
+
+#include <qptrdict.h>
+
+#include "helpdemobase.h"
+
+class TQAssistantClient;
+class TQPopupMenu;
+
+class HelpDemo : public HelpDemoBase
+{
+ Q_OBJECT
+
+public:
+ HelpDemo( TQWidget *parent = 0, const char *name = 0 );
+ ~HelpDemo();
+
+protected:
+ void contextMenuEvent( TQContextMenuEvent *e );
+
+private slots:
+ void setAssistantArguments();
+ void openAssistant();
+ void closeAssistant();
+ void displayPage();
+ void showAssistantErrors( const TQString &err );
+ void assistantOpened();
+ void assistantClosed();
+ void showHelp();
+
+private:
+ TQWidget* lookForWidget();
+ void showHelp( TQWidget *w );
+
+ TQPtrDict<char> widgets;
+ TQAssistantClient *assistant;
+ TQPopupMenu *menu;
+
+};
+
+#endif
diff --git a/examples/helpdemo/helpdemo.pro b/examples/helpdemo/helpdemo.pro
new file mode 100644
index 000000000..ff62776dc
--- /dev/null
+++ b/examples/helpdemo/helpdemo.pro
@@ -0,0 +1,15 @@
+TEMPLATE = app
+
+CONFIG += qt warn_on
+LIBS += -lqassistantclient
+unix {
+ UI_DIR = .ui
+ MOC_DIR = .moc
+ OBJECTS_DIR = .obj
+}
+
+REQUIRES = full-config
+
+SOURCES += helpdemo.cpp main.cpp
+HEADERS += helpdemo.h
+FORMS = helpdemobase.ui
diff --git a/examples/helpdemo/helpdemobase.ui b/examples/helpdemo/helpdemobase.ui
new file mode 100644
index 000000000..75e4b7237
--- /dev/null
+++ b/examples/helpdemo/helpdemobase.ui
@@ -0,0 +1,239 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>HelpDemoBase</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>HelpDemoBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>315</width>
+ <height>346</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Help Example</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>301</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQPushButton">
+ <property name="name">
+ <cstring>closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQFrame" row="1" column="0">
+ <property name="name">
+ <cstring>frame5</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQPushButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>openTQAButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Open Assistant</string>
+ </property>
+ <property name="accel">
+ <string>Alt+L</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="4" column="3">
+ <property name="name">
+ <cstring>displayButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Display</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>checkHide</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Hide Sidebar when Opening</string>
+ </property>
+ <property name="accel">
+ <string>Alt+H</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>closeTQAButton</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;lose Assistant</string>
+ </property>
+ <property name="accel">
+ <string>Alt+L</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Filename:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>leFileName</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="4" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>leFileName</cstring>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>checkOnlyExampleDoc</cstring>
+ </property>
+ <property name="text">
+ <string>Run TQt Assistant customized for HelpDemo</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="TQTextEdit" row="0" column="0">
+ <property name="name">
+ <cstring>textEdit1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;p&gt;
+This example demonstrates how TQt Assistant can be used as a help system for your application. If the button &lt;i&gt;"Run TQt Assistant customized for HelpDemo"&lt;/i&gt; is checked TQt Assistant will be customized for this application.
+&lt;/p&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <enum>WidgetWidth</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>HelpDemoBase</receiver>
+ <slot>close()</slot>
+ </connection>
+ <connection>
+ <sender>openTQAButton</sender>
+ <signal>clicked()</signal>
+ <receiver>HelpDemoBase</receiver>
+ <slot>openAssistant()</slot>
+ </connection>
+ <connection>
+ <sender>closeTQAButton</sender>
+ <signal>clicked()</signal>
+ <receiver>HelpDemoBase</receiver>
+ <slot>closeAssistant()</slot>
+ </connection>
+ <connection>
+ <sender>displayButton</sender>
+ <signal>clicked()</signal>
+ <receiver>HelpDemoBase</receiver>
+ <slot>displayPage()</slot>
+ </connection>
+ <connection>
+ <sender>checkOnlyExampleDoc</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>HelpDemoBase</receiver>
+ <slot>setAssistantArguments()</slot>
+ </connection>
+ <connection>
+ <sender>checkHide</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>HelpDemoBase</receiver>
+ <slot>setAssistantArguments()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>displayPage()</slot>
+ <slot>openAssistant()</slot>
+ <slot>closeAssistant()</slot>
+ <slot>setAssistantArguments()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/examples/helpdemo/main.cpp b/examples/helpdemo/main.cpp
new file mode 100644
index 000000000..c044c1797
--- /dev/null
+++ b/examples/helpdemo/main.cpp
@@ -0,0 +1,11 @@
+#include <qapplication.h>
+#include "helpdemo.h"
+
+int main( int argc, char ** argv )
+{
+ TQApplication a( argc, argv );
+ HelpDemo help;
+ help.show();
+ a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( tquit() ) );
+ return a.exec();
+}