Commit c6c4e55d authored by Jan Möbius's avatar Jan Möbius

Marlin:

ViewMode extended to include context menus

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8860 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6b563bcf
...@@ -99,6 +99,16 @@ class ViewModeInterface { ...@@ -99,6 +99,16 @@ class ViewModeInterface {
*/ */
virtual void defineViewModeToolbars(QString /*_mode*/, QStringList /*_usedToolbars*/){}; virtual void defineViewModeToolbars(QString /*_mode*/, QStringList /*_usedToolbars*/){};
/** \brief Defines a ViewMode for the Toolbars
*
* With this function you can define a set of context menus which should be visible
* for the specified view mode.
*
* @param _mode name of the ViewMode
* @param _usedWidgets list of used context menus
*/
virtual void defineViewModeContextMenus(QString /*_mode*/, QStringList /*_usedContextMenus*/){};
/** \brief Defines an Icon for a ViewMode /** \brief Defines an Icon for a ViewMode
* *
* With this function you can define an Icon associated with this view mode * With this function you can define an Icon associated with this view mode
......
...@@ -500,8 +500,8 @@ Core::init() { ...@@ -500,8 +500,8 @@ Core::init() {
//get keyAssignments from config files //get keyAssignments from config files
restoreKeyBindings(); restoreKeyBindings();
if ( OpenFlipper::Options::defaultToolboxMode( ) != "" ) if ( OpenFlipper::Options::currentViewMode( ) != "" )
coreWidget_->setViewMode( OpenFlipper::Options::defaultToolboxMode() ); coreWidget_->setViewMode( OpenFlipper::Options::currentViewMode() );
else else
coreWidget_->setViewMode("All"); coreWidget_->setViewMode("All");
......
...@@ -441,6 +441,13 @@ public slots: ...@@ -441,6 +441,13 @@ public slots:
@param _toolboxList ; seperated list of toolbars in the view mode @param _toolboxList ; seperated list of toolbars in the view mode
*/ */
void addViewModeToolbars(QString _modeName, QString _toolbarList); void addViewModeToolbars(QString _modeName, QString _toolbarList);
/** \brief Scripting function to set context menus in a view mode
@param _modeName Name of the View Mode
@param _toolboxList ; seperated list of context menus in the view mode
*/
void addViewModeContextMenus(QString _modeName, QString _contextMenuList);
/** @} */ /** @} */
......
...@@ -77,8 +77,6 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -77,8 +77,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
// Parse standard options // Parse standard options
if ( _ini.section_exists("Options") ) { if ( _ini.section_exists("Options") ) {
// TODO: Load View Mode Toolbars and Context Menu Items
// load ViewModes // load ViewModes
int viewModeCount; int viewModeCount;
if (_ini.get_entry(viewModeCount,"Options","ViewModeCount") ) if (_ini.get_entry(viewModeCount,"Options","ViewModeCount") )
...@@ -86,26 +84,31 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -86,26 +84,31 @@ void Core::readApplicationOptions(INIFile& _ini) {
QString entryToolbars; QString entryToolbars;
QString entryToolboxes; QString entryToolboxes;
QString entryContextMenus;
QString entryIcon; QString entryIcon;
QString keyToolbars = "ViewModeToolbars" + QString::number(i); QString keyToolbars = "ViewModeToolbars" + QString::number(i);
QString keyToolboxes = "ViewModeToolboxes" + QString::number(i); QString keyToolboxes = "ViewModeToolboxes" + QString::number(i);
QString keyIcon = "ViewModeIcon" + QString::number(i); QString keyContextMenus = "ViewModeContextMenus" + QString::number(i);
QString keyIcon = "ViewModeIcon" + QString::number(i);
// Read the entries // Read the entries
if ( !_ini.get_entry( entryToolbars , "Options" , keyToolbars ) ) continue; if ( !_ini.get_entry( entryToolbars , "Options" , keyToolbars ) ) continue;
if ( !_ini.get_entry( entryToolboxes , "Options" , keyToolboxes ) ) continue; if ( !_ini.get_entry( entryToolboxes , "Options" , keyToolboxes ) ) continue;
if ( !_ini.get_entry( entryIcon , "Options" , keyIcon ) ) continue; if ( !_ini.get_entry( entryContextMenus , "Options" , keyContextMenus ) ) continue;
if ( !_ini.get_entry( entryIcon , "Options" , keyIcon ) ) continue;
QStringList toolBars = entryToolbars.split(";"); QStringList toolBars = entryToolbars.split(";");
QStringList toolBoxes = entryToolboxes.split(";"); QStringList toolBoxes = entryToolboxes.split(";");
QStringList contextMenus = entryContextMenus.split(";");
// Get Mode name ( prepended to all toolbox/toolbar lists // Get Mode name ( prepended to all toolbox/toolbar/context menu lists )
QString mode = toolBoxes.first(); QString mode = toolBoxes.first();
// Remove leading Modes // Remove leading Modes
toolBoxes.removeFirst(); toolBoxes.removeFirst();
toolBars.removeFirst(); toolBars.removeFirst();
contextMenus.removeFirst();
// Check if the mode already exists // Check if the mode already exists
bool found = false; bool found = false;
...@@ -117,9 +120,10 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -117,9 +120,10 @@ void Core::readApplicationOptions(INIFile& _ini) {
ViewMode* vm = new ViewMode(); ViewMode* vm = new ViewMode();
vm->name = mode; vm->name = mode;
vm->custom = true; vm->custom = true;
vm->visibleToolbars = toolBars; vm->visibleToolbars = toolBars;
vm->visibleToolboxes = toolBoxes; vm->visibleToolboxes = toolBoxes;
vm->icon = entryIcon; vm->visibleContextMenus = contextMenus;
vm->icon = entryIcon;
viewModes_.push_back(vm); viewModes_.push_back(vm);
} }
...@@ -218,9 +222,9 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -218,9 +222,9 @@ void Core::readApplicationOptions(INIFile& _ini) {
//============================================================================ //============================================================================
// Load the setting for the default Toolbox mode // Load the setting for the default Toolbox mode
//============================================================================ //============================================================================
QString toolboxMode = false; QString viewmode = false;
if ( _ini.get_entry( toolboxMode, "Options" , "DefaultToolboxMode") ) if ( _ini.get_entry( viewmode, "Options" , "CurrentViewMode") )
OpenFlipper::Options::defaultToolboxMode(toolboxMode); OpenFlipper::Options::currentViewMode(viewmode);
//============================================================================ //============================================================================
// Load the setting for the translation language // Load the setting for the translation language
...@@ -383,10 +387,10 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -383,10 +387,10 @@ void Core::writeApplicationOptions(INIFile& _ini) {
_ini.add_entry( "Options" , key , type ); _ini.add_entry( "Options" , key , type );
} }
// TODO: Save View Mode Toolbars and Context Menu Items
// save ViewModes // save ViewModes
QVector< QString > toolboxes; QVector< QString > toolboxes;
QVector< QString > toolbars; QVector< QString > toolbars;
QVector< QString > contextmenus;
QVector< QString > icons; QVector< QString > icons;
if ( OpenFlipper::Options::gui() ) if ( OpenFlipper::Options::gui() )
...@@ -410,17 +414,25 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -410,17 +414,25 @@ void Core::writeApplicationOptions(INIFile& _ini) {
entryToolbars += ";" + coreWidget_->viewModes_[i]->visibleToolbars[j]; entryToolbars += ";" + coreWidget_->viewModes_[i]->visibleToolbars[j];
toolbars.push_back(entryToolbars); toolbars.push_back(entryToolbars);
QString entryContextMenus = coreWidget_->viewModes_[i]->name;
icons.push_back(coreWidget_->viewModes_[i]->icon); //store widgets
for (int j=0; j < coreWidget_->viewModes_[i]->visibleContextMenus.size(); j++)
entryContextMenus += ";" + coreWidget_->viewModes_[i]->visibleContextMenus[j];
contextmenus.push_back(entryContextMenus);
icons.push_back(coreWidget_->viewModes_[i]->icon);
} }
//save viewmodes to ini //save viewmodes to ini
_ini.add_entry("Options","ViewModeCount" ,toolboxes.size()); _ini.add_entry("Options","ViewModeCount" ,toolboxes.size());
for (int i=0; i < toolboxes.size(); i++) { for (int i=0; i < toolboxes.size(); i++) {
_ini.add_entry("Options","ViewModeToolboxes" + QString::number(i) ,toolboxes[i]); _ini.add_entry("Options","ViewModeToolboxes" + QString::number(i) ,toolboxes[i]);
_ini.add_entry("Options","ViewModeToolbars" + QString::number(i) ,toolbars[i] ); _ini.add_entry("Options","ViewModeToolbars" + QString::number(i) ,toolbars[i] );
_ini.add_entry("Options","ViewModeIcon" + QString::number(i) ,icons[i] ); _ini.add_entry("Options","ViewModeContextMenus" + QString::number(i) ,contextmenus[i] );
_ini.add_entry("Options","ViewModeIcon" + QString::number(i) ,icons[i] );
} }
//save KeyBindings //save KeyBindings
...@@ -430,8 +442,8 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -430,8 +442,8 @@ void Core::writeApplicationOptions(INIFile& _ini) {
//write default dataType to INI //write default dataType to INI
_ini.add_entry( "Options" , "default_DataType" , OpenFlipper::Options::lastDataType() ); _ini.add_entry( "Options" , "default_DataType" , OpenFlipper::Options::lastDataType() );
//write default ToolboxMode //write current ViewMode
_ini.add_entry("Options","DefaultToolboxMode",OpenFlipper::Options::defaultToolboxMode() ); _ini.add_entry("Options","CurrentViewMode",OpenFlipper::Options::currentViewMode() );
//============================================================================ //============================================================================
// Debugging // Debugging
......
...@@ -83,6 +83,7 @@ class PluginInfo{ ...@@ -83,6 +83,7 @@ class PluginInfo{
keys.clear(); keys.clear();
toolboxWidgets.clear(); toolboxWidgets.clear();
toolbars.clear(); toolbars.clear();
contextMenus.clear();
optionsWidget = 0; optionsWidget = 0;
} }
...@@ -100,6 +101,7 @@ class PluginInfo{ ...@@ -100,6 +101,7 @@ class PluginInfo{
keys = _i.keys; keys = _i.keys;
toolboxWidgets = _i.toolboxWidgets; toolboxWidgets = _i.toolboxWidgets;
toolbars = _i.toolbars; toolbars = _i.toolbars;
contextMenus = _i.contextMenus;
optionsWidget = _i.optionsWidget; optionsWidget = _i.optionsWidget;
} }
...@@ -133,8 +135,11 @@ class PluginInfo{ ...@@ -133,8 +135,11 @@ class PluginInfo{
/// Pointer to plugins toolbox widget (if available) /// Pointer to plugins toolbox widget (if available)
std::vector< std::pair< QString , QWidget* > > toolboxWidgets; std::vector< std::pair< QString , QWidget* > > toolboxWidgets;
/// Pointer to plugins toolbox widget (if available) /// Pointer to plugins toolbars (if available)
std::vector< std::pair< QString , QToolBar* > > toolbars; std::vector< std::pair< QString , QToolBar* > > toolbars;
/// Pointer to plugins context menus (if available)
std::vector< std::pair< QString , QAction* > > contextMenus;
/// Pointer to plugins options widget (if available) /// Pointer to plugins options widget (if available)
QWidget* optionsWidget; QWidget* optionsWidget;
......
...@@ -732,7 +732,11 @@ void Core::loadPlugin(QString filename, bool silent, QObject* _plugin){ ...@@ -732,7 +732,11 @@ void Core::loadPlugin(QString filename, bool silent, QObject* _plugin){
if ( checkSignal(plugin, "defineViewModeToolbars(QString,QStringList)")) if ( checkSignal(plugin, "defineViewModeToolbars(QString,QStringList)"))
connect(plugin, SIGNAL( defineViewModeToolbars(QString, QStringList) ), connect(plugin, SIGNAL( defineViewModeToolbars(QString, QStringList) ),
coreWidget_, SLOT( slotAddViewModeToolbars(QString, QStringList) ),Qt::DirectConnection ); coreWidget_, SLOT( slotAddViewModeToolbars(QString, QStringList) ),Qt::DirectConnection );
if ( checkSignal(plugin, "defineViewModeContextMenus(QString,QStringList)"))
connect(plugin, SIGNAL( defineViewModeContextMenus(QString, QStringList) ),
coreWidget_, SLOT( slotAddViewModeContextMenus(QString, QStringList) ),Qt::DirectConnection );
if ( checkSignal(plugin, "defineViewModeIcon(QString,QString)")) if ( checkSignal(plugin, "defineViewModeIcon(QString,QString)"))
connect(plugin, SIGNAL( defineViewModeIcon(QString, QString) ), connect(plugin, SIGNAL( defineViewModeIcon(QString, QString) ),
......
...@@ -74,8 +74,8 @@ void Core::applyOptions(){ ...@@ -74,8 +74,8 @@ void Core::applyOptions(){
coreWidget_->initViewModes(); coreWidget_->initViewModes();
//Set default Viewmode //Set default Viewmode
if (OpenFlipper::Options::defaultToolboxMode() != "") if (OpenFlipper::Options::currentViewMode() != "")
coreWidget_->slotChangeView(OpenFlipper::Options::defaultToolboxMode(), QStringList(), QStringList()); coreWidget_->slotChangeView(OpenFlipper::Options::currentViewMode(), QStringList(), QStringList(), QStringList());
//Set Fullscreen //Set Fullscreen
if ( OpenFlipperSettings().value("Core/Gui/fullscreen",false).toBool() ) if ( OpenFlipperSettings().value("Core/Gui/fullscreen",false).toBool() )
coreWidget_->setWindowState( coreWidget_->windowState() | Qt::WindowFullScreen); coreWidget_->setWindowState( coreWidget_->windowState() | Qt::WindowFullScreen);
......
...@@ -166,6 +166,14 @@ void Core::addViewModeToolbars(QString _modeName, QString _toolbarList) { ...@@ -166,6 +166,14 @@ void Core::addViewModeToolbars(QString _modeName, QString _toolbarList) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Core::addViewModeContextMenus(QString _modeName, QString _contextMenuList) {
QStringList list = _contextMenuList.split(";");
coreWidget_->slotAddViewModeContextMenus(_modeName,list);
}
//-----------------------------------------------------------------------------
void Core::addToolbox(QString _name ,QWidget* _widget) { void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1; int id = -1;
...@@ -201,7 +209,7 @@ void Core::addToolbox(QString _name ,QWidget* _widget) { ...@@ -201,7 +209,7 @@ void Core::addToolbox(QString _name ,QWidget* _widget) {
viewModes_[0]->visibleToolboxes.sort(); viewModes_[0]->visibleToolboxes.sort();
} }
setViewMode( OpenFlipper::Options::defaultToolboxMode() ); setViewMode( OpenFlipper::Options::currentViewMode() );
} }
//============================================================================= //=============================================================================
......
...@@ -162,7 +162,8 @@ static bool drawModesInContextMenu_ = true; ...@@ -162,7 +162,8 @@ static bool drawModesInContextMenu_ = true;
/// Set if a grid should be drawn in every viewer /// Set if a grid should be drawn in every viewer
static bool gridVisible_ = false; static bool gridVisible_ = false;
static QString defaultToolboxMode_ = ""; /// Current view mode
static QString currentViewMode_ = "";
static QString title_ = "OpenFlipper v?"; static QString title_ = "OpenFlipper v?";
...@@ -538,14 +539,14 @@ LoggerState loggerState( ) { ...@@ -538,14 +539,14 @@ LoggerState loggerState( ) {
return static_cast<OpenFlipper::Options::LoggerState> (OpenFlipperSettings().value("Core/Gui/LogWindow/LogWindowMode",0).toInt() ); return static_cast<OpenFlipper::Options::LoggerState> (OpenFlipperSettings().value("Core/Gui/LogWindow/LogWindowMode",0).toInt() );
} }
/// Which mode should be the default for the toolbar? /// Which mode should is currently selected?
QString defaultToolboxMode( ) { QString currentViewMode( ) {
return defaultToolboxMode_; return currentViewMode_;
} }
/// Which mode should be the default for the toolbar? /// Which view mode is currently selected?
void defaultToolboxMode( QString _mode ) { void currentViewMode( QString _mode ) {
defaultToolboxMode_ = _mode; currentViewMode_ = _mode;
} }
......
...@@ -507,13 +507,13 @@ QString helpDirStr(); ...@@ -507,13 +507,13 @@ QString helpDirStr();
DLLEXPORT DLLEXPORT
LoggerState loggerState( ); LoggerState loggerState( );
/// Which mode should be the default for the toolbar? /// Which view mode is currently selected?
DLLEXPORT DLLEXPORT
QString defaultToolboxMode( ); QString currentViewMode( );
/// Which mode should be the default for the toolbar? /// Which view mode is currently selected?
DLLEXPORT DLLEXPORT
void defaultToolboxMode( QString _mode ); void currentViewMode( QString _mode );
/// Titel of the main window /// Titel of the main window
DLLEXPORT DLLEXPORT
......
...@@ -469,12 +469,29 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id ...@@ -469,12 +469,29 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id
} }
//find the currently selected view mode
int id = -1;
for (int i=0; i<viewModes_.size(); i++) {
if (viewModes_[i]->name == OpenFlipper::Options::currentViewMode()) {
id = i;
break;
}
}
/// \todo Sort the menu entries by the order given in visibleContextMenus
//first add all menus //first add all menus
QMapIterator<QString, QAction*> it(menuMap); QMapIterator<QString, QAction*> it(menuMap);
QStringList visible = viewModes_[id]->visibleContextMenus;
visible.replaceInStrings(QRegExp(".*>"), "");
for (int i=0; i < visible.size(); i++)
std::cout << visible.at(i).toStdString() << std::endl;
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
_menu->addAction( it.value() ); if (visible.contains(it.key())) {
_menu->addAction( it.value() );
}
} }
_menu->addSeparator(); _menu->addSeparator();
...@@ -484,7 +501,9 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id ...@@ -484,7 +501,9 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id
while (it2.hasNext()) { while (it2.hasNext()) {
it2.next(); it2.next();
_menu->addAction( it2.value() ); if (visible.contains(it2.key())) {
_menu->addAction( it2.value() );
}
} }
return added; return added;
...@@ -586,7 +605,8 @@ void CoreWidget::slotAddContextItem(QAction* _entry, ContextMenuType _type) { ...@@ -586,7 +605,8 @@ void CoreWidget::slotAddContextItem(QAction* _entry, ContextMenuType _type) {
info.action = _entry; info.action = _entry;
info.type = _type; info.type = _type;
contextMenus_.push_back(info); contextMenus_.push_back(info);
slotAddContextItemToViewMode(_entry);
} }
void CoreWidget::slotAddContextItem( QAction* _entry , DataType _dataType ,ContextMenuType _type ) { void CoreWidget::slotAddContextItem( QAction* _entry , DataType _dataType ,ContextMenuType _type ) {
...@@ -596,6 +616,44 @@ void CoreWidget::slotAddContextItem( QAction* _entry , DataType _dataType ,Conte ...@@ -596,6 +616,44 @@ void CoreWidget::slotAddContextItem( QAction* _entry , DataType _dataType ,Conte
info.type = _type; info.type = _type;
contextMenus_.push_back(info); contextMenus_.push_back(info);
slotAddContextItemToViewMode(_entry);
}
void CoreWidget::slotAddContextItemToViewMode( QAction* _entry ) {
int id = -1;
// Find the plugin which added this Context Menu
for ( uint i = 0 ; i < plugins_.size(); ++i ) {
if ( plugins_[i].plugin == sender() ) {
id = i;
break;
}
}
// Find the scripting plugin because we assign this context menu to it as we did not find the original sender
if ( id == -1 ) {
for ( uint i = 0 ; i < plugins_.size(); ++i ) {
if ( plugins_[i].name == "Scripting" ) {
id = i;
break;
}
}
if ( id == -1 ) {
std::cerr << "Unknown sender plugin when adding Context Menu!" << std::endl;
return;
}
}
plugins_[id].contextMenus.push_back( std::pair< QString,QAction* >( plugins_[id].name + "->" + _entry->text(), _entry) );
// add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleContextMenus.contains(plugins_[id].name + "->" + _entry->text()) ){
viewModes_[0]->visibleContextMenus << plugins_[id].name + "->" + _entry->text();
viewModes_[0]->visibleContextMenus.sort();
}
setViewMode( OpenFlipper::Options::currentViewMode() );
} }
void CoreWidget::slotUpdateViewerDrawMenu() { void CoreWidget::slotUpdateViewerDrawMenu() {
......
...@@ -609,7 +609,7 @@ CoreWidget::toggleFullscreen() { ...@@ -609,7 +609,7 @@ CoreWidget::toggleFullscreen() {
setWindowState( windowState() ^ Qt::WindowFullScreen); setWindowState( windowState() ^ Qt::WindowFullScreen);
//show toolbars //show toolbars
setViewMode( OpenFlipper::Options::defaultToolboxMode() ); setViewMode( OpenFlipper::Options::currentViewMode() );
//show the menubar //show the menubar
menuBar()->show(); menuBar()->show();
...@@ -822,10 +822,10 @@ CoreWidget::showToolbox( bool _state ) { ...@@ -822,10 +822,10 @@ CoreWidget::showToolbox( bool _state ) {
}else{ }else{
//reset last ViewMode //reset last ViewMode
if (OpenFlipper::Options::defaultToolboxMode().trimmed() == "") if (OpenFlipper::Options::currentViewMode().trimmed() == "")
setViewMode("All"); setViewMode("All");
else else
setViewMode( OpenFlipper::Options::defaultToolboxMode() ); setViewMode( OpenFlipper::Options::currentViewMode() );
toolBoxArea_->setVisible(true); toolBoxArea_->setVisible(true);
} }
} }
......
...@@ -417,8 +417,14 @@ public: ...@@ -417,8 +417,14 @@ public:
/// Add or change Toolbars for a ViewMode (_custom == userdefined viewMode) /// Add or change Toolbars for a ViewMode (_custom == userdefined viewMode)
void slotAddViewModeToolbars(QString _mode, bool _custom, QStringList _usedToolbars); void slotAddViewModeToolbars(QString _mode, bool _custom, QStringList _usedToolbars);
/// Completly configure a view mode ( set toolbars, toolboxes ... ) /// Add or change Toolbars for a ViewMode (non-userdefined viewMode)
void slotAddViewModeComplete(QString _mode , bool _custom, QStringList _toolboxes, QStringList _toolbars); void slotAddViewModeContextMenus(QString _mode, QStringList _usedToolbars);
/// Add or change Toolbars for a ViewMode (_custom == userdefined viewMode)
void slotAddViewModeContextMenus(QString _mode, bool _custom, QStringList _usedToolbars);
/// Completly configure a view mode ( set toolbars, toolboxes, context menus, ... )
void slotAddViewModeComplete(QString _mode , bool _custom, QStringList _toolboxes, QStringList _toolbars, QStringList _contextmenus);
/// Sets the Icon for a given View Mode (non-userdefined viewMode) /// Sets the Icon for a given View Mode (non-userdefined viewMode)
void slotSetViewModeIcon(QString _mode, QString _iconName); void slotSetViewModeIcon(QString _mode, QString _iconName);
...@@ -427,7 +433,7 @@ public: ...@@ -427,7 +433,7 @@ public:
void slotSetViewModeIcon(QString _mode, bool _custom, QString _iconName); void slotSetViewModeIcon(QString _mode, bool _custom, QString _iconName);
/// Slot for Changing visible toolWidgets /// Slot for Changing visible toolWidgets
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars); void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus);
private slots: private slots:
/// Remove viewMode /// Remove viewMode
...@@ -671,6 +677,9 @@ public: ...@@ -671,6 +677,9 @@ public:
/// called by plugins to add a real context menu item depending on DataType /// called by plugins to add a real context menu item depending on DataType
void slotAddContextItem( QAction* _entry , DataType _dataType ,ContextMenuType type_); void slotAddContextItem( QAction* _entry , DataType _dataType ,ContextMenuType type_);
/// called by slotAddContextItem to add the item to the view mode
void slotAddContextItemToViewMode( QAction* _entry );
/// Paste the view to the last active examiner /// Paste the view to the last active examiner
void slotPasteView( ); void slotPasteView( );
......
...@@ -110,6 +110,7 @@ void CoreWidget::slotAddViewModeToolboxes(QString _mode, bool _custom, QStringLi ...@@ -110,6 +110,7 @@ void CoreWidget::slotAddViewModeToolboxes(QString _mode, bool _custom, QStringLi
vm->icon = "Unknown.png"; vm->icon = "Unknown.png";
vm->visibleToolbars = QString("Main Toolbar;Viewer Toolbar").split(";"); vm->visibleToolbars = QString("Main Toolbar;Viewer Toolbar").split(";");
vm->visibleContextMenus = viewModes_[0]->visibleContextMenus;
if (_custom) { if (_custom) {
viewModes_.push_back(vm); viewModes_.push_back(vm);
...@@ -155,6 +156,8 @@ void CoreWidget::slotAddViewModeToolbars(QString _mode, bool _custom, QStringLis ...@@ -155,6 +156,8 @@ void CoreWidget::slotAddViewModeToolbars(QString _mode, bool _custom, QStringLis
vm->custom = _custom; vm->custom = _custom;
vm->icon = "Unknown.png"; vm->icon = "Unknown.png";
vm->visibleContextMenus = viewModes_[0]->visibleContextMenus;
if (_custom) {