QTfrontend/SparkleAutoUpdater.mm
changeset 5095 15dd764b728c
parent 2261 57e99c908e7c
child 6952 7f70f37bbf08
equal deleted inserted replaced
5093:7eb35faa7f7a 5095:15dd764b728c
     1 /*
     1 /*
     2  * Copyright (C) 2008 Remko Troncon
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2005-2011 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
     3  */
    17  */
       
    18 
       
    19 // see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
     4 
    20 
     5 #include "SparkleAutoUpdater.h"
    21 #include "SparkleAutoUpdater.h"
     6 
    22 
     7 #include <Cocoa/Cocoa.h>
    23 #include <Cocoa/Cocoa.h>
     8 #include <Sparkle/Sparkle.h>
    24 #include <Sparkle/Sparkle.h>
     9 
    25 
    10 class SparkleAutoUpdater::Private
    26 class SparkleAutoUpdater::Private
    11 {
    27 {
    12 	public:
    28     public:
    13 		SUUpdater* updater;
    29         SUUpdater* updater;
    14 };
    30 };
    15 
    31 
    16 SparkleAutoUpdater::SparkleAutoUpdater(const QString& aUrl)
    32 SparkleAutoUpdater::SparkleAutoUpdater(const QString& aUrl)
    17 {
    33 {
    18 	d = new Private;
    34     d = new Private;
    19 
    35 
    20 	d->updater = [SUUpdater sharedUpdater];
    36     d->updater = [SUUpdater sharedUpdater];
    21 	[d->updater retain];
    37     [d->updater retain];
    22 
    38 
    23 	NSURL* url = [NSURL URLWithString:
    39     NSURL* url = [NSURL URLWithString:[NSString stringWithUTF8String:aUrl.toUtf8().data()]];
    24 			[NSString stringWithUTF8String: aUrl.toUtf8().data()]];
    40     [d->updater setFeedURL:url];
    25 	[d->updater setFeedURL: url];
       
    26 }
    41 }
    27 
    42 
    28 SparkleAutoUpdater::~SparkleAutoUpdater()
    43 SparkleAutoUpdater::~SparkleAutoUpdater()
    29 {
    44 {
    30 	[d->updater release];
    45     [d->updater release];
    31 	delete d;
    46     delete d;
    32 }
    47 }
    33 
    48 
    34 void SparkleAutoUpdater::checkForUpdates()
    49 void SparkleAutoUpdater::checkForUpdates()
    35 {
    50 {
    36 	[d->updater checkForUpdatesInBackground];
    51     [d->updater checkForUpdatesInBackground];
    37 }
    52 }