Added total transmit duration to send button
This commit is contained in:
		
							parent
							
								
									56a2b13615
								
							
						
					
					
						commit
						6aef6bddb8
					
				| @ -244,6 +244,19 @@ namespace | |||||||
|       return QString {}; |       return QString {}; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   QString timeSince(int delta){ | ||||||
|  |       int seconds = delta % 60; | ||||||
|  |       delta = delta / 60; | ||||||
|  |       int minutes = delta; | ||||||
|  |       if(minutes && seconds){ | ||||||
|  |           return QString("%1m %2s").arg(minutes).arg(seconds); | ||||||
|  |       } else if(minutes){ | ||||||
|  |           return QString("%1m").arg(minutes); | ||||||
|  |       } else { | ||||||
|  |           return QString("%1s").arg(seconds); | ||||||
|  |       } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   void clearTableWidget(QTableWidget *widget){ |   void clearTableWidget(QTableWidget *widget){ | ||||||
|       if(!widget){ |       if(!widget){ | ||||||
|           return; |           return; | ||||||
| @ -5110,6 +5123,7 @@ void MainWindow::guiUpdate() | |||||||
|           tx_status_label.setText(t.trimmed()); |           tx_status_label.setText(t.trimmed()); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       transmitDisplay(true); | ||||||
| 
 | 
 | ||||||
|     } else if(m_monitoring) { |     } else if(m_monitoring) { | ||||||
|       if (m_tx_watchdog) { |       if (m_tx_watchdog) { | ||||||
| @ -5310,6 +5324,8 @@ void MainWindow::stopTx2(){ | |||||||
|     // and remains at that count until the last frame is transmitted.
 |     // and remains at that count until the last frame is transmitted.
 | ||||||
|     // So, we keep the PTT ON so long as m_txFrameCount is non-zero
 |     // So, we keep the PTT ON so long as m_txFrameCount is non-zero
 | ||||||
| 
 | 
 | ||||||
|  |     qDebug() << "stopTx2 frames left" << m_txFrameCount; | ||||||
|  | 
 | ||||||
|     // If we're holding the PTT and there are more frames to transmit, do not emit the PTT signal
 |     // If we're holding the PTT and there are more frames to transmit, do not emit the PTT signal
 | ||||||
|     if(m_config.hold_ptt() && m_txFrameCount > 0){ |     if(m_config.hold_ptt() && m_txFrameCount > 0){ | ||||||
|         return; |         return; | ||||||
| @ -6510,8 +6526,8 @@ void MainWindow::on_startTxButton_toggled(bool checked) | |||||||
|         } |         } | ||||||
|     } else { |     } else { | ||||||
|         resetMessage(); |         resetMessage(); | ||||||
|         stopTx(); |  | ||||||
|         on_stopTxButton_clicked(); |         on_stopTxButton_clicked(); | ||||||
|  |         stopTx(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -9433,14 +9449,37 @@ void MainWindow::updateTxButtonDisplay(){ | |||||||
|         int sent = qMax(1, count - left); |         int sent = qMax(1, count - left); | ||||||
|         ui->startTxButton->setText(m_tune ? "Tuning" : QString("%1 (%2/%3)").arg(ui->turboButton->isChecked() ? "Turbo" : "Send").arg(sent).arg(count)); |         ui->startTxButton->setText(m_tune ? "Tuning" : QString("%1 (%2/%3)").arg(ui->turboButton->isChecked() ? "Turbo" : "Send").arg(sent).arg(count)); | ||||||
| #else | #else | ||||||
|         int sent = count - m_txFrameQueue.count(); |         int left = m_txFrameQueue.count(); | ||||||
|         ui->startTxButton->setText( |         int sent = count - left; | ||||||
|             m_tune ? "Tuning" : QString("%1 (%2/%3)").arg(m_transmitting ? "Sending" : "Ready").arg(sent).arg(count)); | 
 | ||||||
|  |         QString buttonText; | ||||||
|  |         if(m_tune){ | ||||||
|  |             buttonText = "Tuning"; | ||||||
|  |         } else if(m_transmitting){ | ||||||
|  |             auto secondsLeft = (((left + 1) * m_TRperiod) - ((m_sec0 + 1) % m_TRperiod)); | ||||||
|  |             auto timeLeft = timeSince(secondsLeft); | ||||||
|  |             buttonText = QString("Sending (%1)").arg(timeLeft); | ||||||
|  |         } else { | ||||||
|  |             auto secondsLeft = sent == 1 ? ((left + 1) * m_TRperiod) : | ||||||
|  |                 (((left + 2) * m_TRperiod) - ((m_sec0 + 1) % m_TRperiod)); | ||||||
|  |             auto timeLeft = timeSince(secondsLeft); | ||||||
|  |             buttonText = QString("Ready (%1)").arg(timeLeft); | ||||||
|  |         } | ||||||
|  |         ui->startTxButton->setText(buttonText); | ||||||
| #endif | #endif | ||||||
|         ui->startTxButton->setEnabled(false); |         ui->startTxButton->setEnabled(false); | ||||||
|         ui->startTxButton->setFlat(true); |         ui->startTxButton->setFlat(true); | ||||||
|     } else { |     } else { | ||||||
|         ui->startTxButton->setText(m_txFrameCountEstimate <= 0 ? QString("Send") : QString("Send (%1)").arg(m_txFrameCountEstimate)); |         QString buttonText; | ||||||
|  |         if(m_txFrameCountEstimate > 0){ | ||||||
|  |             auto secondsLeft = m_txFrameCountEstimate * m_TRperiod; | ||||||
|  |             auto timeLeft = timeSince(secondsLeft); | ||||||
|  |             buttonText = QString("Send (%1)").arg(timeLeft); | ||||||
|  |         } else { | ||||||
|  |             buttonText = "Send"; | ||||||
|  |         } | ||||||
|  |         ui->startTxButton->setText(buttonText); | ||||||
|  | 
 | ||||||
|         ui->startTxButton->setEnabled(m_txFrameCountEstimate > 0); |         ui->startTxButton->setEnabled(m_txFrameCountEstimate > 0); | ||||||
|         ui->startTxButton->setFlat(false); |         ui->startTxButton->setFlat(false); | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jordan Sherer
						Jordan Sherer