- now remembers what toolbars are enabled and what are disabled in config

Wed, 10 Sep 2014 14:02:31 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 10 Sep 2014 14:02:31 +0300
changeset 896
4988666b5e3c
parent 894
120cf01d8831
child 897
ef9e4469975a

- now remembers what toolbars are enabled and what are disabled in config

src/mainWindow.cc file | annotate | diff | comparison | revisions
--- a/src/mainWindow.cc	Tue Sep 09 02:42:21 2014 +0300
+++ b/src/mainWindow.cc	Wed Sep 10 14:02:31 2014 +0300
@@ -58,6 +58,7 @@
 CFGENTRY (Bool, ColorizeObjectsList, true)
 CFGENTRY (String, QuickColorToolbar, "4:25:14:27:2:3:11:1:22:|:0:72:71:15")
 CFGENTRY (Bool, ListImplicitFiles, false)
+CFGENTRY (List, HiddenToolbars, {})
 EXTERN_CFGENTRY (List, RecentFiles)
 EXTERN_CFGENTRY (Bool, DrawAxes)
 EXTERN_CFGENTRY (String, MainColor)
@@ -125,6 +126,14 @@
 	connect (ui->ringToolSegments, SIGNAL (valueChanged (int)),
 		this, SLOT (circleToolSegmentsChanged()));
 	circleToolSegmentsChanged(); // invoke it manually for initial label text
+
+	for (QVariant const& toolbarname : cfg::HiddenToolbars)
+	{
+		QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString());
+
+		if (toolbar != null)
+			toolbar->hide();
+	}
 }
 
 MainWindow::~MainWindow()
@@ -632,10 +641,17 @@
 		return;
 	}
 
-	// Save the configuration before leaving so that, for instance, grid choice
-	// is preserved across instances.
+	// Save the toolbar set
+	cfg::HiddenToolbars.clear();
+
+	for (QToolBar* toolbar : findChildren<QToolBar*>())
+	{
+		if (toolbar->isHidden())
+			cfg::HiddenToolbars << toolbar->objectName();
+	}
+
+	// Save the configuration before leaving.
 	Config::Save();
-
 	ev->accept();
 }
 

mercurial