From 7837ff5d74d3a863878ec72f72c3684bb895f8aa Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 3 Jul 2018 15:34:03 -0400 Subject: [PATCH] UI: Updated tableview behavior --- mainwindow.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ mainwindow.h | 4 ++++ 2 files changed, 52 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index be6ec32..59ef2c2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -5297,9 +5297,11 @@ void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button void MainWindow::on_logQSOButton_clicked() //Log QSO button { + /* if (!m_hisCall.size ()) { MessageBox::warning_message (this, tr ("Warning: DX Call field is empty.")); } + */ // m_dateTimeQSOOn should really already be set but we'll ensure it gets set to something just in case if (!m_dateTimeQSOOn.isValid ()) { m_dateTimeQSOOn = QDateTime::currentDateTimeUtc(); @@ -6246,6 +6248,52 @@ void MainWindow::on_rbFreeText_clicked(bool checked) } } +void MainWindow::on_tableWidgetRXAll_cellClicked(int row, int col){ + auto item = ui->tableWidgetRXAll->item(row, 0); + int offset = item->text().toInt(); + setFreq4(offset, offset); + + ui->tableWidgetCalls->selectionModel()->select( + ui->tableWidgetCalls->selectionModel()->selection(), + QItemSelectionModel::Deselect); +} + +void MainWindow::on_tableWidgetRXAll_cellDoubleClicked(int row, int col){ + on_tableWidgetRXAll_cellClicked(row, col); + + // TODO: jsherer - could also parse the messages for the last callsign? + auto item = ui->tableWidgetRXAll->item(row, 0); + int offset = item->text().toInt(); + foreach(auto d, m_callActivity.values()){ + if(d.freq == offset){ + ui->extFreeTextMsgEdit->append(d.call); + break; + } + } +} + +void MainWindow::on_tableWidgetCalls_cellClicked(int row, int col){ + auto item = ui->tableWidgetCalls->item(row, 0); + auto call = item->text(); + if(!m_callActivity.contains(call)){ + return; + } + int offset = m_callActivity[call].freq; + setFreq4(offset, offset); + + ui->tableWidgetRXAll->selectionModel()->select( + ui->tableWidgetRXAll->selectionModel()->selection(), + QItemSelectionModel::Deselect); +} + +void MainWindow::on_tableWidgetCalls_cellDoubleClicked(int row, int col){ + on_tableWidgetCalls_cellClicked(row, col); + + auto item = ui->tableWidgetCalls->item(row, 0); + auto call = item->text(); + ui->extFreeTextMsgEdit->append(call); +} + void MainWindow::on_freeTextMsg_currentTextChanged (QString const& text) { msgtype(text, ui->freeTextMsg->lineEdit ()); diff --git a/mainwindow.h b/mainwindow.h index 15f9c06..3d67c98 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -228,6 +228,10 @@ private slots: void on_pbSend73_clicked(); void on_rbGenMsg_clicked(bool checked); void on_rbFreeText_clicked(bool checked); + void on_tableWidgetRXAll_cellClicked(int row, int col); + void on_tableWidgetRXAll_cellDoubleClicked(int row, int col); + void on_tableWidgetCalls_cellClicked(int row, int col); + void on_tableWidgetCalls_cellDoubleClicked(int row, int col); void on_freeTextMsg_currentTextChanged (QString const&); void on_nextFreeTextMsg_currentTextChanged (QString const&); void on_extFreeTextMsg_currentTextChanged (QString const&);