Commit 2be7279a authored by Jan Möbius's avatar Jan Möbius

Added AboutInfoInterface

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16174 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e66cc561
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 11127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2011-03-15 16:18:28 +0100 (Di, 15 Mär 2011) $ *
* *
\*===========================================================================*/
#pragma once
#include <QtGui>
/** \file AboutInfoInterface.hh
*
* Interface for adding a widget to OpenFlippers About dialog .\ref AboutInfoInterfacePage
*/
/** \brief About Info interface
*
* \ref AboutInfoInterfacePage "Detailed description"
* \n
*
* This interface can be used to add a widget to OpenFlippers About dialog to display license Information or other data.
*/
class AboutInfoInterface {
public:
/// Destructor
virtual ~AboutInfoInterface() {};
signals :
/** \brief Adds a widget to OpenFlippers about dialog
*
*
* @param _text Text for the tab (Supports html tags)
* @param _tabName Name of the tab to be added
*/
virtual void addAboutInfo(QString _text, QString _tabName ) {};
};
/** \page AboutInfoInterfacePage About Info interface
\image html AboutInfoInterface.png
\n
The AboutInfoInterface can be used by plugins to add an additional tab to OpenFlippers about dialog.
This is especially useful, if you use an external library which requires you to publish the license information
in the application.
You can add multiple tabs by additional calls to this interface
To use the AboutInfoInterface:
<ul>
<li> include AboutInfoInterface.hh in your plugins header file
<li> derive your plugin from the class AboutInfoInterface
<li> add Q_INTERFACES(AboutInfoInterface) to your plugin class
<li> Implement the signal of this interface
</ul>
\code
void ExamplePlugin::pluginsInitialized(){
// Simply emit the signal with the text
emit addAboutInfo("Info Text","Example Plugin License");
}
\endcode
*/
Q_DECLARE_INTERFACE(AboutInfoInterface,"OpenFlipper.AboutInfoInterface/1.0")
......@@ -67,6 +67,7 @@
#include <QPluginLoader>
#include "OpenFlipper/BasePlugin/BaseInterface.hh"
#include "OpenFlipper/BasePlugin/AboutInfoInterface.hh"
#include "OpenFlipper/BasePlugin/KeyInterface.hh"
#include "OpenFlipper/BasePlugin/BackupInterface.hh"
#include "OpenFlipper/BasePlugin/LoggingInterface.hh"
......@@ -2049,6 +2050,16 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
}
}
//Check if the plugin supports AboutInfo-Interface
AboutInfoInterface* aboutInfoPlugin = qobject_cast< AboutInfoInterface * >(plugin);
if ( aboutInfoPlugin && OpenFlipper::Options::gui() ) {
supported = supported + "AboutInfo ";
if ( checkSignal(plugin,"addAboutInfo(QString,QString)") )
connect(plugin , SIGNAL(addAboutInfo(QString,QString)),
coreWidget_ , SLOT(addAboutInfo(QString,QString)),Qt::DirectConnection);
}
//========================================================================================
// === Collect Scripting Information for Plugin ============================
......
......@@ -125,6 +125,9 @@ Provides a function to add toolbar buttons. ( \ref toolbarInterfacePage )
\image html ViewModeInterface.png
Specify own view modes setting which toolboxes/toolbars/context menus will be visible( \ref viewModeInterfacePage )
\subpage AboutInfoInterfacePage
\image html AboutInfoInterface.png
Add own information to OpenFlippers abouot dialog
*/
/** \page pluginInterfacesDataHandling Object and Data Handling
......
......@@ -73,7 +73,9 @@
//== IMPLEMENTATION ==========================================================
void CoreWidget::addAboutInfo(QString _text, QString _tabName ) {
additionalAboutTabs_[_tabName] = _text;
}
void CoreWidget::showAboutWidget( ) {
......@@ -82,6 +84,18 @@ void CoreWidget::showAboutWidget( ) {
if ( aboutWidget_ == 0 ) {
aboutWidget_ = new AboutWidget( this );
// Add all additional tabs
QMap<QString, QString>::const_iterator it = additionalAboutTabs_.constBegin();
while (it != additionalAboutTabs_.constEnd()) {
QTextEdit* tmp = new QTextEdit();
tmp->insertHtml( it.value() );
aboutWidget_->About->addTab( tmp, it.key() );
++it;
}
} else {
aboutWidget_->OpenFlipperAbout->clear();
}
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 16117 $ *
* $LastChangedBy: moeller $ *
* $Date: 2013-01-11 12:29:53 +0100 (Fr, 11. Jan 2013) $ *
* *
\*===========================================================================*/
#include "CoreWidget.hh"
void CoreWidget::addCoreLicenseInfo() {
// ======================================================================
// Core License Information
// ======================================================================
// Simple opt used for parsing command line arguments across architectures
addAboutInfo("OpenFlipper uses SimpleOpt for platform independent command line parsing<br>"
"SimpleOpt is licensed under the MIT license ( see below)<br>"
"<br>"
"<b>Author:</b> Brodie Thiesfield [code at jellycan dot com]<br>"
"<b>Source:</b> http://code.jellycan.com/simpleopt/ <br>"
"<br>"
"The licence text below is the boilerplate \"<b>MIT Licence</b>\" used from:<br>"
"http://www.opensource.org/licenses/mit-license.php <br>"
"<br>"
"Copyright (c) 2006-2007, Brodie Thiesfield"
"<br>"
"Permission is hereby granted, free of charge, to any person obtaining a copy "
"of this software and associated documentation files (the \"Software\"), to "
"deal in the Software without restriction, including without limitation the "
"rights to use, copy, modify, merge, publish, distribute, sublicense, and/or "
"sell copies of the Software, and to permit persons to whom the Software is "
"furnished to do so, subject to the following conditions:<br><br>"
"The above copyright notice and this permission notice shall be included in "
"all copies or substantial portions of the Software."
"<br><br>"
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL "
"THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER "
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS "
"IN THE SOFTWARE."
,"SimpleOpt");
addAboutInfo("The OpenFlipper project uses the FreeFont fonts for rendering.<br>"
"<br>"
"You can get the fonts from https://savannah.gnu.org/projects/freefont/"
,"FreeFont");
}
//-----------------------------------------------------------------------------
......@@ -629,6 +629,10 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
connect(this, SIGNAL(changeHelpSite(QUrl)), helpWidget_, SLOT(activateLink(QUrl)));
helpWidget_->hide();
// Add the core license information about used libraries
addCoreLicenseInfo();
}
......
......@@ -1105,10 +1105,27 @@ public:
/// Display the about widget
void showAboutWidget();
/** \brief Adds an entry to the about dialog
*
* @param _text Content of the tab
* @param _tabName Header of the tab
*/
void addAboutInfo(QString _text, QString _tabName );
private:
/** \brief Add license information about core parts
*
* Adds the license information to the about dialog for used libraries.
*/
void addCoreLicenseInfo();
private:
/// Pointer to the about widget
AboutWidget* aboutWidget_;
/// Additional tab information, that could be provided by plugins
QMap<QString,QString> additionalAboutTabs_;
/** @} */
//===========================================================================
......
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