Changeset 5088 in ntrip for trunk/GnssCenter/inpedit
- Timestamp:
- Apr 12, 2013, 12:10:55 PM (12 years ago)
- Location:
- trunk/GnssCenter/inpedit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GnssCenter/inpedit/inpedit.cpp
r5060 r5088 27 27 // Constructor 28 28 //////////////////////////////////////////////////////////////////////////// 29 t_inpEdit::t_inpEdit() : QTabWidget() { 29 t_inpEdit::t_inpEdit() : QMainWindow() { 30 _tabWidget = new t_tabWidget(); 31 setCentralWidget(_tabWidget); 32 _tabWidget->setVisible(true); 30 33 } 31 34 … … 33 36 //////////////////////////////////////////////////////////////////////////// 34 37 t_inpEdit::~t_inpEdit() { 35 QMapIterator<QString, t_keyword*> it(_keywords);36 while (it.hasNext()) {37 it.next();38 delete it.value();39 }40 38 } 41 42 //43 ////////////////////////////////////////////////////////////////////////////44 void t_inpEdit::setVisible(bool visible) {45 if (visible) {46 setInputFile("RTNET.INP");47 }48 QTabWidget::setVisible(visible);49 }50 51 //52 ////////////////////////////////////////////////////////////////////////////53 void t_inpEdit::setInputFile(const QString& fileName) {54 _fileName = fileName;55 readFile();56 }57 58 //59 ////////////////////////////////////////////////////////////////////////////60 void t_inpEdit::readFile() {61 62 QFile file(_fileName);63 file.open(QIODevice::ReadOnly | QIODevice::Text);64 QTextStream inStream(&file);65 66 int iPanel = 0;67 68 while (inStream.status() == QTextStream::Ok && !inStream.atEnd()) {69 QString line = inStream.readLine().trimmed();70 71 // Skip Comments and empty Lines72 // -----------------------------73 if (line.isEmpty() || line[0] == '!') {74 continue;75 }76 77 // Read Panels78 // -----------79 else if (line[0] == '#' && line.indexOf("BEGIN_PANEL") != -1) {80 t_panel* panel = new t_panel(line, inStream, &_keywords);81 if (panel->ok()) {82 ++iPanel;83 addTab(panel, QString("Panel %1").arg(iPanel));84 }85 else {86 delete panel;87 }88 }89 90 // Read Keywords91 // -------------92 else {93 t_keyword* keyword = new t_keyword(line, inStream);94 if (keyword->ok()) {95 _keywords[keyword->name()] = keyword;96 }97 else {98 delete keyword;99 }100 }101 }102 } -
trunk/GnssCenter/inpedit/inpedit.h
r5060 r5088 4 4 #include <QtGui> 5 5 #include "plugininterface.h" 6 #include "tabwidget.h" 6 7 7 8 namespace GnssCenter { … … 10 11 class t_panel; 11 12 12 class t_inpEdit : public Q TabWidget{13 class t_inpEdit : public QMainWindow { 13 14 public: 14 15 t_inpEdit(); 15 16 ~t_inpEdit(); 16 void setInputFile(const QString&);17 virtual void setVisible(bool visible);18 17 private: 19 void readFile(); 20 QString _fileName; 21 QMap<QString, t_keyword*> _keywords; 18 t_tabWidget* _tabWidget; 22 19 }; 23 20
Note:
See TracChangeset
for help on using the changeset viewer.