QTfrontend/SparkleAutoUpdater.mm
author nemo
Sun, 24 Jan 2010 16:46:06 +0000
changeset 2712 8f4527c9137c
parent 2261 57e99c908e7c
child 5095 15dd764b728c
permissions -rw-r--r--
Minor tweak, try to make long flavour text last longer, move the hurt self messages to unused messages group, so they don't get wiped by crate an instant later.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2261
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     1
/*
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     2
 * Copyright (C) 2008 Remko Troncon
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     3
 */
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     4
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     5
#include "SparkleAutoUpdater.h"
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     6
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     7
#include <Cocoa/Cocoa.h>
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     8
#include <Sparkle/Sparkle.h>
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
     9
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    10
class SparkleAutoUpdater::Private
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    11
{
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    12
	public:
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    13
		SUUpdater* updater;
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    14
};
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    15
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    16
SparkleAutoUpdater::SparkleAutoUpdater(const QString& aUrl)
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    17
{
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    18
	d = new Private;
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    19
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    20
	d->updater = [SUUpdater sharedUpdater];
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    21
	[d->updater retain];
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    22
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    23
	NSURL* url = [NSURL URLWithString:
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    24
			[NSString stringWithUTF8String: aUrl.toUtf8().data()]];
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    25
	[d->updater setFeedURL: url];
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    26
}
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    27
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    28
SparkleAutoUpdater::~SparkleAutoUpdater()
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    29
{
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    30
	[d->updater release];
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    31
	delete d;
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    32
}
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    33
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    34
void SparkleAutoUpdater::checkForUpdates()
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    35
{
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    36
	[d->updater checkForUpdatesInBackground];
57e99c908e7c a lot of stuff:
koda
parents:
diff changeset
    37
}