1 |
|
---|
2 | /* -------------------------------------------------------------------------
|
---|
3 | * BKG NTRIP Client
|
---|
4 | * -------------------------------------------------------------------------
|
---|
5 | *
|
---|
6 | * Class: bncWindow
|
---|
7 | *
|
---|
8 | * Purpose: This class implements the main application window.
|
---|
9 | *
|
---|
10 | * Author: L. Mervart
|
---|
11 | *
|
---|
12 | * Created: 24-Dec-2005
|
---|
13 | *
|
---|
14 | * Changes:
|
---|
15 | *
|
---|
16 | * -----------------------------------------------------------------------*/
|
---|
17 |
|
---|
18 | #include "bncwindow.h"
|
---|
19 | #include "bncapp.h"
|
---|
20 | #include "bncgetthread.h"
|
---|
21 | #include "bnctabledlg.h"
|
---|
22 |
|
---|
23 | using namespace std;
|
---|
24 |
|
---|
25 | // Constructor
|
---|
26 | ////////////////////////////////////////////////////////////////////////////
|
---|
27 | bncWindow::bncWindow() {
|
---|
28 |
|
---|
29 | int ww = QFontMetrics(this->font()).width('w');
|
---|
30 |
|
---|
31 | setMinimumSize(60*ww, 80*ww);
|
---|
32 |
|
---|
33 | // Create Actions
|
---|
34 | // --------------
|
---|
35 | _actHelp = new QAction(tr("&Help Contents"),this);
|
---|
36 | connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
|
---|
37 |
|
---|
38 | _actAbout = new QAction(tr("&About BNC"),this);
|
---|
39 | connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
|
---|
40 |
|
---|
41 | _actFontSel = new QAction(tr("Select &Fonts"),this);
|
---|
42 | connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
|
---|
43 |
|
---|
44 | _actSaveOpt = new QAction(tr("&Save Options"),this);
|
---|
45 | connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
|
---|
46 |
|
---|
47 | _actQuit = new QAction(tr("&Quit"),this);
|
---|
48 | connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
|
---|
49 |
|
---|
50 | _actAddMountPoints = new QAction(tr("&Add Mountpoints"),this);
|
---|
51 | connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
|
---|
52 |
|
---|
53 | _actDeleteMountPoints = new QAction(tr("&Delete Mountpoints"),this);
|
---|
54 | connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
|
---|
55 | _actDeleteMountPoints->setEnabled(false);
|
---|
56 |
|
---|
57 | _actGetData = new QAction(tr("&Get Data"),this);
|
---|
58 | connect(_actGetData, SIGNAL(triggered()), SLOT(slotGetData()));
|
---|
59 |
|
---|
60 | // Create Menus
|
---|
61 | // ------------
|
---|
62 | _menuFile = menuBar()->addMenu(tr("&File"));
|
---|
63 | _menuFile->addAction(_actFontSel);
|
---|
64 | _menuFile->addSeparator();
|
---|
65 | _menuFile->addAction(_actSaveOpt);
|
---|
66 | _menuFile->addSeparator();
|
---|
67 | _menuFile->addAction(_actQuit);
|
---|
68 |
|
---|
69 | _menuHlp = menuBar()->addMenu(tr("&Help"));
|
---|
70 | _menuHlp->addAction(_actHelp);
|
---|
71 | _menuHlp->addAction(_actAbout);
|
---|
72 |
|
---|
73 | // Tool (Command) Bar
|
---|
74 | // ------------------
|
---|
75 | QToolBar* toolBar = new QToolBar;
|
---|
76 | addToolBar(Qt::BottomToolBarArea, toolBar);
|
---|
77 | toolBar->setMovable(false);
|
---|
78 | toolBar->addAction(_actAddMountPoints);
|
---|
79 | toolBar->addAction(_actDeleteMountPoints);
|
---|
80 | toolBar->addAction(_actGetData);
|
---|
81 |
|
---|
82 | // Canvas with Editable Fields
|
---|
83 | // ---------------------------
|
---|
84 | _canvas = new QWidget;
|
---|
85 | setCentralWidget(_canvas);
|
---|
86 |
|
---|
87 | QGridLayout* layout = new QGridLayout;
|
---|
88 | _canvas->setLayout(layout);
|
---|
89 |
|
---|
90 | QSettings settings;
|
---|
91 | _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
|
---|
92 | _proxyHostLineEdit->setMaximumWidth(12*ww);
|
---|
93 | _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
|
---|
94 | _proxyPortLineEdit->setMaximumWidth(9*ww);
|
---|
95 | _waitTimeSpinBox = new QSpinBox();
|
---|
96 | _waitTimeSpinBox->setMinimum(1);
|
---|
97 | _waitTimeSpinBox->setMaximum(30);
|
---|
98 | _waitTimeSpinBox->setSingleStep(1);
|
---|
99 | _waitTimeSpinBox->setSuffix(" sec");
|
---|
100 | _waitTimeSpinBox->setMaximumWidth(9*ww);
|
---|
101 | _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
|
---|
102 | _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
|
---|
103 | _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
|
---|
104 | _outPortLineEdit->setMaximumWidth(9*ww);
|
---|
105 | _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
|
---|
106 | _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
|
---|
107 | _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
|
---|
108 | _rnxSkelLineEdit->setMaximumWidth(5*ww);
|
---|
109 | _rnxIntrComboBox = new QComboBox();
|
---|
110 | _rnxIntrComboBox->setMaximumWidth(9*ww);
|
---|
111 | _rnxIntrComboBox->setEditable(false);
|
---|
112 | _rnxIntrComboBox->addItems(QString("15 min,1 hour,1 day").split(","));
|
---|
113 | int ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
|
---|
114 | if (ii != -1) {
|
---|
115 | _rnxIntrComboBox->setCurrentIndex(ii);
|
---|
116 | }
|
---|
117 | _rnxSamplSpinBox = new QSpinBox();
|
---|
118 | _rnxSamplSpinBox->setMinimum(0);
|
---|
119 | _rnxSamplSpinBox->setMaximum(60);
|
---|
120 | _rnxSamplSpinBox->setSingleStep(5);
|
---|
121 | _rnxSamplSpinBox->setMaximumWidth(9*ww);
|
---|
122 | _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
|
---|
123 | _rnxSamplSpinBox->setSuffix(" sec");
|
---|
124 | _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
|
---|
125 | _mountPointsTable = new QTableWidget(0,3);
|
---|
126 | _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
---|
127 | _mountPointsTable->horizontalHeader()->hide();
|
---|
128 | _mountPointsTable->verticalHeader()->hide();
|
---|
129 | _mountPointsTable->setGridStyle(Qt::NoPen);
|
---|
130 | _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
---|
131 | _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
---|
132 | _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
---|
133 | QListIterator<QString> it(settings.value("mountPoints").toStringList());
|
---|
134 | if (!it.hasNext()) {
|
---|
135 | _actGetData->setEnabled(false);
|
---|
136 | }
|
---|
137 | int iRow = 0;
|
---|
138 | while (it.hasNext()) {
|
---|
139 | QStringList hlp = it.next().split(" ");
|
---|
140 | if (hlp.size() <= 1) continue;
|
---|
141 | _mountPointsTable->insertRow(iRow);
|
---|
142 |
|
---|
143 | QUrl url(hlp[0]);
|
---|
144 |
|
---|
145 | QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
|
---|
146 | QString format(hlp[1]);
|
---|
147 |
|
---|
148 | QTableWidgetItem* it;
|
---|
149 | it = new QTableWidgetItem(url.userInfo());
|
---|
150 | it->setFlags(it->flags() & ~Qt::ItemIsEditable);
|
---|
151 | _mountPointsTable->setItem(iRow, 0, it);
|
---|
152 |
|
---|
153 | it = new QTableWidgetItem(fullPath);
|
---|
154 | it->setFlags(it->flags() & ~Qt::ItemIsEditable);
|
---|
155 | _mountPointsTable->setItem(iRow, 1, it);
|
---|
156 |
|
---|
157 | it = new QTableWidgetItem(format);
|
---|
158 | _mountPointsTable->setItem(iRow, 2, it);
|
---|
159 | iRow++;
|
---|
160 | }
|
---|
161 | _mountPointsTable->hideColumn(0);
|
---|
162 | _mountPointsTable->sortItems(1);
|
---|
163 |
|
---|
164 | connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
|
---|
165 | SLOT(slotSelectionChanged()));
|
---|
166 |
|
---|
167 | _log = new QTextEdit();
|
---|
168 | _log->setReadOnly(true);
|
---|
169 |
|
---|
170 | layout->addWidget(new QLabel("Proxy host"), 0, 0);
|
---|
171 | layout->addWidget(_proxyHostLineEdit, 0, 1);
|
---|
172 | layout->addWidget(new QLabel("Proxy port"), 0, 2);
|
---|
173 | layout->addWidget(_proxyPortLineEdit, 0, 3);
|
---|
174 |
|
---|
175 | layout->addWidget(new QLabel("Wait for full epoch"), 1, 0, 1, 2);
|
---|
176 | layout->addWidget(_waitTimeSpinBox, 1, 2);
|
---|
177 |
|
---|
178 | layout->addWidget(new QLabel("ASCII output file (full path)"), 2, 0, 1, 2);
|
---|
179 | layout->addWidget(_outFileLineEdit, 2, 2, 1, 3);
|
---|
180 |
|
---|
181 | layout->addWidget(new QLabel("Port for binary output"), 3, 0, 1, 2);
|
---|
182 | layout->addWidget(_outPortLineEdit, 3, 2);
|
---|
183 |
|
---|
184 | layout->addWidget(new QLabel("RINEX path"), 4, 0, 1, 2);
|
---|
185 | layout->addWidget(_rnxPathLineEdit, 4, 2, 1, 3);
|
---|
186 |
|
---|
187 | layout->addWidget(new QLabel("RINEX script (full path)"), 5, 0, 1, 2);
|
---|
188 | layout->addWidget(_rnxScrpLineEdit, 5, 2, 1, 3);
|
---|
189 |
|
---|
190 | layout->addWidget(new QLabel("RINEX file interval"), 6, 0, 1, 2);
|
---|
191 | layout->addWidget(_rnxIntrComboBox, 6, 2);
|
---|
192 | layout->addWidget(new QLabel("Sampling"), 6, 3);
|
---|
193 | layout->addWidget(_rnxSamplSpinBox, 6, 4);
|
---|
194 |
|
---|
195 | layout->addWidget(new QLabel("RINEX skeleton extension"), 7, 0, 1, 2);
|
---|
196 | layout->addWidget(_rnxSkelLineEdit, 7, 2);
|
---|
197 |
|
---|
198 | layout->addWidget(new QLabel("Mountpoints"), 8, 0, 1, 2);
|
---|
199 | layout->addWidget(_mountPointsTable, 9, 0, 1, 5);
|
---|
200 |
|
---|
201 | layout->addWidget(new QLabel("Log (full path)"), 10, 0, 1, 2);
|
---|
202 | layout->addWidget(_logFileLineEdit, 10, 2, 1, 3);
|
---|
203 | layout->addWidget(_log, 11, 0, 1, 5);
|
---|
204 |
|
---|
205 | _bncCaster = 0;
|
---|
206 | }
|
---|
207 |
|
---|
208 | // Destructor
|
---|
209 | ////////////////////////////////////////////////////////////////////////////
|
---|
210 | bncWindow::~bncWindow() {
|
---|
211 | }
|
---|
212 |
|
---|
213 | // Retrieve Table
|
---|
214 | ////////////////////////////////////////////////////////////////////////////
|
---|
215 | void bncWindow::slotAddMountPoints() {
|
---|
216 |
|
---|
217 | QSettings settings;
|
---|
218 | QString proxyHost = settings.value("proxyHost").toString();
|
---|
219 | int proxyPort = settings.value("proxyPort").toInt();
|
---|
220 | if (proxyHost != _proxyHostLineEdit->text() ||
|
---|
221 | proxyPort != _proxyPortLineEdit->text().toInt()) {
|
---|
222 | int iRet = QMessageBox::question(this, "Question", "Proxy options "
|
---|
223 | "changed. Use the new ones?",
|
---|
224 | QMessageBox::Yes, QMessageBox::No,
|
---|
225 | QMessageBox::NoButton);
|
---|
226 | if (iRet == QMessageBox::Yes) {
|
---|
227 | settings.setValue("proxyHost", _proxyHostLineEdit->text());
|
---|
228 | settings.setValue("proxyPort", _proxyPortLineEdit->text());
|
---|
229 | }
|
---|
230 | }
|
---|
231 |
|
---|
232 | bncTableDlg* dlg = new bncTableDlg(this);
|
---|
233 | dlg->move(this->pos().x()+50, this->pos().y()+50);
|
---|
234 | connect(dlg, SIGNAL(newMountPoints(QStringList*)),
|
---|
235 | this, SLOT(slotNewMountPoints(QStringList*)));
|
---|
236 | dlg->exec();
|
---|
237 | delete dlg;
|
---|
238 |
|
---|
239 | }
|
---|
240 |
|
---|
241 | // Delete Selected Mount Points
|
---|
242 | ////////////////////////////////////////////////////////////////////////////
|
---|
243 | void bncWindow::slotDeleteMountPoints() {
|
---|
244 |
|
---|
245 | int nRows = _mountPointsTable->rowCount();
|
---|
246 | bool flg[nRows];
|
---|
247 | for (int iRow = 0; iRow < nRows; iRow++) {
|
---|
248 | if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
|
---|
249 | flg[iRow] = true;
|
---|
250 | }
|
---|
251 | else {
|
---|
252 | flg[iRow] = false;
|
---|
253 | }
|
---|
254 | }
|
---|
255 | for (int iRow = nRows-1; iRow >= 0; iRow--) {
|
---|
256 | if (flg[iRow]) {
|
---|
257 | _mountPointsTable->removeRow(iRow);
|
---|
258 | }
|
---|
259 | }
|
---|
260 | _actDeleteMountPoints->setEnabled(false);
|
---|
261 | }
|
---|
262 |
|
---|
263 | // New Mount Points Selected
|
---|
264 | ////////////////////////////////////////////////////////////////////////////
|
---|
265 | void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
|
---|
266 | int iRow = 0;
|
---|
267 | QListIterator<QString> it(*mountPoints);
|
---|
268 | while (it.hasNext()) {
|
---|
269 | QStringList hlp = it.next().split(" ");
|
---|
270 | QUrl url(hlp[0]);
|
---|
271 | QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
|
---|
272 | QString format(hlp[1]);
|
---|
273 |
|
---|
274 | _mountPointsTable->insertRow(iRow);
|
---|
275 |
|
---|
276 | QTableWidgetItem* it;
|
---|
277 | it = new QTableWidgetItem(url.userInfo());
|
---|
278 | it->setFlags(it->flags() & ~Qt::ItemIsEditable);
|
---|
279 | _mountPointsTable->setItem(iRow, 0, it);
|
---|
280 |
|
---|
281 | it = new QTableWidgetItem(fullPath);
|
---|
282 | it->setFlags(it->flags() & ~Qt::ItemIsEditable);
|
---|
283 | _mountPointsTable->setItem(iRow, 1, it);
|
---|
284 |
|
---|
285 | it = new QTableWidgetItem(format);
|
---|
286 | _mountPointsTable->setItem(iRow, 2, it);
|
---|
287 | iRow++;
|
---|
288 | }
|
---|
289 | _mountPointsTable->hideColumn(0);
|
---|
290 | _mountPointsTable->sortItems(1);
|
---|
291 | if (mountPoints->count() > 0) {
|
---|
292 | _actGetData->setEnabled(true);
|
---|
293 | }
|
---|
294 | delete mountPoints;
|
---|
295 | }
|
---|
296 |
|
---|
297 | // Save Options
|
---|
298 | ////////////////////////////////////////////////////////////////////////////
|
---|
299 | void bncWindow::slotSaveOptions() {
|
---|
300 | QSettings settings;
|
---|
301 | settings.setValue("proxyHost", _proxyHostLineEdit->text());
|
---|
302 | settings.setValue("proxyPort", _proxyPortLineEdit->text());
|
---|
303 | settings.setValue("waitTime", _waitTimeSpinBox->value());
|
---|
304 | settings.setValue("outFile", _outFileLineEdit->text());
|
---|
305 | settings.setValue("outPort", _outPortLineEdit->text());
|
---|
306 | settings.setValue("rnxPath", _rnxPathLineEdit->text());
|
---|
307 | settings.setValue("rnxScript", _rnxScrpLineEdit->text());
|
---|
308 | settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
|
---|
309 | settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
|
---|
310 | settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
|
---|
311 | settings.setValue("logFile", _logFileLineEdit->text());
|
---|
312 |
|
---|
313 | QStringList mountPoints;
|
---|
314 |
|
---|
315 | for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
|
---|
316 | QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
|
---|
317 | "@" + _mountPointsTable->item(iRow, 1)->text() );
|
---|
318 |
|
---|
319 | mountPoints.append(url.toString() + " " +
|
---|
320 | _mountPointsTable->item(iRow, 2)->text());
|
---|
321 | }
|
---|
322 | settings.setValue("mountPoints", mountPoints);
|
---|
323 | }
|
---|
324 |
|
---|
325 | // All get slots terminated
|
---|
326 | ////////////////////////////////////////////////////////////////////////////
|
---|
327 | void bncWindow::slotGetThreadErrors() {
|
---|
328 | slotMessage("All Get Threads Terminated");
|
---|
329 | ((bncApp*)qApp)->slotMessage("All Get Threads Terminated");
|
---|
330 | _actAddMountPoints->setEnabled(true);
|
---|
331 | _actGetData->setEnabled(true);
|
---|
332 | }
|
---|
333 |
|
---|
334 | // Retrieve Data
|
---|
335 | ////////////////////////////////////////////////////////////////////////////
|
---|
336 | void bncWindow::slotGetData() {
|
---|
337 | slotSaveOptions();
|
---|
338 |
|
---|
339 | _actAddMountPoints->setEnabled(false);
|
---|
340 | _actDeleteMountPoints->setEnabled(false);
|
---|
341 | _actGetData->setEnabled(false);
|
---|
342 |
|
---|
343 | _bncCaster = new bncCaster(_outFileLineEdit->text(),
|
---|
344 | _outPortLineEdit->text().toInt());
|
---|
345 |
|
---|
346 | connect(_bncCaster, SIGNAL(getThreadErrors()),
|
---|
347 | this, SLOT(slotGetThreadErrors()));
|
---|
348 |
|
---|
349 | connect(_bncCaster, SIGNAL(newMessage(const QByteArray&)),
|
---|
350 | this, SLOT(slotMessage(const QByteArray&)));
|
---|
351 | connect(_bncCaster, SIGNAL(newMessage(const QByteArray&)),
|
---|
352 | (bncApp*)qApp, SLOT(slotMessage(const QByteArray&)));
|
---|
353 |
|
---|
354 | _bncCaster->start();
|
---|
355 |
|
---|
356 | for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
|
---|
357 | QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
|
---|
358 | "@" + _mountPointsTable->item(iRow, 1)->text() );
|
---|
359 |
|
---|
360 | QByteArray format = _mountPointsTable->item(iRow, 2)->text().toAscii();
|
---|
361 |
|
---|
362 | bncGetThread* getThread = new bncGetThread(url, format);
|
---|
363 |
|
---|
364 | connect(getThread, SIGNAL(newMessage(const QByteArray&)),
|
---|
365 | this, SLOT(slotMessage(const QByteArray&)));
|
---|
366 | connect(getThread, SIGNAL(newMessage(const QByteArray&)),
|
---|
367 | (bncApp*)qApp, SLOT(slotMessage(const QByteArray&)));
|
---|
368 |
|
---|
369 | _bncCaster->addGetThread(getThread);
|
---|
370 |
|
---|
371 | getThread->start();
|
---|
372 | }
|
---|
373 | }
|
---|
374 |
|
---|
375 | // Close Application gracefully
|
---|
376 | ////////////////////////////////////////////////////////////////////////////
|
---|
377 | void bncWindow::closeEvent(QCloseEvent* event) {
|
---|
378 |
|
---|
379 | int iRet = QMessageBox::question(this, "Close", "Save Options?",
|
---|
380 | QMessageBox::Yes, QMessageBox::No,
|
---|
381 | QMessageBox::Cancel);
|
---|
382 |
|
---|
383 | if (iRet == QMessageBox::Cancel) {
|
---|
384 | event->ignore();
|
---|
385 | return;
|
---|
386 | }
|
---|
387 | else if (iRet == QMessageBox::Yes) {
|
---|
388 | slotSaveOptions();
|
---|
389 | }
|
---|
390 |
|
---|
391 | return QMainWindow::closeEvent(event);
|
---|
392 | }
|
---|
393 |
|
---|
394 | // User changed the selection of mountPoints
|
---|
395 | ////////////////////////////////////////////////////////////////////////////
|
---|
396 | void bncWindow::slotSelectionChanged() {
|
---|
397 | if (_mountPointsTable->selectedItems().isEmpty()) {
|
---|
398 | _actDeleteMountPoints->setEnabled(false);
|
---|
399 | }
|
---|
400 | else {
|
---|
401 | _actDeleteMountPoints->setEnabled(true);
|
---|
402 | }
|
---|
403 | }
|
---|
404 |
|
---|
405 | // Display Program Messages
|
---|
406 | ////////////////////////////////////////////////////////////////////////////
|
---|
407 | void bncWindow::slotMessage(const QByteArray& msg) {
|
---|
408 |
|
---|
409 | const int maxBufferSize = 10000;
|
---|
410 |
|
---|
411 | QString txt = _log->toPlainText() + "\n" + msg;
|
---|
412 | _log->clear();
|
---|
413 | _log->append(txt.right(maxBufferSize));
|
---|
414 | }
|
---|
415 |
|
---|
416 | // About Message
|
---|
417 | ////////////////////////////////////////////////////////////////////////////
|
---|
418 | void bncWindow::slotAbout() {
|
---|
419 |
|
---|
420 | QString str("BKG NTRIP Client\n"
|
---|
421 | "Author: L. Mervart\n"
|
---|
422 | "Version 1.0");
|
---|
423 |
|
---|
424 | QMessageBox mb("BNC", str,
|
---|
425 | QMessageBox::Information,
|
---|
426 | QMessageBox::Ok | QMessageBox::Default,
|
---|
427 | QMessageBox::NoButton,
|
---|
428 | QMessageBox::NoButton);
|
---|
429 |
|
---|
430 | mb.setIconPixmap(QPixmap(":ntrip-logo-blau.bmp"));
|
---|
431 |
|
---|
432 | mb.exec();
|
---|
433 | }
|
---|
434 |
|
---|
435 | // Help Window
|
---|
436 | ////////////////////////////////////////////////////////////////////////////
|
---|
437 | void bncWindow::slotHelp() {
|
---|
438 |
|
---|
439 | QString str(
|
---|
440 | #include "bnchelp.html"
|
---|
441 | );
|
---|
442 |
|
---|
443 | QTextBrowser* tb = new QTextBrowser;
|
---|
444 | tb->setHtml(str);
|
---|
445 | tb->setReadOnly(true);
|
---|
446 | tb->show();
|
---|
447 |
|
---|
448 | QDialog* dlg = new QDialog(this);
|
---|
449 |
|
---|
450 | QVBoxLayout* dlgLayout = new QVBoxLayout();
|
---|
451 | dlgLayout->addWidget(tb);
|
---|
452 |
|
---|
453 | dlg->setLayout(dlgLayout);
|
---|
454 | int ww = QFontMetrics(font()).width('w');
|
---|
455 | dlg->resize(60*ww, 60*ww);
|
---|
456 | dlg->show();
|
---|
457 | }
|
---|
458 |
|
---|
459 | // Select Fonts
|
---|
460 | ////////////////////////////////////////////////////////////////////////////
|
---|
461 | void bncWindow::slotFontSel() {
|
---|
462 | bool ok;
|
---|
463 | QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
|
---|
464 | if (ok) {
|
---|
465 | QSettings settings;
|
---|
466 | settings.setValue("font", newFont.toString());
|
---|
467 | QApplication::setFont(newFont);
|
---|
468 | int ww = QFontMetrics(newFont).width('w');
|
---|
469 | setMinimumSize(60*ww, 80*ww);
|
---|
470 | resize(60*ww, 80*ww);
|
---|
471 | }
|
---|
472 | }
|
---|