undo config change

Thu, 04 Jan 2018 22:52:04 +0200

author
Santeri Piippo
date
Thu, 04 Jan 2018 22:52:04 +0200
changeset 1224
5a31b6d4bf81
parent 1223
4f8fa42aed07
child 1225
ffcbdce88978

undo config change

src/colors.h file | annotate | diff | comparison | revisions
src/dialogs/colorselector.cpp file | annotate | diff | comparison | revisions
src/dialogs/configdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/newpartdialog.cpp file | annotate | diff | comparison | revisions
src/documentmanager.cpp file | annotate | diff | comparison | revisions
src/editmodes/abstractEditMode.cpp file | annotate | diff | comparison | revisions
src/glCompiler.cpp file | annotate | diff | comparison | revisions
src/glRenderer.cpp file | annotate | diff | comparison | revisions
src/guiutilities.cpp file | annotate | diff | comparison | revisions
src/ldObject.cpp file | annotate | diff | comparison | revisions
src/ldpaths.cpp file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/miscallenous.cpp file | annotate | diff | comparison | revisions
src/partdownloader.cpp file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/filetoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/movetoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/viewtoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/colors.h	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/colors.h	Thu Jan 04 22:52:04 2018 +0200
@@ -84,7 +84,7 @@
 };
 
 //
-// Parses ldconfig.ldr
+// Parses ldconfig->ldr
 //
 class LDConfigParser
 {
--- a/src/dialogs/colorselector.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/dialogs/colorselector.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -55,8 +55,8 @@
 
 			if (ldcolor == MainColor)
 			{
-				color = QColor(config.mainColor());
-				color.setAlphaF(config.mainColorAlpha());
+				color = QColor(config->mainColor());
+				color.setAlphaF(config->mainColorAlpha());
 			}
 
 			QString color2name(luma(color) < 80 ? "white" : "black");
--- a/src/dialogs/configdialog.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/dialogs/configdialog.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -14,10 +14,6 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *  =====================================================================
- *
- *  configDialog.cxx: Settings dialog and everything related to it.
- *  Actual configuration core is in config.cxx.
  */
 
 #include <QGridLayout>
@@ -82,7 +78,7 @@
 	applyToWidgetOptions(
 	[&](QWidget* widget, QString confname)
 	{
-		QVariant value = m_settings->value(confname, config.defaultValueByName(confname));
+		QVariant value = m_settings->value(confname, config->defaultValueByName(confname));
 		QLineEdit* le;
 		QSpinBox* spinbox;
 		QDoubleSpinBox* doublespinbox;
@@ -232,7 +228,7 @@
 
 		QString optionname(widget->objectName().mid(strlen("config")));
 
-		if (config.existsEntry(optionname))
+		if (config->existsEntry(optionname))
 			func(widget, optionname);
 		else
 			print("Couldn't find configuration entry named %1", optionname);
@@ -277,7 +273,7 @@
 
 	// Rebuild the quick color toolbar
 	m_window->setQuickColors(quickColors);
-	config.setQuickColorToolbar(quickColorString());
+	config->setQuickColorToolbar(quickColorString());
 
 	// Ext program settings
 	for (int i = 0; i < NumExternalPrograms; ++i)
--- a/src/dialogs/newpartdialog.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/dialogs/newpartdialog.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -31,13 +31,13 @@
 {
 	ui.setupUi(this);
 
-	QString authortext = config.defaultName();
+	QString authortext = config->defaultName();
 
-	if (not config.defaultUser().isEmpty())
-		authortext.append(format(" [%1]", config.defaultUser()));
+	if (not config->defaultUser().isEmpty())
+		authortext.append(format(" [%1]", config->defaultUser()));
 
 	ui.author->setText(authortext);
-	ui.useCaLicense->setChecked(config.useCaLicense());
+	ui.useCaLicense->setChecked(config->useCaLicense());
 }
 
 BfcStatement NewPartDialog::getWinding() const
--- a/src/documentmanager.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/documentmanager.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -139,7 +139,7 @@
 		unknowns << static_cast<LDError*>(obj)->fileReferenced();
 	}
 
-	if (config.tryDownloadMissingFiles() and not unknowns.isEmpty())
+	if (config->tryDownloadMissingFiles() and not unknowns.isEmpty())
 	{
 		PartDownloader dl(m_window);
 		dl.setSourceType(PartDownloader::PartsTracker);
@@ -225,7 +225,7 @@
 		return relativePath;
 
 	// Try with just the LDraw path first
-	QString fullPath = format("%1" DIRSLASH "%2", config.lDrawPath(), relativePath);
+	QString fullPath = format("%1" DIRSLASH "%2", config->lDrawPath(), relativePath);
 
 	if (QFileInfo::exists(fullPath))
 		return fullPath;
@@ -234,7 +234,7 @@
 	{
 		// Look in sub-directories: parts and p. Also look in the download path, since that's where we download parts
 		// from the PT to.
-		QStringList dirs = { config.lDrawPath(), config.downloadFilePath() };
+		QStringList dirs = { config->lDrawPath(), config->downloadFilePath() };
 		for (const QString& topdir : dirs)
 		{
 			for (const QString& subdir : QStringList({ "parts", "p" }))
@@ -362,7 +362,7 @@
 
 void DocumentManager::addRecentFile(QString path)
 {
-	QStringList recentFiles = config.recentFiles();
+	QStringList recentFiles = config->recentFiles();
 	int idx = recentFiles.indexOf(path);
 
 	// If this file already is in the list, pop it out.
@@ -380,7 +380,7 @@
 
 	// Add the file
 	recentFiles << path;
-	config.setRecentFiles(recentFiles);
+	config->setRecentFiles(recentFiles);
 	m_window->syncSettings();
 	m_window->updateRecentFilesMenu();
 }
@@ -415,7 +415,7 @@
 	// Possibly substitute with logoed studs:
 	// stud.dat -> stud-logo.dat
 	// stud2.dat -> stud-logo2.dat
-	if (config.useLogoStuds() and renderinline)
+	if (config->useLogoStuds() and renderinline)
 	{
 		// Ensure logoed studs are loaded first
 		loadLogoedStuds();
--- a/src/editmodes/abstractEditMode.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/editmodes/abstractEditMode.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -189,7 +189,7 @@
 void AbstractDrawMode::drawLength(QPainter &painter, const Vertex &v0, const Vertex &v1,
 	const QPointF& v0p, const QPointF& v1p) const
 {
-	if (not config.drawLineLengths())
+	if (not config->drawLineLengths())
 		return;
 
 	const QString label = QString::number((v1 - v0).length());
@@ -231,7 +231,7 @@
 			if (withlengths)
 				drawLength(painter, poly3d[i], poly3d[j], poly[i], poly[j]);
 
-			if (withangles and config.drawAngles())
+			if (withangles and config->drawAngles())
 			{
 				QLineF l0(poly[h], poly[i]),
 					l1(poly[i], poly[j]);
--- a/src/glCompiler.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/glCompiler.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -145,7 +145,7 @@
 		}
 		else if (poly.color == EdgeColor)
 		{
-			qcol = luma(QColor(config.backgroundColor())) > 40 ? Qt::black : Qt::white;
+			qcol = luma(QColor(config->backgroundColor())) > 40 ? Qt::black : Qt::white;
 		}
 		else
 		{
@@ -186,7 +186,7 @@
 
 	if (blendAlpha != 0.0)
 	{
-		QColor selcolor(config.selectColorBlend());
+		QColor selcolor(config->selectColorBlend());
 		double denom = blendAlpha + 1.0;
 		qcol.setRed((qcol.red() +(selcolor.red() * blendAlpha)) / denom);
 		qcol.setGreen((qcol.green() +(selcolor.green() * blendAlpha)) / denom);
--- a/src/glRenderer.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/glRenderer.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -78,7 +78,7 @@
 	m_initialized(false)
 {
 	m_isPicking = false;
-	m_camera = (ECamera) config.camera();
+	m_camera = (ECamera) config->camera();
 	m_drawToolTip = false;
 	m_currentEditMode = AbstractEditMode::createByType(this, EditModeType::Select);
 	m_panning = false;
@@ -174,7 +174,7 @@
 	glShadeModel(GL_SMOOTH);
 	glEnable(GL_MULTISAMPLE);
 
-	if (config.antiAliasedLines())
+	if (config->antiAliasedLines())
 	{
 		glEnable(GL_LINE_SMOOTH);
 		glEnable(GL_POLYGON_SMOOTH);
@@ -264,7 +264,7 @@
 	initializeOpenGLFunctions();
 #endif
 	setBackground();
-	glLineWidth(config.lineThickness());
+	glLineWidth(config->lineThickness());
 	glLineStipple(1, 0x6666);
 	setAutoFillBackground(false);
 	setMouseTracking(true);
@@ -331,7 +331,7 @@
 		return;
 	}
 
-	QColor color = config.backgroundColor();
+	QColor color = config->backgroundColor();
 
 	if (not color.isValid())
 		return;
@@ -392,7 +392,7 @@
 		zoomAllToFit();
 	}
 
-	if (config.drawWireframe() and not isPicking())
+	if (config->drawWireframe() and not isPicking())
 		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -446,7 +446,7 @@
 	}
 	else
 	{
-		if (config.bfcRedGreenView())
+		if (config->bfcRedGreenView())
 		{
 			glEnable(GL_CULL_FACE);
 			glCullFace(GL_BACK);
@@ -461,7 +461,7 @@
 		{
 			ComplementVboType colors;
 
-			if (config.randomColors())
+			if (config->randomColors())
 				colors = RandomColorsVboComplement;
 			else
 				colors = NormalColorsVboComplement;
@@ -475,7 +475,7 @@
 		drawVbos(ConditionalLinesVbo, NormalColorsVboComplement, GL_LINES);
 		glDisable(GL_LINE_STIPPLE);
 
-		if (config.drawAxes())
+		if (config->drawAxes())
 		{
 			glBindBuffer(GL_ARRAY_BUFFER, m_axesVbo);
 			glVertexPointer(3, GL_FLOAT, 0, NULL);
@@ -501,9 +501,9 @@
 void GLRenderer::drawVbos(SurfaceVboType surface, ComplementVboType colors, GLenum type)
 {
 	// Filter this through some configuration options
-	if ((isOneOf(surface, QuadsVbo, TrianglesVbo) and config.drawSurfaces() == false)
-		or(surface == LinesVbo and config.drawEdgeLines() == false)
-		or(surface == ConditionalLinesVbo and config.drawConditionalLines() == false))
+	if ((isOneOf(surface, QuadsVbo, TrianglesVbo) and config->drawSurfaces() == false)
+		or(surface == LinesVbo and config->drawEdgeLines() == false)
+		or(surface == ConditionalLinesVbo and config->drawConditionalLines() == false))
 	{
 		return;
 	}
@@ -914,7 +914,7 @@
 		return;
 
 	m_camera = cam;
-	config.setCamera((int) cam);
+	config->setCamera((int) cam);
 	m_window->updateEditModeActions();
 }
 
@@ -1096,14 +1096,14 @@
 		glDisable(GL_DITHER);
 
 		// Use particularly thick lines while picking ease up selecting lines.
-		glLineWidth(qMax<double>(config.lineThickness(), 6.5));
+		glLineWidth(qMax<double>(config->lineThickness(), 6.5));
 	}
 	else
 	{
 		glEnable(GL_DITHER);
 
 		// Restore line thickness
-		glLineWidth(config.lineThickness());
+		glLineWidth(config->lineThickness());
 	}
 }
 
@@ -1540,14 +1540,14 @@
 //
 void GLRenderer::highlightCursorObject()
 {
-	if (not config.highlightObjectBelowCursor() and objectAtCursor() == nullptr)
+	if (not config->highlightObjectBelowCursor() and objectAtCursor() == nullptr)
 		return;
 
 	LDObject* newObject = nullptr;
 	LDObject* oldObject = objectAtCursor();
 	qint32 newIndex;
 
-	if (m_isCameraMoving or not config.highlightObjectBelowCursor())
+	if (m_isCameraMoving or not config->highlightObjectBelowCursor())
 	{
 		newIndex = 0;
 	}
--- a/src/guiutilities.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/guiutilities.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -37,8 +37,8 @@
 	if (ldcolor == MainColor)
 	{
 		// Use the user preferences for main color here
-		color = config.mainColor();
-		color.setAlphaF(config.mainColorAlpha());
+		color = config->mainColor();
+		color.setAlphaF(config->mainColorAlpha());
 	}
 
 	// Paint the icon border
@@ -84,11 +84,11 @@
 
 QColor GuiUtilities::mainColorRepresentation()
 {
-	QColor col(config.mainColor());
+	QColor col(config->mainColor());
 
 	if (not col.isValid())
 		return QColor(0, 0, 0);
 
-	col.setAlpha(config.mainColorAlpha() * 255.f);
+	col.setAlpha(config->mainColorAlpha() * 255.f);
 	return col;
 }
--- a/src/ldObject.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/ldObject.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -1167,7 +1167,7 @@
 //
 QString PreferredLicenseText()
 {
-	return config.useCaLicense() ? CALicenseText : "";
+	return config->useCaLicense() ? CALicenseText : "";
 }
 
 // =============================================================================
--- a/src/ldpaths.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/ldpaths.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -29,7 +29,7 @@
 
 void LDPaths::checkPaths()
 {
-	QString pathconfig = config.lDrawPath();
+	QString pathconfig = config->lDrawPath();
 
 	if (not configurePaths(pathconfig))
 	{
@@ -39,7 +39,7 @@
 		if (not m_dialog->exec())
 			exit(1);
 		else
-			config.setLDrawPath(m_dialog->path());
+			config->setLDrawPath(m_dialog->path());
 	}
 }
 
--- a/src/main.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/main.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -24,7 +24,7 @@
 #include "documentmanager.h"
 
 MainWindow* g_win = nullptr;
-ConfigurationValueBag config;
+ConfigurationValueBag* config;
 ConfigOption(bool FirstStart = true)
 
 int main(int argc, char* argv[])
@@ -33,6 +33,9 @@
 	app.setOrganizationName(APPNAME);
 	app.setApplicationName(APPNAME);
 
+	static ConfigurationValueBag configInstance;
+	::config = &configInstance;
+
 	LDPaths* paths = new LDPaths;
 	paths->checkPaths();
 	paths->deleteLater();
--- a/src/main.h	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/main.h	Thu Jan 04 22:52:04 2018 +0200
@@ -33,4 +33,4 @@
 #include "hierarchyelement.h"
 #include "configurationvaluebag.h"
 
-extern ConfigurationValueBag config;
\ No newline at end of file
+extern ConfigurationValueBag* config;
\ No newline at end of file
--- a/src/mainwindow.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/mainwindow.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -160,7 +160,7 @@
 		}
 	}
 
-	for (QVariant const& toolbarname : config.hiddenToolbars())
+	for (QVariant const& toolbarname : config->hiddenToolbars())
 	{
 		QToolBar* toolbar = findChild<QToolBar*>(toolbarname.toString());
 
@@ -170,11 +170,11 @@
 
 	// If this is the first start, get the user to configuration. Especially point
 	// them to the profile tab, it's the most important form to fill in.
-	if (config.firstStart())
+	if (config->firstStart())
 	{
 		ConfigDialog* dialog = new ConfigDialog(this, ConfigDialog::ProfileTab);
 		dialog->show();
-		config.setFirstStart(false);
+		config->setFirstStart(false);
 	}
 }
 
@@ -234,7 +234,7 @@
 
 	QAction* first = nullptr;
 
-	for (const QVariant& it : config.recentFiles())
+	for (const QVariant& it : config->recentFiles())
 	{
 		QString file = it.toString();
 		QAction* recent = new QAction(GetIcon("open-recent"), file, this);
@@ -252,7 +252,7 @@
 {
 	QList<ColorToolbarItem> colors;
 
-	for (QString colorname : config.quickColorToolbar().split(":"))
+	for (QString colorname : config->quickColorToolbar().split(":"))
 	{
 		if (colorname == "|")
 			colors << ColorToolbarItem::makeSeparator();
@@ -306,7 +306,7 @@
 void MainWindow::updateGridToolBar()
 {
 	// Ensure that the current grid - and only the current grid - is selected.
-	int grid = config.grid();
+	int grid = config->grid();
 	ui.actionGridCoarse->setChecked(grid == Grid::Coarse);
 	ui.actionGridMedium->setChecked(grid == Grid::Medium);
 	ui.actionGridFine->setChecked(grid == Grid::Fine);
@@ -481,7 +481,7 @@
 			item->setBackground(QColor("#AA0000"));
 			item->setForeground(QColor("#FFAA00"));
 		}
-		else if (config.colorizeObjectsList()
+		else if (config->colorizeObjectsList()
 			and obj->isColored()
 			and obj->color().isValid()
 			and obj->color() != MainColor
@@ -714,7 +714,7 @@
 	}
 
 	// Save the configuration before leaving.
-	config.setHiddenToolbars(hiddenToolbars);
+	config->setHiddenToolbars(hiddenToolbars);
 	syncSettings();
 	ev->accept();
 }
@@ -1040,14 +1040,14 @@
 		ui.actionRedo->setEnabled(pos <(long) his->size() - 1);
 	}
 
-	ui.actionWireframe->setChecked(config.drawWireframe());
-	ui.actionAxes->setChecked(config.drawAxes());
-	ui.actionBfcView->setChecked(config.bfcRedGreenView());
-	ui.actionRandomColors->setChecked(config.randomColors());
-	ui.actionDrawAngles->setChecked(config.drawAngles());
-	ui.actionDrawSurfaces->setChecked(config.drawSurfaces());
-	ui.actionDrawEdgeLines->setChecked(config.drawEdgeLines());
-	ui.actionDrawConditionalLines->setChecked(config.drawConditionalLines());
+	ui.actionWireframe->setChecked(config->drawWireframe());
+	ui.actionAxes->setChecked(config->drawAxes());
+	ui.actionBfcView->setChecked(config->bfcRedGreenView());
+	ui.actionRandomColors->setChecked(config->randomColors());
+	ui.actionDrawAngles->setChecked(config->drawAngles());
+	ui.actionDrawSurfaces->setChecked(config->drawSurfaces());
+	ui.actionDrawEdgeLines->setChecked(config->drawEdgeLines());
+	ui.actionDrawConditionalLines->setChecked(config->drawConditionalLines());
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -1202,7 +1202,7 @@
 //
 QVariant MainWindow::getConfigValue(QString name)
 {
-	QVariant value = m_settings->value(name, config.defaultValueByName(name));
+	QVariant value = m_settings->value(name, config->defaultValueByName(name));
 	return value;
 }
 
--- a/src/miscallenous.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/miscallenous.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -100,11 +100,11 @@
 
 float gridCoordinateSnap()
 {
-	switch(config.grid())
+	switch(config->grid())
 	{
-	case Grid::Coarse: return config.gridCoarseCoordinateSnap();
-	case Grid::Medium: return config.gridMediumCoordinateSnap();
-	case Grid::Fine: return config.gridFineCoordinateSnap();
+	case Grid::Coarse: return config->gridCoarseCoordinateSnap();
+	case Grid::Medium: return config->gridMediumCoordinateSnap();
+	case Grid::Fine: return config->gridFineCoordinateSnap();
 	}
 
 	return 1.0f;
@@ -112,11 +112,11 @@
 
 float gridAngleSnap()
 {
-	switch(config.grid())
+	switch(config->grid())
 	{
-	case Grid::Coarse: return config.gridCoarseAngleSnap();
-	case Grid::Medium: return config.gridMediumAngleSnap();
-	case Grid::Fine: return config.gridFineAngleSnap();
+	case Grid::Coarse: return config->gridCoarseAngleSnap();
+	case Grid::Medium: return config->gridMediumAngleSnap();
+	case Grid::Fine: return config->gridFineAngleSnap();
 	}
 
 	return 45.0f;
@@ -124,12 +124,12 @@
 
 float gridBezierCurveSegments()
 {
-	switch(config.grid())
+	switch(config->grid())
 	{
 	default:
-	case Grid::Coarse: return config.gridCoarseBezierCurveSegments();
-	case Grid::Medium: return config.gridMediumBezierCurveSegments();
-	case Grid::Fine: return config.gridFineBezierCurveSegments();
+	case Grid::Coarse: return config->gridCoarseBezierCurveSegments();
+	case Grid::Medium: return config->gridMediumBezierCurveSegments();
+	case Grid::Fine: return config->gridFineBezierCurveSegments();
 	}
 }
 
@@ -184,7 +184,7 @@
 //
 Vertex GetRotationPoint(const LDObjectList& objs)
 {
-	switch(RotationPoint(config.rotationPointType()))
+	switch(RotationPoint(config->rotationPointType()))
 	{
 	case RotationPoint::ObjectOrigin:
 		{
@@ -206,7 +206,7 @@
 		return {};
 
 	case RotationPoint::CustomPoint:
-		return config.customRotationPoint();
+		return config->customRotationPoint();
 
 	case RotationPoint::NumValues:
 		break;
@@ -223,7 +223,7 @@
 	Ui::RotPointUI ui;
 	ui.setupUi(dlg);
 
-	switch(RotationPoint(config.rotationPointType()))
+	switch(RotationPoint(config->rotationPointType()))
 	{
 	case RotationPoint::ObjectOrigin:
 		ui.objectPoint->setChecked(true);
@@ -241,7 +241,7 @@
 		break;
 	}
 
-	Vertex custompoint = config.customRotationPoint();
+	Vertex custompoint = config->customRotationPoint();
 	ui.customX->setValue(custompoint.x());
 	ui.customY->setValue(custompoint.y());
 	ui.customZ->setValue(custompoint.z());
@@ -249,7 +249,7 @@
 	if (not dlg->exec())
 		return;
 
-	config.setRotationPointType(int(
+	config->setRotationPointType(int(
 		(ui.objectPoint->isChecked()) ? RotationPoint::ObjectOrigin :
 		(ui.worldPoint->isChecked())  ? RotationPoint::WorldOrigin :
 		RotationPoint::CustomPoint));
@@ -257,7 +257,7 @@
 	custompoint.setX(ui.customX->value());
 	custompoint.setY(ui.customY->value());
 	custompoint.setZ(ui.customZ->value());
-	config.setCustomRotationPoint(custompoint);
+	config->setCustomRotationPoint(custompoint);
 }
 
 // =============================================================================
--- a/src/partdownloader.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/partdownloader.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -74,7 +74,7 @@
 		if (path.isEmpty())
 			reject();
 		else
-			config.setDownloadFilePath(path);
+			config->setDownloadFilePath(path);
 	}
 }
 
@@ -103,7 +103,7 @@
 	dest = dest.simplified();
 
 	// If the user doesn't want us to guess, stop right here.
-	if (not config.guessDownloadPaths())
+	if (not config->guessDownloadPaths())
 		return;
 
 	// Ensure .dat extension
@@ -271,7 +271,7 @@
 	for (LDDocument* f : m_files)
 		f->reloadAllSubfiles();
 
-	if (config.autoCloseDownloadDialog() and not failed)
+	if (config->autoCloseDownloadDialog() and not failed)
 	{
 		// Close automatically if desired.
 		accept();
@@ -323,7 +323,7 @@
 
 QString PartDownloader::downloadPath()
 {
-	QString path = config.downloadFilePath();
+	QString path = config->downloadFilePath();
 
 	if (DIRSLASH[0] != '/')
 		path.replace(DIRSLASH, "/");
--- a/src/primitives.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/primitives.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -625,10 +625,10 @@
 	QString author = APPNAME;
 	QString license = "";
 
-	if (not config.defaultName().isEmpty())
+	if (not config->defaultName().isEmpty())
 	{
 		license = PreferredLicenseText();
-		author = format("%1 [%2]", config.defaultName(), config.defaultUser());
+		author = format("%1 [%2]", config->defaultName(), config->defaultUser());
 	}
 
 	LDObjectList objs;
--- a/src/toolsets/algorithmtoolset.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -161,12 +161,12 @@
 
 			v.apply([&](Axis, double& a)
 			{
-				a = RoundToDecimals(a, config.roundPositionPrecision());
+				a = RoundToDecimals(a, config->roundPositionPrecision());
 			});
 
 			ApplyToMatrix(t, [&](int, double& a)
 			{
-				a = RoundToDecimals(a, config.roundMatrixPrecision());
+				a = RoundToDecimals(a, config->roundMatrixPrecision());
 			});
 
 			mo->setPosition(v);
@@ -180,7 +180,7 @@
 				Vertex v = obj->vertex(i);
 				v.apply([&](Axis, double& a)
 				{
-					a = RoundToDecimals(a, config.roundPositionPrecision());
+					a = RoundToDecimals(a, config->roundPositionPrecision());
 				});
 				obj->setVertex(i, v);
 				num += 3;
@@ -367,7 +367,7 @@
 	QDialog* dlg = new QDialog;
 	Ui_AddHistoryLine* ui = new Ui_AddHistoryLine;
 	ui->setupUi(dlg);
-	ui->m_username->setText(config.defaultUser());
+	ui->m_username->setText(config->defaultUser());
 	ui->m_date->setDate(QDate::currentDate());
 	ui->m_comment->setFocus();
 
@@ -412,12 +412,12 @@
 {
 	bool ok;
 	int segments = QInputDialog::getInt(m_window, APPNAME, "Amount of segments:",
-		config.splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
+		config->splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
 
 	if (not ok)
 		return;
 
-	config.setSplitLinesSegments(segments);
+	config->setSplitLinesSegments(segments);
 
 	for (LDObject* obj : selectedObjects())
 	{
@@ -578,7 +578,7 @@
 	LDObjectList objs;
 	objs << LDSpawn<LDComment>(subtitle);
 	objs << LDSpawn<LDComment>("Name: "); // This gets filled in when the subfile is saved
-	objs << LDSpawn<LDComment>(format("Author: %1 [%2]", config.defaultName(), config.defaultUser()));
+	objs << LDSpawn<LDComment>(format("Author: %1 [%2]", config->defaultName(), config->defaultUser()));
 	objs << LDSpawn<LDComment>("!LDRAW_ORG Unofficial_Subpart");
 
 	if (not license.isEmpty())
--- a/src/toolsets/filetoolset.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/toolsets/filetoolset.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -98,10 +98,10 @@
 
 void FileToolset::setLDrawPath()
 {
-	LDrawPathDialog* dialog = new LDrawPathDialog(config.lDrawPath(), true);
+	LDrawPathDialog* dialog = new LDrawPathDialog(config->lDrawPath(), true);
 
 	if (dialog->exec())
-		config.setLDrawPath(dialog->path());
+		config->setLDrawPath(dialog->path());
 }
 
 void FileToolset::exit()
--- a/src/toolsets/movetoolset.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/toolsets/movetoolset.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -44,19 +44,19 @@
 
 void MoveToolset::gridCoarse()
 {
-	config.setGrid(Grid::Coarse);
+	config->setGrid(Grid::Coarse);
 	m_window->updateGridToolBar();
 }
 
 void MoveToolset::gridMedium()
 {
-	config.setGrid(Grid::Medium);
+	config->setGrid(Grid::Medium);
 	m_window->updateGridToolBar();
 }
 
 void MoveToolset::gridFine()
 {
-	config.setGrid(Grid::Fine);
+	config->setGrid(Grid::Fine);
 	m_window->updateGridToolBar();
 }
 
--- a/src/toolsets/viewtoolset.cpp	Thu Jan 04 22:42:01 2018 +0200
+++ b/src/toolsets/viewtoolset.cpp	Thu Jan 04 22:52:04 2018 +0200
@@ -126,7 +126,7 @@
 
 void ViewToolset::axes()
 {
-	config.setDrawAxes(not config.drawAxes());
+	config->setDrawAxes(not config->drawAxes());
 	m_window->updateActions();
 	m_window->renderer()->update();
 }
@@ -151,7 +151,7 @@
 
 void ViewToolset::wireframe()
 {
-	config.setDrawWireframe(not config.drawWireframe());
+	config->setDrawWireframe(not config->drawWireframe());
 	m_window->renderer()->refresh();
 }
 
@@ -173,7 +173,7 @@
 
 void ViewToolset::drawAngles()
 {
-	config.setDrawAngles(not config.drawAngles());
+	config->setDrawAngles(not config->drawAngles());
 	m_window->renderer()->refresh();
 }
 
@@ -242,10 +242,10 @@
 
 void ViewToolset::bfcView()
 {
-	config.setBfcRedGreenView(not config.bfcRedGreenView());
+	config->setBfcRedGreenView(not config->bfcRedGreenView());
 
-	if (config.bfcRedGreenView())
-		config.setRandomColors(false);
+	if (config->bfcRedGreenView())
+		config->setRandomColors(false);
 
 	m_window->updateActions();
 	m_window->renderer()->refresh();
@@ -273,10 +273,10 @@
 
 void ViewToolset::randomColors()
 {
-	config.setRandomColors(not config.randomColors());
+	config->setRandomColors(not config->randomColors());
 
-	if (config.randomColors())
-		config.setBfcRedGreenView(false);
+	if (config->randomColors())
+		config->setBfcRedGreenView(false);
 
 	m_window->updateActions();
 	m_window->renderer()->refresh();
@@ -284,18 +284,18 @@
 
 void ViewToolset::drawSurfaces()
 {
-	config.setDrawSurfaces(not config.drawSurfaces());
+	config->setDrawSurfaces(not config->drawSurfaces());
 	m_window->updateActions();
 }
 
 void ViewToolset::drawEdgeLines()
 {
-	config.setDrawEdgeLines(not config.drawEdgeLines());
+	config->setDrawEdgeLines(not config->drawEdgeLines());
 	m_window->updateActions();
 }
 
 void ViewToolset::drawConditionalLines()
 {
-	config.setDrawConditionalLines(not config.drawConditionalLines());
+	config->setDrawConditionalLines(not config->drawConditionalLines());
 	m_window->updateActions();
 }
\ No newline at end of file

mercurial