15

私は現在 Qt Installer Framework を使用しており、オンライン リポジトリをセットアップすることができました。私が知りたいのは:

フレームワークは、プログラム/システムが起動するたびに更新をチェックするプラグイン/サービスなど、ある種の「自動更新」メカニズムを提供しますか?
インストール自体はメンテナンスツールを使用して実行できるため、更新を確認するだけで十分です。

このトピックについて私が見つけたのは、次の短い文だけでした。

エンド ユーザーは、メンテナンス ツールを使用して、最初のインストール後にサーバーから追加のコンポーネントをインストールしたり、更新がサーバーに公開されるとすぐにコンテンツの自動更新を受信したりできます。

ここから: http://doc.qt.io/qtinstallerframework/ifw-overview.html#choosing-installer-type

ご協力いただきありがとうございます!

編集:提案
この質問の受け入れられた回答に基づいて、インストーラー フレームワークを使用して更新を自動的にチェックする小さなライブラリを作成しました - https://github.com/Skycoder42/QtAutoUpdater

4

4 に答える 4

22

私がしていることは、QProcess を使用してメンテナンス ツールを実行し、出力を確認することです。GUI を実行せず、アップデート情報がある場合のみ出力するモードがあります。

アプリケーションの起動時に作業ディレクトリをアプリケーションのパスに設定しているので、maintenancetool を実行するだけで済みます。

QProcess process;
process.start("maintenancetool --checkupdates");

// Wait until the update tool is finished
process.waitForFinished();

if(process.error() != QProcess::UnknownError)
{
    qDebug() << "Error checking for updates";
    return false;
}

// Read the output
QByteArray data = process.readAllStandardOutput();

// No output means no updates available
// Note that the exit code will also be 1, but we don't use that
// Also note that we should parse the output instead of just checking if it is empty if we want specific update info
if(data.isEmpty())
{
    qDebug() << "No updates available";
    return false;
}

// Call the maintenance tool binary
// Note: we start it detached because this application need to close for the update
QStringList args("--updater");
bool success = QProcess::startDetached("maintenancetool", args);

// Close the application
qApp->closeAllWindows();
于 2015-12-16T23:13:20.083 に答える
2

GitHub で非常に優れた実装を見つけました。

https://github.com/ioriayane/TheArtOfQt2/blob/master/src/HelloWorld/maintenancetool.cpp

Windows、MacOS、および Linux を処理します。+ QML / Qt Quick bindings で使用するように書かれています (+ example)。

日本語のコメントがいくつかありますが、Apache 2.0 ライセンスなので、自由に使用できます (Apache 2.0 の要件に従います)。

于 2019-01-17T13:31:53.297 に答える
0

ガイドにはその方法に関するセクションがありますが、自動更新ではなく更新の促進、doc.qt.io の IFW Updates と呼ばれています。

于 2015-12-16T20:00:03.460 に答える