65 #include <OpenFlipper/common/RecentFiles.hh>
66 #include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh>
68 #include <OpenFlipper/widgets/videoCaptureDialog/VideoCaptureDialog.hh>
71 #include <ACG/GL/ShaderCache.hh>
76 #define WIDGET_HEIGHT 800
77 #define WIDGET_WIDTH 800
81 PickMode::PickMode(
const std::string& _n,
const bool _t,
const bool _v, QCursor _c, QToolBar *_tb ) :
139 std::vector<PluginInfo>& _plugins,
140 QList< SlotInfo >& _coreSlots ) :
142 coreSlots_(_coreSlots),
143 shiftPressed_(false),
144 viewModes_(_viewModes),
152 AC_ShowViewModeControls_(0),
153 pickToolBarExternal_(0),
155 sceneGraphDialog_(0),
156 viewModeChangePopupAction_(0),
171 perspectiveProjectionAction_(0),
173 availableGlobalDrawModes_(0),
175 contextSelectionMenu_(0),
178 viewerDrawMenuWidget_(0),
184 postProcessorDialog_(0),
186 rendererObjectWidget_(0),
187 stereoSettingsWidget_(0),
191 stereoActive_(false),
192 actionMode_(
Viewer::PickingMode),
193 lastActionMode_(
Viewer::ExamineMode),
210 QGLFormat format = QGLFormat::defaultFormat();
213 format.setStereo(
false);
215 format.setStereo( OpenFlipper::Options::stereo() );
217 format.setAlpha(
true);
218 format.setStencil(
true);
219 format.setSampleBuffers(
true);
220 QGLFormat::setDefaultFormat(format);
231 QGLWidget*
test =
new QGLWidget(format);
232 if ( ! test->format().stereo() ) {
234 format.setStereo(
false);
235 QGLFormat::setDefaultFormat(format);
244 format.setProfile(QGLFormat::CompatibilityProfile);
246 #if QT_VERSION >= 0x050000
249 format.setVersion(4,3);
259 OpenFlipper::Options::glStereo(
glWidget_->format().stereo());
262 glView_->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
264 glView_->setFrameStyle(QFrame::NoFrame);
289 logWidget_->setSizePolicy( QSizePolicy ( QSizePolicy::Preferred , QSizePolicy::Preferred ) );
301 if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene) {
307 }
else if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden) {
322 unsigned int maxPases = 1;
326 if ( !
OpenFlipperSettings().value(
"Core/Gui/glViewer/useMultipleViewers",
true).toBool() ) {
345 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
354 this, SLOT(
getPickMode(std::string&) ),Qt::DirectConnection );
356 this, SLOT(
setPickMode(
const std::string) ),Qt::DirectConnection );
358 this, SLOT(
getActionMode(Viewer::ActionMode&) ),Qt::DirectConnection );
360 this, SLOT(
setActionMode(
const Viewer::ActionMode)), Qt::DirectConnection );
366 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
389 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
401 statusBar_, SLOT(showMessage(
const QString&,
int)));
429 moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"transform-move.png") );
433 moveButton_->setToolTip( tr(
"Switch to <b>move</b> mode.") );
435 "Switch to <b>move</b> mode.<br>"
436 "<ul><li><b>Rotate</b> using <b>left</b> mouse button.</li>"
437 "<li><b>Translate</b> using <b>middle</b> mouse button.</li>"
438 "<li><b>Zoom</b> using <b>left+middle</b> mouse buttons.</li></ul>" ));
450 pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"pick.png") );
454 pickButton_->setToolTip(tr(
"Switch to <b>picking</b> mode."));
456 "Switch to <b>picking</b> mode.<br>"
457 "Use picking functions like flipping edges.<br>"
458 "To change the mode use the right click<br>"
459 "context menu in the viewer."));
465 questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"help-about.png") );
469 questionButton_->setToolTip(tr(
"Switch to <b>identification</b> mode."));
471 "Switch to <b>identification</b> mode.<br>"
472 "Use identification mode to get information "
473 "about objects. Click on an object and see "
474 "the log output for information about the "
484 "Switch <b>viewer layout</b>.<br>"
485 "Select the desired viewer layout. "
486 "Possible layouts are: "
488 "<li>Single viewer</li>"
489 "<li>Double viewer</li>"
490 "<li>Multiple viewers (grid)</li>"
491 "<li>Multiple viewers (hsplit)</li>"
494 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"singleviewmode.png"),
"");
495 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"doubleviewmode.png"),
"");
496 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"multiviewmode1.png"),
"");
497 viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"multiviewmode2.png"),
"");
507 if (OpenFlipper::Options::stereo())
510 stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"mono.png") );
518 "Toggle stereo mode<br><br>"
519 "Use this button to switch between stereo "
520 "and mono view. To use this feature you need "
521 "a stereo capable graphics card and a stereo "
522 "display/projection system."));
527 stereoAction->setText( tr(
"Stereo"));
537 if(wsizes.size() > 1) {
551 QHBoxLayout *hLayout =
new QHBoxLayout;
562 viewModePopupBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"preferences.png"));
570 SIGNAL(changeView(QString, QStringList, QStringList, QStringList)),
572 SLOT(
slotChangeView(QString, QStringList, QStringList, QStringList)));
579 hLayout->setContentsMargins(0, 0, 0, 0);
580 hLayout->addStretch(1);
597 QVBoxLayout *vLayout =
new QVBoxLayout;
600 vLayout->setContentsMargins(0, 0, 0, 0);
601 vLayout->setSpacing(0);
614 if (
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/ToolBoxOnTheRight",
true).toBool() ) {
636 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
637 connect(
examiner_widgets_[i] , SIGNAL(signalCustomContextMenuRequested(
const QPoint&) ) ,
646 statusBar_->showMessage(tr(
"Ready"), 5000);
652 setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
717 setWindowState( windowState() | Qt::WindowFullScreen);
719 if ( windowState() & Qt::WindowFullScreen )
720 setWindowState( windowState() ^ Qt::WindowFullScreen);
735 if ( OpenFlipper::Options::gui() && ( !_show !=
OpenFlipperSettings().value(
"Core/Gui/TaskSwitcher/Hide",
false).toBool() ) ) {
821 for (uint p=0; p < plugins_.size(); p++)
822 for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) {
823 if ( ! plugins_[p].toolbars[j].second->isFloating() )
824 plugins_[p].toolbars[j].second->hide();
830 setViewMode( OpenFlipper::Options::currentViewMode() );
859 if ( _toolBoxRight != currentstate ) {
877 QSettings windowStates(QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
".OpenFlipper" +
878 OpenFlipper::Options::dirSeparator() +
"WindowStates.dat", QSettings::IniFormat);
880 windowStates.value(
"Core/ToolSplitter");
896 if ( OpenFlipper::Options::sceneGraphUpdatesBlocked() )
return;
898 OpenFlipper::Options::addRecentFile(_filename, _type);
917 for (
int i = 0 ; i < recentFiles.size() ; ++i ) {
919 QFileInfo fi(recentFiles[i]);
921 QAction* newAction = 0;
923 if (fi.suffix() ==
"ini") {
924 newAction =
recentFilesMenu_->addAction(QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator()+
"Settings-Icon.png"), recentFiles[i]);
925 newAction->setData( QVariant( QString(
"Unknown") ) );
928 newAction->setData( QVariant( recentTypes[i]) );
942 if ( OpenFlipper::Options::nogui() )
949 connect(
optionsWidget_,SIGNAL(addKeyMapping(
int,Qt::KeyboardModifiers,QObject*,
int)),
952 optionsWidget_->setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
957 center.setX( x() + width() / 2 );
958 center.setY( y() + height() / 2 );
972 case QtMultiViewLayout::SingleView:
979 case QtMultiViewLayout::DoubleView:
986 case QtMultiViewLayout::Grid:
993 case QtMultiViewLayout::HSplit:
1008 if (
OpenFlipperSettings().value(
"Core/Gui/glViewer/useMultipleViewers",
true).toBool() ) {
1028 emit log(
LOGERR,tr(
"Requested illegal multiview mode!"));
1046 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
1073 CoreWidget::startVideoCaptureDialog(){
1076 dialog->setModal(
false);
1078 connect(dialog, SIGNAL(startVideoCapture(QString,
int,
bool)),
this, SIGNAL(startVideoCapture(QString,
int,
bool)) );
1079 connect(dialog, SIGNAL(resizeViewers(
int,
int)),
this, SIGNAL(resizeViewers(
int,
int)) );
1080 connect(dialog, SIGNAL(resizeApplication(
int,
int)),
this, SIGNAL(resizeApplication(
int,
int)) );
1094 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
1099 if (postProcessorDialog_)
1100 postProcessorDialog_->
refresh();
1120 if( _event->type() == QEvent::WhatsThisClicked )
1122 QWhatsThisClickedEvent *wtcEvent =
static_cast<QWhatsThisClickedEvent*
>(_event);
1123 QWhatsThis::hideText();
1128 return QMainWindow::event(_event);
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
void drawModeChanged(int _viewerId)
The viewer with id _viewerId changed its draw Mode.
void setForceNative(bool _enabled)
Enabled/Disables native cursors.
DLLEXPORT QIcon & typeIcon(DataType _id)
Get an QIcon associated with the given DataType.
bool tracking() const
PickMode mouse tracking.
void getActionMode(Viewer::ActionMode &_am)
void dropEvent(QDropEvent *_event)
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
static const QString homePage_
Pointer to the help Browser.
void changeHelpSite(QUrl)
Pointer to the help Browser.
void addCoreLicenseInfo()
Add license information about core parts.
void registerCoreKeys()
Register all events related to the core.
void slotApplyStereoSettings(int _tmpParam=0)
QtGLGraphicsView * glView_
graphics view that holds the gl scene
CursorPainter * cursorPainter_
Cursor handling.
QWidgetAction * viewModeChangePopupAction_
Handle to picking toolbar.
std::string name_
Name of the pickMode.
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
void addItem(QGraphicsWidget *_item, unsigned int _pos)
Adds Widget to Layout.
void registerViewer(glViewer *_viewer)
Add a glViewer that will use this CursorPainter.
QtGLGraphicsScene * glScene_
graphics scene used to paint gl context and widgets
void dragEnterEvent(QDragEnterEvent *_event)
void setForceNativeCursor(bool _state)
Use native or gl painted cursor.
SideArea * toolBox_
Toolbox.
void showToolBar(bool _state)
Show or hide toolbar, emits toolBarToggled( bool _state )
void saveOptions()
Pointer to the OptionsWidget.
void setFullscreen(bool _state)
Enable or disable fullscreen mode.
QSplitter * toolSplitter_
Spliter between toplevel objects and toolbox.
void updateRecent()
Update the recent files menu.
void slotViewModeDialog()
Show a dialog in which the viewMode can be edited.
void showViewModeControls(bool _show)
Hide or show the View Mode controls.
QToolButton * questionButton_
Called by Plugins to add a Toolbar.
void slotCustomContextMenu(const QPoint &_point)
This slot is called by the examiner widgets gl area when a context menu is requested.
void closeEvent(QCloseEvent *event)
Called on applications close.
MultiViewMode mode() const
Retruns current layout modes.
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll=false)
Slot for Changing visible toolWidgets.
void slotToggleStereoMode()
Enable or disable Stereo.
LoggerWidget * logWidget_
Textedit at the bottom for log messages.
void showOptionsWidget()
Display the Options Browser.
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator * > getSceneGraphGeneratorList()
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
void toolBoxVisChanged(bool _state)
will be emitted if the visibility of the toolbox is changed
void setViewerLayout(int _idx)
Change viewer layout that was selected in the combo box.
QtMultiViewLayout * baseLayout_
Base layout that holds gl views.
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void menuBarVisChanged(bool _state)
will be emitted if the visibility of the menubar is changed
void getPickMode(std::string &_name)
std::vector< QAction * > extended_actions
QGraphicsWidget * centerWidget_
center widged
void toggleFullscreen()
Set application to Fullscreen and back.
void slotActivateExaminer()
void nextViewerLayout()
Switches over to the next view mode.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
void slotAddToolbar(QToolBar *_toolbar)
Called by Plugins to add a Toolbar.
void setViewers(std::vector< glViewer * > _viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
void slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject *_plugin, int _keyBindingID)
add a new key Mapping
QWidget * toolBoxArea_
Widget for toolBox.
void updateGeometry()
recalculate geometry
void showToolbox(bool _state)
Show or hide toolbox.
HelpWidget * helpWidget_
Pointer to the help Browser.
QSplitter * splitter_
Spliter between toplevel objects and the textedit at the bottom.
void setActionMode(const Viewer::ActionMode _am)
Implementation of the logger Widget.
void setViewMode(QString _mode, bool _expandAll=false)
Set the view Mode to the given Mode.
void stereoButtonContextMenu(const QPoint &_pos)
Creates custom context menu for stereo viewer settings.
QGLWidget * glWidget_
gl widget used as drawing area to paint the graphics scene
void setToolBoxOrientationOnTheRight(bool _toolBoxRight)
Set orientation of tool box (either on the right or the left side of the screen)
void analyzeSceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int &_maxPasses, ACG::Vec3d &_bbmin, ACG::Vec3d &_bbmax)
QtSlideWindow * slidingLogger_
Class that holds the animated log widget.
void attachWidget(QWidget *_m)
attach a child widget
PickMode(const std::string &_n, const bool _t, const bool _v, QCursor _c, QToolBar *_tb=0)
Constructor.
std::string name() const
PickMode Name.
viewModeChangeWidget * modeChangeWidget
Handle to picking toolbar.
void showLoggerInSplitView(bool _show)
Show logger in splitter or not.
QStackedWidget * stackedWidget_
Container widget for holding multiple views.
void closeChangeViewModePopup()
Closes the change view mode popup.
void addRecent(QString _filename, DataType _type)
Add a recent file and update menu.
void shareGLWidget(QGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
void showMenuBar(bool _state)
Show or hide menubar.
bool visible() const
PickMode visible.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
void slotShowSceneGraphDialog()
OpenFlipper::Options::LoggerState loggerState_
Show logger in splitter or not.
void startDrag(QMouseEvent *_event)
void setPrimary(unsigned int _i)
Sets primary element for SingleView and HSplit.
bool stereoActive_
The viewer with id _viewerId changed its draw Mode.
ACG::QtWidgets::QtSceneGraphDialog * sceneGraphDialog_
Handle to picking toolbar.
void sceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
QToolButton * pickButton_
Called by Plugins to add a Toolbar.
QMenu * contextMenu_
context Menu for the gl area
void toggleToolbox()
Hide or show toolbox area.
void toolBarVisChanged(bool _state)
will be emitted if the visibility of the toolbar is changed
QCursor cursor() const
PickMode cursor.
void setGeneratorMap(QMap< std::string, SceneGraphWidgetGenerator * > _map)
Set a complete generator map (this will overwrite the existing one!
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
bool event(QEvent *event)
typedefs
Add normals to mesh item (vertices/faces)
void toggleToolBar()
Hide or show current toolbar.
QScrollArea * toolBoxScroll_
Toolbox scroll area.
QMenu * recentFilesMenu_
QMenu containing the recently opened files.
QToolButton * viewModePopupBtn_
view mode gear icon at the upper left of the tool box
std::vector< StackWidgetInfo > stackWidgetList_
QMenu containing the recently opened files.
void setEnabled(bool _enabled)
Enabled/Disables gl cursor painting.
int originalLoggerSize_
Size of the logging window ( defaults to 240 )
QAction * viewModeButton_
a List of all widgets in the toolbar
void refresh()
refreshes the content of the dialog with current examiner
QMenu * contextSelectionMenu_
Context Menu containing all selection elements.
QVector< ViewMode * > & viewModes_
List of currently available viewModes.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
void showHelpBrowser(const QString &page=homePage_)
Display the help Browser.
void toggleMenuBar()
Hide or show menu bar.
void setDebugOutputDir(const char *_outputDir)
Enable debug output of generated shaders to specified directory.
QToolButton * stereoButton_
Called by Plugins to add a Toolbar.
InverseKeyMap invKeys_
mapping of all registered keys and the corresponding plugins to currently assigned keys ...
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
QToolBar * viewerToolbar_
Called by Plugins to add a Toolbar.
void setMode(MultiViewMode _mode)
Sets layout mode.
QSize defaultIconSize_
Show logger in splitter or not.
QAction * AC_ShowViewModeControls_
Action for View Mode Widget Conrol in Menu.
void fullScreenChanged(bool _state)
will be emitted if the fullscreen state is changed (_state = true => in fullscreen) ...
CoreWidget(QVector< ViewMode * > &_viewModes, std::vector< PluginInfo > &_plugins, QList< SlotInfo > &_coreSlots)
constructor
void setPickMode(const std::string &_name)
void setTimeCheck(bool _on)
enable or disable checking of the time step of each file
QComboBox * viewerLayoutBox_
Called by Plugins to add a Toolbar.
std::vector< KeyBinding > coreKeys_
vector of keys registered to the core
QToolButton * moveButton_
Called by Plugins to add a Toolbar.
void sceneRectChanged(const QRectF &rect)
StereoSettingsWidget * stereoSettingsWidget_
Widget to change stereo settings.
QWidget * viewModeControlBox_
Group box containing Task Switcher Controls.
std::vector< glViewer * > examiner_widgets_
Examiner Widget.
void setupMenuBar()
Setup the main menubar.
QToolBar * toolbar() const
PickMode toolbar.
OptionsWidget * optionsWidget_
Pointer to the OptionsWidget.
void applyOptions()
Pointer to the OptionsWidget.