QTfrontend/SparkleAutoUpdater.mm
author koda
Tue, 20 Oct 2009 17:55:11 +0000
changeset 2567 02ff5f9510b5
parent 2261 57e99c908e7c
child 5095 15dd764b728c
permissions -rw-r--r--
WE HAVE TOUCH INPUT
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
}