Commit 25455fd0 authored by Jan Möbius's avatar Jan Möbius

Extension for ToolBar Interface

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3559 383ad7c9-94d9-4d36-a494-682f7c89f535
parent be103352
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
/** /**
* This Interface should be used by plugins which will provide a toolbar. * This Interface should be used by plugins which will provide a toolbar.
* Each Plugin can create own Toolbars. Emit * Each Plugin can create own Toolbars. Emit
*/ */
class ToolbarInterface { class ToolbarInterface {
...@@ -69,8 +69,8 @@ class ToolbarInterface { ...@@ -69,8 +69,8 @@ class ToolbarInterface {
* @param _toolbar Your Toolbar * @param _toolbar Your Toolbar
*/ */
virtual void addToolbar(QToolBar* /*_toolbar*/) {}; virtual void addToolbar(QToolBar* /*_toolbar*/) {};
/** \brief Remove a Toolbar from the main widget /** \brief Remove a Toolbar from the main widget
* *
* @param _toolbar Toolbar to be removed * @param _toolbar Toolbar to be removed
...@@ -78,8 +78,16 @@ class ToolbarInterface { ...@@ -78,8 +78,16 @@ class ToolbarInterface {
virtual void removeToolbar(QToolBar* /*_toolbar*/) {}; virtual void removeToolbar(QToolBar* /*_toolbar*/) {};
/** \brief Get a pointer to a Toolbar of the given name or 0 if it does not exist.
*
* @param _name Name of the Toolbar
* @param _toolbar requested Toolbar or 0
*/
virtual void getToolBar( QString /*_name*/, QToolBar*& /*_toolbar*/ ) {};
}; };
Q_DECLARE_INTERFACE(ToolbarInterface,"OpenFlipper.ToolbarInterface/1.0") Q_DECLARE_INTERFACE(ToolbarInterface,"OpenFlipper.ToolbarInterface/1.1")
#endif // TOOLBARINTERFACE_HH #endif // TOOLBARINTERFACE_HH
...@@ -152,6 +152,7 @@ Core::init() { ...@@ -152,6 +152,7 @@ Core::init() {
if ( OpenFlipper::Options::gui() ) { if ( OpenFlipper::Options::gui() ) {
// Initialize redraw timer. Will be used to restrict the rendering framerate.
redrawTimer_ = new QTimer(); redrawTimer_ = new QTimer();
redrawTimer_->setSingleShot(true); redrawTimer_->setSingleShot(true);
connect(redrawTimer_, SIGNAL(timeout()), this, SLOT(updateView()),Qt::DirectConnection); connect(redrawTimer_, SIGNAL(timeout()), this, SLOT(updateView()),Qt::DirectConnection);
...@@ -910,7 +911,7 @@ void Core::resizeViewer(int _width, int _height ){ ...@@ -910,7 +911,7 @@ void Core::resizeViewer(int _width, int _height ){
} }
void Core::writeVersionNumbers(QString _filename){ void Core::writeVersionNumbers(QString _filename){
INIFile ini; INIFile ini;
if ( ! ini.connect(_filename,true) ) { if ( ! ini.connect(_filename,true) ) {
......
...@@ -615,6 +615,10 @@ void Core::loadPlugin(QString filename, bool silent){ ...@@ -615,6 +615,10 @@ void Core::loadPlugin(QString filename, bool silent){
if ( checkSignal(plugin,"removeToolbar(QToolBar*)") ) if ( checkSignal(plugin,"removeToolbar(QToolBar*)") )
connect(plugin,SIGNAL(removeToolbar(QToolBar*)), connect(plugin,SIGNAL(removeToolbar(QToolBar*)),
coreWidget_,SLOT(slotRemoveToolbar(QToolBar*)),Qt::DirectConnection); coreWidget_,SLOT(slotRemoveToolbar(QToolBar*)),Qt::DirectConnection);
if ( checkSignal(plugin,"getToolBar(QString,QToolBar*&)") )
connect(plugin,SIGNAL(getToolBar(QString,QToolBar*&)),
coreWidget_,SLOT(getToolBar(QString,QToolBar*&)),Qt::DirectConnection);
} }
//Check if the plugin supports StatusBar-Interface //Check if the plugin supports StatusBar-Interface
......
...@@ -609,7 +609,7 @@ QString updatePassword( ) { ...@@ -609,7 +609,7 @@ QString updatePassword( ) {
} }
QString coreVersion() { QString coreVersion() {
return QString("0.9"); return QString("0.9.1");
} }
......
...@@ -86,6 +86,9 @@ ...@@ -86,6 +86,9 @@
<default/> <default/>
</environments> </environments>
</other> </other>
<general>
<activedir>OpenFlipper</activedir>
</general>
</kdevcustomproject> </kdevcustomproject>
<kdevdebugger> <kdevdebugger>
<general> <general>
......
<?xml version = '1.0' encoding = 'UTF-8'?> <?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession> <!DOCTYPE KDevPrjSession>
<KDevPrjSession> <KDevPrjSession>
<DocsAndViews NumberOfDocuments="8" > <DocsAndViews NumberOfDocuments="16" >
<Doc0 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateModelingPlugin.cc" > <Doc0 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/INIFile/INIFile.hh" >
<View0 Encoding="" line="27" Type="Source" /> <View0 Encoding="" line="276" Type="Source" />
</Doc0> </Doc0>
<Doc1 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateModelingPlugin.hh" > <Doc1 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/coreWidget/CoreWidget.cc" >
<View0 Encoding="" line="0" Type="Source" /> <View0 Encoding="" line="143" Type="Source" />
</Doc1> </Doc1>
<Doc2 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/ManipulatorPlacement.cc" > <Doc2 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/coreWidget/CoreWidget.hh" >
<View0 Encoding="" line="0" Type="Source" /> <View0 Encoding="" line="488" Type="Source" />
</Doc2> </Doc2>
<Doc3 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/Matching.cc" > <Doc3 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/optionsWidget/optionsWidget.cc" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" line="472" Type="Source" />
</Doc3> </Doc3>
<Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateBlendingComputation.cc" > <Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Color/ColorPlugin.hh" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" line="34" Type="Source" />
</Doc4> </Doc4>
<Doc5 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/DataContainerT.hh" > <Doc5 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Scissor/ScissorPlugin.cc" >
<View0 Encoding="" line="0" Type="Source" /> <View0 Encoding="" line="61" Type="Source" />
</Doc5> </Doc5>
<Doc6 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/Init.cc" > <Doc6 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/Core.cc" >
<View0 Encoding="" line="0" Type="Source" /> <View0 Encoding="" line="158" Type="Source" />
</Doc6> </Doc6>
<Doc7 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/SensorFramework/GPS/widgets/GPSWidget.hh" > <Doc7 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/coreWidget/CoreWidgetToolbar.cc" >
<View0 Encoding="" line="24" Type="Source" /> <View0 Encoding="" line="72" Type="Source" />
</Doc7> </Doc7>
<Doc8 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/PluginLoader.cc" >
<View0 Encoding="" line="602" Type="Source" />
</Doc8>
<Doc9 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/BasePlugin/ToolbarInterface.hh" >
<View0 Encoding="" line="85" Type="Source" />
</Doc9>
<Doc10 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/common/GlobalOptions.cc" >
<View0 Encoding="" line="601" Type="Source" />
</Doc10>
<Doc11 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/DataControlPlugin.hh" >
<View0 Encoding="" line="94" Type="Source" />
</Doc11>
<Doc12 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/DataControlPlugin.cc" >
<View0 Encoding="" line="303" Type="Source" />
</Doc12>
<Doc13 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/Toolbox.cc" >
<View0 Encoding="" line="7" Type="Source" />
</Doc13>
<Doc14 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/Toolbox.hh" >
<View0 Encoding="" line="7" Type="Source" />
</Doc14>
<Doc15 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/Popup.cc" >
<View0 Encoding="" line="41" Type="Source" />
</Doc15>
</DocsAndViews> </DocsAndViews>
<pluginList> <pluginList>
<kdevdebugger> <kdevdebugger>
......
...@@ -480,9 +480,14 @@ public: ...@@ -480,9 +480,14 @@ public:
/// Called by Plugins to remove a Toolbar /// Called by Plugins to remove a Toolbar
void slotRemoveToolbar(QToolBar* _toolbar); void slotRemoveToolbar(QToolBar* _toolbar);
/// Called by Plugins to get access to specific Toolbars by name
void getToolBar( QString _name, QToolBar*& _toolbar);
private : private :
QToolBar* mainToolbar_; QToolBar* mainToolbar_;
std::vector< QToolBar* > toolbars_;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
......
...@@ -51,15 +51,45 @@ ...@@ -51,15 +51,45 @@
//== IMPLEMENTATION ========================================================== //== IMPLEMENTATION ==========================================================
void CoreWidget::slotAddToolbar(QToolBar* _toolbar) { void CoreWidget::slotAddToolbar(QToolBar* _toolbar) {
// int newNumber = toolbarCount_;
// toolbarCount_++;
// QString number = QString::number(newNumber);
// _toolbar->setObjectName("Toolbar" + number);
for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
if ( toolbars_[i]->windowTitle() == _toolbar->windowTitle() ) {
std::cerr << "Toolbar exists! " << std::endl;
return;
}
}
_toolbar->setObjectName( _toolbar->windowTitle() );
toolbars_.push_back( _toolbar );
addToolBar( _toolbar ); addToolBar( _toolbar );
int newNumber = toolbarCount_; }
toolbarCount_++;
QString number = QString::number(newNumber); void CoreWidget::getToolBar( QString _name, QToolBar*& _toolbar) {
_toolbar->setObjectName("Toolbar" + number);
for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
if ( toolbars_[i]->windowTitle() == _name ) {
std::cerr << "Toolbar found! " << std::endl;
_toolbar = toolbars_[i];
return;
}
}
_toolbar = 0;
} }
void CoreWidget::slotRemoveToolbar(QToolBar* _toolbar) { void CoreWidget::slotRemoveToolbar(QToolBar* _toolbar) {
removeToolBar( _toolbar ); for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
if ( toolbars_[i]->windowTitle() == _toolbar->windowTitle() ) {
std::cerr << "Todo : erase Toolbar from list" << std::endl;
removeToolBar( _toolbar );
return;
}
}
emit log(LOGERR,"Remove Toolbar: Toolbar not found." );
} }
......
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