939c0e061042b425f4bf232548dffb1e3dc6c8d5
[mverbiste] / about.cpp
1 #include "about.h"
2
3 AboutDialog::AboutDialog(const char *iconFile, const QString &title)
4     : QDialog()
5 {
6     setWindowTitle("About");
7     QHBoxLayout *mlayout = new QHBoxLayout();
8     QLabel *iconshow = new QLabel();
9     iconshow->setPixmap(QPixmap(iconFile));
10     mlayout->addWidget(iconshow);
11
12     rlayout = new QVBoxLayout();
13     QLabel *tit = new QLabel(title);
14     tit->setStyleSheet("QLabel {font-size: 40px}");
15     rlayout->addWidget(tit);
16     mlayout->addLayout(rlayout);
17     setLayout(mlayout);
18 }
19
20 void AboutDialog::setIntro(const QString &text)
21 {
22     // Place to the second item of rlayout
23     if (rlayout->count() == 1) {
24         // No item yet, add one
25         rlayout->addWidget(new QLabel(text));
26     }
27     else {
28         // Second item has existed, replace it.
29         QWidget *child = (QWidget *)rlayout->takeAt(0);
30         delete child;
31         rlayout->insertWidget(0, new QLabel(text));
32     }
33 }
34
35 void AboutDialog::addAuthor(const QString &name)
36 {
37     // Place from the third item of rlayout
38     if (rlayout->count() == 1) {
39         // No second item, add empty one.
40         rlayout->addWidget(new QLabel(""));
41     }
42     // Add from the third
43     rlayout->addWidget(new QLabel(name));
44 }