Commit b6aa4298 authored by Jan Möbius's avatar Jan Möbius
Browse files

Dennis: Provide statusMessage signal instead of using QStatusBar directly.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6656 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 895e1508
...@@ -226,9 +226,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -226,9 +226,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
glViewer* examinerWidget = new glViewer(glScene_, glViewer* examinerWidget = new glViewer(glScene_,
glWidget_, glWidget_,
PluginFunctions::viewerProperties(0), PluginFunctions::viewerProperties(0),
centerWidget_, centerWidget_);
"Examiner Widget",
statusBar_);
examiner_widgets_.push_back(examinerWidget); examiner_widgets_.push_back(examinerWidget);
...@@ -244,9 +242,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -244,9 +242,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
glViewer* newWidget = new glViewer(glScene_, glViewer* newWidget = new glViewer(glScene_,
glWidget_, glWidget_,
PluginFunctions::viewerProperties(i), PluginFunctions::viewerProperties(i),
centerWidget_, centerWidget_);
"Examiner Widget",
statusBar_);
examiner_widgets_.push_back(newWidget); examiner_widgets_.push_back(newWidget);
...@@ -291,6 +287,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -291,6 +287,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
this, SLOT(dropEvent(QDropEvent* ))); this, SLOT(dropEvent(QDropEvent* )));
connect (examiner_widgets_[i], SIGNAL(signalMakeActive ()), connect (examiner_widgets_[i], SIGNAL(signalMakeActive ()),
this, SLOT(slotActivateExaminer())); this, SLOT(slotActivateExaminer()));
connect (examiner_widgets_[i], SIGNAL(statusMessage(QString, int)),
statusBar_, SLOT(showMessage(const QString&, int)));
} }
......
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
#include <QLayout> #include <QLayout>
#include <QPushButton> #include <QPushButton>
#include <QLabel> #include <QLabel>
#include <QStatusBar>
#include <QImage> #include <QImage>
#include <QColorDialog> #include <QColorDialog>
#include <QFileDialog> #include <QFileDialog>
...@@ -122,11 +121,8 @@ static const char VIEW_MAGIC[] = ...@@ -122,11 +121,8 @@ static const char VIEW_MAGIC[] =
glViewer::glViewer( QtGLGraphicsScene* _scene, glViewer::glViewer( QtGLGraphicsScene* _scene,
QGLWidget* _glWidget, QGLWidget* _glWidget,
Viewer::ViewerProperties& _properties, Viewer::ViewerProperties& _properties,
QGraphicsWidget* _parent, QGraphicsWidget* _parent) :
const char* /* _name */ ,
QStatusBar *_statusBar) :
QGraphicsWidget(_parent), QGraphicsWidget(_parent),
statusbar_(_statusBar),
glareaGrabbed_(false), glareaGrabbed_(false),
projectionUpdateLocked_(false), projectionUpdateLocked_(false),
blending_(true), blending_(true),
...@@ -137,7 +133,7 @@ glViewer::glViewer( QtGLGraphicsScene* _scene, ...@@ -137,7 +133,7 @@ glViewer::glViewer( QtGLGraphicsScene* _scene,
{ {
// widget stuff // widget stuff
createWidgets(_statusBar); createWidgets();
// bind GL context to GL state class // bind GL context to GL state class
glstate_ = new ACG::GLState(); glstate_ = new ACG::GLState();
...@@ -221,15 +217,6 @@ glViewer::sizeHint() const ...@@ -221,15 +217,6 @@ glViewer::sizeHint() const
return QSize( 600, 600 ); return QSize( 600, 600 );
} }
//-----------------------------------------------------------------------------
void glViewer::setStatusBar(QStatusBar* _sb)
{
statusbar_ = _sb;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1257,10 +1244,8 @@ void glViewer::actionPasteView() ...@@ -1257,10 +1244,8 @@ void glViewer::actionPasteView()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
glViewer::createWidgets(QStatusBar* _sb) glViewer::createWidgets()
{ {
setStatusBar(_sb);
// Construct GL context & widget // Construct GL context & widget
wheelZ_=new ACG::QtWidgets::QtWheel( 0,"wheel-z",ACG::QtWidgets::QtWheel::Vertical); wheelZ_=new ACG::QtWidgets::QtWheel( 0,"wheel-z",ACG::QtWidgets::QtWheel::Vertical);
...@@ -1940,10 +1925,9 @@ void glViewer::slotAnimation() ...@@ -1940,10 +1925,9 @@ void glViewer::slotAnimation()
if (!properties_.updateLocked()) { if (!properties_.updateLocked()) {
msecs += frame_time_; msecs += frame_time_;
if (count >= 10 && msecs >= 500) { if (count >= 10 && msecs >= 500) {
assert(statusbar_!=0);
char s[100]; char s[100];
sprintf( s, "%.3f fps", (1000.0 * count / (float)msecs) ); sprintf( s, "%.3f fps", (1000.0 * count / (float)msecs) );
statusbar_->showMessage(s,2000); emit statusMessage(s,2000);
count = msecs = 0; count = msecs = 0;
} }
else else
...@@ -2034,14 +2018,13 @@ void glViewer::snapshot() ...@@ -2034,14 +2018,13 @@ void glViewer::snapshot()
bool rval=snapshot.save(fname,format.toUpper().toLatin1()); bool rval=snapshot.save(fname,format.toUpper().toLatin1());
assert(statusbar_!=0);
if (rval) if (rval)
{ {
statusbar_->showMessage(QString("snapshot: ")+fname,5000); emit statusMessage (QString("snapshot: ")+fname,5000);
} }
else else
{ {
statusbar_->showMessage(QString("could not save snapshot to ")+fname); emit statusMessage (QString("could not save snapshot to ")+fname);
} }
} }
......
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
class QPushButton; class QPushButton;
class QToolButton; class QToolButton;
class QStatusBar;
class QSplitter; class QSplitter;
class QTimer; class QTimer;
class QImage; class QImage;
...@@ -129,9 +128,7 @@ public: ...@@ -129,9 +128,7 @@ public:
glViewer( QtGLGraphicsScene* _scene, glViewer( QtGLGraphicsScene* _scene,
QGLWidget* _glWidget, QGLWidget* _glWidget,
Viewer::ViewerProperties& _properties, Viewer::ViewerProperties& _properties,
QGraphicsWidget* _parent=0, QGraphicsWidget* _parent=0);
const char* _name=0,
QStatusBar *_statusBar=0);
/// Destructor. /// Destructor.
virtual ~glViewer(); virtual ~glViewer();
...@@ -144,12 +141,6 @@ public: ...@@ -144,12 +141,6 @@ public:
virtual QSize sizeHint () const; virtual QSize sizeHint () const;
/** Set status bar.
Sets the \c QStatusBar widget that is used for information
output, e.g. the frame rate of the rotation animation.
*/
void setStatusBar(QStatusBar* _sb);
/// Makes this widget the current widget for OpenGL operations. /// Makes this widget the current widget for OpenGL operations.
virtual void makeCurrent(); virtual void makeCurrent();
/// Swaps the screen contents with the off-screen buffer. /// Swaps the screen contents with the off-screen buffer.
...@@ -164,6 +155,8 @@ public: ...@@ -164,6 +155,8 @@ public:
signals : signals :
void functionMenuUpdate(); void functionMenuUpdate();
void statusMessage (const QString & message, int timeout = 0);
public: public:
/// Enable/disable mouse tracking (move events with no button press) /// Enable/disable mouse tracking (move events with no button press)
...@@ -450,7 +443,7 @@ private: ...@@ -450,7 +443,7 @@ private:
glViewer& operator=(const glViewer&); glViewer& operator=(const glViewer&);
// create widgets // create widgets
void createWidgets(QStatusBar* _sb); void createWidgets();
/* Recursively draws each node in the scene graph. /* Recursively draws each node in the scene graph.
Called by paintGL(). */ Called by paintGL(). */
...@@ -491,9 +484,6 @@ protected: ...@@ -491,9 +484,6 @@ protected:
// helper // helper
bool isRotating_; bool isRotating_;
// current status bar
QStatusBar* statusbar_;
//---------------------------------------------------------------- private data //---------------------------------------------------------------- private data
private: private:
......
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