mirror of https://github.com/nomic-ai/gpt4all
Enable the force metal setting.
parent
2565f6a94a
commit
267601d670
@ -0,0 +1,31 @@
|
||||
#include "mysettings.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
class MyPrivateSettings: public MySettings { };
|
||||
Q_GLOBAL_STATIC(MyPrivateSettings, settingsInstance)
|
||||
MySettings *MySettings::globalInstance()
|
||||
{
|
||||
return settingsInstance();
|
||||
}
|
||||
|
||||
MySettings::MySettings()
|
||||
: QObject{nullptr}
|
||||
{
|
||||
QSettings settings;
|
||||
settings.sync();
|
||||
m_forceMetal = settings.value("forceMetal", false).toBool();
|
||||
}
|
||||
|
||||
bool MySettings::forceMetal() const
|
||||
{
|
||||
return m_forceMetal;
|
||||
}
|
||||
|
||||
void MySettings::setForceMetal(bool enabled)
|
||||
{
|
||||
if (m_forceMetal == enabled)
|
||||
return;
|
||||
m_forceMetal = enabled;
|
||||
emit forceMetalChanged(enabled);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
#ifndef MYSETTINGS_H
|
||||
#define MYSETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
|
||||
class MySettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool forceMetal READ forceMetal WRITE setForceMetal NOTIFY forceMetalChanged)
|
||||
|
||||
public:
|
||||
static MySettings *globalInstance();
|
||||
|
||||
bool forceMetal() const;
|
||||
void setForceMetal(bool enabled);
|
||||
|
||||
Q_SIGNALS:
|
||||
void forceMetalChanged(bool);
|
||||
|
||||
private:
|
||||
bool m_forceMetal;
|
||||
|
||||
private:
|
||||
explicit MySettings();
|
||||
~MySettings() {}
|
||||
friend class MyPrivateSettings;
|
||||
};
|
||||
|
||||
#endif // MYSETTINGS_H
|
Loading…
Reference in New Issue