Allow a test profile to be created at an arbitrary path.

Currently there is a very messy tangle of dependencies between
loaders, machines, sessions, and profiles. Right now the
simplest way to create a test loader instance is to create
a test profile, under which the machine and session instances
will exist.
This commit is contained in:
sawinglogz 2019-05-03 16:17:32 -04:00
parent 7937b57b5f
commit 02ffeb6c39
3 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,6 @@
/* SleepLib PRS1 Loader Header /* SleepLib PRS1 Loader Header
* *
* Copyright (c) 2019 The OSCAR Team
* Copyright (C) 2011-2018 Mark Watkins <mark@jedimark.net> * Copyright (C) 2011-2018 Mark Watkins <mark@jedimark.net>
* *
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public

View File

@ -1,5 +1,6 @@
/* SleepLib Profiles Implementation /* SleepLib Profiles Implementation
* *
* Copyright (c) 2019 The OSCAR Team
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net> * Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
* *
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public
@ -971,9 +972,14 @@ Profile *Get(QString name)
return nullptr; return nullptr;
} }
Profile *Create(QString name) Profile *Create(QString name, const QString* in_path)
{ {
QString path = p_pref->Get("{home}/Profiles/") + name; QString path;
if (in_path == nullptr) {
path = p_pref->Get("{home}/Profiles/") + name;
} else {
path = *in_path;
}
QDir dir(path); QDir dir(path);
if (!dir.exists(path)) { if (!dir.exists(path)) {

View File

@ -1,5 +1,6 @@
/* SleepLib Profiles Header /* SleepLib Profiles Header
* *
* Copyright (c) 2019 The OSCAR Team
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net> * Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
* *
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public
@ -263,7 +264,7 @@ void Scan(); // Initialize and load Profile
void Done(); // Save all Profile objects and clear list void Done(); // Save all Profile objects and clear list
int CleanupProfile(Profile *prof); int CleanupProfile(Profile *prof);
Profile *Create(QString name); Profile *Create(QString name, const QString* in_path=nullptr);
Profile *Get(QString name); Profile *Get(QString name);
Profile *Get(); Profile *Get();