Commit ce0e66d0 authored by Jan Möbius's avatar Jan Möbius

Build on windows again, as the DLLEXPORT was missing for the new generator

Fixed documentation bug
Fixed tabs used for indent

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14062 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3078e77e
#include "WhatsThisGenerator.hh"
/*
* @_param _plugin_name the name of the plugin which is used \note use only the name and NOT the prefix Plugin- (e.g. SkeletonEditing for Plugin-SkeletonEditing)
/** Constructor for the whatsThisGenerator initializing the plugin name.
*
* @param _plugin_name the name of the plugin which is used \note use only the name and NOT the prefix Plugin- (e.g. SkeletonEditing for Plugin-SkeletonEditing)
*/
WhatsThisGenerator::WhatsThisGenerator(const QString &_plugin_name)
:plugin_name_(_plugin_name)
WhatsThisGenerator::WhatsThisGenerator(const QString &_plugin_name) :
plugin_name_(_plugin_name)
{
}
/* \brief generates a clickable link to the documentation for whatsThis Messages
/** \brief generates a clickable link to the documentation for whatsThis Messages
* @param _ref gives the section in the documentation for the action. The help-browser will jump into the section.
* An example: _jump = "cube" in PrimitiveGenerator refs to the section "cube" in the Documentation and the help Browser.
*
......@@ -17,20 +18,19 @@ WhatsThisGenerator::WhatsThisGenerator(const QString &_plugin_name)
* Default is the site "index.html".
* You need this parameter if you have more than one site in your plugin documentation and want to refer on one of this.
*/
QString WhatsThisGenerator::generateLink(const QString &_ref /*= ""*/,const QString &_site /*= "index.html"*/) const
QString WhatsThisGenerator::generateLink(const QString &_ref /*= ""*/, const QString &_site /*= "index.html"*/) const
{
const QString baseHelpURL = QString(" <a href='qthelp://org.openflipper.plugin-")
+plugin_name_.toLower()
+QString("/Plugin-")
+plugin_name_+QString("/")
+_site+QString("#")+_ref + QString("'>");
+ plugin_name_.toLower()
+ QString("/Plugin-")
+ plugin_name_+QString("/")
+ _site+QString("#")+_ref + QString("'>");
const QString clickText = QString(QObject::tr("Click for more information"))+QObject::tr("</a>");
return (baseHelpURL + clickText);
}
/* \brief sets a whatsThis Message plus link to the doc for the given QAction
/** \brief sets a whatsThis Message plus link to the doc for the given QAction
* @param _action action where the message should appear.
* @param _msg help message for the user. This is the default Whatsthis Text which you set with QAction::setWhatsThis
*
......@@ -41,8 +41,7 @@ QString WhatsThisGenerator::generateLink(const QString &_ref /*= ""*/,const QStr
* Default is the site "index.html".
* You need this parameter if you have more than one site in your plugin documentation and want to refer on one of this.
*/
void WhatsThisGenerator::setWhatsThis(QAction* _action, const QString &_msg, const QString &_ref /*= ""*/,const QString &_site /*= "index.html"*/) const
{
_action->setWhatsThis(_msg+generateLink(_ref,_site));
_action->setWhatsThis(_msg + generateLink(_ref, _site));
}
......@@ -46,34 +46,40 @@
#include <QAction>
#include <QString>
#include <QObject>
#include <OpenFlipper/common/GlobalDefines.hh>
/** \brief a class which provides an link generator for WhatsThisMessages linking to the user doc
* If you have an QAction pointer called action, you can call:
* \code{.cpp}action->setWhatsThis("Hello");\encode
* \code{.cpp}action->setWhatsThis("Hello");\endcode
* This message "Hello" will be shown when somebody call this action in WhatsThisMode.
*
* WhatsThisGenerator provides functions linking to the user documentation.
* e.g. assume that whatsThisGen is a valid WhatsThisGenerator object
* \code{.cpp}action->setWhatsThis(QString(tr("Hello"))+whatsThisGen.generateLink()); \encode
* \code{.cpp}action->setWhatsThis(QString(tr("Hello"))+whatsThisGen.generateLink()); \endcode
* The code above will change the output for WhatsThisMessages to: "Hello Click here for more information"
* where "Click here for more information" is a link which will call the index.html (default parameter) of the plugin
* which you have to specify in the constructor of WhatsThisGenerator.
*
* You can also use the WhatsThisGenerator to set the WhatsThisMessage:
* \code{.cpp}whatsThisGen.setWHatsThis(action,tr("Hello"));\encode
* \code{.cpp}whatsThisGen.setWHatsThis(action,tr("Hello"));\endcode
* It has the same effect and options like the code above and is shorter.
*/
class WhatsThisGenerator : public QObject
{
Q_OBJECT;
const QString plugin_name_;
class DLLEXPORT WhatsThisGenerator: public QObject {
Q_OBJECT
const QString plugin_name_;
public:
WhatsThisGenerator(const QString &_plugin_name);
WhatsThisGenerator(const QString &_plugin_name);
QString generateLink(const QString &_ref = "",const QString &_site = "index.html") const;
QString generateLink(const QString &_ref = "", const QString &_site = "index.html") const;
void setWhatsThis(QAction* _action, const QString &_msg, const QString &_ref = "",const QString &_site = "index.html") const;
void setWhatsThis(
QAction* _action,
const QString &_msg,
const QString &_ref = "",
const QString &_site = "index.html") const;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment