Changeset 5088 in ntrip for trunk/GnssCenter


Ignore:
Timestamp:
Apr 12, 2013, 12:10:55 PM (11 years ago)
Author:
mervart
Message:
 
Location:
trunk/GnssCenter/inpedit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GnssCenter/inpedit/inpedit.cpp

    r5060 r5088  
    2727// Constructor
    2828////////////////////////////////////////////////////////////////////////////
    29 t_inpEdit::t_inpEdit() : QTabWidget() {
     29t_inpEdit::t_inpEdit() : QMainWindow() {
     30  _tabWidget = new t_tabWidget();
     31  setCentralWidget(_tabWidget);
     32  _tabWidget->setVisible(true);
    3033}
    3134
     
    3336////////////////////////////////////////////////////////////////////////////
    3437t_inpEdit::~t_inpEdit() {
    35   QMapIterator<QString, t_keyword*> it(_keywords);
    36   while (it.hasNext()) {
    37     it.next();
    38     delete it.value();
    39   }
    4038}
    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 Lines
    72     // -----------------------------
    73     if      (line.isEmpty() || line[0] == '!') {
    74       continue;
    75     }
    76 
    77     // Read Panels
    78     // -----------
    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 Keywords
    91     // -------------
    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  
    44#include <QtGui>
    55#include "plugininterface.h"
     6#include "tabwidget.h"
    67
    78namespace GnssCenter {
     
    1011class t_panel;
    1112
    12 class t_inpEdit : public QTabWidget {
     13class t_inpEdit : public QMainWindow {
    1314 public:
    1415  t_inpEdit();
    1516  ~t_inpEdit();
    16   void setInputFile(const QString&);
    17   virtual void setVisible(bool visible);
    1817 private:
    19   void readFile();
    20   QString                   _fileName;
    21   QMap<QString, t_keyword*> _keywords;
     18  t_tabWidget* _tabWidget;
    2219};
    2320
Note: See TracChangeset for help on using the changeset viewer.