mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Merge 1645f6510b into d2fa7cf7f7
This commit is contained in:
commit
9fc6c9d66c
1 changed files with 40 additions and 32 deletions
|
|
@ -75,7 +75,6 @@ class MacSparkleUpdater::Private {
|
|||
SPUStandardUpdaterController* updaterController;
|
||||
UpdaterObserver* updaterObserver;
|
||||
UpdaterDelegate* updaterDelegate;
|
||||
NSAutoreleasePool* autoReleasePool;
|
||||
};
|
||||
|
||||
MacSparkleUpdater::MacSparkleUpdater() {
|
||||
|
|
@ -83,7 +82,6 @@ MacSparkleUpdater::MacSparkleUpdater() {
|
|||
|
||||
// Enable Cocoa's memory management.
|
||||
NSApplicationLoad();
|
||||
priv->autoReleasePool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// Delegate is used for setting/getting allowed update channels.
|
||||
priv->updaterDelegate = [[UpdaterDelegate alloc] init];
|
||||
|
|
@ -101,17 +99,19 @@ MacSparkleUpdater::MacSparkleUpdater() {
|
|||
}
|
||||
|
||||
MacSparkleUpdater::~MacSparkleUpdater() {
|
||||
@autoreleasepool {
|
||||
[priv->updaterObserver removeObserver:priv->updaterObserver forKeyPath:@"updater.canCheckForUpdates"];
|
||||
|
||||
[priv->updaterController release];
|
||||
}
|
||||
[priv->updaterObserver release];
|
||||
[priv->updaterController release];
|
||||
[priv->updaterDelegate release];
|
||||
[priv->autoReleasePool release];
|
||||
delete priv;
|
||||
}
|
||||
|
||||
void MacSparkleUpdater::checkForUpdates() {
|
||||
@autoreleasepool {
|
||||
[priv->updaterController checkForUpdates:nil];
|
||||
}
|
||||
}
|
||||
|
||||
bool MacSparkleUpdater::getAutomaticallyChecksForUpdates() {
|
||||
|
|
@ -123,12 +123,14 @@ double MacSparkleUpdater::getUpdateCheckInterval() {
|
|||
}
|
||||
|
||||
QSet<QString> MacSparkleUpdater::getAllowedChannels() {
|
||||
@autoreleasepool {
|
||||
// Convert NSSet<NSString> -> QSet<QString>
|
||||
__block QSet<QString> channels;
|
||||
[priv->updaterDelegate.allowedChannels enumerateObjectsUsingBlock:^(NSString* channel, BOOL* stop) {
|
||||
channels.insert(QString::fromNSString(channel));
|
||||
}];
|
||||
return channels;
|
||||
}
|
||||
}
|
||||
|
||||
bool MacSparkleUpdater::getBetaAllowed() {
|
||||
|
|
@ -144,10 +146,13 @@ void MacSparkleUpdater::setUpdateCheckInterval(double seconds) {
|
|||
}
|
||||
|
||||
void MacSparkleUpdater::clearAllowedChannels() {
|
||||
@autoreleasepool {
|
||||
priv->updaterDelegate.allowedChannels = [NSSet set];
|
||||
}
|
||||
}
|
||||
|
||||
void MacSparkleUpdater::setAllowedChannel(const QString& channel) {
|
||||
@autoreleasepool {
|
||||
if (channel.isEmpty()) {
|
||||
clearAllowedChannels();
|
||||
return;
|
||||
|
|
@ -155,9 +160,11 @@ void MacSparkleUpdater::setAllowedChannel(const QString& channel) {
|
|||
|
||||
NSSet<NSString*>* nsChannels = [NSSet setWithObject:channel.toNSString()];
|
||||
priv->updaterDelegate.allowedChannels = nsChannels;
|
||||
}
|
||||
}
|
||||
|
||||
void MacSparkleUpdater::setAllowedChannels(const QSet<QString>& channels) {
|
||||
@autoreleasepool {
|
||||
if (channels.isEmpty()) {
|
||||
clearAllowedChannels();
|
||||
return;
|
||||
|
|
@ -172,6 +179,7 @@ void MacSparkleUpdater::setAllowedChannels(const QSet<QString>& channels) {
|
|||
}
|
||||
|
||||
priv->updaterDelegate.allowedChannels = nsChannels;
|
||||
}
|
||||
}
|
||||
|
||||
void MacSparkleUpdater::setBetaAllowed(bool allowed) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue