blob: 738940b3c18864ee9df7097087f23594483cc33d (
plain)
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
|
#include "about.hpp"
#include "../platform/platform.hpp"
#include <QtCore/QFile>
#include <QtGui/QIcon>
#include <QtGui/QMenuBar>
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QTextBrowser>
AboutDialog::AboutDialog(QWidget * parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{
QIcon icon(":/ui/logo.png");
setWindowIcon(icon);
setWindowTitle(QMenuBar::tr("About"));
QLabel * labelIcon = new QLabel();
labelIcon->setPixmap(icon.pixmap(128));
QLabel * labelVersion = new QLabel(QString::fromAscii("TODO: Insert version to bundle."));
QHBoxLayout * hBox = new QHBoxLayout();
hBox->addWidget(labelIcon);
hBox->addWidget(labelVersion);
string aboutText;
try
{
ReaderPtr<Reader> reader = GetPlatform().GetReader("about.html");
reader.ReadAsString(aboutText);
}
catch (RootException const & ex)
{
LOG(LWARNING, ("About text error: ", ex.Msg()));
}
if (!aboutText.empty())
{
QTextBrowser * aboutTextBrowser = new QTextBrowser();
aboutTextBrowser->setReadOnly(true);
aboutTextBrowser->setOpenLinks(true);
aboutTextBrowser->setOpenExternalLinks(true);
aboutTextBrowser->setText(aboutText.c_str());
QVBoxLayout * vBox = new QVBoxLayout();
vBox->addLayout(hBox);
vBox->addWidget(aboutTextBrowser);
setLayout(vBox);
}
else
setLayout(hBox);
}
|