/***************************************************** ** ** Document --- OnTimer ** ******************************************************/ void Document::OnTimer( wxTimerEvent& ) { double sw; if ( config->animation->mode ) { sw = config->animation->stepLength; switch ( config->animation->stepDimension ) { case 0: // seconds sw /= 86400; break; case 1: // minutes sw /= 1400; break; case 2: // hours sw /= 24; break; case 3: // days break; case 4: // months sw *= 30.6; break; case 5: // years sw *= 365.25; break; default: // seconds sw /= 86400; break; } setDate( getJD() + sw ); } else { setCurrentDate(); } update(); updateAllChildWindows(); // see if interval param has changed, so restart timer if ( config->animation->interval != myAniInterval ) StartTimer( true ); }
void SkServer::dataReady() { QByteArray data; data = m_client->readAll(); qDebug() << data; QStringList commands; QString str; for (int i = 0; i < data.count(); i++) { if ((data.mid(i, 3) == "\r\n\n") || (data.mid(i, 3) == "\r\n")) { commands.append(str); i += 2; str.clear(); } else { str += data[i]; } } if (commands.count() == 0) { sendData(SKS_INVALID); return; } foreach (const QString &command, commands) { if (command.startsWith("Echo ", Qt::CaseInsensitive)) { sendData(command.mid(5).toLocal8Bit()); } else if (command.startsWith("SetPos ", Qt::CaseInsensitive)) { setRA_Dec(command.mid(6)); } else if (!command.compare("GetPos", Qt::CaseInsensitive)) { getPos(); } else if (!command.compare("GetJD", Qt::CaseInsensitive)) { getJD(); } else if (command.startsWith("SetJD ", Qt::CaseInsensitive)) { setJD(command.mid(5)); } else if (!command.compare("ZoomIn", Qt::CaseInsensitive)) { zoom(1); } else if (!command.compare("ZoomOut", Qt::CaseInsensitive)) { zoom(-1); } else if (command.startsWith("SetMode ", Qt::CaseInsensitive)) { setMode(command.mid(8)); } else if (!command.compare("ServerVer", Qt::CaseInsensitive)) { sendData(SK_SERVER_VERSION); } else if (!command.compare("SwVer", Qt::CaseInsensitive)) { sendData(SK_VERSION); } else if (command.startsWith("SetExtFrame ", Qt::CaseInsensitive)) { setExtFrame(command.mid(11)); } else if (!command.compare("GetExtFrame", Qt::CaseInsensitive)) { getExtFrame(); } else if (command.startsWith("SetRTC ", Qt::CaseInsensitive)) { setRTC(command.mid(7)); } else if (!command.compare("GetRTC", Qt::CaseInsensitive)) { getRTC(); } else if (!command.compare("Redraw", Qt::CaseInsensitive)) { m_mainWin->getView()->repaintMap(); sendData(SKS_OK); } else { sendData(SKS_UNKNOWN); } } }