QTfrontend/SparkleAutoUpdater.mm
author nemo
Thu, 01 Jul 2010 23:41:10 -0400
changeset 3608 c509bbc779e7
parent 2261 57e99c908e7c
child 5095 15dd764b728c
permissions -rw-r--r--
Revert prior attempted optimisation. Gridding the land pays in some situations, but not all. Restricting to an upper bound might help, but overall, seems too fuzzy to be worth it. On one side is increased cost of Add/Delete + extra test on collision check, on the other is skipping the list iteration. Perhaps for large lists.
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
}