Minor: use constants in internal::

This commit is contained in:
Gerhard Hoffmann 2025-02-21 12:43:15 +01:00
parent f4d785ea9d
commit 2189684cad
2 changed files with 26 additions and 9 deletions

View File

@ -13,12 +13,20 @@ void CheckAndFetchCustomerRepositoryCommand::finished(int exitCode, QProcess::Ex
Worker *w = worker(); Worker *w = worker();
if (w) { if (w) {
switch (exitCode) { switch (exitCode) {
case -2: case internal::GIT_CHECKOUT_ERROR_CODE:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_CHECKOUT_ERROR); emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_CHECKOUT_ERROR);
break; break;
case -4: case internal::GIT_PULL_ERROR_CODE:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_PULL_ERROR); emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_PULL_ERROR);
break; break;
case internal::GIT_NOT_NECESSARY_CODE:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY);
exitCode = 0;
break;
case internal::GIT_UPDATED_CODE:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UPDATED);
exitCode = 0;
break;
case 0: case 0:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UP_TO_DATE); emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UP_TO_DATE);
default:; default:;
@ -29,13 +37,21 @@ void CheckAndFetchCustomerRepositoryCommand::finished(int exitCode, QProcess::Ex
} }
void CheckAndFetchCustomerRepositoryCommand::readyReadStandardOutput() { void CheckAndFetchCustomerRepositoryCommand::readyReadStandardOutput() {
//QProcess *p = (QProcess *)sender(); QProcess *p = (QProcess *)sender();
//if (p) { if (p) {
// Worker *w = worker(); Worker *w = worker();
// if (w) { if (w) {
// QString s = p->readAllStandardOutput().trimmed(); QString s = p->readAllStandardOutput().trimmed();
// m_commandResult += s;
// qCritical() << __func__ << ":" << __LINE__ << s; if (m_commandResult.contains(internal::GIT_CUSTOMER_REPO_NO_UPDATE_NECESSARY)) {
//emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY);
m_commandResult.clear();
} else
if (m_commandResult.contains(internal::GIT_CUSTOMER_REPO_UPDATED)) {
//emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UPDATED);
}
}
}
// static constexpr const char *GIT_CUSTOMER_REPO_UP_TO_DATE{"up to date"}; // static constexpr const char *GIT_CUSTOMER_REPO_UP_TO_DATE{"up to date"};
// emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE); // emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE);

View File

@ -10,6 +10,7 @@ public:
int nextCommandIndex, int nextCommandIndex,
int start_timeout = 100000, int start_timeout = 100000,
int finish_timeout = 100000); int finish_timeout = 100000);
QString m_commandResult{};
public slots: public slots:
virtual void readyReadStandardOutput() override; virtual void readyReadStandardOutput() override;
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override; virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;