Commit 6377c1bb authored by Dirk Wilden's avatar Dirk Wilden

info plugin statusbar stuff

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8507 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 65977269
......@@ -96,6 +96,11 @@ class StatusbarInterface {
*/
void clearStatusMessage() {};
/** \brief Add a widget on the right side of the statusBar
*
*/
void addWidgetToStatusbar(QWidget* _widget) {};
};
Q_DECLARE_INTERFACE(StatusbarInterface,"OpenFlipper.StatusbarInterface/1.0")
......
......@@ -678,7 +678,9 @@ void Core::loadPlugin(QString filename, bool silent){
if ( checkSignal(plugin,"clearStatusMessage()") )
connect(plugin,SIGNAL(clearStatusMessage()),
coreWidget_,SLOT(clearStatusMessage()));
if ( checkSignal(plugin,"addWidgetToStatusbar(QWidget*)") )
connect(plugin,SIGNAL(addWidgetToStatusbar(QWidget*)), coreWidget_,SLOT(addWidgetToStatusbar(QWidget*)));
}
//Check if the plugin supports Key-Interface
......
......@@ -889,6 +889,8 @@ public:
void setStatus( ApplicationStatus::applicationStatus _status);
void addWidgetToStatusbar(QWidget* _widget);
private:
void setupStatusBar();
......
......@@ -121,6 +121,17 @@ void CoreWidget::setStatus( ApplicationStatus::applicationStatus _status)
// QApplication::processEvents();
}
void CoreWidget::addWidgetToStatusbar(QWidget* _widget){
statusBar_->addPermanentWidget(_widget);
statusBar_->removeWidget(statusIcon_);
statusBar_->addPermanentWidget(statusIcon_);
statusIcon_->show();
}
//=============================================================================
......@@ -75,6 +75,11 @@ void InfoPlugin::pluginsInitialized() {
//set the slot descriptions
setDescriptions();
infoBar_ = new InfoBar();
emit addWidgetToStatusbar(infoBar_);
infoBar_->hideCounts();
// Initialize hit point
hit_point_ = ACG::Vec3d(0.0, 0.0, 0.0);
}
......@@ -516,7 +521,61 @@ bool InfoPlugin::getEdgeLengths(int _id, double &min, double &max, double &mean)
//------------------------------------------------------------------------------
void InfoPlugin::slotObjectUpdated( int _identifier ){
if ( (PluginFunctions::objectCount() == 1) || (PluginFunctions::targetCount() == 1) ){
bool found = false;
PluginFunctions::IteratorRestriction restriction;
if ( PluginFunctions::targetCount() == 1 )
restriction = PluginFunctions::TARGET_OBJECTS;
else
restriction = PluginFunctions::ALL_OBJECTS;
for ( PluginFunctions::ObjectIterator o_it(restriction,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH )) ;
o_it != PluginFunctions::objectsEnd(); ++o_it) {
if (o_it->dataType(DATA_TRIANGLE_MESH)){
TriMesh* mesh = PluginFunctions::triMesh(*o_it);
infoBar_->vertices->setText( QLocale::system().toString( mesh->n_vertices() ) );
infoBar_->edges->setText( QLocale::system().toString( mesh->n_edges() ) );
infoBar_->faces->setText( QLocale::system().toString( mesh->n_faces() ) );
}
if (o_it->dataType(DATA_POLY_MESH)){
PolyMesh* mesh = PluginFunctions::polyMesh(*o_it);
infoBar_->vertices->setText( QLocale::system().toString( mesh->n_vertices() ) );
infoBar_->edges->setText( QLocale::system().toString( mesh->n_edges() ) );
infoBar_->faces->setText( QLocale::system().toString( mesh->n_faces() ) );
}
found = true;
}
if (found)
infoBar_->showCounts();
else
infoBar_->hideCounts();
} else {
if ( PluginFunctions::targetCount() > 0 )
infoBar_->showTargetCount( PluginFunctions::targetCount() );
else
infoBar_->hideCounts();
}
}
//------------------------------------------------------------------------------
void InfoPlugin::slotObjectSelectionChanged( int _identifier ){
slotObjectUpdated( _identifier );
}
Q_EXPORT_PLUGIN2( InfoPlugin , InfoPlugin );
......
......@@ -57,24 +57,27 @@
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/MouseInterface.hh>
#include <OpenFlipper/BasePlugin/StatusbarInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include "infoDialog.hh"
#include "infoBar.hh"
//== CLASS DEFINITION =========================================================
/** Plugin for Info Support
*/
class InfoPlugin : public QObject, BaseInterface, MouseInterface, LoggingInterface
class InfoPlugin : public QObject, BaseInterface, MouseInterface, LoggingInterface, StatusbarInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(MouseInterface)
Q_INTERFACES(LoggingInterface)
Q_INTERFACES(StatusbarInterface)
signals:
......@@ -86,14 +89,20 @@ class InfoPlugin : public QObject, BaseInterface, MouseInterface, LoggingInterfa
void log(Logtype _type, QString _message);
void log(QString _message);
// StatusbarInterface
void addWidgetToStatusbar(QWidget* _widget);
private slots :
// BaseInterface
void pluginsInitialized();
void slotObjectUpdated( int _identifier );
void slotObjectSelectionChanged( int _identifier );
// MouseInterface
void slotMouseEventIdentify( QMouseEvent* _event );
public :
// default constructor
......@@ -111,6 +120,8 @@ class InfoPlugin : public QObject, BaseInterface, MouseInterface, LoggingInterfa
private :
InfoDialog* info_;
InfoBar* infoBar_;
template< class MeshT >
void printMeshInfo( MeshT* _mesh, int _id, unsigned int _face, ACG::Vec3d& _hitPoint );
......
<RCC>
<qresource prefix="info" >
<file>dialogIcons/bar_face.png</file>
<file>dialogIcons/bar_edge.png</file>
<file>dialogIcons/info_aspect.png</file>
<file>dialogIcons/bar_vertex.png</file>
<file>dialogIcons/info_dihedral.png</file>
<file>dialogIcons/info_edge.png</file>
<file>dialogIcons/info_angle.png</file>
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2009 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: 83 $ *
* $Author: moebius $ *
* $Date: 2009-02-27 17:31:45 +0100 (Fr, 27. Feb 2009) $ *
* *
\*===========================================================================*/
#include "infoBar.hh"
#include <QtGui>
InfoBar::InfoBar(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
void InfoBar::showCounts(){
vertices->show();
verticesIcon->show();
edges->show();
edgesIcon->show();
faces->show();
facesIcon->show();
info->hide();
}
void InfoBar::hideCounts(){
vertices->hide();
verticesIcon->hide();
edges->hide();
edgesIcon->hide();
faces->hide();
facesIcon->hide();
info->hide();
}
void InfoBar::showTargetCount(int _count){
hideCounts();
info->setText( tr("%1 targets selected").arg( _count ) );
info->show();
}
\ No newline at end of file
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2009 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: 83 $ *
* $Author: moebius $ *
* $Date: 2009-02-27 17:31:45 +0100 (Fr, 27. Feb 2009) $ *
* *
\*===========================================================================*/
#include "ui_infoBar.hh"
#include <QtGui>
class InfoBar : public QWidget, public Ui::InfoBar
{
Q_OBJECT
public:
InfoBar(QWidget *parent = 0);
void showCounts();
void hideCounts();
void showTargetCount(int _count);
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfoBar</class>
<widget class="QWidget" name="InfoBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>235</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="verticesIcon">
<property name="maximumSize">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icons.qrc">:/info/dialogIcons/bar_vertex.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="vertices">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>#vertex</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>2</number>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="edgesIcon">
<property name="maximumSize">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icons.qrc">:/info/dialogIcons/bar_edge.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="edges">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>#edges</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>2</number>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="facesIcon">
<property name="maximumSize">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icons.qrc">:/info/dialogIcons/bar_face.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="faces">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>#faces</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>2</number>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="info">
<property name="text">
<string>info</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>
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