Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cc5ea8c1 authored by Laurent Montel's avatar Laurent Montel 😁

Add a manager

parent 47d10a51
......@@ -19,17 +19,36 @@
#include "grammalectemanager.h"
#include <KConfigGroup>
#include <KSharedConfig>
#include <QStandardPaths>
GrammalecteManager::GrammalecteManager(QObject *parent)
: QObject(parent)
{
loadSettings();
}
GrammalecteManager::~GrammalecteManager()
{
}
GrammalecteManager *GrammalecteManager::self()
{
static GrammalecteManager s_self;
return &s_self;
}
void GrammalecteManager::loadSettings()
{
KConfigGroup grp(KSharedConfig::openConfig(), "Grammalecte");
mPythonPath = grp.readEntry(QStringLiteral("pythonpath"));
if (mPythonPath.isEmpty()) {
mPythonPath = QStandardPaths::findExecutable(QStringLiteral("python3"));
}
mGrammalectePath = grp.readEntry(QStringLiteral("grammalectepath"));
}
QString GrammalecteManager::pythonPath() const
{
return mPythonPath;
......
......@@ -30,12 +30,15 @@ public:
explicit GrammalecteManager(QObject *parent = nullptr);
~GrammalecteManager();
static GrammalecteManager *self();
Q_REQUIRED_RESULT QString pythonPath() const;
Q_REQUIRED_RESULT QString grammalectePath() const;
void setPythonPath(const QString &pythonPath);
void setGrammalectePath(const QString &grammalectePath);
void loadSettings();
private:
QString mPythonPath;
QString mGrammalectePath;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment