-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangesdialog.cpp
More file actions
68 lines (49 loc) · 1.9 KB
/
changesdialog.cpp
File metadata and controls
68 lines (49 loc) · 1.9 KB
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
62
63
64
65
66
67
68
#include "changesdialog.h"
#include <QTabWidget>
#include <QTextBrowser>
#include <QLayout>
#include <QFile>
ChangesDialog::ChangesDialog(QWidget *parent) : QDialog(parent)
{
setWindowTitle("更新历史");
setWindowFlags(windowFlags() & Qt::WindowCloseButtonHint);
setFixedSize(482, 600);
resize(482, 600);
_buildUI();
_displayChanges();
}
// Private Methods
void ChangesDialog::_buildUI()
{
QTabWidget *tabWidget = new QTabWidget;
tabWidget->setObjectName("changes-tabwidget");
_version02X = new QTextBrowser;
_version01X = new QTextBrowser;
_version00X = new QTextBrowser;
_version02X->setContextMenuPolicy(Qt::NoContextMenu);
_version01X->setContextMenuPolicy(Qt::NoContextMenu);
_version00X->setContextMenuPolicy(Qt::NoContextMenu);
tabWidget->addTab(_version02X, "0.2.X");
tabWidget->addTab(_version01X, "0.1.X");
tabWidget->addTab(_version00X, "0.0.X");
tabWidget->setCurrentIndex(0);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->addWidget(tabWidget);
setLayout(mainLayout);
}
void ChangesDialog::_displayChanges()
{
QFile file02X(":/assets/markdowns/CHANGES-0.2.X.md");
if (!file02X.open(QIODevice::ReadOnly | QIODevice::Text)) _version02X->setMarkdown("### 打开更新历史失败");
else _version02X->setMarkdown(file02X.readAll());
file02X.close();
QFile file01X(":/assets/markdowns/CHANGES-0.1.X.md");
if (!file01X.open(QIODevice::ReadOnly | QIODevice::Text)) _version01X->setMarkdown("### 打开更新历史失败");
else _version01X->setMarkdown(file01X.readAll());
file01X.close();
QFile file00X(":/assets/markdowns/CHANGES-0.0.X.md");
if (!file00X.open(QIODevice::ReadOnly | QIODevice::Text)) _version00X->setMarkdown("### 打开更新历史失败");
else _version00X->setMarkdown(file00X.readAll());
file00X.close();
}