diff options
Diffstat (limited to 'ui/qt/bluetooth_hci_summary_dialog.cpp')
-rw-r--r-- | ui/qt/bluetooth_hci_summary_dialog.cpp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/ui/qt/bluetooth_hci_summary_dialog.cpp b/ui/qt/bluetooth_hci_summary_dialog.cpp index 235a4bb770..e7ec986683 100644 --- a/ui/qt/bluetooth_hci_summary_dialog.cpp +++ b/ui/qt/bluetooth_hci_summary_dialog.cpp @@ -22,10 +22,13 @@ #include "bluetooth_hci_summary_dialog.h" #include <ui_bluetooth_hci_summary_dialog.h> +#include "color_utils.h" + #include "epan/epan.h" #include "epan/addr_resolv.h" #include "epan/to_str.h" #include "epan/epan_dissect.h" +#include "epan/prefs.h" #include "epan/dissectors/packet-bluetooth.h" #include "epan/dissectors/packet-bthci_cmd.h" #include "epan/dissectors/packet-bthci_evt.h" @@ -116,6 +119,8 @@ BluetoothHciSummaryDialog::BluetoothHciSummaryDialog(QWidget &parent, CaptureFil ui->tableTreeWidget->setStyleSheet("QTreeView::item:hover{background-color:lightyellow; color:black;}"); + context_menu_.addActions(QList<QAction *>() << ui->actionMark_Unmark_Cell); + context_menu_.addActions(QList<QAction *>() << ui->actionMark_Unmark_Row); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Cell); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Rows); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_All); @@ -182,10 +187,14 @@ void BluetoothHciSummaryDialog::changeEvent(QEvent *event) } -void BluetoothHciSummaryDialog::keyPressEvent(QKeyEvent *) +void BluetoothHciSummaryDialog::keyPressEvent(QKeyEvent *event) { -/* NOTE: Do nothing, but in real it "takes focus" from button_box so allow user +/* NOTE: Do nothing*, but in real it "takes focus" from button_box so allow user * to use Enter button to jump to frame from tree widget */ +/* * - reimplement shortcuts from contex menu */ + + if (event->modifiers() & Qt::ControlModifier && event->key()== Qt::Key_M) + on_actionMark_Unmark_Row_triggered(); } @@ -208,6 +217,48 @@ void BluetoothHciSummaryDialog::tableItemCollapsed(QTreeWidgetItem *) } } +void BluetoothHciSummaryDialog::on_actionMark_Unmark_Cell_triggered() +{ + QBrush fg; + QBrush bg; + + if (ui->tableTreeWidget->currentItem()->background(ui->tableTreeWidget->currentColumn()) == QBrush(ColorUtils::fromColorT(&prefs.gui_marked_bg))) { + fg = QBrush(); + bg = QBrush(); + } else { + fg = QBrush(ColorUtils::fromColorT(&prefs.gui_marked_fg)); + bg = QBrush(ColorUtils::fromColorT(&prefs.gui_marked_bg)); + } + + ui->tableTreeWidget->currentItem()->setForeground(ui->tableTreeWidget->currentColumn(), fg); + ui->tableTreeWidget->currentItem()->setBackground(ui->tableTreeWidget->currentColumn(), bg); +} + +void BluetoothHciSummaryDialog::on_actionMark_Unmark_Row_triggered() +{ + QBrush fg; + QBrush bg; + bool is_marked = TRUE; + + for (int i = 0; i < ui->tableTreeWidget->columnCount(); i += 1) { + if (ui->tableTreeWidget->currentItem()->background(i) != QBrush(ColorUtils::fromColorT(&prefs.gui_marked_bg))) + is_marked = FALSE; + } + + if (is_marked) { + fg = QBrush(); + bg = QBrush(); + } else { + fg = QBrush(ColorUtils::fromColorT(&prefs.gui_marked_fg)); + bg = QBrush(ColorUtils::fromColorT(&prefs.gui_marked_bg)); + } + + for (int i = 0; i < ui->tableTreeWidget->columnCount(); i += 1) { + ui->tableTreeWidget->currentItem()->setForeground(i, fg); + ui->tableTreeWidget->currentItem()->setBackground(i, bg); + } +} + void BluetoothHciSummaryDialog::on_actionCopy_Cell_triggered() { QClipboard *clipboard = QApplication::clipboard(); |