Changeset 749 in ntrip
- Timestamp:
- Mar 30, 2008, 2:39:19 PM (17 years ago)
- Location:
- trunk/BNS
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.pro
r748 r749 2 2 # Switch to debug configuration 3 3 # ----------------------------- 4 ###CONFIG += release5 ###CONFIG -= debug4 CONFIG -= release 5 CONFIG += debug 6 6 7 7 RESOURCES += bns.qrc … … 21 21 release:MOC_DIR=.moc/release 22 22 23 HEADERS = bnsapp.h bnswindow.h 23 HEADERS = bnsapp.h bnswindow.h bnshlpdlg.h bnshtml.h 24 24 25 SOURCES = bnsmain.cpp bnsapp.cpp bnswindow.cpp 25 SOURCES = bnsmain.cpp bnsapp.cpp bnswindow.cpp bnshlpdlg.cpp bnshtml.cpp 26 26 27 27 RC_FILE = bns.rc -
trunk/BNS/bns.qrc
r747 r749 2 2 <qresource> 3 3 <file>ntrip-logo.png</file> 4 <file>bnshelp.html</file> 5 <file>bnsabout.html</file> 4 6 </qresource> 5 7 </RCC> -
trunk/BNS/bnsmain.cpp
r748 r749 77 77 // ---------------------------- 78 78 else { 79 cerr << "non-interactive mode not yet implemented" << endl; 79 80 exit(0); 80 81 } -
trunk/BNS/bnswindow.cpp
r748 r749 1 1 2 2 /* ------------------------------------------------------------------------- 3 * BKG NTRIP Client3 * BKG NTRIP Server 4 4 * ------------------------------------------------------------------------- 5 5 * … … 16 16 * -----------------------------------------------------------------------*/ 17 17 18 #include <iostream> 19 18 20 #include "bnswindow.h" 21 #include "bnshlpdlg.h" 19 22 20 23 using namespace std; … … 23 26 //////////////////////////////////////////////////////////////////////////// 24 27 bnsWindow::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 25 63 } 26 64 … … 28 66 //////////////////////////////////////////////////////////////////////////// 29 67 bnsWindow::~bnsWindow() { 68 cout << "destructor" << endl; 30 69 } 31 70 … … 33 72 //////////////////////////////////////////////////////////////////////////// 34 73 void bnsWindow::closeEvent(QCloseEvent* event) { 74 75 int 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 35 87 QMainWindow::closeEvent(event); 88 36 89 delete this; 37 90 } 38 91 92 // About Message 93 //////////////////////////////////////////////////////////////////////////// 94 void bnsWindow::slotAbout() { 95 new bnsAboutDlg(0); 96 } 97 98 // Help Window 99 //////////////////////////////////////////////////////////////////////////// 100 void bnsWindow::slotHelp() { 101 QUrl url; 102 url.setPath(":bnshelp.html"); 103 new bnsHlpDlg(0, url); 104 } 105 106 // Select Fonts 107 //////////////////////////////////////////////////////////////////////////// 108 void 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 //////////////////////////////////////////////////////////////////////////// 123 void bnsWindow::slotWhatsThis() { 124 QWhatsThis::enterWhatsThisMode(); 125 } 126 127 // Create Menus 128 //////////////////////////////////////////////////////////////////////////// 129 void 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 //////////////////////////////////////////////////////////////////////////// 144 void 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 //////////////////////////////////////////////////////////////////////////// 154 void bnsWindow::slotSaveOptions() { 155 } 156 157 // About Dialog - Constructor 158 //////////////////////////////////////////////////////////////////////////// 159 bnsAboutDlg::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 //////////////////////////////////////////////////////////////////////////// 187 bnsAboutDlg::~bnsAboutDlg() { 188 }; 189 -
trunk/BNS/bnswindow.h
r748 r749 3 3 4 4 #include <QtGui> 5 #include <QWhatsThis> 6 7 class bnsAboutDlg : public QDialog { 8 Q_OBJECT 9 public: 10 bnsAboutDlg(QWidget* parent); 11 ~bnsAboutDlg(); 12 }; 5 13 6 14 class bnsWindow : public QMainWindow { … … 14 22 15 23 private slots: 24 void slotHelp(); 25 void slotAbout(); 26 void slotFontSel(); 27 void slotSaveOptions(); 28 void slotWhatsThis(); 16 29 17 30 protected: 18 31 virtual void closeEvent(QCloseEvent *); 19 32 20 33 private: 34 void CreateMenu(); 35 void AddToolbar(); 21 36 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; 22 48 }; 23 49 #endif
Note:
See TracChangeset
for help on using the changeset viewer.