Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved Maintenancetool and QProcess, --checkupdates argument

    Installation and Deployment
    2
    4
    641
    Loading More Posts
    • 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.Hilk
      J.Hilk Moderators last edited by

      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

      Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


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

      1 Reply Last reply Reply Quote 0
      • J.Hilk
        J.Hilk Moderators @sierdzio last edited by

        @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

        Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


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

        1 Reply Last reply Reply Quote 3
        • sierdzio
          sierdzio Moderators last edited by

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

          (Z(:^

          J.Hilk 1 Reply Last reply Reply Quote 4
          • J.Hilk
            J.Hilk Moderators @sierdzio last edited by

            @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

            Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


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

            1 Reply Last reply Reply Quote 3
            • sierdzio
              sierdzio Moderators last edited by

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

              (Z(:^

              1 Reply Last reply Reply Quote 1
              • First post
                Last post