Consolidate generation and application settings on the new settings object.

This commit is contained in:
Adam Treat
2023-06-28 16:05:35 -04:00
committed by AT
parent 7f66c28649
commit 285aa50b60
14 changed files with 57 additions and 207 deletions

View File

@@ -5,6 +5,7 @@
#include <QFileInfo>
#include <QSettings>
#include <QStandardPaths>
#include <QUrl>
static double default_temperature = 0.7;
static double default_topP = 0.1;
@@ -309,11 +310,13 @@ QString MySettings::modelPath() const
void MySettings::setModelPath(const QString &p)
{
if (modelPath() == p)
QString filePath = (p.startsWith("file://") ?
QUrl(p).toLocalFile() : p);
QString canonical = QFileInfo(filePath).canonicalFilePath() + "/";
if (modelPath() == canonical)
return;
QSettings setting;
setting.setValue("modelPath", p);
setting.setValue("modelPath", canonical);
setting.sync();
emit modelPathChanged();
}