示例#1
0
void
MetarListModel::__gotMetar(const QString& _metar) {
  QString metar = _metar.simplified();

  if (metar.isEmpty())
    return;

  if (metar.contains(METAR_NO_AVAIL)) {
    emit noMetar(__requests.dequeue());
    return;
  }

  QString oneMetar;

for (QString & word: metar.split(' ')) {
    if (__matches(word)) {
      if (!oneMetar.isEmpty())
        __addMetar(oneMetar);

      oneMetar.clear();
    }

    oneMetar.append(word + " ");
  }

  if (!oneMetar.isEmpty())
    __addMetar(oneMetar);

  __requests.dequeue();

  emit newMetarsAvailable();
}
AirportDetailsWindow::AirportDetailsWindow(QWidget* _parent) :
    QWidget(_parent),
    __currentICAO("") {
    setupUi(this);
    UserInterface::setWindowPosition(this);

    connect(MetarListModel::getSingletonPtr(),  SIGNAL(newMetarsAvailable()),
            this,                               SLOT(updateMetar()));

    connect(MetarListModel::getSingletonPtr(),  SIGNAL(noMetar(QString)),
            this,                               SLOT(updateMetar(QString)));

    connect(VatsinatorApplication::getSingletonPtr(), SIGNAL(dataUpdated()),
            this,                                     SLOT(__updateData()));

    connect(ShowButton, SIGNAL(clicked()),
            this,       SLOT(__handleShowClicked()));
}