Double-click on call in Messages window now sets Tx mode and report, as in main window.

This commit is contained in:
Joe Taylor 2021-05-22 09:55:43 -04:00
parent 028b217df3
commit 0fc609ce5f
4 changed files with 13 additions and 8 deletions

View File

@ -1793,7 +1793,7 @@ void MainWindow::doubleClickOnCall(QString hiscall, bool ctrl)
} }
} }
//doubleClickOnMessages //doubleClickOnMessages
void MainWindow::doubleClickOnMessages(QString hiscall, QString t2) void MainWindow::doubleClickOnMessages(QString hiscall, QString t2, bool ctrl)
{ {
if(hiscall.length()<3) return; if(hiscall.length()<3) return;
if(m_worked[hiscall]) { if(m_worked[hiscall]) {
@ -1804,6 +1804,9 @@ void MainWindow::doubleClickOnMessages(QString hiscall, QString t2)
m_txFirst = ((n%2) == 1); m_txFirst = ((n%2) == 1);
ui->txFirstCheckBox->setChecked(m_txFirst); ui->txFirstCheckBox->setChecked(m_txFirst);
if((t2.indexOf(":")<0) and m_modeTx!="JT65") on_pbTxMode_clicked();
if((t2.indexOf(":")>0) and m_modeTx!="Q65") on_pbTxMode_clicked();
auto const& words = t2.mid(25).split(' ', Qt::SkipEmptyParts); auto const& words = t2.mid(25).split(' ', Qt::SkipEmptyParts);
QString grid=words[2]; QString grid=words[2];
if(isGrid4(grid) and hiscall==words[1]) { if(isGrid4(grid) and hiscall==words[1]) {
@ -1813,7 +1816,7 @@ void MainWindow::doubleClickOnMessages(QString hiscall, QString t2)
} }
QString rpt=""; QString rpt="";
if(m_modeTx=="Q65") rpt=t2.mid(20,3); if(ctrl or m_modeTx=="Q65") rpt=t2.mid(20,3);
genStdMsgs(rpt); genStdMsgs(rpt);
if(t2.indexOf(m_myCall)>0) { if(t2.indexOf(m_myCall)>0) {

View File

@ -51,7 +51,7 @@ public slots:
void editor_error(); void editor_error();
void guiUpdate(); void guiUpdate();
void doubleClickOnCall(QString hiscall, bool ctrl); void doubleClickOnCall(QString hiscall, bool ctrl);
void doubleClickOnMessages(QString hiscall, QString t2); void doubleClickOnMessages(QString hiscall, QString t2, bool ctrl);
private: private:
virtual void keyPressEvent (QKeyEvent *) override; virtual void keyPressEvent (QKeyEvent *) override;

View File

@ -71,7 +71,7 @@ void Messages::setText(QString t, QString t2)
} }
} }
void Messages::selectCallsign2(bool /*ctrl*/) void Messages::selectCallsign2(bool ctrl)
{ {
QString t = ui->messagesTextBrowser->toPlainText(); //Full contents QString t = ui->messagesTextBrowser->toPlainText(); //Full contents
int i=ui->messagesTextBrowser->textCursor().position(); int i=ui->messagesTextBrowser->textCursor().position();
@ -80,10 +80,12 @@ void Messages::selectCallsign2(bool /*ctrl*/)
QString hiscall=t.mid(i0+1,i1-i0-1); QString hiscall=t.mid(i0+1,i1-i0-1);
if(hiscall!="") { if(hiscall!="") {
if(hiscall.length() < 13) { if(hiscall.length() < 13) {
QString t1 = t.mid(0,i+14); //contents up to text cursor QString t1 = t.mid(0,i); //contents up to text cursor
int i1=t1.lastIndexOf("\n") + 1; int i1=t1.lastIndexOf("\n") + 1;
QString t2 = t1.mid(i1,i+14-i1); //selected line QString t2 = t.mid(i1,-1); //selected line to end
emit click2OnCallsign(hiscall,t2); int i2=t2.indexOf("\n");
t2=t2.left(i2); //selected line
emit click2OnCallsign(hiscall,t2,ctrl);
} }
} }
} }

View File

@ -19,7 +19,7 @@ public:
~Messages(); ~Messages();
signals: signals:
void click2OnCallsign(QString hiscall, QString t2); void click2OnCallsign(QString hiscall, QString t2, bool ctrl);
private slots: private slots:
void selectCallsign2(bool ctrl); void selectCallsign2(bool ctrl);