Changeset 5474 in ntrip for trunk/GnssCenter


Ignore:
Timestamp:
Sep 18, 2013, 12:14:33 PM (11 years ago)
Author:
mervart
Message:
 
Location:
trunk/GnssCenter/monitor
Files:
2 edited

Legend:

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

    r5473 r5474  
    6969  connect(_actStopThrift, SIGNAL(triggered()), this, SLOT(slotStopThrift()));
    7070
    71   // Window title
    72   // ------------
    73   setTitle();
    74 
    7571  // Thrift Client;
    7672  // --------------
    7773  _thriftClient = 0;
    7874  _results      = 0;
     75
     76  // Read Settings, Set Title, Enable/Disable Actions
     77  // ------------------------------------------------
     78  readSettings();
     79  setTitle();
     80  enableActions();
    7981}
    8082
     
    9294}
    9395
     96// Read Settings
     97/////////////////////////////////////////////////////////////////////////////
     98void t_monitor::readSettings() {
     99  t_settings settings(pluginName);
     100  _host = settings.value("host").toString();
     101  if (_host.isEmpty()) {
     102    _host = "localhost";
     103  }
     104  _port = settings.value("port").toString();
     105}
     106
    94107// Set title
    95108/////////////////////////////////////////////////////////////////////////////
    96109void t_monitor::setTitle() {
    97   t_settings settings(pluginName);
    98   QString host = settings.value("host").toString();
    99   if (host.isEmpty()) {
    100     host = "localhost";
    101   }
    102   QString port = settings.value("port").toString();
    103   if (port.isEmpty()) {
     110  if (_port.isEmpty()) {
    104111    setWindowTitle(QString(pluginName));
    105     _actStartThrift->setEnabled(false);
    106     _actStopThrift->setEnabled(false);
    107112  }
    108113  else {
    109     _actStartThrift->setEnabled(true);
    110     _actStopThrift->setEnabled(false);
    111     setWindowTitle(QString(pluginName) + "   " + host + ':' + port);
    112   }
     114    setWindowTitle(QString(pluginName) + "   " + _host + ':' + _port);
     115  }
     116}
     117
     118// Enable/Disable Actions
     119/////////////////////////////////////////////////////////////////////////////
     120void t_monitor::enableActions() {
     121  _actConfig->setEnabled(true);
     122  _actStartThrift->setEnabled(true);
     123  _actStopThrift->setEnabled(true);
    113124}
    114125
     
    118129  t_dlgConf dlg(this);
    119130  dlg.exec();
     131  readSettings();
    120132  setTitle();
     133  enableActions();
    121134}
    122135
     
    124137/////////////////////////////////////////////////////////////////////////////
    125138void t_monitor::slotStartThrift() {
    126   _actConfig->setEnabled(false);
    127   _actStartThrift->setEnabled(false);
    128   _actStopThrift->setEnabled(true);
     139  enableActions();
    129140  if (!_thriftClient) {
    130     t_settings settings(pluginName);
    131     QString host = settings.value("host").toString();
    132     if (host.isEmpty()) {
    133       host = "localhost";
    134     }
    135     int port = settings.value("port").toInt();
    136     _thriftClient = new t_thriftClient(this, host, port);
     141    _thriftClient = new t_thriftClient(this, _host, _port.toInt());
    137142    connect(_thriftClient, SIGNAL(finished()), this, SLOT(slotThriftFinished()));
    138143    _thriftClient->start();
     
    144149/////////////////////////////////////////////////////////////////////////////
    145150void t_monitor::slotStopThrift() {
    146   _actStopThrift->setEnabled(false);
     151  enableActions();
    147152  if (_thriftClient) {
    148153    _thriftClient->stop();
     
    154159/////////////////////////////////////////////////////////////////////////////
    155160void t_monitor::slotThriftFinished() {
    156   _actConfig->setEnabled(true);
    157   _actStartThrift->setEnabled(true);
    158   _actStopThrift->setEnabled(false);
     161  enableActions();
    159162  sender()->deleteLater();
    160163  _thriftClient = 0;
  • trunk/GnssCenter/monitor/monitor.h

    r5457 r5474  
    3131
    3232 private:
     33  void readSettings();
    3334  void setTitle();
     35  void enableActions();
    3436  QMutex                        _mutex;
    3537  QTabWidget*                   _tabWidget;
     
    3840  QAction*                      _actStopThrift;
    3941  t_worldPlot*                  _plot;
     42  QString                       _host;
     43  QString                       _port;
    4044  t_thriftClient*               _thriftClient;
    4145  std::vector<t_thriftResult*>* _results;
Note: See TracChangeset for help on using the changeset viewer.