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