Warning message for stupid messages
This commit is contained in:
		
							parent
							
								
									a5a6c95a44
								
							
						
					
					
						commit
						00685b9117
					
				| @ -5225,12 +5225,24 @@ bool MainWindow::ensureSelcalCallsignSelected(bool alert){ | |||||||
|     bool blockTransmit = ui->selcalButton->isChecked() && (isAllCall || missingCall); |     bool blockTransmit = ui->selcalButton->isChecked() && (isAllCall || missingCall); | ||||||
| 
 | 
 | ||||||
|     if(blockTransmit && alert){ |     if(blockTransmit && alert){ | ||||||
|         MessageBox::warning_message(this, tr ("Please select or enter a callsign to direct this message while SELCAL is enabled.")); |         MessageBox::warning_message(this, tr ("Please select or enter a callsign to direct this message while SELCALL is enabled.")); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return !blockTransmit; |     return !blockTransmit; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool MainWindow::ensureKeyNotStuck(QString const& text){ | ||||||
|  |     // be annoying and drop messages with all the same character to reduce spam...
 | ||||||
|  |     if(text.length() > 10 && QString(text).replace(text.at(0), "").isEmpty()){ | ||||||
|  | 
 | ||||||
|  |         MessageBox::warning_message(this, tr ("Please enter a message before trying to transmit")); | ||||||
|  | 
 | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MainWindow::createMessage(QString const& text){ | void MainWindow::createMessage(QString const& text){ | ||||||
|     if(!ensureCallsignSet()){ |     if(!ensureCallsignSet()){ | ||||||
|         on_stopTxButton_clicked(); |         on_stopTxButton_clicked(); | ||||||
| @ -5242,6 +5254,11 @@ void MainWindow::createMessage(QString const& text){ | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     if(!ensureKeyNotStuck(text)){ | ||||||
|  |         on_stopTxButton_clicked(); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     if(text.contains("APRS:") && !m_aprsClient->isPasscodeValid()){ |     if(text.contains("APRS:") && !m_aprsClient->isPasscodeValid()){ | ||||||
|         MessageBox::warning_message(this, tr ("Please ensure a valid APRS passcode is set in the settings when sending an APRS packet.")); |         MessageBox::warning_message(this, tr ("Please ensure a valid APRS passcode is set in the settings when sending an APRS packet.")); | ||||||
|         return; |         return; | ||||||
| @ -6697,7 +6714,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ | |||||||
|         if(m_config.transmit_directed()) toggleTx(true); |         if(m_config.transmit_directed()) toggleTx(true); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     auto sevenThreeAction = menu->addAction(QString("%1 73 - I send my best regards / end of contact").arg(call).trimmed()); |     auto sevenThreeAction = menu->addAction(QString("%1 73 - I send my best regards").arg(call).trimmed()); | ||||||
|     connect(sevenThreeAction, &QAction::triggered, this, [this](){ |     connect(sevenThreeAction, &QAction::triggered, this, [this](){ | ||||||
| 
 | 
 | ||||||
|         QString selectedCall = callsignSelected(); |         QString selectedCall = callsignSelected(); | ||||||
| @ -6709,6 +6726,19 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ | |||||||
| 
 | 
 | ||||||
|         if(m_config.transmit_directed()) toggleTx(true); |         if(m_config.transmit_directed()) toggleTx(true); | ||||||
|     }); |     }); | ||||||
|  | 
 | ||||||
|  |     auto skAction = menu->addAction(QString("%1 SK - End of contact").arg(call).trimmed()); | ||||||
|  |     connect(skAction, &QAction::triggered, this, [this](){ | ||||||
|  | 
 | ||||||
|  |         QString selectedCall = callsignSelected(); | ||||||
|  |         if(selectedCall.isEmpty()){ | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         addMessageText(QString("%1 SK").arg(selectedCall), true); | ||||||
|  | 
 | ||||||
|  |         if(m_config.transmit_directed()) toggleTx(true); | ||||||
|  |     }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWindow::buildRelayMenu(QMenu *menu){ | void MainWindow::buildRelayMenu(QMenu *menu){ | ||||||
|  | |||||||
| @ -151,6 +151,7 @@ public slots: | |||||||
|   void initializeDummyData(); |   void initializeDummyData(); | ||||||
|   bool ensureCallsignSet(bool alert=true); |   bool ensureCallsignSet(bool alert=true); | ||||||
|   bool ensureSelcalCallsignSelected(bool alert=true); |   bool ensureSelcalCallsignSelected(bool alert=true); | ||||||
|  |   bool ensureKeyNotStuck(QString const& text); | ||||||
|   void createMessage(QString const& text); |   void createMessage(QString const& text); | ||||||
|   void createMessageTransmitQueue(QString const& text); |   void createMessageTransmitQueue(QString const& text); | ||||||
|   void resetMessageTransmitQueue(); |   void resetMessageTransmitQueue(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jordan Sherer
						Jordan Sherer