diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.cpp | 58 | ||||
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.h | 2 | ||||
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.ui | 16 | ||||
-rw-r--r-- | ui/qt/bluetooth_device_dialog.cpp | 58 | ||||
-rw-r--r-- | ui/qt/bluetooth_device_dialog.h | 2 | ||||
-rw-r--r-- | ui/qt/bluetooth_device_dialog.ui | 16 | ||||
-rw-r--r-- | ui/qt/bluetooth_devices_dialog.cpp | 58 | ||||
-rw-r--r-- | ui/qt/bluetooth_devices_dialog.h | 2 | ||||
-rw-r--r-- | ui/qt/bluetooth_devices_dialog.ui | 16 | ||||
-rw-r--r-- | ui/qt/bluetooth_hci_summary_dialog.cpp | 55 | ||||
-rw-r--r-- | ui/qt/bluetooth_hci_summary_dialog.h | 2 | ||||
-rw-r--r-- | ui/qt/bluetooth_hci_summary_dialog.ui | 16 |
12 files changed, 291 insertions, 10 deletions
diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.cpp b/ui/qt/bluetooth_att_server_attributes_dialog.cpp index 1d1259beca..09aeacc74a 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.cpp +++ b/ui/qt/bluetooth_att_server_attributes_dialog.cpp @@ -22,9 +22,12 @@ #include "bluetooth_att_server_attributes_dialog.h" #include <ui_bluetooth_att_server_attributes_dialog.h> +#include "color_utils.h" + #include "epan/epan.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-btatt.h" @@ -76,7 +79,8 @@ BluetoothAttServerAttributesDialog::BluetoothAttServerAttributesDialog(QWidget & 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); @@ -130,10 +134,14 @@ void BluetoothAttServerAttributesDialog::changeEvent(QEvent *event) } -void BluetoothAttServerAttributesDialog::keyPressEvent(QKeyEvent *) +void BluetoothAttServerAttributesDialog::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(); } @@ -143,6 +151,50 @@ void BluetoothAttServerAttributesDialog::tableContextMenu(const QPoint &pos) } +void BluetoothAttServerAttributesDialog::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 BluetoothAttServerAttributesDialog::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 BluetoothAttServerAttributesDialog::on_actionCopy_Cell_triggered() { QClipboard *clipboard = QApplication::clipboard(); diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.h b/ui/qt/bluetooth_att_server_attributes_dialog.h index 292bda217b..cbe113075c 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.h +++ b/ui/qt/bluetooth_att_server_attributes_dialog.h @@ -82,6 +82,8 @@ private slots: void captureFileClosing(); void on_tableTreeWidget_itemActivated(QTreeWidgetItem *item, int); void on_buttonBox_clicked(QAbstractButton *button); + void on_actionMark_Unmark_Cell_triggered(); + void on_actionMark_Unmark_Row_triggered(); void on_actionCopy_Cell_triggered(); void on_actionCopy_Rows_triggered(); void on_actionCopy_All_triggered(); diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.ui b/ui/qt/bluetooth_att_server_attributes_dialog.ui index b5f5687c62..ea48e3f125 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.ui +++ b/ui/qt/bluetooth_att_server_attributes_dialog.ui @@ -195,6 +195,22 @@ <string>Save as image</string> </property> </action> + <action name="actionMark_Unmark_Row"> + <property name="text"> + <string>Mark/Unmark Row</string> + </property> + <property name="toolTip"> + <string>Mark/Unmark Row</string> + </property> + <property name="shortcut"> + <string>CtrlM</string> + </property> + </action> + <action name="actionMark_Unmark_Cell"> + <property name="text"> + <string>Mark/Unmark Cell</string> + </property> + </action> </widget> <resources/> <connections> diff --git a/ui/qt/bluetooth_device_dialog.cpp b/ui/qt/bluetooth_device_dialog.cpp index 07c4181baa..5bcf31bfd7 100644 --- a/ui/qt/bluetooth_device_dialog.cpp +++ b/ui/qt/bluetooth_device_dialog.cpp @@ -22,10 +22,13 @@ #include "bluetooth_device_dialog.h" #include <ui_bluetooth_device_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-bthci_cmd.h" #include "epan/dissectors/packet-bthci_evt.h" @@ -135,6 +138,8 @@ BluetoothDeviceDialog::BluetoothDeviceDialog(QWidget &parent, CaptureFile &cf, Q ui->tableWidget->setStyleSheet("QTableView::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); @@ -216,10 +221,57 @@ void BluetoothDeviceDialog::changeEvent(QEvent *event) } -void BluetoothDeviceDialog::keyPressEvent(QKeyEvent *) +void BluetoothDeviceDialog::keyPressEvent(QKeyEvent *event) +{ +/* 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(); +} + +void BluetoothDeviceDialog::on_actionMark_Unmark_Cell_triggered() +{ + QBrush fg; + QBrush bg; + + if (ui->tableWidget->currentItem()->background() == 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->tableWidget->currentItem()->setForeground(fg); + ui->tableWidget->currentItem()->setBackground(bg); +} + + +void BluetoothDeviceDialog::on_actionMark_Unmark_Row_triggered() { -/* NOTE: Do nothing, but in real it "takes focus" from button_box so allow user - * to use Enter button to jump to frame from table widget */ + QBrush fg; + QBrush bg; + bool is_marked = TRUE; + + for (int i = 0; i < ui->tableWidget->columnCount(); i += 1) { + if (ui->tableWidget->item((ui->tableWidget->currentItem())->row(), i)->background() != 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->tableWidget->columnCount(); i += 1) { + ui->tableWidget->item((ui->tableWidget->currentItem())->row(), i)->setForeground(fg); + ui->tableWidget->item((ui->tableWidget->currentItem())->row(), i)->setBackground(bg); + } } diff --git a/ui/qt/bluetooth_device_dialog.h b/ui/qt/bluetooth_device_dialog.h index b899a1300e..d5e0898608 100644 --- a/ui/qt/bluetooth_device_dialog.h +++ b/ui/qt/bluetooth_device_dialog.h @@ -93,6 +93,8 @@ private slots: void setTitle(QString bdAddr, QString name); void on_tableWidget_itemActivated(QTableWidgetItem *item); void on_buttonBox_clicked(QAbstractButton *button); + void on_actionMark_Unmark_Cell_triggered(); + void on_actionMark_Unmark_Row_triggered(); void on_actionCopy_Cell_triggered(); void on_actionCopy_Rows_triggered(); void on_actionCopy_All_triggered(); diff --git a/ui/qt/bluetooth_device_dialog.ui b/ui/qt/bluetooth_device_dialog.ui index 2b24d3915d..91411c5dd5 100644 --- a/ui/qt/bluetooth_device_dialog.ui +++ b/ui/qt/bluetooth_device_dialog.ui @@ -238,6 +238,22 @@ <string>Save as image</string> </property> </action> + <action name="actionMark_Unmark_Row"> + <property name="text"> + <string>Mark/Unmark Row</string> + </property> + <property name="toolTip"> + <string>Mark/Unmark Row</string> + </property> + <property name="shortcut"> + <string>CtrlM</string> + </property> + </action> + <action name="actionMark_Unmark_Cell"> + <property name="text"> + <string>Mark/Unmark Cell</string> + </property> + </action> </widget> <resources/> <connections> diff --git a/ui/qt/bluetooth_devices_dialog.cpp b/ui/qt/bluetooth_devices_dialog.cpp index 5698b81740..0940938916 100644 --- a/ui/qt/bluetooth_devices_dialog.cpp +++ b/ui/qt/bluetooth_devices_dialog.cpp @@ -24,10 +24,13 @@ #include "bluetooth_device_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_evt.h" @@ -95,6 +98,8 @@ BluetoothDevicesDialog::BluetoothDevicesDialog(QWidget &parent, CaptureFile &cf, 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); @@ -148,10 +153,14 @@ void BluetoothDevicesDialog::changeEvent(QEvent *event) } -void BluetoothDevicesDialog::keyPressEvent(QKeyEvent *) +void BluetoothDevicesDialog::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(); } @@ -172,6 +181,51 @@ void BluetoothDevicesDialog::tableItemDoubleClicked(QTreeWidgetItem *item, int c bluetooth_device_dialog->show(); } + +void BluetoothDevicesDialog::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 BluetoothDevicesDialog::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 BluetoothDevicesDialog::on_actionCopy_Cell_triggered() { QClipboard *clipboard = QApplication::clipboard(); diff --git a/ui/qt/bluetooth_devices_dialog.h b/ui/qt/bluetooth_devices_dialog.h index 63cebf889b..7d0e8fee9c 100644 --- a/ui/qt/bluetooth_devices_dialog.h +++ b/ui/qt/bluetooth_devices_dialog.h @@ -83,6 +83,8 @@ private slots: void captureFileClosing(); void on_tableTreeWidget_itemActivated(QTreeWidgetItem *item, int); void on_buttonBox_clicked(QAbstractButton *button); + void on_actionMark_Unmark_Cell_triggered(); + void on_actionMark_Unmark_Row_triggered(); void on_actionCopy_Cell_triggered(); void on_actionCopy_Rows_triggered(); void on_actionCopy_All_triggered(); diff --git a/ui/qt/bluetooth_devices_dialog.ui b/ui/qt/bluetooth_devices_dialog.ui index 3862951526..5a5ab534fd 100644 --- a/ui/qt/bluetooth_devices_dialog.ui +++ b/ui/qt/bluetooth_devices_dialog.ui @@ -178,6 +178,22 @@ <string>Save as image</string> </property> </action> + <action name="actionMark_Unmark_Row"> + <property name="text"> + <string>Mark/Unmark Row</string> + </property> + <property name="toolTip"> + <string>Mark/Unmark Row</string> + </property> + <property name="shortcut"> + <string>CtrlM</string> + </property> + </action> + <action name="actionMark_Unmark_Cell"> + <property name="text"> + <string>Mark/Unmark Cell</string> + </property> + </action> </widget> <resources/> <connections> 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(); diff --git a/ui/qt/bluetooth_hci_summary_dialog.h b/ui/qt/bluetooth_hci_summary_dialog.h index 2fd3999067..9f9488b819 100644 --- a/ui/qt/bluetooth_hci_summary_dialog.h +++ b/ui/qt/bluetooth_hci_summary_dialog.h @@ -98,6 +98,8 @@ private slots: void recursiveCopyTreeItems(QTreeWidgetItem *item, QString ©, int ident_level); void on_tableTreeWidget_itemActivated(QTreeWidgetItem *item, int); void on_buttonBox_clicked(QAbstractButton *button); + void on_actionMark_Unmark_Cell_triggered(); + void on_actionMark_Unmark_Row_triggered(); void on_actionCopy_Cell_triggered(); void on_actionCopy_Rows_triggered(); void on_actionCopy_All_triggered(); diff --git a/ui/qt/bluetooth_hci_summary_dialog.ui b/ui/qt/bluetooth_hci_summary_dialog.ui index b64b23db92..4b34b7c37b 100644 --- a/ui/qt/bluetooth_hci_summary_dialog.ui +++ b/ui/qt/bluetooth_hci_summary_dialog.ui @@ -622,6 +622,22 @@ <string>Save as image</string> </property> </action> + <action name="actionMark_Unmark_Row"> + <property name="text"> + <string>Mark/Unmark Row</string> + </property> + <property name="toolTip"> + <string>Mark/Unmark Row</string> + </property> + <property name="shortcut"> + <string>Ctrl+M</string> + </property> + </action> + <action name="actionMark_Unmark_Cell"> + <property name="text"> + <string>Mark/Unmark Cell</string> + </property> + </action> </widget> <resources/> <connections> |