Changeset 749 in ntrip


Ignore:
Timestamp:
Mar 30, 2008, 2:39:19 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
5 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.pro

    r748 r749  
    22# Switch to debug configuration
    33# -----------------------------
    4 ###CONFIG += release
    5 ###CONFIG -= debug
     4CONFIG -= release
     5CONFIG += debug
    66
    77RESOURCES += bns.qrc
     
    2121release:MOC_DIR=.moc/release
    2222
    23 HEADERS =             bnsapp.h   bnswindow.h
     23HEADERS =             bnsapp.h   bnswindow.h   bnshlpdlg.h   bnshtml.h
    2424
    25 SOURCES = bnsmain.cpp bnsapp.cpp bnswindow.cpp
     25SOURCES = bnsmain.cpp bnsapp.cpp bnswindow.cpp bnshlpdlg.cpp bnshtml.cpp
    2626
    2727RC_FILE = bns.rc
  • trunk/BNS/bns.qrc

    r747 r749  
    22<qresource>
    33    <file>ntrip-logo.png</file>
     4    <file>bnshelp.html</file>
     5    <file>bnsabout.html</file>
    46</qresource>
    57</RCC>
  • trunk/BNS/bnsmain.cpp

    r748 r749  
    7777  // ----------------------------
    7878  else {
     79    cerr << "non-interactive mode not yet implemented" << endl;
    7980    exit(0);
    8081  }
  • trunk/BNS/bnswindow.cpp

    r748 r749  
    11
    22/* -------------------------------------------------------------------------
    3  * BKG NTRIP Client
     3 * BKG NTRIP Server
    44 * -------------------------------------------------------------------------
    55 *
     
    1616 * -----------------------------------------------------------------------*/
    1717
     18#include <iostream>
     19
    1820#include "bnswindow.h"
     21#include "bnshlpdlg.h"
    1922
    2023using namespace std;
     
    2326////////////////////////////////////////////////////////////////////////////
    2427bnsWindow::bnsWindow() {
     28
     29  int ww = QFontMetrics(this->font()).width('w');
     30 
     31  setMinimumSize(77*ww, 65*ww);
     32
     33  setWindowTitle(tr("BKG Ntrip Server (BNS) Version 1.0"));
     34
     35  // Create Actions
     36  // --------------
     37  _actHelp = new QAction(tr("&Help Contents"),this);
     38  connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
     39
     40  _actAbout = new QAction(tr("&About BNS"),this);
     41  connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
     42
     43  _actFontSel = new QAction(tr("Select &Font"),this);
     44  connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
     45
     46  _actSaveOpt = new QAction(tr("&Save Options"),this);
     47  connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
     48
     49  _actQuit  = new QAction(tr("&Quit"),this);
     50  connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
     51
     52  _actwhatsthis= new QAction(tr("Help=Shift+F1"),this);
     53  connect(_actwhatsthis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
     54
     55  CreateMenu();
     56  AddToolbar();
     57
     58  // Canvas with Editable Fields
     59  // ---------------------------
     60  _canvas = new QWidget;
     61  setCentralWidget(_canvas);
     62
    2563}
    2664
     
    2866////////////////////////////////////////////////////////////////////////////
    2967bnsWindow::~bnsWindow() {
     68  cout << "destructor" << endl;
    3069}
    3170
     
    3372////////////////////////////////////////////////////////////////////////////
    3473void bnsWindow::closeEvent(QCloseEvent* event) {
     74
     75int iRet = QMessageBox::question(this, "Close", "Save Options?",
     76                                 QMessageBox::Yes, QMessageBox::No,
     77                                 QMessageBox::Cancel);
     78
     79  if      (iRet == QMessageBox::Cancel) {
     80    event->ignore();
     81    return;
     82  }
     83  else if (iRet == QMessageBox::Yes) {
     84    slotSaveOptions();
     85  }
     86
    3587  QMainWindow::closeEvent(event);
     88
    3689  delete this;
    3790}
    3891
     92// About Message
     93////////////////////////////////////////////////////////////////////////////
     94void bnsWindow::slotAbout() {
     95 new bnsAboutDlg(0);
     96}
     97
     98// Help Window
     99////////////////////////////////////////////////////////////////////////////
     100void bnsWindow::slotHelp() {
     101  QUrl url;
     102  url.setPath(":bnshelp.html");
     103  new bnsHlpDlg(0, url);
     104}
     105
     106// Select Fonts
     107////////////////////////////////////////////////////////////////////////////
     108void bnsWindow::slotFontSel() {
     109  bool ok;
     110  QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
     111  if (ok) {
     112    QSettings settings;
     113    settings.setValue("font", newFont.toString());
     114    QApplication::setFont(newFont);
     115    int ww = QFontMetrics(newFont).width('w');
     116    setMinimumSize(60*ww, 80*ww);
     117    resize(60*ww, 80*ww);
     118  }
     119}
     120
     121// Whats This Help
     122////////////////////////////////////////////////////////////////////////////
     123void bnsWindow::slotWhatsThis() {
     124QWhatsThis::enterWhatsThisMode();
     125}
     126
     127// Create Menus
     128////////////////////////////////////////////////////////////////////////////
     129void bnsWindow::CreateMenu() {
     130  _menuFile = menuBar()->addMenu(tr("&File"));
     131  _menuFile->addAction(_actFontSel);
     132  _menuFile->addSeparator();
     133  _menuFile->addAction(_actSaveOpt);
     134  _menuFile->addSeparator();
     135  _menuFile->addAction(_actQuit);
     136
     137  _menuHlp = menuBar()->addMenu(tr("&Help"));
     138  _menuHlp->addAction(_actHelp);
     139  _menuHlp->addAction(_actAbout);
     140}
     141
     142// Tool (Command) Bar
     143////////////////////////////////////////////////////////////////////////////
     144void bnsWindow::AddToolbar() {
     145  QToolBar* toolBar = new QToolBar;
     146  addToolBar(Qt::BottomToolBarArea, toolBar);
     147  toolBar->setMovable(false);
     148  toolBar->addWidget(new QLabel("                                   "));
     149  toolBar->addAction(_actwhatsthis);
     150}
     151
     152// Save Options
     153////////////////////////////////////////////////////////////////////////////
     154void bnsWindow::slotSaveOptions() {
     155}
     156
     157// About Dialog - Constructor
     158////////////////////////////////////////////////////////////////////////////
     159bnsAboutDlg::bnsAboutDlg(QWidget* parent) :
     160   QDialog(parent) {
     161
     162  QTextBrowser* tb = new QTextBrowser;
     163  QUrl url; url.setPath(":bnsabout.html");
     164  tb->setSource(url);
     165  tb->setReadOnly(true);
     166
     167  int ww = QFontMetrics(font()).width('w');
     168  QPushButton* _closeButton = new QPushButton("Close");
     169  _closeButton->setMaximumWidth(10*ww);
     170  connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
     171
     172  QGridLayout* dlgLayout = new QGridLayout();
     173  QLabel* img = new QLabel();
     174  img->setPixmap(QPixmap(":ntrip-logo.png"));
     175  dlgLayout->addWidget(img, 0,0);
     176  dlgLayout->addWidget(new QLabel("BKG NTRIP Server (BNS) Version 1.0"), 0,1);
     177  dlgLayout->addWidget(tb,1,0,1,2);
     178  dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight); 
     179
     180  setLayout(dlgLayout);
     181  resize(60*ww, 60*ww);
     182  show();
     183}
     184
     185// About Dialog - Constructor
     186////////////////////////////////////////////////////////////////////////////
     187bnsAboutDlg::~bnsAboutDlg() {
     188};
     189
  • trunk/BNS/bnswindow.h

    r748 r749  
    33
    44#include <QtGui>
     5#include <QWhatsThis>
     6
     7class bnsAboutDlg : public QDialog {
     8 Q_OBJECT
     9 public:
     10  bnsAboutDlg(QWidget* parent);
     11  ~bnsAboutDlg();
     12};
    513
    614class bnsWindow : public QMainWindow {
     
    1422
    1523 private slots:
     24  void slotHelp();
     25  void slotAbout();
     26  void slotFontSel();
     27  void slotSaveOptions();
     28  void slotWhatsThis();
    1629
    1730 protected:
    18    virtual void closeEvent(QCloseEvent *);
     31  virtual void closeEvent(QCloseEvent *);
    1932
    2033 private:
     34  void CreateMenu();
     35  void AddToolbar();
    2136
     37  QMenu*     _menuHlp;
     38  QMenu*     _menuFile;
     39
     40  QAction*   _actHelp;
     41  QAction*   _actAbout;
     42  QAction*   _actFontSel;
     43  QAction*   _actSaveOpt;
     44  QAction*   _actQuit;
     45  QAction*   _actwhatsthis;
     46
     47  QWidget*   _canvas;
    2248};
    2349#endif
Note: See TracChangeset for help on using the changeset viewer.