54 #include <OpenFlipper/widgets/viewModeWidget/viewModeWidget.hh>
55 #include <OpenFlipper/widgets/viewModeWidget/viewModeChangeWidget.hh>
72 bool seenCustom =
false;
83 QAction* acViewMode =
new QAction(
viewModes_[i]->name,
this);
84 acViewMode->setStatusTip(tr(
"Change ViewMode"));
107 for (
int i = 0 ; i <
viewModes_.size(); i++) {
119 vm->
icon =
"Unknown.png";
121 vm->
visibleToolbars = QString(
"Main Toolbar;Viewer Toolbar").split(
";");
154 for (
int i = 0 ; i <
viewModes_.size(); i++) {
166 vm->
icon =
"Unknown.png";
187 if ( ! _usedToolbars.contains(
"Viewer Toolbar") )
188 _usedToolbars.prepend(
"Viewer Toolbar");
191 if ( ! _usedToolbars.contains(
"Main Toolbar") )
192 _usedToolbars.prepend(
"Main Toolbar");
208 for (
int i = 0 ; i <
viewModes_.size(); i++) {
220 vm->
icon =
"Unknown.png";
222 vm->
visibleToolbars = QString(
"Main Toolbar;Viewer Toolbar").split(
";");
257 for (
int i = 0 ; i <
viewModes_.size(); i++) {
269 vm->
icon = _iconName;
287 vm->
icon = _iconName;
317 slotChangeView(_mode, QStringList(), QStringList(), QStringList(), _expandAll);
332 widget->setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
333 connect(widget, SIGNAL(changeView(QString, QStringList, QStringList, QStringList)),
this, SLOT(
slotChangeView(QString, QStringList, QStringList, QStringList)) );
334 connect(widget, SIGNAL(saveMode(QString,
bool, QStringList, QStringList, QStringList)),
this, SLOT(
slotAddViewModeComplete(QString,
bool, QStringList, QStringList, QStringList)) );
335 connect(widget, SIGNAL(removeMode(QString)),
this, SLOT(
slotRemoveViewMode(QString)) );
337 widget->
show( OpenFlipper::Options::currentViewMode() );
347 void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus,
bool _expandAll ){
350 if (_mode !=
"" && _toolboxWidgets.size() == 0 && _toolbars.size() == 0)
353 _toolboxWidgets =
viewModes_[i]->visibleToolboxes;
355 _contextmenus =
viewModes_[i]->visibleContextMenus;
360 if (_mode != OpenFlipper::Options::currentViewMode()) {
366 for (
int i=0; i < _toolboxWidgets.size(); i++) {
367 for (uint p=0; p < plugins_.size(); p++){
368 for ( uint j = 0 ; j < plugins_[p].toolboxWidgets.size(); ++j )
369 if (_toolboxWidgets[i] == plugins_[p].toolboxWidgets[j].first ) {
381 toolBox_->
addItem (plugins_[p].plugin, plugins_[p].toolboxWidgets[j].second, plugins_[p].toolboxWidgets[j].first, plugins_[p].toolboxIcons[j], plugins_[p].headerAreaWidgets[j].second );
384 if (i < toolBox_->lastPos_) {
391 if (plugins_[p].name ==
"Scripting") {
393 QFile statesFile(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() +
"WindowStates.dat");
395 if (statesFile.exists() ) {
396 QSettings windowStates(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() +
"WindowStates.dat", QSettings::IniFormat);
399 windowStates.beginGroup (
"Core");
400 windowStates.beginGroup(
"SideArea");
401 windowStates.beginGroup(_toolboxWidgets[i]);
402 bool active = windowStates.value (
"Active",
false).toBool();
403 windowStates.endGroup();
404 windowStates.endGroup();
405 windowStates.endGroup();
415 if (_mode != OpenFlipper::Options::currentViewMode()) {
425 for (uint p=0; p < plugins_.size(); p++)
426 for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j )
427 if (_toolbars.contains( plugins_[p].toolbars[j].first ) )
428 plugins_[p].toolbars[j].second->show();
430 plugins_[p].toolbars[j].second->hide();
434 if ( _toolbars.contains(tr(
"Main Toolbar")) )
440 if ( _toolbars.contains(tr(
"Viewer Toolbar")) )
448 OpenFlipper::Options::currentViewMode(_mode);
465 if(!OpenFlipper::Options::glStereo()) {
468 stereoSettingsWidget_->stereoOpengl->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::OpenGL);
472 stereoSettingsWidget_->stereoAnaglyph->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphRedCyan);
473 stereoSettingsWidget_->stereoCustomAnaglyph->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphCustom);
489 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
493 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
496 OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
505 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i) {
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void slotSetViewMode(QAction *action)
Slot for setting ViewMode from Menu.
const QList< const QObject * > & plugins()
Get plugins in side area.
void moveToolBoxToBottom(QString _name)
Move a specific toolbox widget to the bottom of the side area.
void slotAddViewModeToolboxes(QString _mode, QStringList _usedWidgets)
Add or change Toolboxes for a ViewMode (non-userdefined viewMode)
void slotApplyStereoSettings(int _tmpParam=0)
void moveItemToPosition(const QString &_name, int _position)
Move a toolbox widget to a given position.
QMenu * viewMenu_
View Menu.
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
void slotAddViewModeContextMenus(QString _mode, QStringList _usedToolbars)
Add or change Toolbars for a ViewMode (non-userdefined viewMode)
void setElementActive(QString _name, bool _active)
set the active state of given element
void show(QString _lastMode)
overloaded show function
SideArea * toolBox_
Toolbox.
void slotViewModeDialog()
Show a dialog in which the viewMode can be edited.
QMenu * viewModeMenu_
Submenu holding all ViewMode actions.
void slotSetViewModeIcon(QString _mode, QString _iconName)
Sets the Icon for a given View Mode (non-userdefined viewMode)
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll=false)
Slot for Changing visible toolWidgets.
void slotUpdateExaminer(unsigned _id)
update the content of the specified examiner
void slotRemoveViewMode(QString _name)
Remove viewMode.
int getNumberOfWidgets() const
Get number of widgets.
void saveViewModeState(const QString &_viewMode)
saves the active state of _viewMode
void initViewModes()
init ViewModes that were loaded via ini-file
QStringList visibleContextMenus
List of context Menus in this view mode.
bool custom
Is this a user defined custom view mode or a plugin generated one.
QString name
Name of the View Mode.
QStringList visibleToolboxes
List of Visible Toolboxes in this view mode.
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.
const QStringList & names()
Get item names.
viewModeChangeWidget * modeChangeWidget
Handle to picking toolbar.
QActionGroup * viewGroup_
Group for all menu items.
void closeChangeViewModePopup()
Closes the change view mode popup.
void restoreViewModeState(const QString &_viewMode)
restores the active state of _viewMode
void clear()
clears the whole tool widget area
ViewMode struct This struct contains a ViewMode and its status information such as used widgets...
void moveToolBoxToTop(QString _name)
Move a specific toolbox widget to the top of the side area.
void addItem(QObject const *const _plugin, QWidget *_w, QString _name, QIcon *_icon=0, QWidget *_headerAreaWidget=0)
void slotAddViewModeComplete(QString _mode, bool _custom, QStringList _toolboxes, QStringList _toolbars, QStringList _contextmenus)
Completly configure a view mode ( set toolbars, toolboxes, context menus, ... )
QAction * viewModeButton_
a List of all widgets in the toolbar
QStringList visibleToolbars
List of Toolbars in this view mode.
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...
QToolButton * stereoButton_
Called by Plugins to add a Toolbar.
QToolBar * viewerToolbar_
Called by Plugins to add a Toolbar.
void slotAddViewModeToolbars(QString _mode, QStringList _usedToolbars)
Add or change Toolbars for a ViewMode (non-userdefined viewMode)
StereoSettingsWidget * stereoSettingsWidget_
Widget to change stereo settings.
std::vector< glViewer * > examiner_widgets_
Examiner Widget.