@@ -163,14 +163,12 @@ void MainWindow::load_config(QString filename) {
163163 // StorageLocation
164164 QString studyRoot;
165165 legacyTemplate.clear ();
166- // StudyRoot
167- if (pt.contains (" StudyRoot" )) { studyRoot = pt.value (" StudyRoot" ).toString (); }
168-
166+
169167 if (pt.contains (" StorageLocation" )) {
170- if (!studyRoot. isEmpty ( ))
171- throw std::runtime_error (" Both StudyRoot and StorageLocation specified" );
168+ if (pt. contains ( " StudyRoot " ))
169+ throw std::runtime_error (" StorageLocation cannot be used if StudyRoot is also specified. " );
172170 if (pt.contains (" PathTemplate" ))
173- throw std::runtime_error (" Both StorageLocation and PathTemplate specified" );
171+ throw std::runtime_error (" StorageLocation cannot be used if PathTemplate is also specified. " );
174172
175173 QString str_path = pt.value (" StorageLocation" ).toString ();
176174 QString path_root;
@@ -181,16 +179,18 @@ void MainWindow::load_config(QString filename) {
181179 // foo/bar/baz%a/untitled.xdf gets split into
182180 // foo/bar and baz%a/untitled.xdf
183181 path_root = str_path.left (index);
184- } else
182+ } else {
185183 // Otherwise, it's split into folder and constant filename
186184 path_root = str_path;
187- path_root = QFileInfo (path_root).path ();
188- legacyTemplate = str_path.remove (0 , path_root.length () + 1 );
189- // absolute path, nothing to be done
185+ }
190186 studyRoot = QFileInfo (path_root).absolutePath ();
191- ui->lineEdit_template ->setText (QDir::toNativeSeparators (legacyTemplate));
187+ legacyTemplate = str_path.remove (0 , studyRoot.length () + 1 );
188+ // absolute path, nothing to be done
189+ // studyRoot = QFileInfo(path_root).absolutePath();
192190 }
193- if (pt.contains (" PathTemplate" )) legacyTemplate = pt.value (" PathTemplate" ).toString ();
191+ // StudyRoot
192+ if (pt.contains (" StudyRoot" )) { studyRoot = pt.value (" StudyRoot" ).toString (); }
193+ if (pt.contains (" PathTemplate" )) { legacyTemplate = pt.value (" PathTemplate" ).toString (); }
194194
195195 if (studyRoot.isEmpty ())
196196 studyRoot = QStandardPaths::writableLocation (QStandardPaths::DocumentsLocation) +
@@ -199,7 +199,7 @@ void MainWindow::load_config(QString filename) {
199199
200200 if (legacyTemplate.isEmpty ()) {
201201 ui->check_bids ->setChecked (true );
202- // Legacy takes the form path/to/study/ exp%n/%b.xdf
202+ // Use default, exp%n/%b.xdf , only to be used if BIDS gets unchecked.
203203 legacyTemplate = " exp%n/block_%b.xdf" ;
204204 } else {
205205 ui->check_bids ->setChecked (false );
@@ -211,20 +211,20 @@ void MainWindow::load_config(QString filename) {
211211 ui->input_modality ->count (), pt.value (" BidsModalities" , bids_modalities_default).toStringList ());
212212 ui->input_modality ->setCurrentIndex (0 );
213213
214- buildFilename ();
214+ buildFilename ();
215215
216216 // Remote Control Socket options
217217 if (pt.contains (" RCSPort" )) {
218- int rcs_port = pt.value (" RCSPort" ).toInt ();
218+ int rcs_port = pt.value (" RCSPort" ).toInt ();
219219 ui->rcsport ->setValue (rcs_port);
220- // In case it's already running (how?), stop the RCS listener.
220+ // In case it's already running (how?), stop the RCS listener.
221221 ui->rcsCheckBox ->setChecked (false );
222- }
223-
224- if (pt.contains (" RCSEnabled" )) {
225- bool b_enable_rcs = pt.value (" RCSEnabled" ).toBool ();
222+ }
223+
224+ if (pt.contains (" RCSEnabled" )) {
225+ bool b_enable_rcs = pt.value (" RCSEnabled" ).toBool ();
226226 ui->rcsCheckBox ->setChecked (b_enable_rcs);
227- }
227+ }
228228
229229 // Check the wild-card-replaced filename to see if it exists already.
230230 // If it does then increment the exp number.
@@ -445,7 +445,7 @@ void MainWindow::buildFilename() {
445445 // This function is only called when a widget within Location Builder is activated.
446446
447447 // Build the file location in parts, starting with the root folder.
448- if (ui->check_bids ->isChecked ()) buildBidsTemplate ();
448+ if (ui->check_bids ->isChecked ()) { buildBidsTemplate (); }
449449 QString tpl = QDir::cleanPath (ui->lineEdit_template ->text ());
450450
451451 // Auto-increment Spin/Run Number if necessary.
0 commit comments