Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1407

Missing show progress support on windows platform

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 1.12.1
    • Fix Version/s: 1.13.0
    • Component/s: Command Line Frontend
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      41e1a4bd2b667c7e5c54553e2b189b2beb38ef49 (qbs/qbs/master)

      Description

      Currently the --show-progress option is not supported on the windows platform. If I'm not wrong the only reason is the different console type on windows? I wrote some code that should work for all console types. I tested this successful  on windows with a dos, cygwin and mingw64 shell.

       

      void ConsoleProgressObserver::eraseCurrentPercentageString()
      {
          const int charsToErase = m_percentage == 0 ? 2 : m_percentage < 10 ? 3 : 4;
          // move cursor left
          std::cout << QString(charsToErase, QChar(QLatin1Char('\b'))).toLocal8Bit().constData();
          // erase via spaces
          std::cout << QString(charsToErase, QChar(QLatin1Char(' '))).toLocal8Bit().constData();
          // move cursor left again
          std::cout << QString(charsToErase, QChar(QLatin1Char('\b'))).toLocal8Bit().constData();
      
      #if 0
          // old implementation
          // (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";
      #endif
      }
      
      

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            amz Andreas Zieringer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes