forked from pypt/fervor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fvupdateconfirmdialog.cpp
51 lines (41 loc) · 1.42 KB
/
fvupdateconfirmdialog.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
#include "fvupdateconfirmdialog.h"
#include "fvavailableupdate.h"
#include "fvupdater.h"
#include "ui_fvupdateconfirmdialog.h"
#include <QCloseEvent>
FvUpdateConfirmDialog::FvUpdateConfirmDialog(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::FvUpdateConfirmDialog)
{
m_ui->setupUi(this);
// Delete on close
setAttribute(Qt::WA_DeleteOnClose, true);
// Set the "close app, then reopen" string
QString closeReopenString = m_ui->downloadThisUpdateLabel->text().arg(QApplication::applicationName());
m_ui->downloadThisUpdateLabel->setText(closeReopenString);
// Connect buttons
connect(m_ui->confirmButtonBox, SIGNAL(accepted()),
FvUpdater::sharedUpdater(), SLOT(UpdateInstallationConfirmed()));
connect(m_ui->confirmButtonBox, SIGNAL(rejected()),
FvUpdater::sharedUpdater(), SLOT(UpdateInstallationNotConfirmed()));
}
FvUpdateConfirmDialog::~FvUpdateConfirmDialog()
{
delete m_ui;
}
bool FvUpdateConfirmDialog::UpdateWindowWithCurrentProposedUpdate()
{
FvAvailableUpdate* proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
if (! proposedUpdate) {
return false;
}
QString downloadLinkString = m_ui->updateFileLinkLabel->text()
.arg(proposedUpdate->GetEnclosureUrl().toString());
m_ui->updateFileLinkLabel->setText(downloadLinkString);
return true;
}
void FvUpdateConfirmDialog::closeEvent(QCloseEvent* event)
{
FvUpdater::sharedUpdater()->updateConfirmationDialogWasClosed();
event->accept();
}