Commit c87c3364 authored by Dirk Wilden's avatar Dirk Wilden

ordering when changing viewMode fixed

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3007 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c0a368f5
...@@ -905,7 +905,7 @@ void Core::loadPlugin(QString filename, bool silent){ ...@@ -905,7 +905,7 @@ void Core::loadPlugin(QString filename, bool silent){
//tab all dockwidgets together //tab all dockwidgets together
if (OpenFlipper::Options::gui()) if (OpenFlipper::Options::gui())
coreWidget_->tabDockWidgets(); coreWidget_->tabDockWidgets( QVector< QDockWidget* >() );
// Initialize Plugin // Initialize Plugin
if ( basePlugin ) { if ( basePlugin ) {
......
...@@ -242,7 +242,7 @@ public: ...@@ -242,7 +242,7 @@ public:
public: public:
/// Tab all DockWidgets which belong to ToolWidgets together /// Tab all DockWidgets which belong to ToolWidgets together
void tabDockWidgets(); void tabDockWidgets(QVector< QDockWidget* > _widgets);
public slots: public slots:
......
...@@ -127,56 +127,58 @@ void CoreWidget::slotSetViewMode( QAction* action){ ...@@ -127,56 +127,58 @@ void CoreWidget::slotSetViewMode( QAction* action){
/// Slot for setting the viewMode from menu /// Slot for setting the viewMode from menu
void CoreWidget::setViewMode( QString _mode ){ void CoreWidget::setViewMode( QString _mode ){
//find viewMode // //find viewMode
for (int i=0; i < viewModes_.size(); i++) // for (int i=0; i < viewModes_.size(); i++)
if ( viewModes_[i]->name == _mode ){ // if ( viewModes_[i]->name == _mode ){
//
OpenFlipper::Options::defaultToolboxMode(_mode); // OpenFlipper::Options::defaultToolboxMode(_mode);
//
QStringList widgets = viewModes_[i]->visibleWidgets; // QStringList widgets = viewModes_[i]->visibleWidgets;
//and find all widgets that should be visible // //and find all widgets that should be visible
for (uint p=0; p < plugins_.size(); p++){ // for (uint p=0; p < plugins_.size(); p++){
if (plugins_[p].widget == 0) continue; // if (plugins_[p].widget == 0) continue;
QString name_nospace = plugins_[p].name; // QString name_nospace = plugins_[p].name;
name_nospace.remove(" "); // name_nospace.remove(" ");
if (widgets.contains( name_nospace) ) // if (widgets.contains( name_nospace) )
plugins_[p].widget->setVisible( true ); // plugins_[p].widget->setVisible( true );
else // else
plugins_[p].widget->setVisible( false ); // plugins_[p].widget->setVisible( false );
} // }
//
//tab all dockWidgets together // //tab all dockWidgets together
tabDockWidgets(); // tabDockWidgets();
break; // break;
//
} // }
slotChangeView(_mode, QStringList());
} }
/// Tab all DockWidgets which belong to ToolWidgets together /// Tab all DockWidgets which belong to ToolWidgets together
void CoreWidget::tabDockWidgets(){ void CoreWidget::tabDockWidgets(QVector< QDockWidget* > _widgets){
int maxH = maximumHeight(); int maxH = maximumHeight();
int minH = minimumHeight(); int minH = minimumHeight();
setFixedHeight(height()); setFixedHeight(height());
//if no widgets are given take all visible one's and ignore the order
if (_widgets.size() == 0)
for (uint p=0; p < plugins_.size(); p++){
if (plugins_[p].widget == 0) continue;
if ( plugins_[p].widget->isVisible() && !plugins_[p].widget->isFloating() )
_widgets.push_back( plugins_[p].widget );
}
//tab all dockWidgets together //tab all dockWidgets together
QVector< QDockWidget* > widgets; if (_widgets.size() > 1){
for (uint p=0; p < plugins_.size(); p++)
if ( plugins_[p].widget && !plugins_[p].widget->isFloating() )
widgets.push_back( plugins_[p].widget );
if (widgets.size() > 1){
QDockWidget* d1 = 0; QDockWidget* d1 = 0;
QDockWidget* d2 = widgets.first(); QDockWidget* d2 = _widgets.first();
widgets.pop_front(); _widgets.pop_front();
while (widgets.size() > 0){ while (_widgets.size() > 0){
d1 = d2; d1 = d2;
d2 = widgets.first(); d2 = _widgets.first();
widgets.pop_front(); _widgets.pop_front();
tabifyDockWidget(d1, d2); tabifyDockWidget(d1, d2);
} }
} }
...@@ -211,21 +213,33 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolWidgets){ ...@@ -211,21 +213,33 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolWidgets){
for (int i=0; i < viewModes_.size(); i++) for (int i=0; i < viewModes_.size(); i++)
if (viewModes_[i]->name == _mode) if (viewModes_[i]->name == _mode)
_toolWidgets = viewModes_[i]->visibleWidgets; _toolWidgets = viewModes_[i]->visibleWidgets;
//find all widgets that should be visible
//first hide all widgets
for (uint p=0; p < plugins_.size(); p++){ for (uint p=0; p < plugins_.size(); p++){
if (plugins_[p].widget == 0) continue; if ( plugins_[p].widget )
QString name_nospace = plugins_[p].name;
name_nospace.remove(" ");
if (_toolWidgets.contains( name_nospace ))
plugins_[p].widget->setVisible( true );
else
plugins_[p].widget->setVisible( false ); plugins_[p].widget->setVisible( false );
} }
OpenFlipper::Options::defaultToolboxMode(_mode); QVector< QDockWidget* > dockWidgets;
//find all widgets that should be visible
for (int i=0; i < _toolWidgets.size(); i++)
for (uint p=0; p < plugins_.size(); p++){
if (plugins_[p].widget == 0) continue;
QString name_nospace = plugins_[p].name;
name_nospace.remove(" ");
if (_toolWidgets[i] == name_nospace ){
plugins_[p].widget->setVisible( true );
if ( !plugins_[p].widget->isFloating() )
dockWidgets.push_back( plugins_[p].widget );
}
}
if (_mode != "")
OpenFlipper::Options::defaultToolboxMode(_mode);
//tab all dockWidgets together //tab all dockWidgets together
tabDockWidgets(); tabDockWidgets(dockWidgets);
setMaximumHeight(maxH); setMaximumHeight(maxH);
setMinimumHeight(minH); setMinimumHeight(minH);
......
...@@ -216,7 +216,7 @@ void viewModeWidget::slotChangeView(){ ...@@ -216,7 +216,7 @@ void viewModeWidget::slotChangeView(){
for (int i=0; i < toolList->count(); i++) for (int i=0; i < toolList->count(); i++)
widgets << toolList->item(i)->text(); widgets << toolList->item(i)->text();
//get mode //get mode
QString mode; QString mode = "";
if (modeList->selectedItems().size() > 0) if (modeList->selectedItems().size() > 0)
mode = modeList->selectedItems()[0]->text(); mode = modeList->selectedItems()[0]->text();
emit changeView(mode,widgets); emit changeView(mode,widgets);
......
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