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

Save Toolbars for view modes

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7291 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 549513b8
......@@ -83,24 +83,38 @@ void Core::readApplicationOptions(INIFile& _ini) {
int viewModeCount;
if (_ini.get_entry(viewModeCount,"Options","ViewModeCount") )
for (int i=0; i < viewModeCount; i++){
QString entry;
QString key = "ViewMode" + QString::number(i);
if ( !_ini.get_entry( entry , "Options" , key ) ) continue;
QStringList widgets = entry.split(";");
QString mode = widgets.first();
widgets.removeFirst();
QString entryToolbars;
QString entryToolboxes;
QString keyToolbars = "ViewModeToolbars" + QString::number(i);
QString keyToolboxes = "ViewModeToolboxes" + QString::number(i);
// Read the entries
if ( !_ini.get_entry( entryToolbars , "Options" , keyToolbars ) ) continue;
if ( !_ini.get_entry( entryToolboxes , "Options" , keyToolboxes ) ) continue;
QStringList toolBars = entryToolbars.split(";");
QStringList toolBoxes = entryToolboxes.split(";");
// Get Mode name ( prepended to all toolbox/toolbar lists
QString mode = toolBoxes.first();
// Remove leading Modes
toolBoxes.removeFirst();
toolBars.removeFirst();
// Check if the mode already exists
bool found = false;
for (int i=0; i < viewModes_.size(); i++)
if (viewModes_[i]->name == mode)
found = true;
if (!found){
ViewMode* vm = new ViewMode();
vm->name = mode;
vm->custom = true;
vm->visibleToolboxes = widgets;
vm->visibleToolbars = toolBars;
vm->visibleToolboxes = toolBoxes;
viewModes_.push_back(vm);
}
......@@ -487,25 +501,39 @@ void Core::writeApplicationOptions(INIFile& _ini) {
// TODO: Save View Mode Toolbars and Context Menu Items
// save ViewModes
QVector< QString > entries;
QVector< QString > toolboxes;
QVector< QString > toolbars;
if ( OpenFlipper::Options::gui() )
for (int i=0; i < coreWidget_->viewModes_.size(); i++)
if (coreWidget_->viewModes_[i]->custom){
//store name
QString entry = coreWidget_->viewModes_[i]->name;
QString entryToolboxes = coreWidget_->viewModes_[i]->name;
//store widgets
for (int j=0; j < coreWidget_->viewModes_[i]->visibleToolboxes.size(); j++)
entry += ";" + coreWidget_->viewModes_[i]->visibleToolboxes[j];
entryToolboxes += ";" + coreWidget_->viewModes_[i]->visibleToolboxes[j];
toolboxes.push_back(entryToolboxes);
entries.push_back(entry);
//store name
QString entryToolbars = coreWidget_->viewModes_[i]->name;
//store widgets
for (int j=0; j < coreWidget_->viewModes_[i]->visibleToolbars.size(); j++)
entryToolbars += ";" + coreWidget_->viewModes_[i]->visibleToolbars[j];
toolbars.push_back(entryToolbars);
}
//save viewmodes to ini
_ini.add_entry("Options","ViewModeCount" ,entries.size());
for (int i=0; i < entries.size(); i++)
_ini.add_entry("Options","ViewMode" + QString::number(i) ,entries[i]);
_ini.add_entry("Options","ViewModeCount" ,toolboxes.size());
for (int i=0; i < toolboxes.size(); i++) {
_ini.add_entry("Options","ViewModeToolboxes" + QString::number(i) ,toolboxes[i]);
_ini.add_entry("Options","ViewModeToolbars" + QString::number(i) ,toolbars[i] );
}
//save KeyBindings
if ( OpenFlipper::Options::gui() )
......
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