Commit 0c3feec7 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

updater: add download manager

- the download manager is responsible for Jami version verification,
  installer download, presenting ui for user update event

Change-Id: Id71232a8c32675391f9d46b0b5a7658e8a47fc95
parent b0589f83
20190102542748
\ No newline at end of file
/***************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "downloadbar.h"
#include "ui_downloadbar.h"
updateDownloadDialog::updateDownloadDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::updateDownloadDialog)
{
ui->setupUi(this);
ui->progressBar->setValue(0);
ui->progressBar->setVisible(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
void updateDownloadDialog::setValue(double var)
{
value_ = var;
}
void updateDownloadDialog::setMaximum(double var)
{
maximum_ = var;
}
updateDownloadDialog::~updateDownloadDialog()
{
delete ui;
}
void updateDownloadDialog::update(QString displayText)
{
int percent = static_cast<int>((1 - ((maximum_ - value_) / maximum_)) * 100);
ui->Statusedit->setText("Speed: " + displayText);
ui->progressBar->setValue(percent);
}
/***************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
#include <QDialog>
namespace Ui {
class updateDownloadDialog;
}
class updateDownloadDialog : public QDialog {
Q_OBJECT
public:
updateDownloadDialog(QWidget* parent = nullptr);
~updateDownloadDialog();
void setValue(double var);
void setMaximum(double var);
void update(QString displayText);
private:
Ui::updateDownloadDialog* ui;
double value_ = 0;
double maximum_ = -1;
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>updateDownloadDialog</class>
<widget class="QDialog" name="updateDownloadDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>309</width>
<height>121</height>
</rect>
</property>
<property name="windowTitle">
<string>Update Download</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Update Download Status</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="Statusedit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Speed: </string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/***************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <windows.h>
#include <QMessageBox>
#include "downloadbar.h"
#include "downloadmanger.h"
DownloadManager::DownloadManager(QObject* parent)
: QObject(parent)
{
//Download it into %TEMP%
downloadpath_ = WinGetEnv("TEMP");
}
void DownloadManager::doDownload(const QUrl& url)
{
QFileInfo fileInfo(url.path());
QString fileName = fileInfo.fileName();
if (fileName.isEmpty())
fileName = "download";
file_.reset(new QFile(downloadpath_ + "/" + fileName));
if (!file_->open(QIODevice::WriteOnly)) {
QMessageBox::information(0, "Error!", "Unable to Open File Path");
file_.reset(nullptr);
return;
}
QNetworkRequest request(url);
// get() method posts a request
// to obtain the contents of the target request
// and returns a new QNetworkReply object
// opened for reading which emits
// the readyRead() signal whenever new data arrives.
currentDownload_ = manager_.get(request);
downloadTime_.start();
#if QT_CONFIG(ssl)
connect(currentDownload_, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));
#endif
//downloadProgress() signal is emitted when data is received
connect(currentDownload_, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)));
// This signal is emitted when the reply has finished processing.
// After this signal is emitted,
// there will be no more updates to the reply's data or metadata.
connect(currentDownload_, SIGNAL(finished()), this, SLOT(downloadFinished()));
// Whenever more data is received from the network,
// this readyRead() signal is emitted
connect(currentDownload_, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
probar_.exec();
}
void DownloadManager::downloadFinished()
{
// donload finished normally
int statusCode = currentDownload_->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (statusCode == 404) {
QMessageBox::information(0, "Error!", "DownLoaded Installer Invalid!");
}
probar_.setMaximum(0);
probar_.setValue(0);
file_->flush();
file_->close();
currentDownload_->deleteLater();
currentDownload_ = nullptr;
file_.reset(nullptr);
probar_.setValue(0);
probar_.update("0");
probar_.close();
}
void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
probar_.setMaximum(bytesTotal);
probar_.setValue(bytesReceived);
int presentTime = downloadTime_.elapsed();
// calculate the download speed
double speed = (bytesReceived - previousDownloadBytes_) * 1000.0 / (presentTime - previousTime_);
previousTime_ = presentTime;
previousDownloadBytes_ = bytesReceived;
QString unit;
if (speed < 1024) {
unit = "bytes/sec";
} else if (speed < 1024 * 1024) {
speed /= 1024;
unit = "kB/s";
} else {
speed /= 1024 * 1024;
unit = "MB/s";
}
probar_.update(QString::number(speed) + " " + unit);
}
void DownloadManager::httpReadyRead()
{
// this slot gets called every time the QNetworkReply has new data.
// We read all of its new data and write it into the file.
// That way we use less RAM than when reading it at the finished()
// signal of the QNetworkReply
if (file_)
file_->write(currentDownload_->readAll());
}
QString DownloadManager::versionOnline()
{
QString urlstr = "https://dl.jami.net/windows/testver";
QUrl url = QUrl::fromEncoded(urlstr.toLocal8Bit());
doDownload(url);
QFile file(downloadpath_ + "/" + "testver");
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::information(0, "Downloaded Version File Error", file.errorString());
}
QTextStream in(&file);
QString onlineVersion = in.readLine();
file.close();
return onlineVersion;
}
void DownloadManager::sslErrors(const QList<QSslError>& sslErrors)
{
#if QT_CONFIG(ssl)
for (const QSslError& error : sslErrors)
QMessageBox::information(0, "SSL Error ", error.errorString());
#else
Q_UNUSED(sslErrors);
#endif
}
const char* DownloadManager::WinGetEnv(const char* name)
{
const DWORD buffSize = 65535;
static char buffer[buffSize];
if (GetEnvironmentVariableA(name, buffer, buffSize)) {
return buffer;
} else {
return 0;
}
}
/***************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
#include <memory>
#include <QtCore>
#include <QtNetwork>
#include "downloadbar.h"
class QSslError;
class DownloadManager : public QObject {
Q_OBJECT
QNetworkAccessManager manager_;
QNetworkReply* currentDownload_;
updateDownloadDialog probar_;
std::unique_ptr<QFile> file_;
QTime downloadTime_;
int previousTime_ = 0;
qint64 previousDownloadBytes_ = 0;
QString downloadpath_;
const char* WinGetEnv(const char* name);
public:
explicit DownloadManager(QObject* parent = nullptr);
void doDownload(const QUrl& url);
QString versionOnline();
public slots:
void sslErrors(const QList<QSslError>& sslErrors);
void downloadFinished();
void downloadProgress(qint64 bytesRead, qint64 totalBytes);
void httpReadyRead();
};
......@@ -62,7 +62,10 @@ HEADERS += ./pixbufmanipulator.h \
./toggleswitch.h \
./videooverlay.h \
./videoview.h \
./videowidget.h
./videowidget.h \
./downloadbar.h \
./updateconfirmdialog.h \
./downloadmanger.h
SOURCES += ./advancedsettingswidget.cpp \
./advancedsipsettingwidget.cpp \
./avatargraphicsview.cpp \
......@@ -108,7 +111,10 @@ SOURCES += ./advancedsettingswidget.cpp \
./videoview.cpp \
./videowidget.cpp \
./webchathelpers.cpp \
./windowscontactbackend.cpp
./windowscontactbackend.cpp \
./downloadbar.cpp \
./updateconfirmdialog.cpp \
./downloadmanger.cpp
FORMS += ./aboutdialog.ui \
./advancedsettingswidget.ui \
./advancedsipsettingwidget.ui \
......@@ -128,5 +134,7 @@ FORMS += ./aboutdialog.ui \
./ringbutton.ui \
./settingswidget.ui \
./videooverlay.ui \
./videoview.ui
./videoview.ui \
./downloadbar.ui \
./updateconfirmdialog.ui
RESOURCES += ressources.qrc
......@@ -135,62 +135,87 @@ Global
{79F8DE42-595D-49D9-A66F-55244FD9DCC3}.RelWithDebInfo|x64.Build.0 = ReleaseLib|x64
{79F8DE42-595D-49D9-A66F-55244FD9DCC3}.RelWithDebInfo|x86.ActiveCfg = ReleaseLib|Win32
{79F8DE42-595D-49D9-A66F-55244FD9DCC3}.RelWithDebInfo|x86.Build.0 = ReleaseLib|Win32
{A604BA33-C1DB-34F6-8584-C429857717A8}.Debug|Any CPU.ActiveCfg = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Debug|x64.ActiveCfg = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Debug|x64.Build.0 = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Debug|x86.ActiveCfg = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib_win32|Any CPU.ActiveCfg = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib_win32|Any CPU.Build.0 = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib_win32|x64.ActiveCfg = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib_win32|x64.Build.0 = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib_win32|x86.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib_win32|x86.Build.0 = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib|Any CPU.ActiveCfg = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib|Any CPU.Build.0 = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib|x64.ActiveCfg = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib|x64.Build.0 = Debug|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib|x86.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.DebugLib|x86.Build.0 = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Release|Any CPU.ActiveCfg = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Release|x64.ActiveCfg = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Release|x64.Build.0 = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.Release|x86.ActiveCfg = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib_win32|Any CPU.ActiveCfg = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib_win32|Any CPU.Build.0 = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib_win32|x64.ActiveCfg = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib_win32|x64.Build.0 = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib_win32|x86.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib_win32|x86.Build.0 = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib|Any CPU.ActiveCfg = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib|Any CPU.Build.0 = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib|x64.ActiveCfg = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib|x64.Build.0 = Release|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib|x86.ActiveCfg = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.ReleaseLib|x86.Build.0 = MinSizeRel|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
{A604BA33-C1DB-34F6-8584-C429857717A8}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Debug|Any CPU.ActiveCfg = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Debug|x64.ActiveCfg = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Debug|x64.Build.0 = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Debug|x86.ActiveCfg = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib_win32|Any CPU.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib_win32|Any CPU.Build.0 = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib_win32|x64.ActiveCfg = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib_win32|x64.Build.0 = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib_win32|x86.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib_win32|x86.Build.0 = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib|Any CPU.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib|Any CPU.Build.0 = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib|x64.ActiveCfg = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib|x64.Build.0 = Debug|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib|x86.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.DebugLib|x86.Build.0 = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Release|Any CPU.ActiveCfg = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Release|x64.ActiveCfg = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Release|x64.Build.0 = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.Release|x86.ActiveCfg = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib_win32|Any CPU.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib_win32|Any CPU.Build.0 = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib_win32|x64.ActiveCfg = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib_win32|x64.Build.0 = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib_win32|x86.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib_win32|x86.Build.0 = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib|Any CPU.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib|Any CPU.Build.0 = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib|x64.ActiveCfg = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib|x64.Build.0 = Release|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib|x86.ActiveCfg = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.ReleaseLib|x86.Build.0 = MinSizeRel|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
{8C3AD0D4-A52C-3EFB-A2C6-04EA3AB5F00E}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
{DBBFBC55-1C20-4D21-AE3B-6E8B14C4FE48}.Debug|Any CPU.ActiveCfg = Debug|x64
{DBBFBC55-1C20-4D21-AE3B-6E8B14C4FE48}.Debug|x64.ActiveCfg = Debug|x64
{DBBFBC55-1C20-4D21-AE3B-6E8B14C4FE48}.Debug|x64.Build.0 = Debug|x64
{DBBFBC55-1C20-4D21-AE3B-6E8B14C4FE48}.Debug|x86.ActiveCfg = Debug|x64
......
......@@ -231,6 +231,8 @@
<ClCompile Include="animationhelpers.cpp" />
<ClCompile Include="currentaccountcombobox.cpp" />
<ClCompile Include="aboutdialog.cpp" />
<ClCompile Include="downloadbar.cpp" />
<ClCompile Include="downloadmanger.cpp" />
<ClCompile Include="accountitemdelegate.cpp" />
<ClCompile Include="accountlistmodel.cpp" />
<ClCompile Include="callwidget.cpp">
......@@ -300,6 +302,7 @@
<ClCompile Include="utils.cpp" />
<ClCompile Include="videooverlay.cpp" />
<ClCompile Include="videoview.cpp" />
<ClCompile Include="updateconfirmdialog.cpp" />
<ClCompile Include="videowidget.cpp" />
<ClCompile Include="webchathelpers.cpp" />
<ClCompile Include="windowscontactbackend.cpp" />
......@@ -393,6 +396,14 @@
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
<Define Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
</QtMoc>
<QtMoc Include="downloadbar.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<QtMoc Include="downloadmanger.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<QtMoc Include="passworddialog.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\.;.\GeneratedFiles;.;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\lrc\src;$(ProjectDir)..\client-windows\winsparkle\include;$(ProjectDir)..\client-windows\qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtMultimediaWidgets</IncludePath>
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG;QT_MULTIMEDIA_LIB;QT_MULTIMEDIAWIDGETS_LIB</Define>
......@@ -464,6 +475,10 @@
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
<Define Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
</QtMoc>
<QtMoc Include="updateconfirmdialog.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<QtMoc Include="settingswidget.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;NIGHTLY_VERSION=20180706;ENABLE_AUTOUPDATE;QT_NO_DEBUG;NDEBUG</Define>
......@@ -589,6 +604,7 @@
<QtUic Include="callwidget.ui">
<SubType>Designer</SubType>
</QtUic>
<QtUic Include="downloadbar.ui" />
<QtUic Include="deleteaccountdialog.ui">
<SubType>Designer</SubType>
</QtUic>
......@@ -612,6 +628,7 @@
<QtUic Include="settingswidget.ui">
<SubType>Designer</SubType>
</QtUic>
<QtUic Include="updateconfirmdialog.ui" />
<QtUic Include="videooverlay.ui">
</QtUic>
<QtUic Include="videoview.ui">
......@@ -669,6 +686,9 @@
<ItemGroup>
<ResourceCompile Include="ico.rc" />
</ItemGroup>
<ItemGroup>
<Text Include="Version.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
......
......@@ -150,6 +150,12 @@
<ClCompile Include="webchathelpers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="downloadbar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="downloadmanger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="animationhelpers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
......@@ -201,6 +207,9 @@
<ClCompile Include="linkdevicedialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="updateconfirmdialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="aboutdialog.h">
......@@ -296,6 +305,12 @@
<QtMoc Include="animationhelpers.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="downloadbar.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="downloadmanger.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="passworddialog.h">
<Filter>Header Files</Filter>
</QtMoc>
......@@ -341,6 +356,9 @@
<QtMoc Include="linkdevicedialog.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="updateconfirmdialog.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
......@@ -605,6 +623,9 @@
<QtUic Include="advancedsipsettingwidget.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="downloadbar.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="nameregistrationdialog.ui">
<Filter>Form Files</Filter>
</QtUic>
......@@ -617,6 +638,9 @@
<QtUic Include="linkdevicedialog.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="updateconfirmdialog.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="images\FontAwesome.otf">
......@@ -769,4 +793,9 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="Version.txt">
<Filter>Resource Files</Filter>
</Text>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -35,6 +35,7 @@
#include <QTimer>
#include <QtConcurrent/QtConcurrent>
#include "downloadmanger.h"
#include "deleteaccountdialog.h"
#include "passworddialog.h"
#include "nameregistrationdialog.h"
......@@ -42,6 +43,7 @@
#include "utils.h"
#include "deviceitemwidget.h"
#include "banneditemwidget.h"
#include "UpdateConfirmDialog.h"
#include "api/newdevicemodel.h"
#include "audio/inputdevicemodel.h"
......@@ -516,7 +518,39 @@ void SettingsWidget::setAccEnableSlot(int state)
void SettingsWidget::delAccountSlot()
{
DeleteAccountDialog delDialog(this);
DownloadManager manager;
UpdateConfirmDialog updatedia;
QFile file("Version.txt");
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, "Version File Error", file.errorString());
}
QTextStream in(&file);
QString localVersion = in.readLine();
file.close();
QString onlineVersion = manager.versionOnline();
if (onlineVersion != localVersion) {
auto ret = updatedia.exec();
QThread::sleep(1);
if (ret == QDialog::Accepted) {
QString urlstr = "https://dl.jami.net/windows/test.exe";
QUrl url = QUrl::fromEncoded(urlstr.toLocal8Bit());
manager.doDownload(url);
auto args = QString(" /passive /norestart WIXNONUILAUNCH=1");
auto dir = QString("C:\\Users\\mzhang\\Desktop");
auto cmd = "powershell " + dir + "\\Jami.msi"
+ " /L*V " + dir + "\\jami_install.log" + args;
auto retq = QProcess::startDetached(cmd);
if (retq) {
QApplication::quit();
}
}
} else {
QMessageBox::information(this, "Update Status", "No New Version Detected");
}
/*DeleteAccountDialog delDialog(this);
auto ret = delDialog.exec();
if (ret == QDialog::Accepted) {
......@@ -529,7 +563,7 @@ void SettingsWidget::delAccountSlot()
LRCInstance::setSelectedConvId("");
emit NavigationRequested(ScreenEnum::CallScreen);
}
}
}*/
}
void SettingsWidget::removeDeviceSlot(int index)
......
......@@ -106,13 +106,15 @@ 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#btnExitSettings:hover, QPushButton#btnDeleteAccept:hover, QPushButton#btnDeleteCancel:hover,
QPushButton#btnUpdateAccept:hover, QPushButton#btnUpdateCancel:hover {
background-color: rgb(237, 237, 237);
}