--- a/src/ldpaths.cpp Wed Feb 17 02:56:59 2016 +0200 +++ b/src/ldpaths.cpp Wed Feb 17 03:10:12 2016 +0200 @@ -23,26 +23,29 @@ ConfigOption (QString LDrawPath) -LDPaths::LDPaths (QObject* parent) : - QObject (parent), - m_dialog (nullptr) {} +LDPaths::LDPaths (Configuration *config, QObject* parent) : + QObject(parent), + m_config(config), + m_dialog(nullptr) {} + void LDPaths::checkPaths() { - QString pathconfig = Config->lDrawPath(); + QString pathconfig = m_config->lDrawPath(); if (not configurePaths (pathconfig)) { m_dialog = new LDrawPathDialog (pathconfig, false); - connect (m_dialog, SIGNAL (pathChanged(QString)), this, SLOT (configurePaths (QString))); + connect(m_dialog, &LDrawPathDialog::pathChanged, this, &LDPaths::configurePaths); - if (not m_dialog->exec()) - exit (1); + if (m_dialog->exec() != QDialog::Accepted) + exit(1); else - Config->setLDrawPath (m_dialog->path()); + m_config->setLDrawPath(m_dialog->path()); } } + bool LDPaths::isValid (const QDir& dir) const { if (dir.exists()) @@ -66,6 +69,7 @@ return m_error.isEmpty(); } + bool LDPaths::configurePaths (QString path) { QDir dir (path); @@ -85,24 +89,28 @@ return ok; } + QString& LDPaths::ldConfigPath() { static QString value; return value; } + QDir& LDPaths::primitivesDir() { static QDir value; return value; } + QDir& LDPaths::partsDir() { static QDir value; return value; } + QDir& LDPaths::baseDir() { static QDir value;