Gerrit: added ability to save path for applying patches

Change-Id: I3cc8f1d19784145a7fbf19c321ccbc079847fbc2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Petar Perisin
2013-03-26 20:02:06 +02:00
parent 42547062af
commit 83d51b2691
11 changed files with 224 additions and 40 deletions

View File

@@ -50,7 +50,9 @@ static const char userKeyC[] = "User";
static const char portKeyC[] = "Port";
static const char portFlagKeyC[] = "PortFlag";
static const char sshKeyC[] = "Ssh";
static const char repositoryKeyC[] = "RepoPath";
static const char httpsKeyC[] = "Https";
static const char promptPathKeyC[] = "PromptPath";
static const char defaultHostC[] = "codereview.qt-project.org";
static const char defaultSshC[] = "ssh";
static const char savedQueriesKeyC[] = "SavedQueries";
@@ -99,6 +101,7 @@ GerritParameters::GerritParameters()
: host(QLatin1String(defaultHostC))
, port(defaultPort)
, https(true)
, promptPath(true)
, portFlag(QLatin1String(defaultPortFlag))
{
}
@@ -118,8 +121,8 @@ QString GerritParameters::sshHostArgument() const
bool GerritParameters::equals(const GerritParameters &rhs) const
{
return port == rhs.port && host == rhs.host && user == rhs.user
&& ssh == rhs.ssh && https == rhs.https;
return port == rhs.port && host == rhs.host && user == rhs.user && promptPath == rhs.promptPath
&& ssh == rhs.ssh && https == rhs.https && repositoryPath == rhs.repositoryPath;
}
void GerritParameters::toSettings(QSettings *s) const
@@ -130,7 +133,9 @@ void GerritParameters::toSettings(QSettings *s) const
s->setValue(QLatin1String(portKeyC), port);
s->setValue(QLatin1String(portFlagKeyC), portFlag);
s->setValue(QLatin1String(sshKeyC), ssh);
s->setValue(QLatin1String(repositoryKeyC), repositoryPath);
s->setValue(QLatin1String(httpsKeyC), https);
s->setValue(QLatin1String(promptPathKeyC), promptPath);
s->endGroup();
}
@@ -147,11 +152,13 @@ void GerritParameters::fromSettings(const QSettings *s)
host = s->value(rootKey + QLatin1String(hostKeyC), QLatin1String(defaultHostC)).toString();
user = s->value(rootKey + QLatin1String(userKeyC), QString()).toString();
ssh = s->value(rootKey + QLatin1String(sshKeyC), QString()).toString();
repositoryPath = s->value(rootKey + QLatin1String(repositoryKeyC), QString()).toString();
port = s->value(rootKey + QLatin1String(portKeyC), QVariant(int(defaultPort))).toInt();
portFlag = s->value(rootKey + QLatin1String(portFlagKeyC), QLatin1String(defaultPortFlag)).toString();
savedQueries = s->value(rootKey + QLatin1String(savedQueriesKeyC), QString()).toString()
.split(QLatin1String(","));
https = s->value(rootKey + QLatin1String(httpsKeyC), QVariant(true)).toBool();
promptPath = s->value(rootKey + QLatin1String(promptPathKeyC), QVariant(true)).toBool();
if (ssh.isEmpty())
ssh = detectSsh();
}