Commit ec4a1027 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #16962 Use QSettings instead of ConfigService

parent 3b274c1d
......@@ -4572,8 +4572,14 @@ void ApplicationWindow::openRecentProject(QAction *action) {
// Have to change the working directory here because that is used when
// finding the nexus files to load
workingDir = QFileInfo(f).absolutePath();
ConfigService::Instance().setString("project.workingdir",
workingDir.toStdString());
// store the working directory in the settings so it may be accessed
// elsewhere in the Qt layer.
QSettings settings;
settings.beginGroup("/Project");
settings.setValue("/WorkingDirectory", workingDir);
settings.endGroup();
ApplicationWindow *a = open(fn, false, false);
if (a && (fn.endsWith(".qti", Qt::CaseInsensitive) ||
fn.endsWith(".qti~", Qt::CaseInsensitive) ||
......@@ -4608,9 +4614,13 @@ ApplicationWindow *ApplicationWindow::openProject(const QString &filename,
newProject();
m_mantidmatrixWindows.clear();
 
// store the working directory in the config service.
ConfigService::Instance().setString("project.workingdir",
workingDir.toStdString());
// store the working directory in the settings so it may be accessed
// elsewhere in the Qt layer.
QSettings settings;
settings.beginGroup("/Project");
settings.setValue("/WorkingDirectory", workingDir);
settings.endGroup();
projectname = filename;
setWindowTitle("MantidPlot - " + filename);
 
......
......@@ -52,6 +52,7 @@
#include <QTemporaryFile>
#include <QGroupBox>
#include <QCheckBox>
#include <QSettings>
#include "MantidQtAPI/FileDialogHandler.h"
......@@ -1235,8 +1236,9 @@ void InstrumentWidgetMaskTab::loadMaskViewFromProject(const std::string &name) {
using namespace Mantid::API;
using namespace Mantid::Kernel;
auto workingDir = ConfigService::Instance().getString("project.workingdir");
auto fileName = workingDir + "/" + name;
QSettings settings;
auto workingDir = settings.value("Project/WorkingDirectory", "").toString();
auto fileName = workingDir.toStdString() + "/" + name;
auto maskWS = loadMask(fileName);
if (!maskWS)
......@@ -1284,9 +1286,9 @@ InstrumentWidgetMaskTab::loadMask(const std::string &fileName) {
}
// get the mask workspace and remove from ADS to clean up
auto maskWS =
AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(tempName);
AnalysisDataService::Instance().remove(tempName);
auto &ads = AnalysisDataService::Instance();
auto maskWS = ads.retrieveWS<MatrixWorkspace>(tempName);
ads.remove(tempName);
return maskWS;
}
......@@ -1341,8 +1343,9 @@ bool InstrumentWidgetMaskTab::saveMaskViewToProject(
using namespace Mantid::API;
using namespace Mantid::Kernel;
auto workingDir = ConfigService::Instance().getString("project.workingdir");
auto fileName = workingDir + "/" + name;
QSettings settings;
auto workingDir = settings.value("Project/WorkingDirectory", "").toString();
auto fileName = workingDir.toStdString() + "/" + name;
try {
// get masked detector workspace from actor
......
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