Skip to content

Commit

Permalink
Member and Function are now static
Browse files Browse the repository at this point in the history
I am unsure whether QApplication maybe used at that location
  • Loading branch information
OnSlbWXt committed May 15, 2024
1 parent d392402 commit 9045da8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,18 +459,12 @@ void Config::migrate()
Config::Config(const QString& configFileName, const QString& localConfigFileName, QObject* parent)
: QObject(parent)
{
auto portablePath = QCoreApplication::applicationDirPath().append("/%1");
auto portableFile = portablePath.arg(".portable");
m_isPortable = QFile::exists(portableFile);
init(configFileName, localConfigFileName);
}

Config::Config(QObject* parent)
: QObject(parent)
{
auto portablePath = QCoreApplication::applicationDirPath().append("/%1");
auto portableFile = portablePath.arg(".portable");
m_isPortable = QFile::exists(portableFile);
auto configFiles = defaultConfigFiles();
init(configFiles.first, configFiles.second);
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ class Config : public QObject
bool hasAccessError();
void sync();
void resetToDefaults();
bool isPortable();

QList<ShortcutEntry> getShortcuts() const;
void setShortcuts(const QList<ShortcutEntry>& shortcuts);

static Config* instance();
static void createConfigFromFile(const QString& configFileName, const QString& localConfigFileName = {});
static void createTempFileInstance();
static bool isPortable();

signals:
void changed(ConfigKey key);
Expand All @@ -238,11 +238,12 @@ class Config : public QObject
static QPair<QString, QString> defaultConfigFiles();

static QPointer<Config> m_instance;
static bool m_isPortable = QFile::exists(QCoreApplication::applicationDirPath().append("/%1").arg(".portable"));

QScopedPointer<QSettings> m_settings;
QScopedPointer<QSettings> m_localSettings;
QHash<QString, QVariant> m_defaults;
bool m_isPortable;

};

inline Config* config()
Expand Down

0 comments on commit 9045da8

Please sign in to comment.