Commit e83788f1 authored by mae's avatar mae
Browse files

Show the "Open Documents" navigation bar widget in the default

configuration. Contains some compatible versioning code to also show it
to current users, but without destroying their manual setup.
parent 62dd2a5a
...@@ -238,16 +238,27 @@ void NavigationWidget::saveSettings(QSettings *settings) ...@@ -238,16 +238,27 @@ void NavigationWidget::saveSettings(QSettings *settings)
void NavigationWidget::restoreSettings(QSettings *settings) void NavigationWidget::restoreSettings(QSettings *settings)
{ {
if (settings->contains("Navigation/Views")) { int version = settings->value("Navigation/Version", 1).toInt();
QStringList views = settings->value("Navigation/Views").toStringList(); QStringList views = settings->value("Navigation/Views").toStringList();
for (int i=0; i<views.count()-1; ++i) {
insertSubItem(0); bool restoreSplitterState = true;
} if (version == 1) {
for (int i=0; i<views.count(); ++i) { if (views.isEmpty())
const QString &view = views.at(i); views += "Projects";
NavigationSubWidget *nsw = m_subWidgets.at(i); if (!views.contains("Open Documents")) {
nsw->setFactory(view); views += "Open Documents";
restoreSplitterState = false;
} }
settings->setValue("Navigation/Version", 2);
}
for (int i=0; i<views.count()-1; ++i) {
insertSubItem(0);
}
for (int i=0; i<views.count(); ++i) {
const QString &view = views.at(i);
NavigationSubWidget *nsw = m_subWidgets.at(i);
nsw->setFactory(view);
} }
if (settings->contains("Navigation/Visible")) { if (settings->contains("Navigation/Visible")) {
...@@ -256,8 +267,15 @@ void NavigationWidget::restoreSettings(QSettings *settings) ...@@ -256,8 +267,15 @@ void NavigationWidget::restoreSettings(QSettings *settings)
setShown(true); setShown(true);
} }
if (settings->contains("Navigation/VerticalPosition")) if (restoreSplitterState && settings->contains("Navigation/VerticalPosition")) {
restoreState(settings->value("Navigation/VerticalPosition").toByteArray()); restoreState(settings->value("Navigation/VerticalPosition").toByteArray());
} else {
QList<int> sizes;
sizes += 256;
for (int i = views.size()-1; i; --i)
sizes.prepend(512);
setSizes(sizes);
}
if (settings->contains("Navigation/Width")) { if (settings->contains("Navigation/Width")) {
m_width = settings->value("Navigation/Width").toInt(); m_width = settings->value("Navigation/Width").toInt();
......
Supports Markdown
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