Also download and open new updates on OS X (#4926)
* Also download and open new updates on OS X * Cosmetics
This commit is contained in:
committed by
Bertrand Songis
parent
9437d98df9
commit
355f4b5f92
@@ -58,13 +58,19 @@
|
|||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define COMPANION_STAMP "companion-macosx.stamp"
|
#define COMPANION_STAMP "companion-macosx.stamp"
|
||||||
#define COMPANION_INSTALLER "" // no automatated updates for MacOsx
|
#define COMPANION_INSTALLER "macosx/opentx-companion-%1.dmg"
|
||||||
|
#define COMPANION_FILEMASK tr("Diskimage (*.dmg)")
|
||||||
|
#define COMPANION_INSTALL_QUESTION tr("Would you like to open the disk image to install the new version?")
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
#define COMPANION_STAMP "companion-windows.stamp"
|
#define COMPANION_STAMP "companion-windows.stamp"
|
||||||
#define COMPANION_INSTALLER "windows/companion-windows-%1.exe"
|
#define COMPANION_INSTALLER "windows/companion-windows-%1.exe"
|
||||||
|
#define COMPANION_FILEMASK tr("Executable (*.exe)")
|
||||||
|
#define COMPANION_INSTALL_QUESTION tr("Would you like to launch the installer?")
|
||||||
#else
|
#else
|
||||||
#define COMPANION_STAMP "companion-linux.stamp"
|
#define COMPANION_STAMP "companion-linux.stamp"
|
||||||
#define COMPANION_INSTALLER "" // no automatated updates for linux
|
#define COMPANION_INSTALLER "" // no automatated updates for linux
|
||||||
|
#define COMPANION_FILEMASK "*.*"
|
||||||
|
#define COMPANION_INSTALL_QUESTION tr("Would you like to launch the installer?")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightlies/companion"
|
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightlies/companion"
|
||||||
@@ -294,14 +300,15 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
|||||||
int c9xver = version2index(c9xversion);
|
int c9xver = version2index(c9xversion);
|
||||||
|
|
||||||
if (c9xver < vnum) {
|
if (c9xver < vnum) {
|
||||||
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
|
#if defined WIN32 || !defined __GNUC__ || defined __APPLE__
|
||||||
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
|
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
|
||||||
"Would you like to download it?").arg(version) ,
|
"Would you like to download it?").arg(version) ,
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
|
||||||
if (ret == QMessageBox::Yes) {
|
if (ret == QMessageBox::Yes) {
|
||||||
QDir dir(g.updatesDir());
|
QDir dir(g.updatesDir());
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), dir.absoluteFilePath(QString(COMPANION_INSTALLER).arg(version)), tr("Executable (*.exe)"));
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), dir.absoluteFilePath(QString(COMPANION_INSTALLER).arg(version)), COMPANION_FILEMASK);
|
||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
g.updatesDir(QFileInfo(fileName).dir().absolutePath());
|
g.updatesDir(QFileInfo(fileName).dir().absolutePath());
|
||||||
downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
|
downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
|
||||||
@@ -325,8 +332,7 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
|||||||
|
|
||||||
void MainWindow::updateDownloaded()
|
void MainWindow::updateDownloaded()
|
||||||
{
|
{
|
||||||
int ret = QMessageBox::question(this, "Companion", tr("Would you like to launch the installer?") ,
|
int ret = QMessageBox::question(this, "Companion", COMPANION_INSTALL_QUESTION, QMessageBox::Yes | QMessageBox::No);
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if (ret == QMessageBox::Yes) {
|
if (ret == QMessageBox::Yes) {
|
||||||
if (QDesktopServices::openUrl(QUrl::fromLocalFile(installer_fileName)))
|
if (QDesktopServices::openUrl(QUrl::fromLocalFile(installer_fileName)))
|
||||||
QApplication::exit();
|
QApplication::exit();
|
||||||
|
|||||||
Reference in New Issue
Block a user