CoreWidget.cc 37.5 KB
Newer Older
1
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
2 3
*                                                                            *
*                              OpenFlipper                                   *
Martin Schultz's avatar
Martin Schultz committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 *           Copyright (c) 2001-2015, RWTH-Aachen University                 *
 *           Department of Computer Graphics and Multimedia                  *
 *                          All rights reserved.                             *
 *                            www.openflipper.org                            *
 *                                                                           *
 *---------------------------------------------------------------------------*
 * This file is part of OpenFlipper.                                         *
 *---------------------------------------------------------------------------*
 *                                                                           *
 * Redistribution and use in source and binary forms, with or without        *
 * modification, are permitted provided that the following conditions        *
 * are met:                                                                  *
 *                                                                           *
 * 1. Redistributions of source code must retain the above copyright notice, *
 *    this list of conditions and the following disclaimer.                  *
 *                                                                           *
 * 2. Redistributions in binary form must reproduce the above copyright      *
 *    notice, this list of conditions and the following disclaimer in the    *
 *    documentation and/or other materials provided with the distribution.   *
 *                                                                           *
 * 3. Neither the name of the copyright holder nor the names of its          *
 *    contributors may be used to endorse or promote products derived from   *
 *    this software without specific prior written permission.               *
 *                                                                           *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       *
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           *
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  *
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,       *
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR        *
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    *
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      *
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        *
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              *
Jan Möbius's avatar
Jan Möbius committed
39
*                                                                            *
40
\*===========================================================================*/
Jan Möbius's avatar
 
Jan Möbius committed
41

42
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
43 44 45 46 47
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
48
\*===========================================================================*/
Jan Möbius's avatar
 
Jan Möbius committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65



//=============================================================================
//
//  CLASS MViewWidget - IMPLEMENTATION
//
//=============================================================================


//== INCLUDES =================================================================

// -------------------- mview
#include "CoreWidget.hh"

// -------------------- OpenFlipper Includes
#include <OpenFlipper/common/RecentFiles.hh>
Jan Möbius's avatar
 
Jan Möbius committed
66
#include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh>
Jan Möbius's avatar
 
Jan Möbius committed
67

Dirk Wilden's avatar
Dirk Wilden committed
68 69
#include <OpenFlipper/widgets/videoCaptureDialog/VideoCaptureDialog.hh>

Jan Möbius's avatar
Jan Möbius committed
70
#include <ACG/Scenegraph/SceneGraphAnalysis.hh>
71
#include <ACG/GL/ShaderCache.hh>
Jan Möbius's avatar
Jan Möbius committed
72

Matthias Möller's avatar
doc  
Matthias Möller committed
73
// -------------------- Qt event Includes
Hans-Christian Ebke's avatar
Hans-Christian Ebke committed
74
#include <QGLFormat>
Matthias Möller's avatar
doc  
Matthias Möller committed
75

Jan Möbius's avatar
 
Jan Möbius committed
76 77 78
#define WIDGET_HEIGHT 800
#define WIDGET_WIDTH  800

Jan Möbius's avatar
Jan Möbius committed
79
//== IMPLEMENTATION ==========================================================
Jan Möbius's avatar
 
Jan Möbius committed
80

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
PickMode::PickMode(const std::string& _n, const bool _t, const bool _v, QCursor _c, QToolBar *_tb ) :
      name_(_n),
      tracking_(_t),
      visible_(_v),
      cursor_(_c),
      toolbar_(_tb)
{

}

void PickMode::visible(const bool _visible) {
  visible_ = _visible;
}

bool PickMode::visible() const  {
  return visible_;
}

std::string PickMode::name() const {
  return name_;
}

void PickMode::tracking(bool _tracking) {
  tracking_ = _tracking;
}

bool PickMode::tracking() const {
  return tracking_;
}

111 112 113 114
void PickMode::cursor(const QCursor _cursor) {
  cursor_ = _cursor;
}

115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
QCursor PickMode::cursor() const{
  return cursor_;
}

void PickMode::toolbar(QToolBar* _toolbar) {
  toolbar_ = _toolbar;
}

QToolBar * PickMode::toolbar() const {
  return toolbar_;
}









135
/** \brief Constructor for the Core Widget
Jan Möbius's avatar
Jan Möbius committed
136
 *
Jan Möbius's avatar
 
Jan Möbius committed
137 138
*/
CoreWidget::
Dirk Wilden's avatar
Dirk Wilden committed
139
CoreWidget( QVector<ViewMode*>& _viewModes,
Dirk Wilden's avatar
Dirk Wilden committed
140 141
            std::vector<PluginInfo>& _plugins,
            QList< SlotInfo >& _coreSlots ) :
Jan Möbius's avatar
 
Jan Möbius committed
142
  QMainWindow(),
Dirk Wilden's avatar
Dirk Wilden committed
143
  coreSlots_(_coreSlots),
Dirk Wilden's avatar
Dirk Wilden committed
144
  shiftPressed_(false),
Jan Möbius's avatar
 
Jan Möbius committed
145 146
  viewModes_(_viewModes),
  viewModeButton_(0),
147
  viewModeMenu_(0),
Jan Möbius's avatar
 
Jan Möbius committed
148
  splitter_(0),
149
  logWidget_(0),
Jan Möbius's avatar
 
Jan Möbius committed
150
  recentFilesMenu_(0),
151
  helpMenu_(0),
152 153
  windowMenu_(0),
  AC_ShowViewModeControls_(0),
154
  pickToolBarExternal_(0),
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
155
  cursorPainter_(0),
156
  sceneGraphDialog_(0),
157 158 159
  fileMenu_(0),
  viewMenu_(0),
  toolsMenu_(0),
Jan Möbius's avatar
 
Jan Möbius committed
160
  fileMenuEnd_(0),
161 162 163
  stereoButton_(0),
  moveButton_(0),
  pickButton_(0),
Dirk Wilden's avatar
Dirk Wilden committed
164
  questionButton_(0),
165
  globalDrawMenu_(0),
166
  rendererMenu_(0),
167
  drawGroup_(0),
168
  rendererGroup_(0),
169
  viewGroup_(0),
170
  perspectiveProjectionAction_(0),
171 172
  activeDrawModes_(0),
  availableGlobalDrawModes_(0),
Jan Möbius's avatar
 
Jan Möbius committed
173
  contextMenu_(0),
Jan Möbius's avatar
Jan Möbius committed
174
  contextSelectionMenu_(0),
175 176
  drawGroupViewer_(0),
  viewerDrawMenu_(0),
Matthias Möller's avatar
Matthias Möller committed
177
  viewerDrawMenuWidget_(0),
178
  coordSysMenu_(0),
179
  snapshotName_(""),
Dirk Wilden's avatar
Dirk Wilden committed
180
  snapshotCounter_(0),
Jan Möbius's avatar
 
Jan Möbius committed
181
  stackMenu_(0),
182
  helpWidget_(0),
183
  postProcessorDialog_(0),
Jan Möbius's avatar
Jan Möbius committed
184
  rendererDialog_(0),
Jan Möbius's avatar
Jan Möbius committed
185
  rendererObjectWidget_(0),
186
  stereoSettingsWidget_(0),
Jan Möbius's avatar
Jan Möbius committed
187
  aboutWidget_(0),
188
  optionsWidget_(0),
189
  plugins_(_plugins),
190 191 192 193 194 195
  stereoActive_(false),
  actionMode_(Viewer::PickingMode),
  lastActionMode_(Viewer::ExamineMode),
  pickMenu_(0),
  pick_mode_name_(""),
  pick_mode_idx_(-1)
Jan Möbius's avatar
 
Jan Möbius committed
196
{
Matthias Möller's avatar
doc  
Matthias Möller committed
197

Jan Möbius's avatar
 
Jan Möbius committed
198
  setupStatusBar();
Jan Möbius's avatar
Jan Möbius committed
199

Dirk Wilden's avatar
Dirk Wilden committed
200 201
  defaultIconSize_ = iconSize();

Jan Möbius's avatar
Dennis:  
Jan Möbius committed
202 203 204 205 206
  toolSplitter_ = new QSplitter(Qt::Horizontal,this);

  setCentralWidget(toolSplitter_);

  splitter_ = new QSplitter(Qt::Vertical,toolSplitter_);
Jan Möbius's avatar
 
Jan Möbius committed
207
  stackedWidget_ = new QStackedWidget(splitter_);
Jan Möbius's avatar
Jan Möbius committed
208

209 210
  QGLFormat format = QGLFormat::defaultFormat();

211 212 213
  #ifdef ARCH_DARWIN
  format.setStereo(false);
  #else
Jan Möbius's avatar
 
Jan Möbius committed
214
  format.setStereo( OpenFlipper::Options::stereo() );
215
  #endif
Jan Möbius's avatar
 
Jan Möbius committed
216
  format.setAlpha(true);
217
  format.setStencil(true);
218 219
  format.setSampleBuffers(true);
  QGLFormat::setDefaultFormat(format);
Jan Möbius's avatar
 
Jan Möbius committed
220 221

  // Construct GL context & widget
222 223 224
  baseLayout_ = new QtMultiViewLayout;
  baseLayout_->setContentsMargins(0,0,0,0);

225 226 227
  // ===============================================================================
  // Test context capabilities ...
  // If we get stereo buffers, we use them .. which might disable multisampling
228
  // If we don't have stereo, we disable it to not interfere with multisampling
229 230 231 232 233 234 235 236 237 238 239 240
  // ===============================================================================
  QGLWidget* test = new QGLWidget(format);
  if ( ! test->format().stereo() ) {
    //     std::cerr << "No stereo ... disabling stereo for real context!" << std::endl;
    format.setStereo(false);
    QGLFormat::setDefaultFormat(format);
  }/* else {
    std::cerr << "Stereo found ok" << std::endl;
  }*/

  delete test;

241 242 243 244
  // force the compatibility profile since OpenFlipper does not work with the
  // Core profile
  format.setProfile(QGLFormat::CompatibilityProfile);

245 246 247 248 249 250
#if QT_VERSION >= 0x050000
  // request the highest OpenGL version
  // QT 5 should gracefully provide the next highest available version
  format.setVersion(4,3);
#endif

251
  glWidget_ = new QGLWidget(format,0);
252
  PluginFunctions::shareGLWidget (glWidget_);
253

Jan Möbius's avatar
 
Jan Möbius committed
254
  glView_ = new QtGLGraphicsView(stackedWidget_);
255
  glScene_ = new QtGLGraphicsScene (&examiner_widgets_, baseLayout_);
Jan Möbius's avatar
 
Jan Möbius committed
256

Jan Möbius's avatar
Jan Möbius committed
257
  // is stereo possible, use it?
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
258
  OpenFlipper::Options::glStereo(glWidget_->format().stereo());
Jan Möbius's avatar
Jan Möbius committed
259

Jan Möbius's avatar
 
Jan Möbius committed
260 261 262
  glView_->setViewport(glWidget_);
  glView_->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  glView_->setScene(glScene_);
263
  glView_->setFrameStyle(QFrame::NoFrame);
Jan Möbius's avatar
 
Jan Möbius committed
264

Jan Möbius's avatar
Dennis:  
Jan Möbius committed
265 266
  // gl widget as parent to make sure that the CursorPainter will be deleted before
  cursorPainter_ = new CursorPainter (glWidget_);
Jan Möbius's avatar
Jan Möbius committed
267
  cursorPainter_->setForceNative (OpenFlipperSettings().value("Core/Gui/glViewer/nativeMouse",false).toBool() );
268
  cursorPainter_->setEnabled (stereoActive_);
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
269
  glScene_->setCursorPainter (cursorPainter_);
270

Jan Möbius's avatar
 
Jan Möbius committed
271 272 273 274 275 276 277 278 279 280
  centerWidget_ = new QGraphicsWidget;
  glScene_->addItem(centerWidget_);
  centerWidget_->setGeometry (glScene_->sceneRect ());

  connect ( glView_, SIGNAL( sceneRectChanged( const QRectF & ) ),
            this, SLOT( sceneRectChanged( const QRectF & ) ) );

  stackedWidget_->addWidget(glView_);
  stackWidgetList_.push_back( StackWidgetInfo( false, "3D Examiner Widget", glView_ ) );

Jan Möbius's avatar
 
Jan Möbius committed
281 282 283
  // ======================================================================
  // Set up the logging window
  // ======================================================================
284

285
  slidingLogger_ = new QtSlideWindow (tr("Log Viewer"), centerWidget_);
286

287 288
  logWidget_ = new LoggerWidget(splitter_);
  logWidget_->setSizePolicy( QSizePolicy ( QSizePolicy::Preferred , QSizePolicy::Preferred ) );
289
  logWidget_->resize( splitter_->width() ,240);
Jan Möbius's avatar
Jan Möbius committed
290

291
  originalLoggerSize_ = 0;
Jan Möbius's avatar
Jan Möbius committed
292
  loggerState_ = OpenFlipper::Options::Normal;
293

294 295 296 297 298
  QList<int> wsizes(splitter_->sizes());
  // Set initial values to have a usable state
  wsizes[0] = 480;
  wsizes[1] = 240;
  splitter_->setSizes(wsizes);
299

Jan Möbius's avatar
Jan Möbius committed
300
  if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene) {
301

302
    slidingLogger_->attachWidget (logWidget_);
303
    showLoggerInSplitView(false);
Jan Möbius's avatar
Jan Möbius committed
304
    loggerState_ = OpenFlipper::Options::InScene;
305

Jan Möbius's avatar
Jan Möbius committed
306
  } else if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden) {
307

308
    showLoggerInSplitView(false);
Jan Möbius's avatar
Jan Möbius committed
309 310
    loggerState_ = OpenFlipper::Options::Hidden;
  } else {
311 312

    showLoggerInSplitView(true);
Jan Möbius's avatar
 
Jan Möbius committed
313
  }
Jan Möbius's avatar
Jan Möbius committed
314

315

Jan Möbius's avatar
 
Jan Möbius committed
316 317 318
  // ======================================================================
  // Create examiner
  // ======================================================================
Jan Möbius's avatar
Jan Möbius committed
319

Jan Möbius's avatar
Jan Möbius committed
320 321 322 323 324
  // First we analyze the scenegraph
  unsigned int maxPases = 1;
  ACG::Vec3d bbmin,bbmax;
  ACG::SceneGraph::analyzeSceneGraph(PluginFunctions::getSceneGraphRootNode(),maxPases,bbmin,bbmax);

Jan Möbius's avatar
Jan Möbius committed
325
  if ( !OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) {
Jan Möbius's avatar
Jan Möbius committed
326

Jan Möbius's avatar
 
Jan Möbius committed
327
    glViewer* examinerWidget = new glViewer(glScene_,
Jan Möbius's avatar
Jan Möbius committed
328 329 330
					                                  glWidget_,
					                                  PluginFunctions::viewerProperties(0),
					                                  centerWidget_);
Jan Möbius's avatar
Jan Möbius committed
331

Jan Möbius's avatar
Jan Möbius committed
332 333
    examiner_widgets_.push_back(examinerWidget);

Jan Möbius's avatar
Jan Möbius committed
334
    examinerWidget->sceneGraph( PluginFunctions::getSceneGraphRootNode(), maxPases,bbmin,bbmax );
Jan Möbius's avatar
Jan Möbius committed
335

Jan Möbius's avatar
Jan Möbius committed
336
    baseLayout_->addItem(examinerWidget, 0);
Jan Möbius's avatar
Jan Möbius committed
337

Jan Möbius's avatar
Dennis:  
Jan Möbius committed
338 339
    cursorPainter_->registerViewer (examinerWidget);

Jan Möbius's avatar
Jan Möbius committed
340 341 342
  } else {


Jan Möbius's avatar
 
Jan Möbius committed
343 344 345
    // Create examiners
    for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
      glViewer* newWidget = new glViewer(glScene_,
Jan Möbius's avatar
Jan Möbius committed
346
					                               glWidget_,
347
                                         PluginFunctions::viewerProperties(i),
Jan Möbius's avatar
Jan Möbius committed
348
                                         centerWidget_);
Dirk Wilden's avatar
Dirk Wilden committed
349

Jan Möbius's avatar
Jan Möbius committed
350
      examiner_widgets_.push_back(newWidget);
351 352 353 354 355 356 357 358 359 360

      connect (&PluginFunctions::viewerProperties(i), SIGNAL( getPickMode(std::string&) ),
               this,                                   SLOT( getPickMode(std::string&) ),Qt::DirectConnection );
      connect (&PluginFunctions::viewerProperties(i), SIGNAL( setPickMode(const std::string) ),
               this,                                   SLOT( setPickMode(const std::string) ),Qt::DirectConnection );
      connect (&PluginFunctions::viewerProperties(i), SIGNAL( getActionMode(Viewer::ActionMode&) ),
               this,                                   SLOT( getActionMode(Viewer::ActionMode&) ),Qt::DirectConnection );
      connect (&PluginFunctions::viewerProperties(i), SIGNAL( setActionMode(const Viewer::ActionMode) ),
               this,                                   SLOT( setActionMode(const Viewer::ActionMode)), Qt::DirectConnection );

361
      connect (&PluginFunctions::viewerProperties(i), SIGNAL( drawModeChanged(int)), this, SIGNAL(drawModeChanged(int)));
Jan Möbius's avatar
Jan Möbius committed
362 363 364 365
    }

    // Initialize all examiners
    for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
Jan Möbius's avatar
Jan Möbius committed
366
      examiner_widgets_[i]->sceneGraph( PluginFunctions::getSceneGraphRootNode(), maxPases,bbmin,bbmax );
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
367
      cursorPainter_->registerViewer (examiner_widgets_[i]);
Jan Möbius's avatar
Jan Möbius committed
368 369
    }

Jan Möbius's avatar
Jan Möbius committed
370 371 372 373
    baseLayout_->addItem(examiner_widgets_[0],0);
    baseLayout_->addItem(examiner_widgets_[1],1);
    baseLayout_->addItem(examiner_widgets_[2],2);
    baseLayout_->addItem(examiner_widgets_[3],3);
Jan Möbius's avatar
Jan Möbius committed
374 375
  }

Jan Möbius's avatar
 
Jan Möbius committed
376 377 378
  // Make examiner available to the plugins ( defined in PluginFunctions.hh)
  PluginFunctions::setViewers( examiner_widgets_ );

Jan Möbius's avatar
 
Jan Möbius committed
379
  centerWidget_->setLayout(baseLayout_);
380 381


382
  ACG::ShaderCache::getInstance()->setTimeCheck(OpenFlipperSettings().value("Core/File/ReloadShaders",false).toBool());
383
  ACG::ShaderCache::getInstance()->setDebugOutputDir(OpenFlipperSettings().value("Core/File/ShaderOutputDir","").toString().toUtf8());
384

Jan Möbius's avatar
 
Jan Möbius committed
385 386 387
  // ======================================================================
  // Setup dragging for examiner widget
  // ======================================================================
388 389 390 391 392 393 394 395
  for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {

    connect( examiner_widgets_[i], SIGNAL(startDragEvent( QMouseEvent*)),
             this, SLOT(startDrag(QMouseEvent* )));
    connect( examiner_widgets_[i], SIGNAL(dragEnterEvent( QDragEnterEvent*)),
            this, SLOT(dragEnterEvent(QDragEnterEvent* )));
    connect( examiner_widgets_[i], SIGNAL(dropEvent( QDropEvent*)),
            this, SLOT(dropEvent(QDropEvent* )));
396 397
    connect (examiner_widgets_[i], SIGNAL(signalMakeActive ()),
             this, SLOT(slotActivateExaminer()));
398 399 400

    connect (examiner_widgets_[i], SIGNAL(statusMessage(QString, int)),
             statusBar_, SLOT(showMessage(const QString&, int)));
Jan Möbius's avatar
Jan Möbius committed
401 402 403
  }


Jan Möbius's avatar
 
Jan Möbius committed
404 405 406
  // ======================================================================
  // Create main Toolbar
  // ======================================================================
Jan Möbius's avatar
Jan Möbius committed
407

Jan Möbius's avatar
Jan Möbius committed
408 409 410
  mainToolbar_ = new QToolBar(tr("Main Toolbar"));
  mainToolbar_->setWindowTitle(tr("Main Toolbar"));
  mainToolbar_->setObjectName(tr("MainToolbar"));
411
  slotAddToolbar(mainToolbar_);
Jan Möbius's avatar
Jan Möbius committed
412

Jan Möbius's avatar
 
Jan Möbius committed
413 414 415
  // ======================================================================
  // Get Toolbar from examiner and integrate it into main window
  // ======================================================================
Jan Möbius's avatar
Jan Möbius committed
416

Jan Möbius's avatar
Jan Möbius committed
417

418
  // Create the toolbar
Jan Möbius's avatar
Jan Möbius committed
419
  viewerToolbar_ = new QToolBar( tr("Viewer Toolbar" ), this );
420
  viewerToolbar_->setOrientation(Qt::Vertical);
Jan Möbius's avatar
 
Jan Möbius committed
421 422
  viewerToolbar_->setAllowedAreas(Qt::AllToolBarAreas);
  viewerToolbar_->setIconSize(QSize(20,20));
Jan Möbius's avatar
Jan Möbius committed
423
  viewerToolbar_->setObjectName(tr("ViewerToolbar"));
424

Jan Möbius's avatar
Jan Möbius committed
425
  slotAddToolbar(viewerToolbar_);
Jan Möbius's avatar
Jan Möbius committed
426

427 428 429 430
  moveButton_ = new QToolButton( viewerToolbar_ );
  moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"transform-move.png") );
  moveButton_->setMinimumSize( 16, 16 );
  moveButton_->setMaximumSize( 32, 32 );
431
  moveButton_->setCheckable(true);
Jan Möbius's avatar
Jan Möbius committed
432 433
  moveButton_->setToolTip( tr("Switch to <b>move</b> mode.") );
  moveButton_->setWhatsThis(tr(
434 435 436
                  "Switch to <b>move</b> mode.<br>"
                  "<ul><li><b>Rotate</b> using <b>left</b> mouse button.</li>"
                  "<li><b>Translate</b> using <b>middle</b> mouse button.</li>"
Jan Möbius's avatar
Jan Möbius committed
437
                  "<li><b>Zoom</b> using <b>left+middle</b> mouse buttons.</li></ul>" ));
438 439

  connect( moveButton_,SIGNAL( clicked() ), this, SLOT( setExamineMode() ) );
440
/*
441
  connect( this, SIGNAL( actionModeChanged( Viewer::ActionMode ) ),
442
            this, SLOT(   slotActionModeChanged(Viewer::ActionMode) ) );*/
443

Jan Möbius's avatar
Jan Möbius committed
444
  viewerToolbar_->addWidget( moveButton_ )->setText(tr("Move"));
445
  moveButton_->setChecked(true);
446

447
  
448 449 450 451
  pickButton_ = new QToolButton( viewerToolbar_ );
  pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"pick.png") );
  pickButton_->setMinimumSize( 16, 16 );
  pickButton_->setMaximumSize( 32, 32 );
452
  pickButton_->setCheckable(true);
Jan Möbius's avatar
Jan Möbius committed
453 454
  pickButton_->setToolTip(tr("Switch to <b>picking</b> mode."));
  pickButton_->setWhatsThis(tr(
455 456 457
                  "Switch to <b>picking</b> mode.<br>"
                  "Use picking functions like flipping edges.<br>"
                  "To change the mode use the right click<br>"
Jan Möbius's avatar
Jan Möbius committed
458
                  "context menu in the viewer."));
459
  connect( pickButton_,SIGNAL( clicked() ), this, SLOT( setPickingMode() ) );
Jan Möbius's avatar
Jan Möbius committed
460
  viewerToolbar_->addWidget( pickButton_)->setText(tr("Pick"));
461 462 463 464 465 466


  questionButton_ = new QToolButton( viewerToolbar_ );
  questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-about.png") );
  questionButton_->setMinimumSize( 16, 16 );
  questionButton_->setMaximumSize( 32, 32 );
467
  questionButton_->setCheckable(true);
Jan Möbius's avatar
Jan Möbius committed
468 469
  questionButton_->setToolTip(tr("Switch to <b>identification</b> mode."));
  questionButton_->setWhatsThis(tr(
470 471 472 473
                  "Switch to <b>identification</b> mode.<br>"
                  "Use identification mode to get information "
                  "about objects. Click on an object and see "
                  "the log output for information about the "
Jan Möbius's avatar
Jan Möbius committed
474
                  "object."));
475
  connect( questionButton_,SIGNAL( clicked() ), this, SLOT( setQuestionMode() ) );
Jan Möbius's avatar
Jan Möbius committed
476
  viewerToolbar_->addWidget( questionButton_)->setText(tr("Question"));
477

478 479 480 481 482 483 484 485
  viewerLayoutBox_ = new QComboBox( viewerToolbar_ );
  viewerLayoutBox_->setMinimumSize( 32, 16 );
  viewerLayoutBox_->setMaximumSize( 64, 32 );
  viewerLayoutBox_->setToolTip(tr("Switch <b>viewer layout</b>."));
  viewerLayoutBox_->setWhatsThis(tr(
                  "Switch <b>viewer layout</b>.<br>"
                  "Select the desired viewer layout. "
                  "Possible layouts are: "
486
                  "<ul> "
487
				  "<li>Single viewer</li>"
Jan Möbius's avatar
Jan Möbius committed
488
          "<li>Double viewer</li>"
489 490
				  "<li>Multiple viewers (grid)</li>"
				  "<li>Multiple viewers (hsplit)</li>"
Jan Möbius's avatar
Jan Möbius committed
491
				  "</ul>"));
492

493
  viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"singleviewmode.png"), "");
Jan Möbius's avatar
Jan Möbius committed
494
  viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"doubleviewmode.png"), "");
495 496
  viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multiviewmode1.png"), "");
  viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multiviewmode2.png"), "");
497

498
  viewerLayoutBox_->setIconSize(QSize(22,22));
499

500
  connect( viewerLayoutBox_,SIGNAL( activated(int) ), this, SLOT( setViewerLayout(int) ) );
501

Jan Möbius's avatar
Jan Möbius committed
502
  extended_actions.push_back(viewerToolbar_->addWidget( viewerLayoutBox_ ));
503

Jan Möbius's avatar
Jan Möbius committed
504
  extended_actions.push_back(viewerToolbar_->addSeparator());
505 506 507 508 509 510 511 512

  if (OpenFlipper::Options::stereo())
  {
    stereoButton_ = new QToolButton( viewerToolbar_ );
    stereoButton_->setIcon(  QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"mono.png")  );
    stereoButton_->setMinimumSize( 16, 16 );
    stereoButton_->setMaximumSize( 32, 32 );
    stereoButton_->setCheckable( true );
Jan Möbius's avatar
Jan Möbius committed
513
    stereoButton_->setToolTip(tr( "Toggle stereo viewing"));
514 515
    // We want a custom context menu
    stereoButton_->setContextMenuPolicy(Qt::CustomContextMenu);
Jan Möbius's avatar
Jan Möbius committed
516
    stereoButton_->setWhatsThis(tr(
517 518 519 520
                  "Toggle stereo mode<br><br>"
                  "Use this button to switch between stereo "
                  "and mono view. To use this feature you need "
                  "a stereo capable graphics card and a stereo "
Jan Möbius's avatar
Jan Möbius committed
521
                  "display/projection system."));
522 523 524
    connect( stereoButton_, SIGNAL( clicked() ), this , SLOT( slotToggleStereoMode() ) );
    // Custom context menu
    connect( stereoButton_, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(stereoButtonContextMenu(const QPoint &)));
Jan Möbius's avatar
Jan Möbius committed
525 526 527
    QAction *stereoAction = viewerToolbar_->addWidget( stereoButton_ );
    stereoAction->setText( tr("Stereo"));
    extended_actions.push_back(stereoAction);
528
  }
529 530


531
  addToolBar(Qt::TopToolBarArea,viewerToolbar_);
Jan Möbius's avatar
Jan Möbius committed
532

Jan Möbius's avatar
 
Jan Möbius committed
533 534
  // Remember logger size
  wsizes = splitter_->sizes();
535 536 537 538 539 540

  if(wsizes.size() > 1) {
    originalLoggerSize_  = wsizes[1];
  } else {
    originalLoggerSize_ = 240;
  }
Jan Möbius's avatar
Jan Möbius committed
541

Jan Möbius's avatar
 
Jan Möbius committed
542
  // ======================================================================
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
543
  // Create ToolBox area
Jan Möbius's avatar
Jan Möbius committed
544
  // ======================================================================
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
545 546 547

  toolBoxArea_ = new QWidget (toolSplitter_);

548
  viewModeControlBox_ = new QGroupBox (tr("ViewMode"));
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
549 550 551

  QHBoxLayout *hLayout = new QHBoxLayout;

Jan Möbius's avatar
Jan Möbius committed
552 553
  vmChangeButton_ = new QPushButton(tr("Change View Mode"));
  QPushButton* vmEditButton   = new QPushButton(tr("Edit View Modes"));
554

Jan Möbius's avatar
Jan Möbius committed
555 556
  hLayout->addWidget(vmChangeButton_);
  hLayout->addWidget(vmEditButton);
557
  viewModeControlBox_->setLayout (hLayout);
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
558

Jan Möbius's avatar
Jan Möbius committed
559 560
  connect(vmChangeButton_, SIGNAL(clicked()), this, SLOT(slotViewChangeDialog()));
  connect(vmEditButton, SIGNAL(clicked()), this, SLOT(slotViewModeDialog()));
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
561 562 563 564 565 566 567 568

  toolBoxScroll_ = new QScrollArea ();
  toolBox_ = new SideArea ();
  toolBoxScroll_->setWidget (toolBox_);
  toolBoxScroll_->setWidgetResizable (true);
  toolBoxScroll_->setFrameStyle (QFrame::StyledPanel);

  QVBoxLayout *vLayout = new QVBoxLayout;
569
  vLayout->addWidget(viewModeControlBox_);
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
570
  vLayout->addWidget(toolBoxScroll_);
571
  
Jan Möbius's avatar
Jan Möbius committed
572
  if ( OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() ) {
573
    viewModeControlBox_->hide();
Jan Möbius's avatar
Jan Möbius committed
574 575 576
    if (viewModeButton_)
        viewModeButton_->setVisible(false);
  }
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
577 578 579 580 581

  toolBoxArea_->setLayout (vLayout);

  wsizes = toolSplitter_->sizes();

582
  // if the toolbox should be on the right, use the defaults. Otherwise, we have to reorder them.
Jan Möbius's avatar
Jan Möbius committed
583
  if ( OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight", true).toBool() ) {
584

585 586 587 588 589
    // Set relative sizes of windows
    wsizes[0] = 480;
    wsizes[1] = 240;
    toolSplitter_->setSizes(wsizes);  
  } else {
590

591 592 593 594 595 596 597 598 599 600
    // Show tool box on the left side of the main window
    toolSplitter_->insertWidget(0, toolBoxArea_);
    toolSplitter_->insertWidget(1, splitter_);

    // Default sizes are swaped when toolbox is on the left.
    wsizes[0] = 240;
    wsizes[1] = 480;
    toolSplitter_->setSizes(wsizes);
  }
  
Jan Möbius's avatar
 
Jan Möbius committed
601 602 603
  // ======================================================================
  // Context menu setup
  // ======================================================================
Jan Möbius's avatar
Jan Möbius committed
604

Jan Möbius's avatar
Jan Möbius committed
605 606 607 608
  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
    connect( examiner_widgets_[i] , SIGNAL(signalCustomContextMenuRequested( const QPoint&) ) ,
             this                 , SLOT( slotCustomContextMenu( const QPoint&) ) );
  }
Jan Möbius's avatar
Jan Möbius committed
609

Dirk Wilden's avatar
 
Dirk Wilden committed
610
  contextMenu_ = new QMenu(this);
Jan Möbius's avatar
Jan Möbius committed
611
  contextSelectionMenu_ = new QMenu(tr("Selection"),0);
Jan Möbius's avatar
Jan Möbius committed
612

Jan Möbius's avatar
 
Jan Möbius committed
613
  setupMenuBar();
Jan Möbius's avatar
Jan Möbius committed
614

Jan Möbius's avatar
Jan Möbius committed
615
  statusBar_->showMessage(tr("Ready"), 5000);
Dirk Wilden's avatar
Dirk Wilden committed
616

617
  registerCoreKeys();
Dirk Wilden's avatar
Dirk Wilden committed
618

619
  setExamineMode();
620 621 622

  setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );

623 624 625 626
  // Create stereo settings widget
  stereoSettingsWidget_ = new StereoSettingsWidget(this);
  // Make it look like a dialog
  stereoSettingsWidget_->setWindowFlags(Qt::Popup);
627 628
  // Connect combo boxes and sliders to local slots
  connect(stereoSettingsWidget_->stereoOpengl, SIGNAL(clicked()),
629
          this, SLOT(slotApplyStereoSettings()));
630 631 632 633 634
  connect(stereoSettingsWidget_->stereoAnaglyph, SIGNAL(clicked()),
          this, SLOT(slotApplyStereoSettings()));
  connect(stereoSettingsWidget_->stereoCustomAnaglyph, SIGNAL(clicked()),
          this, SLOT(slotApplyStereoSettings()));

635 636
  connect(stereoSettingsWidget_->focalDistance, SIGNAL(sliderReleased()),
          this, SLOT(slotApplyStereoSettings()));
637 638 639 640 641 642
  connect(stereoSettingsWidget_->eyeDistance, SIGNAL(editingFinished()),
          this, SLOT(slotApplyStereoSettings()));

  // Close button
  connect(stereoSettingsWidget_->closeButton, SIGNAL(clicked()),
          stereoSettingsWidget_, SLOT(hide()));
643 644 645 646 647 648


  // ======================================================================
  // Help Browser start up
  // ======================================================================

649
  helpWidget_ = new HelpWidget(this,homePage_,false);
Matthias Möller's avatar
doc  
Matthias Möller committed
650 651
  connect(this, SIGNAL(changeHelpSite(QUrl)), helpWidget_, SLOT(activateLink(QUrl)));
  helpWidget_->hide();
652

Jan Möbius's avatar
Jan Möbius committed
653 654 655 656

  // Add the core license information about used libraries
  addCoreLicenseInfo();

Jan Möbius's avatar
 
Jan Möbius committed
657 658 659 660 661 662 663
}


//-----------------------------------------------------------------------------


CoreWidget::~CoreWidget() {
Jan Möbius's avatar
Jan Möbius committed
664

Jan Möbius's avatar
 
Jan Möbius committed
665 666 667 668 669 670 671 672
}

//-----------------------------------------------------------------------------

/** Set viewer to Fullscreen Mode and back
  */
void
CoreWidget::toggleFullscreen() {
Jan Möbius's avatar
Jan Möbius committed
673

674
  bool fullScreen = OpenFlipperSettings().value("Core/Gui/fullscreen", false ).toBool();
Dirk Wilden's avatar
Dirk Wilden committed
675

676
  setFullscreen( !fullScreen );
Jan Möbius's avatar
 
Jan Möbius committed
677 678 679 680
}

//-----------------------------------------------------------------------------

681 682 683 684 685 686 687 688 689 690 691
/** Enable or disable Fullscreen Mode
  */
void
CoreWidget::setFullscreen(bool _state ) {
  if ( _state )
    setWindowState( windowState() | Qt::WindowFullScreen);
  else {
    if ( windowState() & Qt::WindowFullScreen )
      setWindowState( windowState() ^  Qt::WindowFullScreen);
  }

Jan Möbius's avatar
Jan Möbius committed
692
  OpenFlipperSettings().setValue("Core/Gui/fullscreen", bool( windowState() & Qt::WindowFullScreen) );
693 694

  show();
695 696

  emit fullScreenChanged( _state );
697 698
}

699 700 701 702 703 704 705 706 707 708
//-----------------------------------------------------------------------------

void 
CoreWidget::showViewModeControls(bool _show) {
  // Only change if the actual setting has changed!
  if ( OpenFlipper::Options::gui() && ( !_show != OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() ) ) {
  
    // Update setting in Conf storage
    OpenFlipperSettings().setValue("Core/Gui/TaskSwitcher/Hide",!_show);
    
709 710 711 712 713
    // Update The Checkbox in the Menu
    AC_ShowViewModeControls_->blockSignals(true);
    AC_ShowViewModeControls_->setChecked( _show  );
    AC_ShowViewModeControls_->blockSignals(false);
    
714 715
    if ( _show ) {
      viewModeControlBox_->show();
Jan Möbius's avatar
Jan Möbius committed
716
      viewModeButton_->setVisible(true);
717 718
    } else {
      viewModeControlBox_->hide();
Jan Möbius's avatar
Jan Möbius committed
719
      viewModeButton_->setVisible(false);
720 721 722 723 724 725
    }
    
  }
  
}

Jan Möbius's avatar
 
Jan Möbius committed
726 727 728 729 730 731
//-----------------------------------------------------------------------------

/** Hide or show toolbox
  */
void
CoreWidget::toggleToolbox() {
Jan Möbius's avatar
Jan Möbius committed
732

Jan Möbius's avatar
 
Jan Möbius committed
733
  //toggle
Jan Möbius's avatar
Jan Möbius committed
734
  showToolbox( OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() );
735

736 737 738 739 740 741 742 743 744 745
}

//-----------------------------------------------------------------------------

/** Hide or show toolbox
  */
void
CoreWidget::showToolbox( bool _state ) {

  //toggle
Jan Möbius's avatar
Jan Möbius committed
746
  OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",!_state);
Jan Möbius's avatar
 
Jan Möbius committed
747

Jan Möbius's avatar
Jan Möbius committed
748
  if ( OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() ){
Jan Möbius's avatar
 
Jan Möbius committed
749 750

    //hide ViewMode Selection Widget
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
751
    toolBoxArea_->setVisible(false);
Jan Möbius's avatar
 
Jan Möbius committed
752 753

  }else{
754
    //show last view mode
Jan Möbius's avatar
Dennis:  
Jan Möbius committed
755
    toolBoxArea_->setVisible(true);
Jan Möbius's avatar
 
Jan Möbius committed
756
  }
757
  emit toolBoxVisChanged(_state);
Jan Möbius's avatar
 
Jan Möbius committed
758
}
759
//-----------------------------------------------------------------------------
760
void CoreWidget::showMenuBar( bool _state )
761
{
762 763 764 765 766
  OpenFlipperSettings().setValue("Core/Gui/MenuBar/hidden",!_state);

  if ( _state ){

    //hide ViewMode Selection Widget
767
    menuBar()->show();
768 769 770

  }else{
    //show last view mode
771
    menuBar()->hide();
772 773
  }
  emit menuBarVisChanged(_state);
774 775
}
//-----------------------------------------------------------------------------
776 777
/// Show or hide toolbar
void CoreWidget::showToolBar( bool _state )
778
{
779 780
  OpenFlipperSettings().setValue("Core/Gui/Toolbar/hidden",!_state);
  if ( !_state )
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800
  {
    //hide main toolbar
    if ( ! mainToolbar_->isFloating() )
      mainToolbar_->hide();

    //hide viewer toolbar
    if ( ! viewerToolbar_->isFloating() )
      viewerToolbar_->hide();

    for (uint p=0; p < plugins_.size(); p++)
      for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) {
        if ( ! plugins_[p].toolbars[j].second->isFloating() )
          plugins_[p].toolbars[j].second->hide();
      }
  }
  else
  {
    //show toolbars
    setViewMode( OpenFlipper::Options::currentViewMode() );
  }
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
  emit toolBarVisChanged(_state);
}
//-----------------------------------------------------------------------------
/// Hide or show menubar
void CoreWidget::toggleMenuBar()
{
  bool hidden = OpenFlipperSettings().value("Core/Gui/MenuBar/hidden",false).toBool();
  showMenuBar( hidden );
}

//-----------------------------------------------------------------------------
/// Hide or show current toolbar
void CoreWidget::toggleToolBar()
{
  bool hidden = OpenFlipperSettings().value("Core/Gui/Toolbar/hidden",false).toBool();
  showToolBar( hidden );
817
}
Jan Möbius's avatar
Jan Möbius committed
818

819

820 821
//=============================================================================

822
void CoreWidget::setToolBoxOrientationOnTheRight(bool _toolBoxRight) {
823
  QList<int> wsizes;
Jan Möbius's avatar
Jan Möbius committed
824
  
825 826
  // Is toolbox currently on the right hand side?
  bool currentstate = toolSplitter_->widget(1) == toolBoxArea_;
Jan Möbius's avatar
Jan Möbius committed
827 828
  
  if ( _toolBoxRight != currentstate ) {
829
    
Jan Möbius's avatar
Jan Möbius committed
830 831 832 833 834 835 836 837 838 839 840
    if(_toolBoxRight ) {
      
      // Show tool box on the right side of the main window
      toolSplitter_->insertWidget(0, splitter_);
      toolSplitter_->insertWidget(1, toolBoxArea_);
    } else {
      
      // Show tool box on the left side of the main window
      toolSplitter_->insertWidget(0, toolBoxArea_);
      toolSplitter_->insertWidget(1, splitter_);
    }
841
    
Jan Möbius's avatar
Jan Möbius committed
842
    // Store new setting
Jan Möbius's avatar
Jan Möbius committed
843
    OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/ToolBoxOnTheRight",_toolBoxRight);
844
    
Jan Möbius's avatar
Jan Möbius committed
845 846
    // remove the windowstates definition for the toolboxes, as it changed anyway.
    QSettings windowStates(QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() + ".OpenFlipper" +
847
                            OpenFlipper::Options::dirSeparator() +  "WindowStates.dat", QSettings::IniFormat);
Jan Möbius's avatar
Jan Möbius committed
848 849
    
    windowStates.value("Core/ToolSplitter");
850 851 852
    
  }
  
Jan Möbius's avatar
Jan Möbius committed
853

854 855 856 857 858
    
  toolSplitter_->refresh();
}
      

Jan Möbius's avatar
 
Jan Möbius committed
859 860
//=============================================================================

Jan Möbius's avatar
Jan Möbius committed
861 862
void
CoreWidget::addRecent(QString _filename, DataType _type)
Jan Möbius's avatar
 
Jan Möbius committed
863
{
864
  //dont add objects to recentMenu while loadind Settings
865
  if ( OpenFlipper::Options::sceneGraphUpdatesBlocked() ) return;
Jan Möbius's avatar
Jan Möbius committed
866

Jan Möbius's avatar
 
Jan Möbius committed
867
  OpenFlipper::Options::addRecentFile(_filename, _type);
Jan Möbius's avatar
Jan Möbius committed
868

Jan Möbius's avatar
 
Jan Möbius committed
869
  updateRecent();
Jan Möbius's avatar
Jan Möbius committed
870 871 872 873 874 875 876

}

//=============================================================================

void
CoreWidget::updateRecent()
Jan Möbius's avatar
 
Jan Möbius committed
877 878 879
{
  if ( recentFilesMenu_ == NULL)
    return;
Jan Möbius's avatar
Jan Möbius committed
880

Jan Möbius's avatar
 
Jan Möbius committed
881 882
  recentFilesMenu_->clear();

883 884
  QStringList recentFiles = OpenFlipperSettings().value("Core/File/RecentFiles", QStringList()).toStringList();
  QStringList recentTypes = OpenFlipperSettings().value("Core/File/RecentTypes", QStringList()).toStringList();
885

Jan Möbius's avatar
 
Jan Möbius committed
886
  for (int i = 0 ; i < recentFiles.size() ; ++i ) {
887

888
    QFileInfo fi(recentFiles[i]);
889

890 891 892 893
    QAction* newAction = 0;

    if (fi.suffix() == "ini") {
      newAction = recentFilesMenu_->addAction(QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator()+"Settings-Icon.png"), recentFiles[i]);
894
      newAction->setData( QVariant( QString("Unknown") ) );
895 896 897 898
    } else {
      newAction = recentFilesMenu_->addAction(typeIcon( typeId(recentTypes[i]) ), recentFiles[i]);
      newAction->setData( QVariant( recentTypes[i]) );
    }
899

Jan Möbius's avatar
 
Jan Möbius committed
900 901
  }

Jan Möbius's avatar
Jan Möbius committed
902 903 904
}

void
Jan Möbius's avatar
 
Jan Möbius committed
905 906 907
CoreWidget::closeEvent ( QCloseEvent * /* event */ ) {
  emit exit();
}
908 909

void CoreWidget::showOptionsWidget() {
Jan Möbius's avatar
Jan Möbius committed
910

911 912
  if ( OpenFlipper::Options::nogui() )
    return;
Jan Möbius's avatar
Jan Möbius committed
913

914