Commit 2e148229 authored by Jan Möbius's avatar Jan Möbius

Extension to view Mode struct

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7231 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 59dc09f9
......@@ -138,7 +138,7 @@ Core() :
ViewMode* vm = new ViewMode();
vm->name = "All";
vm->custom = false;
vm->visibleWidgets = QStringList();
vm->visibleToolboxes = QStringList();
viewModes_.push_front(vm);
......
......@@ -98,7 +98,7 @@ void Core::readApplicationOptions(INIFile& _ini) {
ViewMode* vm = new ViewMode();
vm->name = mode;
vm->custom = true;
vm->visibleWidgets = widgets;
vm->visibleToolboxes = widgets;
viewModes_.push_back(vm);
}
......@@ -493,8 +493,8 @@ void Core::writeApplicationOptions(INIFile& _ini) {
QString entry = coreWidget_->viewModes_[i]->name;
//store widgets
for (int j=0; j < coreWidget_->viewModes_[i]->visibleWidgets.size(); j++)
entry += ";" + coreWidget_->viewModes_[i]->visibleWidgets[j];
for (int j=0; j < coreWidget_->viewModes_[i]->visibleToolboxes.size(); j++)
entry += ";" + coreWidget_->viewModes_[i]->visibleToolboxes[j];
entries.push_back(entry);
}
......
......@@ -309,8 +309,8 @@ void Core::unloadPlugin(QString name){
//remove toolbox widget
QString name_nospace = name;
name_nospace.remove(" ");
if ( coreWidget_->viewModes_[0]->visibleWidgets.contains(name_nospace) )
coreWidget_->viewModes_[0]->visibleWidgets.removeAt(coreWidget_->viewModes_[0]->visibleWidgets.indexOf(name_nospace));
if ( coreWidget_->viewModes_[0]->visibleToolboxes.contains(name_nospace) )
coreWidget_->viewModes_[0]->visibleToolboxes.removeAt(coreWidget_->viewModes_[0]->visibleToolboxes.indexOf(name_nospace));
for ( uint j = 0 ; j < plugins[i].widgets.size() ; ++j )
if (plugins[i].widgets[j].second ){
plugins[i].widgets[j].second->setVisible(false);
......@@ -597,9 +597,9 @@ void Core::loadPlugin(QString filename, bool silent){
info.widgets.push_back( std::pair< QString,QWidget* >( info.name , widget) );
// add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleWidgets.contains(info.name) ){
viewModes_[0]->visibleWidgets << info.name;
viewModes_[0]->visibleWidgets.sort();
if ( !viewModes_[0]->visibleToolboxes.contains(info.name) ){
viewModes_[0]->visibleToolboxes << info.name;
viewModes_[0]->visibleToolboxes.sort();
}
}
......
......@@ -168,9 +168,9 @@ void Core::addToolbox(QString _name ,QWidget* _widget) {
plugins[id].widgets.push_back( std::pair< QString,QWidget* >( _name , _widget) );
// add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleWidgets.contains(_name) ){
viewModes_[0]->visibleWidgets << _name;
viewModes_[0]->visibleWidgets.sort();
if ( !viewModes_[0]->visibleToolboxes.contains(_name) ){
viewModes_[0]->visibleToolboxes << _name;
viewModes_[0]->visibleToolboxes.sort();
}
setViewMode( OpenFlipper::Options::defaultToolboxMode() );
......
......@@ -97,11 +97,26 @@
#include <OpenFlipper/INIFile/INIFile.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
/** \brief ViewMode struct
* This struct contains a ViewMode and its status information such as used widgets,toolbars or context menus
*
*/
struct ViewMode{
/// Name of the View Mode
QString name;
bool custom; //is the mode defined by the user?
QStringList visibleWidgets;
/// Is this a user defined custom view mode or a plugin generated one
bool custom;
/// List of Visible Toolboxes in this view mode
QStringList visibleToolboxes;
/// List of Toolbars in this view mode
QStringList visibleToolbars;
/// List of context Menus in this view mode
QStringList visibleContextMenus;
};
class StackWidgetInfo {
......
......@@ -96,7 +96,7 @@ void CoreWidget::slotAddViewMode(QString _mode, bool _custom, QStringList _usedW
ViewMode* vm = new ViewMode();
vm->name = _mode;
vm->custom = _custom;
vm->visibleWidgets = _usedWidgets;
vm->visibleToolboxes = _usedWidgets;
if (_custom)
viewModes_.push_back(vm);
else{
......@@ -162,7 +162,7 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolWidgets){
if (_mode != "" && _toolWidgets.size() == 0)
for (int i=0; i < viewModes_.size(); i++)
if (viewModes_[i]->name == _mode)
_toolWidgets = viewModes_[i]->visibleWidgets;
_toolWidgets = viewModes_[i]->visibleToolboxes;
// remove all toolbox entries
toolBox_->clear ();
......
......@@ -217,7 +217,7 @@ void viewModeWidget::slotSetToolWidgets(){
// find mode in modeVector modes_
for (int i=0; i < modes_.size(); i++)
if ( modes_[i]->name == (modeList->selectedItems()[m])->text() )
toolList->addItems(modes_[i]->visibleWidgets); //add corresponding widgets
toolList->addItems(modes_[i]->visibleToolboxes); //add corresponding widgets
}
/// Slot for changing View and closing widget
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment