-
Notifications
You must be signed in to change notification settings - Fork 0
/
aboutwindow.cpp
118 lines (90 loc) · 4.29 KB
/
aboutwindow.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include "aboutwindow.h"
#include "mainmenu.h"
void AboutWindow::makeUI(QWidget* parent, Platform platform) {
// UI
this->setWindowTitle("About iMemo");
this->setWindowIcon(parent->windowIcon());
QFont font;
font.setPointSize(11);
this->setFont(font);
QFont appNameFont = font;
appNameFont.setPointSize(16);
this->setStyleSheet(parent->styleSheet());
QVBoxLayout* mainLayout = new QVBoxLayout(this);
QHBoxLayout* upperLayout = new QHBoxLayout();
QPushButton* backPushButton = new QPushButton("Back");
backPushButton->setIcon(QIcon(":/icons/go-previous.png"));
upperLayout->addWidget(backPushButton);
upperLayout->addSpacerItem(new QSpacerItem(0, 0,
QSizePolicy::MinimumExpanding,
QSizePolicy::Ignored));
mainLayout->addLayout(upperLayout);
QHBoxLayout* iconLayout = new QHBoxLayout();
iconLayout->addSpacerItem(new QSpacerItem(0, 0,
QSizePolicy::MinimumExpanding,
QSizePolicy::Ignored));
QString iconPath = ":/icons/app-icon-generic.png";
if (platform == Mac) {
iconPath = ":/icons/app-icon-mac.png";
}
QLabel* iconLabel = new QLabel();
iconLabel->setFixedSize(128, 128);
iconLabel->setPixmap(QPixmap(iconPath));
iconLabel->setScaledContents(true);
iconLayout->addWidget(iconLabel);
iconLayout->addSpacerItem(new QSpacerItem(0, 0,
QSizePolicy::MinimumExpanding,
QSizePolicy::Ignored));
mainLayout->addLayout(iconLayout);
QLabel* appNameLabel = new QLabel("<b>iMemo</b>");
appNameLabel->setTextFormat(Qt::RichText);
appNameLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(appNameLabel);
QLabel* versionLabel = new QLabel("v. 0.1");
versionLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(versionLabel);
QLabel* developerLabel = new QLabel("\niMemo was brought to you by thm-unix");
developerLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(developerLabel);
QLabel* websiteLabel = new QLabel("<a href=\"https://thm-unix.github.io/\" style=\"color: #378edf\">https://thm-unix.github.io/</a>");
websiteLabel->setTextFormat(Qt::RichText);
websiteLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(websiteLabel);
QLabel* githubLabel = new QLabel("<a href=\"https://github.com/thm-unix/iMemo/\" style=\"color: #378edf\">https://github.com/thm-unix/iMemo/</a>");
githubLabel->setTextFormat(Qt::RichText);
githubLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(githubLabel);
QLabel* issuesLabel = new QLabel("Found bug/want to help us/have an idea?\n"
"Contact us via GitHub Issues.");
issuesLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(issuesLabel);
QLabel* licenseLabel = new QLabel("<br><br><a href=\"https://www.gnu.org/licenses/gpl-3.0.html\" style=\"color: #378edf\">Learn more about GNU General Public License v3...</a>");
licenseLabel->setTextFormat(Qt::RichText);
licenseLabel->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(licenseLabel);
mainLayout->addSpacerItem(new QSpacerItem(0, 0,
QSizePolicy::Ignored,
QSizePolicy::MinimumExpanding));
// Make connections
connect(backPushButton, &QPushButton::clicked, this, [this, parent]() {
QString req = static_cast<MainMenu*>(mParent)->mSearchBox->text();
static_cast<MainMenu*>(mParent)->buildList(req);
this->hide();
parent->setGeometry(this->geometry());
parent->show();
delete this;
});
}
void AboutWindow::closeEvent(QCloseEvent* event) {
QString req = static_cast<MainMenu*>(mParent)->mSearchBox->text();
static_cast<MainMenu*>(mParent)->buildList(req);
mParent->show();
event->accept();
}
AboutWindow::AboutWindow(QWidget *parent,
Platform platform) : QWidget(nullptr) {
mParent = parent;
this->setObjectName("about");
makeUI(parent, platform);
this->setGeometry(parent->geometry());
}