QTfrontend/util/platform/SparkleAutoUpdater.mm
branchhedgeroid
changeset 15515 7030706266df
parent 12273 2eedf9e0cd6d
equal deleted inserted replaced
7861:bc7b6aa5d67a 15515:7030706266df
       
     1 /*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2004-2015 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    17  */
       
    18 
       
    19 // see original example here https://el-tramo.be/blog/mixing-cocoa-and-qt
       
    20 
       
    21 #include "SparkleAutoUpdater.h"
       
    22 
       
    23 #include <Cocoa/Cocoa.h>
       
    24 #include <Sparkle/Sparkle.h>
       
    25 
       
    26 class SparkleAutoUpdater::Private
       
    27 {
       
    28     public:
       
    29         SUUpdater* updater;
       
    30 };
       
    31 
       
    32 SparkleAutoUpdater::SparkleAutoUpdater()
       
    33 {
       
    34     d = new SparkleAutoUpdater::Private();
       
    35 
       
    36     d->updater = [SUUpdater sharedUpdater];
       
    37     [d->updater retain];
       
    38 }
       
    39 
       
    40 SparkleAutoUpdater::~SparkleAutoUpdater()
       
    41 {
       
    42     [d->updater release];
       
    43     delete d;
       
    44 }
       
    45 
       
    46 void SparkleAutoUpdater::checkForUpdates()
       
    47 {
       
    48     [d->updater checkForUpdatesInBackground];
       
    49 }
       
    50 
       
    51 void SparkleAutoUpdater::checkForUpdatesNow()
       
    52 {
       
    53     [d->updater checkForUpdates:NULL];
       
    54 }