Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
ec4a1027
Commit
ec4a1027
authored
Aug 16, 2016
by
Samuel Jackson
Browse files
Refs #16962 Use QSettings instead of ConfigService
parent
3b274c1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
MantidPlot/src/ApplicationWindow.cpp
View file @
ec4a1027
...
...
@@ -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);
...
...
MantidQt/MantidWidgets/src/InstrumentView/InstrumentWidgetMaskTab.cpp
View file @
ec4a1027
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment