Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Maintenancetool and QProcess, --checkupdates argument

Maintenancetool and QProcess, --checkupdates argument

Scheduled Pinned Locked Moved Solved Installation and Deployment
4 Posts 2 Posters 955 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J.HilkJ Online
    J.HilkJ Online
    J.Hilk
    Moderators
    wrote on last edited by
    #1

    Hi everyone,

    I'm using the QtInstallerframework to distribut my program and keep it up to date. I'm quite happy with it, and it works well enough for my case.

    I would now like to streamline the update, add and remove packages process for the user. I thought about downloading and parsing the xml files myself and downloading and decompressing the 7z files too, but I realised that the maintenancetool has nearly all features build in, and I could simply use QProcess and an argument string list.

    But, I'm a bit confused about how it's working, take for example this code

        QStringList args;args << "--checkupdates";
        qDebug() << "####" << endl;
        int exitCode = QProcess::execute("C:/path//to/the/maintenancetool.exe", args);
        qDebug() << endl << "exitCode" << exitCode;
    

    it returns, 1 when no updates are available, and 0 when there are some, easy enough.

    However looking at the Applicationoutput console, I see this:
    0_1530855237974_1b6aef9b-6024-4aa2-a948-8ebbf55b33a5-image.png

    Where does the xml formated part come from !? oO And is there a way to catch that string for further evaluations? It would save me from parsing the generated components.xml file

    Greetings.


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    1 Reply Last reply
    0
    • sierdzioS sierdzio

      Perhaps you need to merge the output channels. See the docs

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #3

      @sierdzio ah, I see!

      So far my experience with QProcess is limited, so thanks for the given direction!

      I was able to adjust the "process" with QProcess 😏

      For what ever reason, I was forced to create the QProcess object on the heap and use start instead of execute.
      Or the process would still send the output to the standartoutput.

          QStringList args;args << "--checkupdates";
          qDebug() << "####" << endl;
          QProcess *process = new QProcess(this);
      
          qDebug() << process->processChannelMode();
          process->setProcessChannelMode(QProcess::MergedChannels);
          qDebug() << process->processChannelMode();
      
          process->start("C:/Path/To/the/maintenancetool.exe", args);
      
          connect(process, QOverload<int>::of(&QProcess::finished), this, [=](int exitCode){
              qDebug() << endl << "exitCode" << exitCode;
              qDebug() << process->readAll() << endl;
          });
      

      0_1530858422878_a7f04752-528c-4687-9407-7a4fe4f2f6c2-image.png

      I can work with that, I think :)

      thanks @sierdzio !


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        Perhaps you need to merge the output channels. See the docs

        (Z(:^

        J.HilkJ 1 Reply Last reply
        4
        • sierdzioS sierdzio

          Perhaps you need to merge the output channels. See the docs

          J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by
          #3

          @sierdzio ah, I see!

          So far my experience with QProcess is limited, so thanks for the given direction!

          I was able to adjust the "process" with QProcess 😏

          For what ever reason, I was forced to create the QProcess object on the heap and use start instead of execute.
          Or the process would still send the output to the standartoutput.

              QStringList args;args << "--checkupdates";
              qDebug() << "####" << endl;
              QProcess *process = new QProcess(this);
          
              qDebug() << process->processChannelMode();
              process->setProcessChannelMode(QProcess::MergedChannels);
              qDebug() << process->processChannelMode();
          
              process->start("C:/Path/To/the/maintenancetool.exe", args);
          
              connect(process, QOverload<int>::of(&QProcess::finished), this, [=](int exitCode){
                  qDebug() << endl << "exitCode" << exitCode;
                  qDebug() << process->readAll() << endl;
              });
          

          0_1530858422878_a7f04752-528c-4687-9407-7a4fe4f2f6c2-image.png

          I can work with that, I think :)

          thanks @sierdzio !


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          3
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #4

            Thanks to you as well, for posting the solution. Maybe it will help somebody else, too :-)

            (Z(:^

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved