-
Notifications
You must be signed in to change notification settings - Fork 72
/
fvupdatewindow.cpp
61 lines (49 loc) · 1.69 KB
/
fvupdatewindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "fvupdatewindow.h"
#include "ui_fvupdatewindow.h"
#include "fvupdater.h"
#include "fvavailableupdate.h"
#include <QApplication>
#include <QCloseEvent>
#include <QDebug>
FvUpdateWindow::FvUpdateWindow(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::FvUpdateWindow)
{
m_ui->setupUi(this);
m_appIconScene = 0;
// Delete on close
setAttribute(Qt::WA_DeleteOnClose, true);
// Set the "new version is available" string
QString newVersString = m_ui->newVersionIsAvailableLabel->text().arg(QString::fromUtf8(FV_APP_NAME));
m_ui->newVersionIsAvailableLabel->setText(newVersString);
// Connect buttons
connect(m_ui->installUpdateButton, SIGNAL(clicked()),
FvUpdater::sharedUpdater(), SLOT(InstallUpdate()));
connect(m_ui->skipThisVersionButton, SIGNAL(clicked()),
FvUpdater::sharedUpdater(), SLOT(SkipUpdate()));
connect(m_ui->remindMeLaterButton, SIGNAL(clicked()),
FvUpdater::sharedUpdater(), SLOT(RemindMeLater()));
}
FvUpdateWindow::~FvUpdateWindow()
{
m_ui->releaseNotesWebView->stop();
delete m_ui;
}
bool FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate()
{
FvAvailableUpdate* proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
if (! proposedUpdate) {
return false;
}
QString downloadString = m_ui->wouldYouLikeToDownloadLabel->text()
.arg(QString::fromUtf8(FV_APP_NAME), proposedUpdate->GetEnclosureVersion(), QString::fromUtf8(FV_APP_VERSION));
m_ui->wouldYouLikeToDownloadLabel->setText(downloadString);
m_ui->releaseNotesWebView->stop();
m_ui->releaseNotesWebView->load(proposedUpdate->GetReleaseNotesLink());
return true;
}
void FvUpdateWindow::closeEvent(QCloseEvent* event)
{
FvUpdater::sharedUpdater()->updaterWindowWasClosed();
event->accept();
}