diff --git a/gpt4all-chat/llm.cpp b/gpt4all-chat/llm.cpp index 8a69d6e7..f831ea47 100644 --- a/gpt4all-chat/llm.cpp +++ b/gpt4all-chat/llm.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include class MyLLM: public LLM { }; @@ -48,7 +49,13 @@ LLM::LLM() #endif m_compatHardware = minimal; - emit compatHardwareChanged(); +} + +bool LLM::hasSettingsAccess() const +{ + QSettings settings; + settings.sync(); + return settings.status() == QSettings::NoError; } bool LLM::checkForUpdates() const diff --git a/gpt4all-chat/llm.h b/gpt4all-chat/llm.h index 8b8894fa..8a582e3a 100644 --- a/gpt4all-chat/llm.h +++ b/gpt4all-chat/llm.h @@ -6,12 +6,11 @@ class LLM : public QObject { Q_OBJECT - Q_PROPERTY(bool compatHardware READ compatHardware NOTIFY compatHardwareChanged) - public: static LLM *globalInstance(); - bool compatHardware() const { return m_compatHardware; } + Q_INVOKABLE bool hasSettingsAccess() const; + Q_INVOKABLE bool compatHardware() const { return m_compatHardware; } Q_INVOKABLE bool checkForUpdates() const; Q_INVOKABLE bool directoryExists(const QString &path) const; @@ -22,7 +21,6 @@ public: Q_SIGNALS: void chatListModelChanged(); void modelListChanged(); - void compatHardwareChanged(); private: bool m_compatHardware; diff --git a/gpt4all-chat/main.qml b/gpt4all-chat/main.qml index 99ba5853..6c850805 100644 --- a/gpt4all-chat/main.qml +++ b/gpt4all-chat/main.qml @@ -89,14 +89,22 @@ Window { property bool hasShownModelDownload: false property bool hasShownFirstStart: false + property bool hasShownSettingsAccess: false function startupDialogs() { - if (!LLM.compatHardware) { + if (!LLM.compatHardware()) { Network.sendNonCompatHardware(); errorCompatHardware.open(); return; } + // check if we have access to settings and if not show an error + if (!hasShownSettingsAccess && !LLM.hasSettingsAccess()) { + errorSettingsAccess.open(); + hasShownSettingsAccess = true; + return; + } + // check for first time start of this version if (!hasShownFirstStart && Download.isFirstStart()) { firstStartDialog.open(); @@ -135,6 +143,20 @@ Window { + qsTr("https://en.wikipedia.org/wiki/Advanced_Vector_Extensions") } + PopupDialog { + id: errorSettingsAccess + anchors.centerIn: parent + shouldTimeOut: false + shouldShowBusy: false + modal: true + text: qsTr("

Encountered an error starting up:


") + + qsTr("\"Inability to access settings file.\"") + + qsTr("

Unfortunately, something is preventing the program from accessing ") + + qsTr("the settings file. This could be caused by incorrect permissions in the local ") + + qsTr("app config directory where the settings file is located. ") + + qsTr("Check out our discord channel for help.") + } + StartupDialog { id: firstStartDialog anchors.centerIn: parent