Skip to content
Snippets Groups Projects
Commit 79d3f687 authored by Edric Milaret's avatar Edric Milaret Committed by gerrit2
Browse files

autoupdate: integrate winsparkle

- Winsparkle is the windows port of Sparkle the framework used on OSX
to provide the autoupdate feature
- This commit add:
  - Winsparkle as a submodule
  - A check for update button in the configuration panel
  - All that is guarded by ENABLE_AUTOUPDATE to allow build without
  Winsparkle
  - Add a way for the user to enable/disable auto check for updates
  and to set the interval of these checks

Change-Id: Iea9cb0a31b60c8111f30a4f648d6f5e80b92abdc
Tuleap: #183
parent 58f5762a
No related branches found
No related tags found
No related merge requests found
[submodule "winsparkle"]
path = winsparkle
url = git://github.com/vslavik/winsparkle.git
......@@ -13,8 +13,11 @@ win32: QT += winextras
VERSION = 0.3.0
GIT_VERSION = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
NIGHTLY_VERSION =$$system(date +'%Y%m%d')
DEFINES += VERSION=\\\"$$VERSION\\\"
DEFINES += GIT_VERSION=\\\"$$GIT_VERSION\\\"
DEFINES += NIGHTLY_VERSION=\\\"$$NIGHTLY_VERSION\\\"
BUILD=$${BUILD}
TARGET = Ring
......@@ -117,6 +120,7 @@ FORMS += mainwindow.ui \
win32: LIBS += -lole32 -luuid -lshlwapi
INCLUDEPATH += $${RING}/include/libringclient
INCLUDEPATH += $${RING}/include
LIBS += -L$${RING}/lib -lringclient
......@@ -203,4 +207,14 @@ win32 {
INSTALLS += RINGTONES PACKAGING LICENSE RUNTIME LRC_TRANSLATION QTRUNTIME QTDEPSRUNTIME \
QTPLUGINIMAGE QTPLATFORMS LIBSTD
ENABLE_AUTOUPDATE=$${ENABLE_AUTOUPDATE}
equals (ENABLE_AUTOUPDATE, True) {
DEFINES += ENABLE_AUTOUPDATE
LIBS += -L$${RING}/lib -lWinSparkle
WINSPARKLE.files = $${RING}/bin/WinSparkle.dll $${RING}/bin/libringclient.dll
WINSPARKLE.path = $$OUT_PWD/release
INSTALLS += WINSPARKLE
message("AUTO UPDATES enabled")
}
}
......@@ -30,7 +30,7 @@
#include "accountserializationadapter.h"
#include "accountstatedelegate.h"
#include "settingskey.h"
#include "utils.h"
#include "accountmodel.h"
#include "protocolmodel.h"
......@@ -39,7 +39,9 @@
#include "ringtonemodel.h"
#include "categorizedhistorymodel.h"
#include "utils.h"
#ifdef ENABLE_AUTOUPDATE
#include "winsparkle.h"
#endif
ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
NavWidget(Nav, parent),
......@@ -84,10 +86,23 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) :
}
}
});
#ifndef ENABLE_AUTOUPDATE
ui->checkUpdateButton->hide();
ui->intervalUpdateCheckSpinBox->hide();
ui->updateDayLabel->hide();
ui->autoUpdateCheckBox->hide();
#endif
}
void
ConfigurationWidget::showEvent(QShowEvent *event) {
#ifdef ENABLE_AUTOUPDATE
if (win_sparkle_get_automatic_check_for_updates()) {
ui->autoUpdateCheckBox->setChecked(true);
}
ui->intervalUpdateCheckSpinBox->setValue(win_sparkle_get_update_check_interval() / 86400);
#endif
QWidget::showEvent(event);
if (ui->tabWidget->currentIndex() == 1
&& CallModel::instance().getActiveCalls().size() == 0) {
......@@ -215,3 +230,27 @@ ConfigurationWidget::on_closeOrMinCheckBox_toggled(bool checked)
{
settings_.setValue(SettingsKey::closeOrMinimized, checked);
}
void
ConfigurationWidget::on_checkUpdateButton_clicked()
{
#ifdef ENABLE_AUTOUPDATE
win_sparkle_check_update_with_ui();
#endif
}
void
ConfigurationWidget::on_autoUpdateCheckBox_toggled(bool checked)
{
#ifdef ENABLE_AUTOUPDATE
win_sparkle_set_automatic_check_for_updates(checked);
#endif
}
void
ConfigurationWidget::on_intervalUpdateCheckSpinBox_valueChanged(int arg1)
{
#ifdef ENABLE_AUTOUPDATE
win_sparkle_set_update_check_interval(arg1 * 86400);
#endif
}
......@@ -56,6 +56,9 @@ private slots:
void on_clearHistoryButton_clicked();
void on_historyDaySettingsSpinBox_valueChanged(int limit);
void on_closeOrMinCheckBox_toggled(bool checked);
void on_checkUpdateButton_clicked();
void on_autoUpdateCheckBox_toggled(bool checked);
void on_intervalUpdateCheckSpinBox_valueChanged(int arg1);
private slots:
void accountSelected(QItemSelection itemSel);
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>558</width>
<height>391</height>
<height>433</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -166,6 +166,80 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="autoUpdateCheckBox">
<property name="text">
<string>Check for update automatically every</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="intervalUpdateCheckSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="updateDayLabel">
<property name="text">
<string>days</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="checkUpdateButton">
<property name="text">
<string>Check for updates</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
......@@ -464,5 +538,22 @@
<resources>
<include location="ressources.qrc"/>
</resources>
<connections/>
<connections>
<connection>
<sender>autoUpdateCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>intervalUpdateCheckSpinBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>78</x>
<y>278</y>
</hint>
<hint type="destinationlabel">
<x>321</x>
<y>279</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -35,4 +35,3 @@ public:
private:
GlobalSystemTray();
};
......@@ -33,6 +33,10 @@
#include "aboutdialog.h"
#include "mainwindowtoolbar.h"
#ifdef ENABLE_AUTOUPDATE
#include "winsparkle.h"
#endif
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
......@@ -87,6 +91,21 @@ MainWindow::MainWindow(QWidget *parent) :
callWidget, &CallWidget::on_historicButton_clicked);
connect(mwToolBar_->getContactListButton(), &QAction::triggered,
callWidget, &CallWidget::on_contactButton_clicked);
#ifdef ENABLE_AUTOUPDATE
win_sparkle_set_appcast_url("http://gpl.savoirfairelinux.net/ring-download/windows/winsparkle-ring.xml");
win_sparkle_set_app_details(L"Savoir-faire Linux", L"Ring", QString(NIGHTLY_VERSION).toStdWString().c_str());
win_sparkle_set_shutdown_request_callback([]() {QCoreApplication::exit();});
win_sparkle_init();
if (win_sparkle_get_last_check_time() == -1) {
win_sparkle_set_update_check_interval(7 * 86400);
}
QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, [=]() {
win_sparkle_cleanup();
});
#endif
}
MainWindow::~MainWindow()
......
Subproject commit 0e2112bf52ca171062cbb732896be1c9760ff44c
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment