From bd0f3345a938b35ce6a12f6150373b0955b8dd12 Mon Sep 17 00:00:00 2001
From: Timothy Pearson
Date: Sun, 10 Jul 2011 15:24:15 -0500
Subject: Add Qt3 development HEAD version
---
examples/helpdemo/about.txt | 1 +
examples/helpdemo/doc/handbook.png | Bin 0 -> 1060 bytes
examples/helpdemo/doc/helpdemo.adp | 27 +++++
examples/helpdemo/doc/index.html | 41 +++++++
examples/helpdemo/doc/logo.png | Bin 0 -> 811 bytes
examples/helpdemo/doc/manual.html | 65 ++++++++++
examples/helpdemo/helpdemo.cpp | 119 ++++++++++++++++++
examples/helpdemo/helpdemo.h | 42 +++++++
examples/helpdemo/helpdemo.pro | 15 +++
examples/helpdemo/helpdemobase.ui | 239 +++++++++++++++++++++++++++++++++++++
examples/helpdemo/main.cpp | 11 ++
11 files changed, 560 insertions(+)
create mode 100644 examples/helpdemo/about.txt
create mode 100644 examples/helpdemo/doc/handbook.png
create mode 100644 examples/helpdemo/doc/helpdemo.adp
create mode 100644 examples/helpdemo/doc/index.html
create mode 100644 examples/helpdemo/doc/logo.png
create mode 100644 examples/helpdemo/doc/manual.html
create mode 100644 examples/helpdemo/helpdemo.cpp
create mode 100644 examples/helpdemo/helpdemo.h
create mode 100644 examples/helpdemo/helpdemo.pro
create mode 100644 examples/helpdemo/helpdemobase.ui
create mode 100644 examples/helpdemo/main.cpp
(limited to 'examples/helpdemo')
diff --git a/examples/helpdemo/about.txt b/examples/helpdemo/about.txt
new file mode 100644
index 0000000..f47564d
--- /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 0000000..3bd2b92
Binary files /dev/null and b/examples/helpdemo/doc/handbook.png differ
diff --git a/examples/helpdemo/doc/helpdemo.adp b/examples/helpdemo/doc/helpdemo.adp
new file mode 100644
index 0000000..fbc0fc5
--- /dev/null
+++ b/examples/helpdemo/doc/helpdemo.adp
@@ -0,0 +1,27 @@
+
+
+
+
+
+ HelpExample
+ Help Example
+ logo.png
+ index.html
+ About Help
+ ../about.txt
+ ../../../doc/html
+
+
+
+
+ Example Profile
+ Filename
+ Hide Sidebar
+ Open Assistant
+ Close Assistant
+ Display
+ Close
+
+
+
+
diff --git a/examples/helpdemo/doc/index.html b/examples/helpdemo/doc/index.html
new file mode 100644
index 0000000..7b68152
--- /dev/null
+++ b/examples/helpdemo/doc/index.html
@@ -0,0 +1,41 @@
+
+
+
+ Help example
+
+
+ Help example
+
+
+ This example demonstrates how to use Qt Assistant as help system
+ for your own application. You can control Qt Assistant either directly
+ using e.g. the open button or indirectly by pressing F1.
+
+
+
+ This example provides a context sensitive help, i.e. pressing F1 will
+ show the help for the item under the mouse cursor.
+
+
+
+ In order to run Qt 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 Qt 3.1. Once such a profile has been
+ specified Qt Assistant can be run with the option -profile
+ and then the filename of the profile. The HelpDemo example does
+ this for you if you press the Run Qt Assistant customized for
+ HelpDemo.
+
+
+
+ Qt Assistant can also display arbitrary pages with the
+ Display button or using the context help (F1), but Qt
+ Assistant won't be customized for this example application.
+
+
+
+
+
diff --git a/examples/helpdemo/doc/logo.png b/examples/helpdemo/doc/logo.png
new file mode 100644
index 0000000..16f7d1f
Binary files /dev/null and b/examples/helpdemo/doc/logo.png differ
diff --git a/examples/helpdemo/doc/manual.html b/examples/helpdemo/doc/manual.html
new file mode 100644
index 0000000..7df0e3a
--- /dev/null
+++ b/examples/helpdemo/doc/manual.html
@@ -0,0 +1,65 @@
+
+
+
+ How to use this Example
+
+
+ How to use this Example
+ There are three ways to get help in this example:
+
+ -
+ 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.
+
+ -
+ Press the right mouse button to invoke a context menu, then click
+ 'Help'. The displayed help page is choose as described above.
+
+ -
+ Use the buttons to control Qt Assistant directly. For a further
+ explanation see below.
+
+
+
+
+ Open Assistant Button
+ Click this button to open Qt Assistant. If it is already open nothing
+ will happen. The displayed page is the one that was last displayed.
+
+
+ Close Assistant Button
+ Click this button to close Qt Assistant. If it is not running nothing
+ will happen.
+
+
+ Run Qt Assistant customized for HelpDemo
+ Check this item in order to run Qt Assistant as a customized help tool for
+ the HelpDemo example. Checking or unchecking has no effect if Qt
+ Assistant is already running. To apply changes you have to restart
+ Qt Assistant. Please see the HelpDemo::setAssistantArguments()
+ function to see how Qt Assistant can be started in customized mode.
+
+
+
+ Hide Sidebar on Startup
+ Check this item to run Qt Assistant with the sidebar hidden.
+ Checking or unchecking has no effect if Qt Assistant is already running.
+ To apply changes you have to restart Qt Assistant.
+
+
+ Filename
+ 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.
+
+
+ Display Button
+ Click this button in order to get the help page which is specified in the file name
+ line edit displayed. If Qt Assistant is currently not open, it will be
+ opened automatically.
+
+
+ Close Button
+ Click this button to quit this example application.
+
+
diff --git a/examples/helpdemo/helpdemo.cpp b/examples/helpdemo/helpdemo.cpp
new file mode 100644
index 0000000..28f8865
--- /dev/null
+++ b/examples/helpdemo/helpdemo.cpp
@@ -0,0 +1,119 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "helpdemo.h"
+
+HelpDemo::HelpDemo( QWidget *parent, const char *name )
+ : HelpDemoBase( parent, name )
+{
+ leFileName->setText( "./doc/index.html" );
+ assistant = new QAssistantClient( QDir( "../../bin" ).absPath(), this );
+ widgets.insert( (QWidget*)openQAButton, "./doc/manual.html#openqabutton" );
+ widgets.insert( (QWidget*)closeQAButton, "./doc/manual.html#closeqabutton" );
+ widgets.insert( (QWidget*)checkOnlyExampleDoc, "./doc/manual.html#onlydoc" );
+ widgets.insert( (QWidget*)checkHide, "./doc/manual.html#hide" );
+ widgets.insert( (QWidget*)leFileName, "./doc/manual.html#lineedit" );
+ widgets.insert( (QWidget*)displayButton, "./doc/manual.html#displaybutton" );
+ widgets.insert( (QWidget*)closeButton, "./doc/manual.html#closebutton" );
+
+ menu = new QPopupMenu( this );
+
+ QAction *helpAction = new QAction( "Show Help", QKeySequence(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 QString&)),
+ this, SLOT(showAssistantErrors(const QString&)) );
+ closeQAButton->setEnabled(FALSE);
+}
+
+HelpDemo::~HelpDemo()
+{
+}
+
+void HelpDemo::contextMenuEvent( QContextMenuEvent *e )
+{
+ QWidget *w = lookForWidget();
+ if ( menu->exec( e->globalPos() ) != -1 )
+ showHelp( w );
+}
+
+QWidget* HelpDemo::lookForWidget()
+{
+ QPtrDictIterator it( widgets );
+ QWidget *w;
+ while ( (w = (QWidget*)(it.currentKey())) != 0 ) {
+ ++it;
+ if ( w->hasMouse() )
+ return w;
+ }
+ return 0;
+}
+
+void HelpDemo::showHelp()
+{
+ showHelp( lookForWidget() );
+}
+
+void HelpDemo::showHelp( QWidget *w )
+{
+ if ( w )
+ assistant->showPage( QString( widgets[w] ) );
+ else
+ assistant->showPage( "./doc/index.html" );
+}
+
+void HelpDemo::setAssistantArguments()
+{
+ QStringList cmdLst;
+ if ( checkHide->isChecked() )
+ cmdLst << "-hideSidebar";
+ if ( checkOnlyExampleDoc->isChecked() )
+ cmdLst << "-profile"
+ << QString("doc") + QDir::separator() + QString("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 QString &err )
+{
+ QMessageBox::critical( this, "Assistant Error", err );
+
+}
+
+void HelpDemo::assistantOpened()
+{
+ closeQAButton->setEnabled( TRUE );
+ openQAButton->setEnabled( FALSE );
+}
+
+void HelpDemo::assistantClosed()
+{
+ closeQAButton->setEnabled( FALSE );
+ openQAButton->setEnabled( TRUE );
+}
diff --git a/examples/helpdemo/helpdemo.h b/examples/helpdemo/helpdemo.h
new file mode 100644
index 0000000..9916872
--- /dev/null
+++ b/examples/helpdemo/helpdemo.h
@@ -0,0 +1,42 @@
+#ifndef HELPDEMO_H
+#define HELPDEMO_H
+
+#include
+
+#include "helpdemobase.h"
+
+class QAssistantClient;
+class QPopupMenu;
+
+class HelpDemo : public HelpDemoBase
+{
+ Q_OBJECT
+
+public:
+ HelpDemo( QWidget *parent = 0, const char *name = 0 );
+ ~HelpDemo();
+
+protected:
+ void contextMenuEvent( QContextMenuEvent *e );
+
+private slots:
+ void setAssistantArguments();
+ void openAssistant();
+ void closeAssistant();
+ void displayPage();
+ void showAssistantErrors( const QString &err );
+ void assistantOpened();
+ void assistantClosed();
+ void showHelp();
+
+private:
+ QWidget* lookForWidget();
+ void showHelp( QWidget *w );
+
+ QPtrDict widgets;
+ QAssistantClient *assistant;
+ QPopupMenu *menu;
+
+};
+
+#endif
diff --git a/examples/helpdemo/helpdemo.pro b/examples/helpdemo/helpdemo.pro
new file mode 100644
index 0000000..ff62776
--- /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 0000000..35d98ed
--- /dev/null
+++ b/examples/helpdemo/helpdemobase.ui
@@ -0,0 +1,239 @@
+
+HelpDemoBase
+
+
+ HelpDemoBase
+
+
+
+ 0
+ 0
+ 315
+ 346
+
+
+
+ Help Example
+
+
+
+ unnamed
+
+
+
+ layout2
+
+
+
+ unnamed
+
+
+
+ spacer1
+
+
+ Horizontal
+
+
+ Expanding
+
+
+
+ 301
+ 20
+
+
+
+
+
+ closeButton
+
+
+ &Close
+
+
+ Alt+C
+
+
+ true
+
+
+
+
+
+
+ frame5
+
+
+ StyledPanel
+
+
+ Sunken
+
+
+
+ unnamed
+
+
+
+ openQAButton
+
+
+ &Open Assistant
+
+
+ Alt+L
+
+
+ true
+
+
+
+
+ displayButton
+
+
+ &Display
+
+
+ Alt+D
+
+
+ true
+
+
+
+
+ checkHide
+
+
+ &Hide Sidebar when Opening
+
+
+ Alt+H
+
+
+
+
+ closeQAButton
+
+
+ C&lose Assistant
+
+
+ Alt+L
+
+
+ true
+
+
+
+
+ textLabel3
+
+
+ &Filename:
+
+
+ leFileName
+
+
+
+
+ leFileName
+
+
+
+
+ checkOnlyExampleDoc
+
+
+ Run Qt Assistant customized for HelpDemo
+
+
+
+
+
+
+
+
+
+ textEdit1
+
+
+ <p>
+This example demonstrates how Qt Assistant can be used as a help system for your application. If the button <i>"Run Qt Assistant customized for HelpDemo"</i> is checked Qt Assistant will be customized for this application.
+</p>
+
+
+ WidgetWidth
+
+
+ true
+
+
+
+
+ spacer2
+
+
+ Vertical
+
+
+ Expanding
+
+
+
+ 31
+ 30
+
+
+
+
+
+
+
+ closeButton
+ clicked()
+ HelpDemoBase
+ close()
+
+
+ openQAButton
+ clicked()
+ HelpDemoBase
+ openAssistant()
+
+
+ closeQAButton
+ clicked()
+ HelpDemoBase
+ closeAssistant()
+
+
+ displayButton
+ clicked()
+ HelpDemoBase
+ displayPage()
+
+
+ checkOnlyExampleDoc
+ toggled(bool)
+ HelpDemoBase
+ setAssistantArguments()
+
+
+ checkHide
+ toggled(bool)
+ HelpDemoBase
+ setAssistantArguments()
+
+
+
+ displayPage()
+ openAssistant()
+ closeAssistant()
+ setAssistantArguments()
+
+
+
diff --git a/examples/helpdemo/main.cpp b/examples/helpdemo/main.cpp
new file mode 100644
index 0000000..81a6edc
--- /dev/null
+++ b/examples/helpdemo/main.cpp
@@ -0,0 +1,11 @@
+#include
+#include "helpdemo.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication a( argc, argv );
+ HelpDemo help;
+ help.show();
+ a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
+ return a.exec();
+}
--
cgit v1.2.1