/
updateavailabledialog.cpp
58 lines (46 loc) · 1.67 KB
/
updateavailabledialog.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
#include "updateavailabledialog.h"
#include "versioninfo.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QCheckBox>
#include <QPushButton>
#include <QFont>
#include <QLabel>
struct UpdateAvailableDialog::Instance
{
UpdateAvailableDialog* self;
QLabel* info;
Instance(UpdateAvailableDialog* d) : self(d)
{
QVBoxLayout* mainLayout = new QVBoxLayout(self);
self->setLayout(mainLayout);
//mainLayout->setMargin(12);
info = new QLabel;
info->setTextFormat(Qt::RichText);
info->setText(QString("<span style=\"font-weight:bold; font-size:%1pt;\">You are up to date.</span>"
"<p>The installed version %2 is the latest available stable build.")
.arg(int(self->font().pointSize() * 1.2))
.arg(VersionInfo().asText()));
QCheckBox* neverCheck = new QCheckBox("Never check for updates automatically");
QDialogButtonBox* bbox = new QDialogButtonBox;
QPushButton* ok = bbox->addButton("Ok", QDialogButtonBox::AcceptRole);
ok->setDefault(true);
QPushButton* cfg = bbox->addButton("Settings...", QDialogButtonBox::ActionRole);
cfg->setAutoDefault(false);
cfg->setDefault(false);
//QPushButton* whatsNew = bbox->addButton("What's new?", QDialogButtonBox::HelpRole);
mainLayout->addWidget(info);
mainLayout->addWidget(neverCheck);
mainLayout->addWidget(bbox);
}
};
UpdateAvailableDialog::UpdateAvailableDialog(QWidget *parent)
: QDialog(parent)
{
d = new Instance(this);
}
UpdateAvailableDialog::~UpdateAvailableDialog()
{
delete d;
}