[177] | 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 | _tb->setSource(url);
|
---|
| 30 | _tb->setReadOnly(true);
|
---|
| 31 | connect(_tb, SIGNAL(backwardAvailable(bool)),
|
---|
| 32 | this, SLOT(backwardAvailable(bool)));
|
---|
| 33 | connect(_tb, SIGNAL(forwardAvailable(bool)),
|
---|
| 34 | this, SLOT(forwardAvailable(bool)));
|
---|
| 35 |
|
---|
| 36 | QVBoxLayout* dlgLayout = new QVBoxLayout;
|
---|
| 37 | dlgLayout->addWidget(_tb);
|
---|
| 38 |
|
---|
| 39 | QHBoxLayout* butLayout = new QHBoxLayout;
|
---|
| 40 |
|
---|
| 41 | _backButton = new QPushButton("Backward");
|
---|
| 42 | _backButton->setMaximumWidth(10*ww);
|
---|
| 43 | _backButton->setEnabled(false);
|
---|
| 44 | connect(_backButton, SIGNAL(clicked()), _tb, SLOT(backward()));
|
---|
| 45 | butLayout->addWidget(_backButton);
|
---|
| 46 |
|
---|
| 47 | _forwButton = new QPushButton("Forward");
|
---|
| 48 | _forwButton->setMaximumWidth(10*ww);
|
---|
| 49 | _forwButton->setEnabled(false);
|
---|
| 50 | connect(_forwButton, SIGNAL(clicked()), _tb, SLOT(forward()));
|
---|
| 51 | butLayout->addWidget(_forwButton);
|
---|
| 52 |
|
---|
| 53 | _closeButton = new QPushButton("Close");
|
---|
| 54 | _closeButton->setMaximumWidth(10*ww);
|
---|
| 55 | butLayout->addWidget(_closeButton);
|
---|
| 56 | connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
---|
| 57 |
|
---|
| 58 | dlgLayout->addLayout(butLayout);
|
---|
| 59 |
|
---|
| 60 | setLayout(dlgLayout);
|
---|
| 61 | resize(60*ww, 60*ww);
|
---|
| 62 | show();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | // Destructor
|
---|
| 66 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 67 | bncHlpDlg::~bncHlpDlg() {
|
---|
| 68 | delete _tb;
|
---|
| 69 | delete _backButton;
|
---|
| 70 | delete _forwButton;
|
---|
| 71 | delete _closeButton;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | // Slots
|
---|
| 75 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 76 | void bncHlpDlg::backwardAvailable(bool avail) {
|
---|
| 77 | _backButton->setEnabled(avail);
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | void bncHlpDlg::forwardAvailable(bool avail) {
|
---|
| 81 | _forwButton->setEnabled(avail);
|
---|
| 82 | }
|
---|