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();
if (w) {
switch (exitCode) {
case -2:
case internal::GIT_CHECKOUT_ERROR_CODE:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_CHECKOUT_ERROR);
break;
case -4:
case internal::GIT_PULL_ERROR_CODE:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_PULL_ERROR);
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:
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UP_TO_DATE);
default:;
@ -29,13 +37,21 @@ void CheckAndFetchCustomerRepositoryCommand::finished(int exitCode, QProcess::Ex
}
void CheckAndFetchCustomerRepositoryCommand::readyReadStandardOutput() {
//QProcess *p = (QProcess *)sender();
//if (p) {
// Worker *w = worker();
// if (w) {
// QString s = p->readAllStandardOutput().trimmed();
//
// qCritical() << __func__ << ":" << __LINE__ << s;
QProcess *p = (QProcess *)sender();
if (p) {
Worker *w = worker();
if (w) {
QString s = p->readAllStandardOutput().trimmed();
m_commandResult += 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"};
// emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE);

View File

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