diff options
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.cpp | 25 | ||||
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.h | 4 | ||||
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.ui | 10 |
3 files changed, 31 insertions, 8 deletions
diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.cpp b/ui/qt/bluetooth_att_server_attributes_dialog.cpp index 69fecc2c3a..03b6ab4e84 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.cpp +++ b/ui/qt/bluetooth_att_server_attributes_dialog.cpp @@ -34,6 +34,7 @@ #include <QContextMenuEvent> #include <QPushButton> #include <QTreeWidget> +#include <QFileDialog> static const int column_number_handle = 0; static const int column_number_uuid = 1; @@ -134,8 +135,8 @@ BluetoothAttServerAttributesDialog::BluetoothAttServerAttributesDialog(QWidget & context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Cell); context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Rows); - - copy_all_button_ = ui->buttonBox->addButton(tr("Copy All"), QDialogButtonBox::ApplyRole); + context_menu_.addActions(QList<QAction *>() << ui->actionCopy_All); + context_menu_.addActions(QList<QAction *>() << ui->actionSave_as_image); tapinfo_.tap_packet = tapPacket; tapinfo_.tap_reset = tapReset; @@ -330,7 +331,7 @@ void BluetoothAttServerAttributesDialog::on_tableTreeWidget_itemActivated(QTreeW } -void BluetoothAttServerAttributesDialog::copyAll() +void BluetoothAttServerAttributesDialog::on_actionCopy_All_triggered() { QClipboard *clipboard = QApplication::clipboard(); QString copy; @@ -353,11 +354,23 @@ void BluetoothAttServerAttributesDialog::copyAll() clipboard->setText(copy); } +void BluetoothAttServerAttributesDialog::on_actionSave_as_image_triggered() +{ + QPixmap image; + + QString fileName = QFileDialog::getSaveFileName(this, tr("Save Table Image"), + "att_server_attributes_table.png", + tr("PNG Image (*.png)")); + + if (fileName.isEmpty()) return; + + image = QPixmap::grabWidget(ui->tableTreeWidget); + image.save(fileName, "PNG"); +} -void BluetoothAttServerAttributesDialog::on_buttonBox_clicked(QAbstractButton *button) +void BluetoothAttServerAttributesDialog::on_buttonBox_clicked(QAbstractButton *button _U_) { - if (button == copy_all_button_) - copyAll(); +/* if (button == foo_button_) */ } /* diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.h b/ui/qt/bluetooth_att_server_attributes_dialog.h index 10e0909f45..0612c07789 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.h +++ b/ui/qt/bluetooth_att_server_attributes_dialog.h @@ -72,12 +72,10 @@ private: Ui::BluetoothAttServerAttributesDialog *ui; tapinfo_t tapinfo_; - QPushButton *copy_all_button_; QMenu context_menu_; static void tapReset(void *tapinfo_ptr); static gboolean tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data); - void copyAll(); private slots: void captureFileClosing(); @@ -85,6 +83,8 @@ private slots: void on_buttonBox_clicked(QAbstractButton *button); void on_actionCopy_Cell_triggered(); void on_actionCopy_Rows_triggered(); + void on_actionCopy_All_triggered(); + void on_actionSave_as_image_triggered(); void tableContextMenu(const QPoint &pos); void interfaceCurrentIndexChanged(int index); void deviceCurrentIndexChanged(int index); diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.ui b/ui/qt/bluetooth_att_server_attributes_dialog.ui index affff437a3..b5f5687c62 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.ui +++ b/ui/qt/bluetooth_att_server_attributes_dialog.ui @@ -185,6 +185,16 @@ <string>Copy Rows</string> </property> </action> + <action name="actionCopy_All"> + <property name="text"> + <string>Copy All</string> + </property> + </action> + <action name="actionSave_as_image"> + <property name="text"> + <string>Save as image</string> + </property> + </action> </widget> <resources/> <connections> |