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";
189 if ( ! _usedToolbars.contains(
"Viewer Toolbar") )
190 _usedToolbars.prepend(
"Viewer Toolbar");
193 if ( ! _usedToolbars.contains(
"Main Toolbar") )
194 _usedToolbars.prepend(
"Main Toolbar");
210 for (
int i = 0 ; i <
viewModes_.size(); i++) {
222 vm->
icon =
"Unknown.png";
224 vm->
visibleToolbars = QString(
"Main Toolbar;Viewer Toolbar").split(
";");
259 for (
int i = 0 ; i <
viewModes_.size(); i++) {
271 vm->
icon = _iconName;
293 vm->
icon = _iconName;
323 slotChangeView(_mode, QStringList(), QStringList(), QStringList(), _expandAll);
338 widget->setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
339 connect(widget, SIGNAL(changeView(QString, QStringList, QStringList, QStringList)),
this, SLOT(
slotChangeView(QString, QStringList, QStringList, QStringList)) );
340 connect(widget, SIGNAL(saveMode(QString,
bool, QStringList, QStringList, QStringList)),
this, SLOT(
slotAddViewModeComplete(QString,
bool, QStringList, QStringList, QStringList)) );
341 connect(widget, SIGNAL(removeMode(QString)),
this, SLOT(
slotRemoveViewMode(QString)) );
343 widget->
show( OpenFlipper::Options::currentViewMode() );
353 void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus,
bool _expandAll ){
356 if (_mode !=
"" && _toolboxWidgets.size() == 0 && _toolbars.size() == 0)
359 _toolboxWidgets =
viewModes_[i]->visibleToolboxes;
361 _contextmenus =
viewModes_[i]->visibleContextMenus;
366 if (_mode != OpenFlipper::Options::currentViewMode()) {
372 for (
int i=0; i < _toolboxWidgets.size(); i++) {
373 for (uint p=0; p < plugins_.size(); p++){
374 for ( uint j = 0 ; j < plugins_[p].toolboxWidgets.size(); ++j )
375 if (_toolboxWidgets[i] == plugins_[p].toolboxWidgets[j].first ) {
387 toolBox_->
addItem (plugins_[p].plugin, plugins_[p].toolboxWidgets[j].second, plugins_[p].toolboxWidgets[j].first, plugins_[p].toolboxIcons[j], plugins_[p].headerAreaWidgets[j].second );
390 if (i < toolBox_->lastPos_) {
397 if (plugins_[p].name ==
"Scripting") {
399 QFile statesFile(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() +
"WindowStates.dat");
401 if (statesFile.exists() ) {
402 QSettings windowStates(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() +
"WindowStates.dat", QSettings::IniFormat);
405 windowStates.beginGroup (
"Core");
406 windowStates.beginGroup(
"SideArea");
407 windowStates.beginGroup(_toolboxWidgets[i]);
408 bool active = windowStates.value (
"Active",
false).toBool();
409 windowStates.endGroup();
410 windowStates.endGroup();
411 windowStates.endGroup();
421 if (_mode != OpenFlipper::Options::currentViewMode()) {
431 for (uint p=0; p < plugins_.size(); p++)
432 for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j )
433 if (_toolbars.contains( plugins_[p].toolbars[j].first ) )
434 plugins_[p].toolbars[j].second->show();
436 plugins_[p].toolbars[j].second->hide();
440 if ( _toolbars.contains(tr(
"Main Toolbar")) )
446 if ( _toolbars.contains(tr(
"Viewer Toolbar")) )
454 OpenFlipper::Options::currentViewMode(_mode);
471 if(!OpenFlipper::Options::glStereo()) {
474 stereoSettingsWidget_->stereoOpengl->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::OpenGL);
478 stereoSettingsWidget_->stereoAnaglyph->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphRedCyan);
479 stereoSettingsWidget_->stereoCustomAnaglyph->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphCustom);
495 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
499 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
502 OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
511 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i) {
void moveItemToPosition(const QString &_name, int _position)
Move a toolbox widget to a given position.
QActionGroup * viewGroup_
Group for all menu items.
QToolBar * viewerToolbar_
Called by Plugins to add a Toolbar.
const QList< const QObject * > & plugins()
Get plugins in side area.
void show(QString _lastMode)
overloaded show function
void restoreViewModeState(const QString &_viewMode)
restores the active state of _viewMode
void moveToolBoxToBottom(QString _name)
Move a specific toolbox widget to the bottom of the side area.
bool custom
Is this a user defined custom view mode or a plugin generated one.
void slotApplyStereoSettings(int _tmpParam=0)
QStringList visibleToolboxes
List of Visible Toolboxes in this view mode.
ViewMode struct This struct contains a ViewMode and its status information such as used widgets...
QMenu * viewMenu_
View Menu.
StereoSettingsWidget * stereoSettingsWidget_
Widget to change stereo settings.
SideArea * toolBox_
Toolbox.
void closeChangeViewModePopup()
Closes the change view mode popup.
void setViewMode(QString _mode, bool _expandAll=false)
Set the view Mode to the given Mode.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void slotAddViewModeContextMenus(QString _mode, QStringList _usedToolbars)
Add or change Toolbars for a ViewMode (non-userdefined viewMode)
void slotViewModeDialog()
Show a dialog in which the viewMode can be edited.
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll=false)
Slot for Changing visible toolWidgets.
QMenu * viewModeMenu_
Submenu holding all ViewMode actions.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
QAction * viewModeButton_
a List of all widgets in the toolbar
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
viewModeChangeWidget * modeChangeWidget
Handle to picking toolbar.
QStringList visibleToolbars
List of Toolbars in this view mode.
QToolButton * stereoButton_
Called by Plugins to add a Toolbar.
void addItem(QObject const *const _plugin, QWidget *_w, QString _name, QIcon *_icon=0, QWidget *_headerAreaWidget=0)
void slotAddViewModeToolboxes(QString _mode, QStringList _usedWidgets)
Add or change Toolboxes for a ViewMode (non-userdefined viewMode)
const QStringList & names()
Get item names.
QString name
Name of the View Mode.
void slotRemoveViewMode(QString _name)
Remove viewMode.
int getNumberOfWidgets() const
Get number of widgets.
std::vector< glViewer * > examiner_widgets_
Examiner Widget.
void clear()
clears the whole tool widget area
void initViewModes()
init ViewModes that were loaded via ini-file
void saveViewModeState(const QString &_viewMode)
saves the active state of _viewMode
QStringList visibleContextMenus
List of context Menus in this view mode.
void slotSetViewModeIcon(QString _mode, QString _iconName)
Sets the Icon for a given View Mode (non-userdefined viewMode)
void slotAddViewModeToolbars(QString _mode, QStringList _usedToolbars)
Add or change Toolbars for a ViewMode (non-userdefined viewMode)
void stereoButtonContextMenu(const QPoint &_pos)
Creates custom context menu for stereo viewer settings.
void slotSetViewMode(QAction *action)
Slot for setting ViewMode from Menu.
void slotAddViewModeComplete(QString _mode, bool _custom, QStringList _toolboxes, QStringList _toolbars, QStringList _contextmenus)
Completly configure a view mode ( set toolbars, toolboxes, context menus, ... )
void moveToolBoxToTop(QString _name)
Move a specific toolbox widget to the top of the side area.
void slotUpdateExaminer(unsigned _id)
update the content of the specified examiner
QVector< ViewMode * > & viewModes_
List of currently available viewModes.
void setElementActive(QString _name, bool _active)
set the active state of given element