diff --git a/plugins/feature/satellitetracker/satellitetrackergui.cpp b/plugins/feature/satellitetracker/satellitetrackergui.cpp index 9059d927a..6e9179b39 100644 --- a/plugins/feature/satellitetracker/satellitetrackergui.cpp +++ b/plugins/feature/satellitetracker/satellitetrackergui.cpp @@ -989,6 +989,8 @@ void SatelliteTrackerGUI::resizeTable() ui->satTable->setItem(row, SAT_COL_NAME, new QTableWidgetItem("Satellite123")); ui->satTable->setItem(row, SAT_COL_AZ, new QTableWidgetItem("360")); ui->satTable->setItem(row, SAT_COL_EL, new QTableWidgetItem("-90")); + ui->satTable->setItem(row, SAT_COL_TNE, new QTableWidgetItem("9999:99 AOS")); + ui->satTable->setItem(row, SAT_COL_DUR, new QTableWidgetItem("999:99")); ui->satTable->setItem(row, SAT_COL_AOS, new QTableWidgetItem("+1 10:17")); ui->satTable->setItem(row, SAT_COL_LOS, new QTableWidgetItem("+1 10:17")); ui->satTable->setItem(row, SAT_COL_MAX_EL, new QTableWidgetItem("90")); @@ -1022,6 +1024,19 @@ QString SatelliteTrackerGUI::formatDaysTime(qint64 days, QDateTime dateTime) return dt.time().toString(QString("hh:mm %1").arg(days)); } + +QString SatelliteTrackerGUI::formatSecondsHHMM(qint64 seconds) +{ + char const* sign = ""; + if(seconds < 0) + { + sign = "-"; + seconds = -seconds; + } + return QString("%1%2:%3").arg(sign).arg(seconds/60).arg(seconds%60,2,10,QChar('0')); +} + + // Table item showing some text, but sorted by datetime set as user data class DateTimeSortedTableWidgetItem : public QTableWidgetItem { public: @@ -1113,9 +1128,14 @@ void SatelliteTrackerGUI::updateTable(SatelliteState *satState) if (satState->m_passes.size() > 0) { // Get number of days to AOS/LOS - QDate currentDate = QDate::currentDate(); - int daysToAOS = currentDate.daysTo(satState->m_passes[0]->m_aos.date()); - int daysToLOS = currentDate.daysTo(satState->m_passes[0]->m_los.date()); + QDateTime currentDateTime = QDateTime::currentDateTime(); + int daysToAOS = currentDateTime.daysTo(satState->m_passes[0]->m_aos); + int daysToLOS = currentDateTime.daysTo(satState->m_passes[0]->m_los); + if( satState->m_passes[ 0 ]->m_aos > currentDateTime ) + items[SAT_COL_TNE]->setText(formatSecondsHHMM(currentDateTime.secsTo(satState->m_passes[0]->m_aos))+" AOS"); + else + items[SAT_COL_TNE]->setText(formatSecondsHHMM(currentDateTime.secsTo(satState->m_passes[0]->m_los))+" LOS"); + items[SAT_COL_DUR]->setText(formatSecondsHHMM(satState->m_passes[0]->m_aos.secsTo(satState->m_passes[0]->m_los))); items[SAT_COL_AOS]->setText(formatDaysTime(daysToAOS, satState->m_passes[0]->m_aos)); items[SAT_COL_AOS]->setData(Qt::UserRole, satState->m_passes[0]->m_aos); items[SAT_COL_LOS]->setText(formatDaysTime(daysToLOS, satState->m_passes[0]->m_los)); @@ -1128,6 +1148,8 @@ void SatelliteTrackerGUI::updateTable(SatelliteState *satState) } else { + items[SAT_COL_TNE]->setText(""); + items[SAT_COL_DUR]->setText(""); items[SAT_COL_AOS]->setText(""); items[SAT_COL_LOS]->setText(""); items[SAT_COL_MAX_EL]->setData(Qt::DisplayRole, QVariant()); diff --git a/plugins/feature/satellitetracker/satellitetrackergui.h b/plugins/feature/satellitetracker/satellitetrackergui.h index 78ee5de75..2c80f35da 100644 --- a/plugins/feature/satellitetracker/satellitetrackergui.h +++ b/plugins/feature/satellitetracker/satellitetrackergui.h @@ -84,6 +84,8 @@ private: SAT_COL_NAME, SAT_COL_AZ, SAT_COL_EL, + SAT_COL_TNE, + SAT_COL_DUR, SAT_COL_AOS, SAT_COL_LOS, SAT_COL_MAX_EL, @@ -118,6 +120,7 @@ private: QAction *createCheckableItem(QString& text, int idx, bool checked); void updateTimeToAOS(); QString formatDaysTime(qint64 days, QDateTime dateTime); + QString formatSecondsHHMM(qint64 seconds); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/feature/satellitetracker/satellitetrackergui.ui b/plugins/feature/satellitetracker/satellitetrackergui.ui index 10cc0dd68..49411c998 100644 --- a/plugins/feature/satellitetracker/satellitetrackergui.ui +++ b/plugins/feature/satellitetracker/satellitetrackergui.ui @@ -580,6 +580,16 @@ Elevation in degrees to satellite from antenna location + + + Next + + + + + Dur + + AOS diff --git a/plugins/feature/satellitetracker/satellitetrackersettings.h b/plugins/feature/satellitetracker/satellitetrackersettings.h index 169fc7cf3..643f331b0 100644 --- a/plugins/feature/satellitetracker/satellitetrackersettings.h +++ b/plugins/feature/satellitetracker/satellitetrackersettings.h @@ -27,7 +27,7 @@ class Serializable; -#define SAT_COL_COLUMNS 14 +#define SAT_COL_COLUMNS 16 struct SatelliteTrackerSettings {