Add option to use Sparkle for updates

OBS Sparkle feeds have two extensions to vanilla Sparkle feeds:
- There can be two kinds of items per feed: (zipped) .app and .mpkg
  via <ce:packageType>app|mpkg</ce:packageType> (default is mpkg)
- Feed items can be disabled via <ce:deployed>false</ce:deployed>; these
  items will not be considered for updates unless
  "[General] UpdateToUndeployed=1" is set the global config

Unlike other Sparkle implementations the FeedURL cannot be updated via user
preferences because we support multiple app packages with the same package
identifier but different FeedURL settings on the same machine
This commit is contained in:
Palana
2014-10-11 22:17:18 +02:00
parent 2edac33c58
commit e7cfd58e9e
3 changed files with 156 additions and 0 deletions
+14
View File
@@ -890,8 +890,17 @@ bool OBSBasic::QueryRemoveSource(obs_source_t *source)
#define UPDATE_CHECK_INTERVAL (60*60*24*4) /* 4 days */
#ifdef UPDATE_SPARKLE
void init_sparkle_updater(bool update_to_undeployed);
void trigger_sparkle_update();
#endif
void OBSBasic::TimedCheckForUpdates()
{
#ifdef UPDATE_SPARKLE
init_sparkle_updater(config_get_bool(App()->GlobalConfig(), "General",
"UpdateToUndeployed"));
#else
long long lastUpdate = config_get_int(App()->GlobalConfig(), "General",
"LastUpdateCheck");
uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General",
@@ -908,10 +917,14 @@ void OBSBasic::TimedCheckForUpdates()
if (secs > UPDATE_CHECK_INTERVAL)
CheckForUpdates();
#endif
}
void OBSBasic::CheckForUpdates()
{
#ifdef UPDATE_SPARKLE
trigger_sparkle_update();
#else
ui->actionCheckForUpdates->setEnabled(false);
string versionString("obs-basic ");
@@ -926,6 +939,7 @@ void OBSBasic::CheckForUpdates()
this, SLOT(updateFileFinished()));
connect(updateReply, SIGNAL(readyRead()),
this, SLOT(updateFileRead()));
#endif
}
void OBSBasic::updateFileRead()