Commit 1733fe7e authored by Jan Möbius's avatar Jan Möbius

Ask for save if a view mode has been changed

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7285 383ad7c9-94d9-4d36-a494-682f7c89f535
parent aa7081b3
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="title"> <property name="title">
<string>Used</string> <string>Visible</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="groupBox_4">
<property name="title"> <property name="title">
<string>Used</string> <string>Visible</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
......
...@@ -408,7 +408,53 @@ void viewModeWidget::slotChangeView(){ ...@@ -408,7 +408,53 @@ void viewModeWidget::slotChangeView(){
if (viewModeList->selectedItems().size() > 0) if (viewModeList->selectedItems().size() > 0)
mode = viewModeList->selectedItems()[0]->text(); mode = viewModeList->selectedItems()[0]->text();
std::cerr << "TODO: Ask for Save" << std::endl;
// Check current configuration if it is a changed view mode
// Search for current mode
int id = -1;
if ( viewModeList->selectedItems().count() > 0)
for (int i=0; i < modes_.size(); i++)
if (modes_[i]->name == viewModeList->currentItem()->text()){
id = i;
break;
}
if ( id == -1 ) {
std::cerr << "Currently selected Mode not found?!" << std::endl;
return;
}
bool matching = true;
// Check if toolbox list matches:
if ( modes_[id]->visibleToolboxes.size() == toolboxes.size() ) {
for ( int i = 0 ; i < modes_[id]->visibleToolboxes.size(); ++i )
if ( modes_[id]->visibleToolboxes[i] != toolboxes[i] )
matching = false;
} else {
matching = false;
}
// Check if toolbar list matches:
if ( modes_[id]->visibleToolbars.size() == toolbars.size() ) {
for ( int i = 0 ; i < modes_[id]->visibleToolbars.size(); ++i )
if ( modes_[id]->visibleToolbars[i] != toolbars[i] )
matching = false;
} else {
matching = false;
}
if ( !matching ) {
int ret = QMessageBox::warning(this,
tr("Mode has been changed!"),
tr("You changed the view mode configuration. Do you want to save it?"),
QMessageBox::Yes|QMessageBox::No,
QMessageBox::No);
if (ret == QMessageBox::Yes)
slotSaveMode();
}
emit changeView(mode,toolboxes,toolbars); emit changeView(mode,toolboxes,toolbars);
close(); close();
} }
...@@ -425,7 +471,7 @@ void viewModeWidget::slotSaveMode(){ ...@@ -425,7 +471,7 @@ void viewModeWidget::slotSaveMode(){
} }
if ( id == -1 ) { if ( id == -1 ) {
std::cerr << "Moded Not found in slotSaveMode" << std::endl; std::cerr << "Mode Not found in slotSaveMode" << std::endl;
return; return;
} }
......
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