| 1 | /* -------------------------------------------------------------------------
 | 
|---|
| 2 |  * BKG NTRIP Server
 | 
|---|
| 3 |  * -------------------------------------------------------------------------
 | 
|---|
| 4 |  *
 | 
|---|
| 5 |  * Class:      bnsHlpDlg
 | 
|---|
| 6 |  *
 | 
|---|
| 7 |  * Purpose:    Displays the help
 | 
|---|
| 8 |  *
 | 
|---|
| 9 |  * Author:     L. Mervart
 | 
|---|
| 10 |  *
 | 
|---|
| 11 |  * Created:    30-Mar-2008
 | 
|---|
| 12 |  *
 | 
|---|
| 13 |  * Changes:    
 | 
|---|
| 14 |  *
 | 
|---|
| 15 |  * -----------------------------------------------------------------------*/
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #include "bnshlpdlg.h"
 | 
|---|
| 18 | #include "bnshtml.h"
 | 
|---|
| 19 | 
 | 
|---|
| 20 | // Constructor
 | 
|---|
| 21 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 22 | bnsHlpDlg::bnsHlpDlg(QWidget* parent, const QUrl& url) :
 | 
|---|
| 23 |                     QDialog(parent) {
 | 
|---|
| 24 | 
 | 
|---|
| 25 |   const int ww = QFontMetrics(font()).width('w');
 | 
|---|
| 26 | 
 | 
|---|
| 27 |   bnsHtml* _tb = new bnsHtml;
 | 
|---|
| 28 |   setWindowTitle("Help Contents");
 | 
|---|
| 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 | bnsHlpDlg::~bnsHlpDlg() {
 | 
|---|
| 68 |   delete _tb;
 | 
|---|
| 69 |   delete _backButton;
 | 
|---|
| 70 |   delete _forwButton;
 | 
|---|
| 71 |   delete _closeButton;
 | 
|---|
| 72 | }
 | 
|---|
| 73 | 
 | 
|---|
| 74 | // Slots
 | 
|---|
| 75 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 76 | void bnsHlpDlg::backwardAvailable(bool avail) {
 | 
|---|
| 77 |   _backButton->setEnabled(avail);
 | 
|---|
| 78 | }
 | 
|---|
| 79 | 
 | 
|---|
| 80 | void bnsHlpDlg::forwardAvailable(bool avail) {
 | 
|---|
| 81 |   _forwButton->setEnabled(avail);
 | 
|---|
| 82 | }
 | 
|---|