[Qt-interest] updating QT application

Bob Hood bhood2 at comcast.net
Thu Apr 22 15:24:02 CEST 2010


On 4/21/2010 9:46 PM, Nikos Chantziaras wrote:
> On 04/21/2010 04:49 PM, Andre Somers wrote:
>> On 21-4-2010 15:37, David Boosalis wrote:
>>> If updates can be done via FTP QFTP is a good way to go. Simply check
>>> the version number against what is on the server. On Linux it might be
>>> a bit tricky if you have to install it as root. Windows it might be a
>>> bit easier as you can put your download an installer and launch it
>>> after the download completes with QProcess. Maybe on Linux you can
>>> download it as a RPM or debian package and figure out how to launch
>>> the package manager.
>>
>> I think on linux, you should actually leave the updates to the package
>> system period. No separate updater should be needed.
>
> Won't work if the app is not included in the repos.
>
> However, you can have "check for updates" functionality that won't try 
> to update, but inform the user (maybe on startup) that there's a new 
> version available.

I'm actually using this approach with a utility I created for the
developers on my team.  Since we do not have an available HTTP server
running, it connects to an FTP location to which all personnel have
access when it starts up:

    ...
    ftp_version_check = new QFtp(this);
    connect(ftp_version_check, SIGNAL(commandFinished(int, bool)), this,
SLOT(slot_ftp_command_finished(int, bool)));
    connect(ftp_version_check, SIGNAL(listInfo(const QUrlInfo &)), this,
SLOT(slot_ftp_list_info(const QUrlInfo &)));
    ...
    show_status_message(tr("Checking for updates..."), 10000);
    ftp_version_check->connectToHost("<address>");
    ftp_version_check->login("<username>", "<password>");
    ftp_version_check->list("<path>");
    ...

and when the list information arrives, it uses a QRegExp to scan the
file names for the release notes file, which also happens to contain the
version number as part of its name:

    ...
    QRegExp
version_expression("^release_([-+]?[0-9]*\\.?[0-9]+(\\.[0-9]+)*)$");
    ...

Once found and extracted, I test it against the version of the running
application, and if it is newer, I set up a single-shot timer that will
announce the availability to the user:

    ...
    QTimer::singleShot(60000 * 2, this, SLOT(slot_announce_new_version()));
    ...

They can then download and update at their leisure.




More information about the Qt-interest-old mailing list