Commit c8d782ee authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Rework i18n stuff in refactoring

parent 59993777
......@@ -142,17 +142,17 @@ void GitWidget::getStatus(bool untracked, bool submodules)
void GitWidget::runGitCmd(const QStringList &args, const char *error)
void GitWidget::runGitCmd(const QStringList &args, const QString &i18error)
disconnect(&git, &QProcess::finished, nullptr, nullptr);
connect(&git, &QProcess::finished, this, [this, error](int exitCode, QProcess::ExitStatus es) {
connect(&git, &QProcess::finished, this, [this, i18error](int exitCode, QProcess::ExitStatus es) {
// sever connection
disconnect(&git, &QProcess::finished, nullptr, nullptr);
if (es != QProcess::NormalExit || exitCode != 0) {
sendMessage(i18n(error, QString::fromUtf8(git.readAllStandardError())), true);
sendMessage(i18error + QStringLiteral("\n") + QString::fromUtf8(git.readAllStandardError()), true);
} else {
......@@ -168,7 +168,7 @@ void GitWidget::stage(const QStringList &files, bool)
auto args = QStringList{QStringLiteral("add"), QStringLiteral("-A"), QStringLiteral("--")};
runGitCmd(args, "Failed to stage file. Error:\n%1");
runGitCmd(args, i18n("Failed to stage file. Error:"));
void GitWidget::unstage(const QStringList &files)
......@@ -181,7 +181,7 @@ void GitWidget::unstage(const QStringList &files)
auto args = QStringList{QStringLiteral("reset"), QStringLiteral("-q"), QStringLiteral("HEAD"), QStringLiteral("--")};
runGitCmd(args, "Failed to unstage file. Error:\n%1");
runGitCmd(args, i18n("Failed to unstage file. Error:"));
void GitWidget::discard(const QStringList &files)
......@@ -193,7 +193,7 @@ void GitWidget::discard(const QStringList &files)
auto args = QStringList{QStringLiteral("checkout"), QStringLiteral("-q"), QStringLiteral("--")};
runGitCmd(args, "Failed to discard changes. Error:\n%1");
runGitCmd(args, i18n("Failed to discard changes. Error:"));
void GitWidget::clean(const QStringList &files)
......@@ -205,7 +205,7 @@ void GitWidget::clean(const QStringList &files)
auto args = QStringList{QStringLiteral("clean"), QStringLiteral("-q"), QStringLiteral("-f"), QStringLiteral("--")};
runGitCmd(args, "Failed to remove. Error:\n%1");
runGitCmd(args, i18n("Failed to remove. Error:"));
void GitWidget::openAtHEAD(const QString &file)
......@@ -56,7 +56,7 @@ private:
void buildMenu();
void initGitExe();
void runGitCmd(const QStringList &args, const char *error);
void runGitCmd(const QStringList &args, const QString &i18error);
void stage(const QStringList &files, bool = false);
void unstage(const QStringList &files);
void discard(const QStringList &files);
Supports Markdown
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