Added Sparkle to Telldus Center
This commit is contained in:
parent
d7751732ef
commit
79356beb32
9 changed files with 179 additions and 4 deletions
9
telldus-gui/TelldusCenter/AutoUpdater.cpp
Normal file
9
telldus-gui/TelldusCenter/AutoUpdater.cpp
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Remko Troncon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AutoUpdater.h"
|
||||||
|
|
||||||
|
AutoUpdater::~AutoUpdater()
|
||||||
|
{
|
||||||
|
}
|
11
telldus-gui/TelldusCenter/AutoUpdater.h
Normal file
11
telldus-gui/TelldusCenter/AutoUpdater.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef AUTOUPDATER_H
|
||||||
|
#define AUTOUPDATER_H
|
||||||
|
|
||||||
|
class AutoUpdater
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~AutoUpdater();
|
||||||
|
virtual void checkForUpdates() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
19
telldus-gui/TelldusCenter/CocoaInitializer.h
Normal file
19
telldus-gui/TelldusCenter/CocoaInitializer.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Remko Troncon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COCOAINITIALIZER_H
|
||||||
|
#define COCOAINITIALIZER_H
|
||||||
|
|
||||||
|
class CocoaInitializer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CocoaInitializer();
|
||||||
|
~CocoaInitializer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
class Private;
|
||||||
|
Private* d;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
27
telldus-gui/TelldusCenter/CocoaInitializer.mm
Normal file
27
telldus-gui/TelldusCenter/CocoaInitializer.mm
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Remko Troncon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CocoaInitializer.h"
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
|
class CocoaInitializer::Private {
|
||||||
|
public:
|
||||||
|
NSAutoreleasePool* autoReleasePool_;
|
||||||
|
};
|
||||||
|
|
||||||
|
CocoaInitializer::CocoaInitializer()
|
||||||
|
{
|
||||||
|
d = new CocoaInitializer::Private();
|
||||||
|
NSApplicationLoad();
|
||||||
|
d->autoReleasePool_ = [[NSAutoreleasePool alloc] init];
|
||||||
|
}
|
||||||
|
|
||||||
|
CocoaInitializer::~CocoaInitializer()
|
||||||
|
{
|
||||||
|
[d->autoReleasePool_ release];
|
||||||
|
delete d;
|
||||||
|
}
|
24
telldus-gui/TelldusCenter/Info.plist
Normal file
24
telldus-gui/TelldusCenter/Info.plist
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>tellduscenter</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>TelldusCenter</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.telldus.center</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Telldus Center</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>Telldus Center 1.3.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.3.0</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
25
telldus-gui/TelldusCenter/SparkleAutoUpdater.h
Normal file
25
telldus-gui/TelldusCenter/SparkleAutoUpdater.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Remko Troncon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPARKLEAUTOUPDATER_H
|
||||||
|
#define SPARKLEAUTOUPDATER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "AutoUpdater.h"
|
||||||
|
|
||||||
|
class SparkleAutoUpdater : public AutoUpdater
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SparkleAutoUpdater(const QString& url);
|
||||||
|
~SparkleAutoUpdater();
|
||||||
|
|
||||||
|
void checkForUpdates();
|
||||||
|
|
||||||
|
private:
|
||||||
|
class Private;
|
||||||
|
Private* d;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
37
telldus-gui/TelldusCenter/SparkleAutoUpdater.mm
Normal file
37
telldus-gui/TelldusCenter/SparkleAutoUpdater.mm
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Remko Troncon
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SparkleAutoUpdater.h"
|
||||||
|
|
||||||
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#include <Sparkle/Sparkle.h>
|
||||||
|
|
||||||
|
class SparkleAutoUpdater::Private
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SUUpdater* updater;
|
||||||
|
};
|
||||||
|
|
||||||
|
SparkleAutoUpdater::SparkleAutoUpdater(const QString& aUrl)
|
||||||
|
{
|
||||||
|
d = new Private;
|
||||||
|
|
||||||
|
d->updater = [SUUpdater sharedUpdater];
|
||||||
|
[d->updater retain];
|
||||||
|
|
||||||
|
NSURL* url = [NSURL URLWithString:
|
||||||
|
[NSString stringWithUTF8String: aUrl.toUtf8().data()]];
|
||||||
|
[d->updater setFeedURL: url];
|
||||||
|
}
|
||||||
|
|
||||||
|
SparkleAutoUpdater::~SparkleAutoUpdater()
|
||||||
|
{
|
||||||
|
[d->updater release];
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SparkleAutoUpdater::checkForUpdates()
|
||||||
|
{
|
||||||
|
[d->updater checkForUpdatesInBackground];
|
||||||
|
}
|
|
@ -5,11 +5,20 @@ TARGET = TelldusCenter
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
tellduscenterapplication.cpp
|
tellduscenterapplication.cpp \
|
||||||
|
autoupdater.cpp
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
tellduscenterapplication.h
|
tellduscenterapplication.h \
|
||||||
|
autoupdater.h \
|
||||||
|
CocoaInitializer.h
|
||||||
FORMS +=
|
FORMS +=
|
||||||
RESOURCES += resource.qrc
|
RESOURCES += resource.qrc
|
||||||
macx:LIBS += -lTelldusGui \
|
macx {
|
||||||
-L../TelldusGui
|
HEADERS += sparkleautoupdater.h
|
||||||
|
LIBS += -framework TelldusGui -framework Sparkle
|
||||||
|
OBJECTIVE_SOURCES += SparkleAutoUpdater.mm \
|
||||||
|
CocoaInitializer.mm
|
||||||
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
|
}
|
||||||
!macx:LIBS += -ltelldus-gui
|
!macx:LIBS += -ltelldus-gui
|
||||||
|
VERSION = 1.3.0
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#include "tellduscenterapplication.h"
|
#include "tellduscenterapplication.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
#include "CocoaInitializer.h"
|
||||||
|
#include "SparkleAutoUpdater.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE( resource );
|
Q_INIT_RESOURCE( resource );
|
||||||
|
@ -10,5 +15,14 @@ int main(int argc, char *argv[])
|
||||||
MainWindow *w = new MainWindow();
|
MainWindow *w = new MainWindow();
|
||||||
w->show();
|
w->show();
|
||||||
|
|
||||||
|
AutoUpdater* updater = 0;
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
CocoaInitializer initializer;
|
||||||
|
updater = new SparkleAutoUpdater("file:///Users/micke/Documents/dev/appcast.xml");
|
||||||
|
#endif
|
||||||
|
if (updater) {
|
||||||
|
//updater->checkForUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
return application.exec();
|
return application.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue