Selection tracking

This commit is contained in:
Jordan Sherer 2018-07-03 02:02:19 -04:00
parent 0a95c79f3a
commit d048f5a2ab
2 changed files with 53 additions and 18 deletions

View File

@ -2860,7 +2860,7 @@ void MainWindow::readFromStdout() //readFromStdout
{
while(proc_jt9.canReadLine()) {
QByteArray t=proc_jt9.readLine();
qDebug()<< QString(t);
qDebug() << "JT9: " << QString(t);
if(m_mode=="FT8" and !m_config.bHound() and t.contains(";")) {
if(t.contains("<...>")) continue;
if(!m_bWarnedHound) {
@ -7090,6 +7090,11 @@ void MainWindow::postDecode (bool is_new, QString const& message)
// TODO: keep track of selection
int selectedOffset = -1;
auto selectedItems = ui->tableWidgetRXAll->selectedItems();
if(!selectedItems.isEmpty()){
selectedOffset = selectedItems.first()->text().toInt();
}
int now = QDateTime::currentDateTimeUtc().toMSecsSinceEpoch();
for(int i = ui->tableWidgetRXAll->rowCount(); i >= 0; i--){
ui->tableWidgetRXAll->removeRow(i);
@ -7117,17 +7122,34 @@ void MainWindow::postDecode (bool is_new, QString const& message)
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 0, new QTableWidgetItem(QString("%1").arg(offset)));
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 1, new QTableWidgetItem(QString("%1").arg(snr)));
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 2, new QTableWidgetItem(joined));
if(offset == selectedOffset){
ui->tableWidgetRXAll->selectRow(ui->tableWidgetRXAll->rowCount() - 1);
}
}
}
ui->tableWidgetRXAll->resizeColumnsToContents();
// TODO: keep track of selection
ui->listWidget->clear();
ui->listWidget->addItem("allcall");
QString selectedCall;
auto selectedCalls = ui->tableWidgetCalls->selectedItems();
if(!selectedCalls.isEmpty()){
selectedCall = selectedCalls.first()->text();
}
for(int i = ui->tableWidgetCalls->rowCount(); i >= 0; i--){
ui->tableWidgetCalls->removeRow(i);
}
ui->tableWidgetCalls->insertRow(ui->tableWidgetCalls->rowCount());
ui->tableWidgetCalls->setItem(ui->tableWidgetCalls->rowCount() - 1, 0, new QTableWidgetItem("allcall"));
QList<QString> calls = m_callActivity.keys();
qSort(calls.begin(), calls.end());
foreach(QString call, calls){
ui->listWidget->addItem(call);
ui->tableWidgetCalls->insertRow(ui->tableWidgetCalls->rowCount());
ui->tableWidgetCalls->setItem(ui->tableWidgetCalls->rowCount() - 1, 0, new QTableWidgetItem(call));
if(call == selectedCall){
ui->tableWidgetCalls->selectRow(ui->tableWidgetCalls->rowCount() - 1);
}
}
}

View File

@ -835,23 +835,36 @@ QTextEdit[readOnly=&quot;true&quot;] {
</property>
</widget>
</widget>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QTableWidget" name="tableWidgetCalls">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="styleSheet">
<string notr="true">QListWidget { background:rgb(255, 255, 255); }</string>
<property name="gridStyle">
<enum>Qt::DotLine</enum>
</property>
<item>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>0</string>
</property>
</row>
<column>
<property name="text">
<string>Callsign</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>allcall</string>
</property>