GpsConnection::GpsConnection (QObject *parent) : QObject (parent) , isExpired_ (true) , gpsPort_ (AbstractGpsPort::createGpsPort (ComPortSettings::isMockPort () ? AbstractGpsPort::MOCK_GPS_PORT : AbstractGpsPort::REAL_GPS_PORT)) { constexpr int currentCoordinatesExpireTime = 1500; coordinatesExpireTimer_.setInterval (currentCoordinatesExpireTime); connect (&coordinatesExpireTimer_, SIGNAL (timeout ()), SLOT (setExpired ())); connect (gpsPort_.get (), SIGNAL (ggaSentenceReceived (GgaSentence)), SLOT (rememberCoordinates (GgaSentence))); connect (gpsPort_.get (), SIGNAL (sentenceReady (QString)), SLOT (showSentence (QString))); }
ReadFromFileWidget::ReadFromFileWidget(QWidget *parent) : QWidget(parent) { sl = new QHBoxLayout; QVBoxLayout * vl = new QVBoxLayout; { sentenses = readFile(); showSentence(0); } QPushButton * next = new QPushButton("Далее", this); { connect(next, SIGNAL(clicked()), this, SLOT(nextSentence()) ); } vl->addWidget(next); vl->addLayout(sl); setLayout(vl); }
void ReadFromFileWidget::nextSentence() { current++; showSentence(current % sentenses.count()); }