aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference/cli/cli-options.qdocinc2
-rw-r--r--src/app/qbs/consoleprogressobserver.cpp13
-rw-r--r--src/app/qbs/parser/parsercommand.cpp2
-rw-r--r--tests/auto/cmdlineparser/tst_cmdlineparser.cpp13
4 files changed, 14 insertions, 16 deletions
diff --git a/doc/reference/cli/cli-options.qdocinc b/doc/reference/cli/cli-options.qdocinc
index 9f3c47b39..254444dcb 100644
--- a/doc/reference/cli/cli-options.qdocinc
+++ b/doc/reference/cli/cli-options.qdocinc
@@ -457,8 +457,6 @@
This option is mutually exclusive with \c --log-time.
- \note This option is not available on a Windows host.
-
//! [show-progress]
//! [setup-tools-system]
diff --git a/src/app/qbs/consoleprogressobserver.cpp b/src/app/qbs/consoleprogressobserver.cpp
index b6110077b..b49723a64 100644
--- a/src/app/qbs/consoleprogressobserver.cpp
+++ b/src/app/qbs/consoleprogressobserver.cpp
@@ -87,11 +87,16 @@ void ConsoleProgressObserver::setProgressValue(int value)
void ConsoleProgressObserver::eraseCurrentPercentageString()
{
const int charsToErase = m_percentage == 0 ? 2 : m_percentage < 10 ? 3 : 4;
+ const QByteArray backspaceCommand(charsToErase, '\b');
- // (1) Move cursor before the old percentage string.
- // (2) Erase current line content to the right of the cursor.
- std::cout << QString::fromLatin1("\x1b[%1D").arg(charsToErase).toLocal8Bit().constData();
- std::cout << "\x1b[K";
+ // Move cursor before the old percentage string.
+ std::cout << backspaceCommand.constData();
+
+ // Erase old percentage string.
+ std::cout << QByteArray(charsToErase, ' ').constData();
+
+ // Move cursor before the erased string.
+ std::cout << backspaceCommand.constData();
}
void ConsoleProgressObserver::updateProgressBarIfNecessary()
diff --git a/src/app/qbs/parser/parsercommand.cpp b/src/app/qbs/parser/parsercommand.cpp
index ff331fd50..33f93ce53 100644
--- a/src/app/qbs/parser/parsercommand.cpp
+++ b/src/app/qbs/parser/parsercommand.cpp
@@ -94,8 +94,6 @@ void Command::parsePropertyAssignment(const QString &argument)
QList<CommandLineOption::Type> Command::actualSupportedOptions() const
{
QList<CommandLineOption::Type> options = supportedOptions();
- if (!HostOsInfo::isAnyUnixHost())
- options.removeOne(CommandLineOption::ShowProgressOptionType);
if (type() != HelpCommandType)
options.push_back(CommandLineOption::SettingsDirOptionType); // Valid for almost all commands.
return options;
diff --git a/tests/auto/cmdlineparser/tst_cmdlineparser.cpp b/tests/auto/cmdlineparser/tst_cmdlineparser.cpp
index 88a458d53..15b9ec382 100644
--- a/tests/auto/cmdlineparser/tst_cmdlineparser.cpp
+++ b/tests/auto/cmdlineparser/tst_cmdlineparser.cpp
@@ -84,14 +84,11 @@ private slots:
QVERIFY(parser.parseCommandLine(QStringList() << "-t" << m_fileArgs));
QVERIFY(parser.logTime());
- if (!Internal::HostOsInfo::isWindowsHost()) { // Windows has no progress bar atm.
- // Note: We cannot just check for !parser.logTime() here, because if the test is not
- // run in a terminal, "--show-progress" is ignored, in which case "--log-time"
- // takes effect.
- QVERIFY(parser.parseCommandLine(QStringList() << "-t" << "--show-progress"
- << m_fileArgs));
- QVERIFY(parser.showProgress() != parser.logTime());
- }
+ // Note: We cannot just check for !parser.logTime() here, because if the test is not
+ // run in a terminal, "--show-progress" is ignored, in which case "--log-time"
+ // takes effect.
+ QVERIFY(parser.parseCommandLine(QStringList() << "-t" << "--show-progress" << m_fileArgs));
+ QVERIFY(parser.showProgress() != parser.logTime());
QVERIFY(parser.parseCommandLine(QStringList() << "-vvqqq" << m_fileArgs));
QCOMPARE(ConsoleLogger::instance().logSink()->logLevel(), LoggerWarning);