48 #include <OpenFlipper/widgets/viewModeWidget/viewModeWidget.hh> 49 #include <OpenFlipper/widgets/viewModeWidget/viewModeChangeWidget.hh> 66 bool seenCustom =
false;
77 QAction* acViewMode =
new QAction(
viewModes_[i]->name,
this);
78 acViewMode->setStatusTip(tr(
"Change ViewMode"));
101 for (
int i = 0 ; i <
viewModes_.size(); i++) {
113 vm->
icon =
"Unknown.png";
115 vm->
visibleToolbars = QString(
"Main Toolbar;Viewer Toolbar").split(
";");
148 for (
int i = 0 ; i <
viewModes_.size(); i++) {
160 vm->
icon =
"Unknown.png";
183 if ( ! _usedToolbars.contains(
"Viewer Toolbar") )
184 _usedToolbars.prepend(
"Viewer Toolbar");
187 if ( ! _usedToolbars.contains(
"Main Toolbar") )
188 _usedToolbars.prepend(
"Main Toolbar");
204 for (
int i = 0 ; i <
viewModes_.size(); i++) {
216 vm->
icon =
"Unknown.png";
218 vm->
visibleToolbars = QString(
"Main Toolbar;Viewer Toolbar").split(
";");
253 for (
int i = 0 ; i <
viewModes_.size(); i++) {
265 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 ) {
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) {
void moveToolBoxToBottom(QString _name)
Move a specific toolbox widget to the bottom of the side area.
void setViewMode(QString _mode, bool _expandAll=false)
Set the view Mode to the given Mode.
QStringList visibleContextMenus
List of context Menus in this view mode.
void slotViewModeDialog()
Show a dialog in which the viewMode can be edited.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void slotSetViewModeIcon(QString _mode, QString _iconName)
Sets the Icon for a given View Mode (non-userdefined viewMode)
void closeChangeViewModePopup()
Closes the change view mode popup.
bool custom
Is this a user defined custom view mode or a plugin generated one.
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll=false)
Slot for Changing visible toolWidgets.
QStringList visibleToolbars
List of Toolbars in this view mode.
QToolButton * stereoButton_
Called by Plugins to add a Toolbar.
void restoreViewModeState(const QString &_viewMode)
restores the active state of _viewMode
StereoSettingsWidget * stereoSettingsWidget_
Widget to change stereo settings.
QString name
Name of the View Mode.
void slotUpdateExaminer(unsigned _id)
update the content of the specified examiner
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...
void slotAddViewModeContextMenus(QString _mode, QStringList _usedToolbars)
Add or change Toolbars for a ViewMode (non-userdefined viewMode)
std::vector< PluginInfo > & plugins()
Convenient way to access plugin list.
SideArea * toolBox_
Toolbox.
QActionGroup * viewGroup_
Group for all menu items.
void moveItemToPosition(const QString &_name, int _position)
Move a toolbox widget to a given position.
void moveToolBoxToTop(QString _name)
Move a specific toolbox widget to the top of the side area.
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
void stereoButtonContextMenu(const QPoint &_pos)
Creates custom context menu for stereo viewer settings.
void slotApplyStereoSettings(int _tmpParam=0)
const QStringList & names()
Get item names.
void slotRemoveViewMode(QString _name)
Remove viewMode.
void slotAddViewModeToolbars(QString _mode, QStringList _usedToolbars)
Add or change Toolbars for a ViewMode (non-userdefined viewMode)
QStringList visibleToolboxes
List of Visible Toolboxes in this view mode.
void saveViewModeState(const QString &_viewMode)
saves the active state of _viewMode
ViewMode struct This struct contains a ViewMode and its status information such as used widgets...
viewModeChangeWidget * modeChangeWidget
Handle to picking toolbar.
QToolBar * mainToolbar_
Called by Plugins to add a Toolbar.
void setElementActive(QString _name, bool _active)
set the active state of given element
void initViewModes()
init ViewModes that were loaded via ini-file
const QList< const QObject * > & plugins()
Get plugins in side area.
int getNumberOfWidgets() const
Get number of widgets.
std::vector< glViewer *> examiner_widgets_
Examiner Widget.
void clear()
clears the whole tool widget area
QToolBar * viewerToolbar_
Called by Plugins to add a Toolbar.
QVector< ViewMode * > & viewModes_
List of currently available viewModes.
void slotSetViewMode(QAction *action)
Slot for setting ViewMode from Menu.
void show(QString _lastMode)
overloaded show function
QMenu * viewMenu_
View Menu.
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)