Remove station from heard list

This commit is contained in:
Jordan Sherer 2018-07-27 02:22:48 -04:00
parent 21e87d8b6f
commit 6ad2417804

View File

@ -1078,8 +1078,18 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
auto clearAction4 = new QAction(QIcon::fromTheme("edit-clear"), QString("Clear"), ui->tableWidgetCalls); auto clearAction4 = new QAction(QIcon::fromTheme("edit-clear"), QString("Clear"), ui->tableWidgetCalls);
connect(clearAction4, &QAction::triggered, this, [this](){ this->on_clearAction_triggered(ui->tableWidgetCalls); }); connect(clearAction4, &QAction::triggered, this, [this](){ this->on_clearAction_triggered(ui->tableWidgetCalls); });
auto removeStation = new QAction(QString("Remove Station"), ui->tableWidgetCalls);
connect(removeStation, &QAction::triggered, this, [this](){
QString selectedCall = callsignSelected();
if(!selectedCall.isEmpty() && m_callActivity.contains(selectedCall)){
m_callActivity.remove(selectedCall);
displayActivity(true);
}
});
ui->tableWidgetCalls->setContextMenuPolicy(Qt::CustomContextMenu); ui->tableWidgetCalls->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tableWidgetCalls, &QTableWidget::customContextMenuRequested, this, [this, clearAction4, clearActionAll](QPoint const &point){ connect(ui->tableWidgetCalls, &QTableWidget::customContextMenuRequested, this, [this, clearAction4, clearActionAll, removeStation](QPoint const &point){
QMenu * menu = new QMenu(ui->tableWidgetCalls); QMenu * menu = new QMenu(ui->tableWidgetCalls);
QString selectedCall = callsignSelected(); QString selectedCall = callsignSelected();
@ -1092,6 +1102,12 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
directedMenu->setDisabled(missingCallsign); directedMenu->setDisabled(missingCallsign);
buildQueryMenu(directedMenu); buildQueryMenu(directedMenu);
menu->addSeparator();
removeStation->setDisabled(missingCallsign || callsignSelected() == "ALLCALL");
menu->addAction(removeStation);
menu->addSeparator(); menu->addSeparator();
menu->addAction(clearAction4); menu->addAction(clearAction4);
menu->addAction(clearActionAll); menu->addAction(clearActionAll);