summaryrefslogtreecommitdiff
path: root/src/frontend/btaboutmoduledialog.cpp
blob: 3d7cde33b9909105668ca7737f8bd84315564e7a (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
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2016 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#include <QDialog>
#include <QDialogButtonBox>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QWidget>
#include "backend/drivers/cswordmoduleinfo.h"
#include "frontend/btaboutmoduledialog.h"
#include "frontend/messagedialog.h"
#include "util/btconnect.h"


BTAboutModuleDialog::BTAboutModuleDialog(const CSwordModuleInfo *moduleInfo,
                                         QWidget *parent,
                                         Qt::WindowFlags flags)
        : QDialog(parent, flags)
        , m_moduleInfo(moduleInfo)
{
    resize(650, 400);
    QVBoxLayout* vboxLayout = new QVBoxLayout(this);

    m_textEdit = new QTextEdit(this);
    m_textEdit->setReadOnly(true);
    m_textEdit->setTextInteractionFlags(Qt::TextSelectableByMouse);
    vboxLayout->addWidget(m_textEdit);

    m_buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
    BT_CONNECT(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));
    vboxLayout->addWidget(m_buttons);

    retranslateUi();

    BT_CONNECT(moduleInfo, SIGNAL(destroyed()), this, SLOT(close()));
}

void BTAboutModuleDialog::retranslateUi() {
    setWindowTitle(tr("Information About %1").arg(m_moduleInfo->name()));
    m_textEdit->setHtml(m_moduleInfo->aboutText());
    message::prepareDialogBox(m_buttons);
}