forked from qt-creator/qt-creator
Utils, all: Standardize on QtcSettings
Change-Id: Id222016f15b1c3bfe6710fe5d0297666d4565ef1 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcsettings.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
@@ -13,6 +14,8 @@
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace GitLab {
|
||||
|
||||
const char settingsGroupC[] = "GitLab";
|
||||
@@ -153,13 +156,13 @@ static QList<GitLabServer> readTokensFile(const Utils::FilePath &filePath)
|
||||
return result;
|
||||
}
|
||||
|
||||
static Utils::FilePath tokensFilePath(const QSettings *s)
|
||||
static FilePath tokensFilePath(const QtcSettings *s)
|
||||
{
|
||||
return Utils::FilePath::fromString(s->fileName()).parentDir()
|
||||
return FilePath::fromString(s->fileName()).parentDir()
|
||||
.pathAppended("/qtcreator/gitlabtokens.json");
|
||||
}
|
||||
|
||||
void GitLabParameters::toSettings(QSettings *s) const
|
||||
void GitLabParameters::toSettings(QtcSettings *s) const
|
||||
{
|
||||
|
||||
writeTokensFile(tokensFilePath(s), gitLabServers);
|
||||
@@ -169,11 +172,11 @@ void GitLabParameters::toSettings(QSettings *s) const
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
void GitLabParameters::fromSettings(const QSettings *s)
|
||||
void GitLabParameters::fromSettings(const QtcSettings *s)
|
||||
{
|
||||
const QString rootKey = QLatin1String(settingsGroupC) + '/';
|
||||
curl = Utils::FilePath::fromSettings(s->value(rootKey + curlKeyC));
|
||||
defaultGitLabServer = Utils::Id::fromSetting(s->value(rootKey + defaultUuidKeyC));
|
||||
const Key rootKey = Key(settingsGroupC) + '/';
|
||||
curl = FilePath::fromSettings(s->value(rootKey + curlKeyC));
|
||||
defaultGitLabServer = Id::fromSetting(s->value(rootKey + defaultUuidKeyC));
|
||||
|
||||
gitLabServers = readTokensFile(tokensFilePath(s));
|
||||
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
#include <utils/id.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
class QJsonObject;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class QtcSettings; }
|
||||
|
||||
namespace GitLab {
|
||||
|
||||
class GitLabServer
|
||||
@@ -49,8 +50,8 @@ public:
|
||||
bool equals(const GitLabParameters &other) const;
|
||||
bool isValid() const;
|
||||
|
||||
void toSettings(QSettings *s) const;
|
||||
void fromSettings(const QSettings *s);
|
||||
void toSettings(Utils::QtcSettings *s) const;
|
||||
void fromSettings(const Utils::QtcSettings *s);
|
||||
|
||||
GitLabServer currentDefaultServer() const;
|
||||
GitLabServer serverForId(const Utils::Id &id) const;
|
||||
|
||||
Reference in New Issue
Block a user