1 |
|
---|
2 | /* -------------------------------------------------------------------------
|
---|
3 | * BKG NTRIP Client
|
---|
4 | * -------------------------------------------------------------------------
|
---|
5 | *
|
---|
6 | * Class: bncHlpDlg
|
---|
7 | *
|
---|
8 | * Purpose: Displays the help
|
---|
9 | *
|
---|
10 | * Author: L. Mervart
|
---|
11 | *
|
---|
12 | * Created: 24-Sep-2006
|
---|
13 | *
|
---|
14 | * Changes:
|
---|
15 | *
|
---|
16 | * -----------------------------------------------------------------------*/
|
---|
17 |
|
---|
18 | #include "bnchlpdlg.h"
|
---|
19 | #include "bnchtml.h"
|
---|
20 |
|
---|
21 | // Constructor
|
---|
22 | ////////////////////////////////////////////////////////////////////////////
|
---|
23 | bncHlpDlg::bncHlpDlg(QWidget* parent, const QUrl& url) :
|
---|
24 | QDialog(parent) {
|
---|
25 |
|
---|
26 | const int ww = QFontMetrics(font()).width('w');
|
---|
27 |
|
---|
28 | bncHtml* _tb = new bncHtml;
|
---|
29 | setWindowTitle("Help Contents");
|
---|
30 | _tb->setSource(url);
|
---|
31 | _tb->setReadOnly(true);
|
---|
32 | connect(_tb, SIGNAL(backwardAvailable(bool)),
|
---|
33 | this, SLOT(backwardAvailable(bool)));
|
---|
34 | connect(_tb, SIGNAL(forwardAvailable(bool)),
|
---|
35 | this, SLOT(forwardAvailable(bool)));
|
---|
36 |
|
---|
37 | QVBoxLayout* dlgLayout = new QVBoxLayout;
|
---|
38 | dlgLayout->addWidget(_tb);
|
---|
39 |
|
---|
40 | QHBoxLayout* butLayout = new QHBoxLayout;
|
---|
41 |
|
---|
42 | _backButton = new QPushButton("Backward");
|
---|
43 | _backButton->setMaximumWidth(10*ww);
|
---|
44 | _backButton->setEnabled(false);
|
---|
45 | connect(_backButton, SIGNAL(clicked()), _tb, SLOT(backward()));
|
---|
46 | butLayout->addWidget(_backButton);
|
---|
47 |
|
---|
48 | _forwButton = new QPushButton("Forward");
|
---|
49 | _forwButton->setMaximumWidth(10*ww);
|
---|
50 | _forwButton->setEnabled(false);
|
---|
51 | connect(_forwButton, SIGNAL(clicked()), _tb, SLOT(forward()));
|
---|
52 | butLayout->addWidget(_forwButton);
|
---|
53 |
|
---|
54 | _closeButton = new QPushButton("Close");
|
---|
55 | _closeButton->setMaximumWidth(10*ww);
|
---|
56 | butLayout->addWidget(_closeButton);
|
---|
57 | connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
---|
58 |
|
---|
59 | dlgLayout->addLayout(butLayout);
|
---|
60 |
|
---|
61 | setLayout(dlgLayout);
|
---|
62 | resize(60*ww, 60*ww);
|
---|
63 | show();
|
---|
64 | }
|
---|
65 |
|
---|
66 | // Destructor
|
---|
67 | ////////////////////////////////////////////////////////////////////////////
|
---|
68 | bncHlpDlg::~bncHlpDlg() {
|
---|
69 | delete _tb;
|
---|
70 | delete _backButton;
|
---|
71 | delete _forwButton;
|
---|
72 | delete _closeButton;
|
---|
73 | }
|
---|
74 |
|
---|
75 | // Slots
|
---|
76 | ////////////////////////////////////////////////////////////////////////////
|
---|
77 | void bncHlpDlg::backwardAvailable(bool avail) {
|
---|
78 | _backButton->setEnabled(avail);
|
---|
79 | }
|
---|
80 |
|
---|
81 | void bncHlpDlg::forwardAvailable(bool avail) {
|
---|
82 | _forwButton->setEnabled(avail);
|
---|
83 | }
|
---|