Commit 7ce7bd73 authored by Ming Rui Zhang's avatar Ming Rui Zhang

beta: add differentiation between release version and beta version

- update mechanism also changes

Change-Id: I7fb8614431413d1d550cf9b32a206ee25a234c53
parent b81e9d1b
......@@ -19,6 +19,7 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "utils.h"
#include "version.h"
AboutDialog::AboutDialog(QWidget *parent) :
......@@ -30,7 +31,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
this->setFixedSize(this->width(),this->height());
ui->creditsWidget->hide();
ui->gitVersionLabel->setText(QString("%1: %2").arg(tr("version"), QString(VERSION_STRING)));
ui->gitVersionLabel->setText(QString("%1: %2").arg(isBeta ? tr("beta version") : tr("version"), QString(VERSION_STRING)));
ui->creditsBrowser->setHtml("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">"
......@@ -47,6 +48,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Anthony Léonard</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Cyrille Béraud</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Dorina Mosku</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Eden Abitbol</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Édric Milaret</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Éloi Bail</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Emmanuel Lepage-Vallée</p>"
......@@ -56,20 +58,25 @@ AboutDialog::AboutDialog(QWidget *parent) :
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Julien Grossholtz</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Kateryna Kostiuk</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Loïc Siret</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Mingrui Zhang</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Mohamed Amine Younes Bouacida</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Nicolas Jäger</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Nicolas Reynaud</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Olivier Gregoire</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Olivier Soldano</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Patrick Keroulas</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Philippe Gorley</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Pierre Lespagnol</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Rayan Osseiran</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Romain Bertozzi</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Sébastien Blin</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Seva Ivanov</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Silbino Gonçalves Matado</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Simon Désaulniers</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Stepan Salenikovich</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Simon Zeni</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Thibault Wittemberg</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Vsevolod Ivanov</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Yang Wang</p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">"
+ tr("Artwork by:") + "</span></p>"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Marianne Forget</p>"
......@@ -85,17 +92,15 @@ AboutDialog::~AboutDialog()
}
void
AboutDialog::on_aboutButton_toggled(bool checked)
AboutDialog::on_aboutButton_clicked()
{
ui->creditsButton->setChecked(!checked);
ui->aboutWidget->setVisible(checked);
ui->creditsWidget->setVisible(!checked);
ui->aboutWidget->setVisible(true);
ui->creditsWidget->setVisible(false);
}
void
AboutDialog::on_creditsButton_clicked(bool checked)
AboutDialog::on_creditsButton_clicked()
{
ui->aboutButton->setChecked(!checked);
ui->creditsWidget->setVisible(checked);
ui->aboutWidget->setVisible(!checked);
ui->creditsWidget->setVisible(true);
ui->aboutWidget->setVisible(false);
}
......@@ -34,8 +34,8 @@ public:
//UI SLOTS
private slots:
void on_aboutButton_toggled(bool checked);
void on_creditsButton_clicked(bool checked);
void on_aboutButton_clicked();
void on_creditsButton_clicked();
private:
Ui::AboutDialog *ui;
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>674</width>
<height>555</height>
<height>616</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -439,7 +439,7 @@
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0">
<property name="topMargin">
<number>0</number>
</property>
......@@ -458,30 +458,58 @@
</item>
<item>
<widget class="QPushButton" name="aboutButton">
<property name="minimumSize">
<size>
<width>98</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>about button</string>
<string>About</string>
</property>
<property name="text">
<string>About</string>
</property>
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="creditsButton">
<property name="minimumSize">
<size>
<width>98</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>credits button</string>
<string>Credits</string>
</property>
<property name="text">
<string>Credits</string>
</property>
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
......
......@@ -46,6 +46,8 @@ MainWindow::MainWindow(QWidget* parent)
{
ui->setupUi(this);
setWindowTitle(isBeta ? "Jami (Beta)" : "Jami");
for (int i = 0; i < ui->navStack->count(); ++i) {
if (auto navWidget = dynamic_cast<NavWidget*>(ui->navStack->widget(i))) {
connect(navWidget, &NavWidget::NavigationRequested,
......@@ -54,13 +56,6 @@ MainWindow::MainWindow(QWidget* parent)
if (auto navWidget = dynamic_cast<NavWidget*>(ui->navStack->widget(i))) {
navWidget->navigated(scr == i);
}
if (scr == ScreenEnum::WizardScreen) {
setWindowTitle(QObject::tr("Setup account"));
} else if (scr == ScreenEnum::SetttingsScreen) {
setWindowTitle(QObject::tr("Settings"));
} else {
setWindowTitle(QStringLiteral("Jami"));
}
}
Utils::setStackWidget(ui->navStack, ui->navStack->widget(scr));
});
......@@ -91,10 +86,8 @@ MainWindow::MainWindow(QWidget* parent)
readSettingsFromRegistry();
startScreen = ScreenEnum::CallScreen;
emit LRCInstance::instance().accountListChanged();
setWindowTitle(QStringLiteral("Jami"));
} else {
startScreen = ScreenEnum::WizardScreen;
setWindowTitle(QStringLiteral("Log In"));
}
Utils::setStackWidget(ui->navStack, ui->navStack->widget(startScreen));
......
......@@ -121,6 +121,10 @@ SettingsWidget::SettingsWidget(QWidget* parent)
ui->lookupStatusLabel->setMovie(lookupSpinnerMovie_);
ui->lookupStatusLabel->hide();
ui->autoUpdateCheckBox->setText(QString("Check for updates automatically") + QString(isBeta ? " (Beta)" : ""));
ui->checkUpdateButton->setText(QString("Check for updates now") + QString(isBeta ? " (Beta)" : ""));
ui->installBetaButton->setVisible(!isBeta);
// btnExitSettings
connect(ui->btnExitSettings, &QPushButton::clicked, this, &SettingsWidget::leaveSettingsSlot);
......@@ -240,6 +244,11 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(ui->autoUpdateCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetUpdateAutomatic);
connect(ui->installBetaButton, &QAbstractButton::clicked,
[this] {
Utils::applyUpdates(true, this);
});
// audio / visual settings
connect(ui->alwaysRecordingCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotAlwaysRecordingClicked);
......
......@@ -715,7 +715,7 @@
</font>
</property>
<property name="icon">
<iconset>
<iconset resource="ressources.qrc">
<normaloff>:/images/icons/round-folder-24px.svg</normaloff>:/images/icons/round-folder-24px.svg</iconset>
</property>
<property name="iconSize">
......@@ -1060,7 +1060,7 @@
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="ressources.qrc">
<normaloff>:/images/icons/round-folder-24px.svg</normaloff>:/images/icons/round-folder-24px.svg</iconset>
</property>
<property name="iconSize">
......@@ -1124,10 +1124,7 @@
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_16">
<property name="spacing">
<number>14</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>20</number>
</property>
......@@ -1137,7 +1134,7 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>12</number>
......@@ -1183,7 +1180,7 @@
</item>
</layout>
</item>
<item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<property name="topMargin">
<number>0</number>
......@@ -1214,7 +1211,7 @@
</font>
</property>
<property name="toolTip">
<string>Check for updates now button</string>
<string>Check for updates now</string>
</property>
<property name="text">
<string>Check for updates now</string>
......@@ -1229,7 +1226,57 @@
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_27">
<item>
<widget class="QPushButton" name="installBetaButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Install the newest beta version</string>
</property>
<property name="text">
<string>Install the latest beta version</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_32">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
......@@ -1416,7 +1463,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>706</width>
<width>745</width>
<height>1398</height>
</rect>
</property>
......@@ -2739,7 +2786,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>683</width>
<width>745</width>
<height>874</height>
</rect>
</property>
......
......@@ -115,14 +115,16 @@ QPushButton#btnAcceptInvite:pressed, QPushButton#btnIgnoreInvite:pressed, QPushB
QPushButton#imBackButton:hover, QPushButton#btnAudioCall:hover, QPushButton#btnVideoCall:hover,
QPushButton#sendContactRequestButton:hover, QPushButton#sendButton:hover, QPushButton#sendIMButton:hover,
QPushButton#btnExitSettings:hover, QPushButton#btnDeleteAccept:hover, QPushButton#btnDeleteCancel:hover,
QPushButton#btnUpdateAccept:hover, QPushButton#btnUpdateCancel:hover {
QPushButton#aboutButton:hover, QPushButton#creditsButton:hover, QPushButton#updateCancelBtn:hover,
QPushButton#updateAcceptBtn:hover, QPushButton#installBetaButton:hover {
background-color: rgb(237, 237, 237);
}
QPushButton#imBackButton:pressed, QPushButton#btnAudioCall:pressed, QPushButton#btnVideoCall:pressed,
QPushButton#sendContactRequestButton:pressed, QPushButton#sendButton:pressed, QPushButton#sendIMButton:pressed,
QPushButton#btnExitSettings:pressed, QPushButton#btnDeleteAccept:pressed, QPushButton#btnDeleteCancel:pressed,
QPushButton#btnUpdateAccept:pressed, QPushButton#btnUpdateCancel:pressed {
QPushButton#aboutButton:pressed, QPushButton#creditsButton:pressed, QPushButton#updateCancelBtn:pressed,
QPushButton#updateAcceptBtn:pressed, QPushButton#installBetaButton:pressed {
background-color: rgb(212, 212, 212);
}
......@@ -552,6 +554,10 @@ QLabel#warningLabel{
color: red;
}
QLabel#labelWarning {
color: darkorange;
}
QLabel#accountIdLabel{
color: LightSlateGrey;
font-style: italic;
......
......@@ -18,6 +18,10 @@
#include "ui_updateconfirmdialog.h"
#include "updateconfirmdialog.h"
#include <QDesktopServices>
#include <QFontMetrics>
#include <QUrl>
UpdateConfirmDialog::UpdateConfirmDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::UpdateConfirmDialog)
......@@ -32,12 +36,54 @@ UpdateConfirmDialog::~UpdateConfirmDialog()
delete ui;
}
void UpdateConfirmDialog::on_updateCancelBtn_clicked()
void
UpdateConfirmDialog::changeToUpdateToBetaVersionText()
{
connect(ui->labelWarning, &QLabel::linkActivated,
[this] (const QString& link) {
QDesktopServices::openUrl(QUrl(link));
});
ui->labelWarning->setWordWrap(true);
ui->updateAcceptBtn->setToolTip("Install Beta Version");
ui->updateCancelBtn->setToolTip("Cancel Installation");
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
setMaximumHeight(INT_MAX);
setMaximumWidth(INT_MAX);
// inital constraint of Text
ui->labelWarning->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
ui->labelWarning->setMinimumHeight(300);
ui->labelWarning->setMinimumWidth(350);
QString warning { QString("Please be aware that this will uninstall your current Release version.<br>"
"You can always download the latest Release version on our website.<br>") };
// reset size to be able to contain all text
auto rect = ui->labelWarning->fontMetrics().boundingRect(ui->labelWarning->rect(), Qt::AlignCenter | Qt::TextWordWrap, warning);
ui->labelWarning->setText(warning);
ui->labelWarning->setMinimumHeight(rect.height());
ui->labelWarning->setMinimumWidth(rect.width());
setWindowTitle("Jami Beta Installation");
ui->labelDeletion->setText("Install the latest Beta version?");
setMaximumHeight(height() + rect.height());
setMinimumHeight(height() + rect.height());
setMaximumWidth(rect.width() + 40);
setMinimumWidth(rect.width() + 40);
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
}
void
UpdateConfirmDialog::on_updateCancelBtn_clicked()
{
done(DialogCode::Rejected);
}
void UpdateConfirmDialog::on_updateAcceptBtn_clicked()
void
UpdateConfirmDialog::on_updateAcceptBtn_clicked()
{
done(DialogCode::Accepted);
}
......@@ -31,6 +31,8 @@ public:
UpdateConfirmDialog(QWidget* parent = nullptr);
~UpdateConfirmDialog();
void changeToUpdateToBetaVersionText();
private slots:
void on_updateCancelBtn_clicked();
void on_updateAcceptBtn_clicked();
......
......@@ -88,41 +88,74 @@
</property>
</spacer>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="labelWarning">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: red;</string>
</property>
<property name="text">
<string>This update will restart Jami automatically</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>3</number>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
</widget>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelWarning">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This update will restart Jami automatically&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="margin">
<number>3</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
......@@ -168,9 +201,9 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="updateAcceptBtn">
<widget class="QPushButton" name="updateCancelBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -181,25 +214,19 @@
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Update Client</string>
<string>Cancel Update</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Install</string>
<string>Cancel</string>
</property>
</widget>
</item>
......@@ -217,9 +244,9 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="updateCancelBtn">
<widget class="QPushButton" name="updateAcceptBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -230,19 +257,25 @@
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Cancel Update</string>
<string>Update Client</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Cancel</string>
<string>Install</string>
</property>
</widget>
</item>
......
......@@ -366,8 +366,13 @@ void
Utils::checkForUpdates(bool withUI, QWidget* parent)
{
Utils::cleanUpdateFiles();
QUrl downloadPath { isBeta ?
QUrl::fromEncoded("https://dl.jami.net/windows/beta/version") :
QUrl::fromEncoded("https://dl.jami.net/windows/version")
};
LRCInstance::instance().getNetworkManager()->getRequestReply(
QUrl::fromEncoded("https://dl.jami.net/windows/version"),
downloadPath,
[parent, withUI] (int status, const QString& onlineVersion) {
if (status != 200) {
if (withUI) {
......@@ -382,7 +387,7 @@ Utils::checkForUpdates(bool withUI, QWidget* parent)
qWarning() << "No version file found";
} else if (onlineVersion.toULongLong() > currentVersion) {
qDebug() << "New version found";
Utils::applyUpdates(parent);
Utils::applyUpdates(false, parent);
} else {
qDebug() << "No new version found";
if (withUI) {
......@@ -395,21 +400,30 @@ Utils::checkForUpdates(bool withUI, QWidget* parent)
}
void
Utils::applyUpdates(QWidget* parent)
Utils::applyUpdates(bool updateToBeta, QWidget* parent)
{
if (!parent->findChild<UpdateConfirmDialog*>()) {
UpdateConfirmDialog updateDialog(parent);
if(updateToBeta)
updateDialog.changeToUpdateToBetaVersionText();
auto ret = updateDialog.exec();
if (ret != QDialog::Accepted)
return;
} else
return;
QUrl downloadPath;
if (updateToBeta || isBeta) {
downloadPath = QUrl::fromEncoded("https://dl.jami.net/windows/beta/jami.beta.x64.msi");
} else {
downloadPath = QUrl::fromEncoded("https://dl.jami.net/windows/jami.release.x64.msi");
}
LRCInstance::instance().getNetworkManager()->getRequestFile(
QUrl::fromEncoded("https://dl.jami.net/windows/jami.release.x64.msi"),
downloadPath,
WinGetEnv("TEMP"),
true,
[parent](int status) {
[parent, downloadPath](int status) {
if (status != 200) {
QMessageBox::critical(0,
QObject::tr("Update"),
......@@ -418,7 +432,7 @@ Utils::applyUpdates(QWidget* parent)
}
auto args = QString(" /passive /norestart WIXNONUILAUNCH=1");
auto dir = Utils::WinGetEnv("TEMP");
auto cmd = "powershell " + QString(dir) + "\\jami.release.x64.msi"
auto cmd = "powershell " + QString(dir) + "\\" + downloadPath.fileName()
+ " /L*V " + QString(dir) + "\\jami_x64_install.log" + args;
auto retq = QProcess::startDetached(cmd);
if (retq) {
......
......@@ -48,6 +48,12 @@
static const QSize IMAGE_SIZE{ 128, 128 };
#ifdef BETA
static constexpr bool isBeta = true;
#else
static constexpr bool isBeta = false;
#endif
namespace Utils
{
......@@ -71,7 +77,7 @@ void drawBlackCircularImageOntoLabel(QLabel* containerWidget);
// updates
void cleanUpdateFiles();
void checkForUpdates(bool withUI, QWidget* parent = nullptr);
void applyUpdates(QWidget* parent = nullptr);
void applyUpdates(bool updateToBeta, QWidget* parent = nullptr);
// names
std::string bestIdForConversation(const lrc::api::conversation::Info& conv, const lrc::api::ConversationModel& model);
......