forked from osmocom/wireshark
Qt: Add copy from another profile for UAT frames
Add a new button to UAT frames to copy entries from another profile. Change-Id: I9decb5ed5d67e97388ee7b22a15cacae4d5a3621 Reviewed-on: https://code.wireshark.org/review/30084 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
parent
75c370fe54
commit
420c4ecc56
|
@ -52,8 +52,9 @@ since version 2.6.0:
|
|||
* The SSL dissector has been renamed to TLS. As with BOOTP the old
|
||||
“ssl.*” display filter fields are supported but may be removed in a
|
||||
future release.
|
||||
* Coloring rules, IO graphs and protocol preference tables can now be copied
|
||||
from other profiles using a button in the corresponding configuration dialogs.
|
||||
* Coloring rules, IO graphs, Filter Buttons and protocol preference tables
|
||||
can now be copied from other profiles using a button in the corresponding
|
||||
configuration dialogs.
|
||||
|
||||
=== Removed Features and Support
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <ui/qt/widgets/display_filter_edit.h>
|
||||
#include "wireshark_application.h"
|
||||
|
||||
#include <ui/qt/widgets/copy_from_profile_menu.h>
|
||||
#include <ui/qt/utils/qt_ui_utils.h>
|
||||
#include <wsutil/report_message.h>
|
||||
|
||||
|
@ -33,6 +34,7 @@ UatFrame::UatFrame(QWidget *parent) :
|
|||
ui(new Ui::UatFrame),
|
||||
uat_model_(NULL),
|
||||
uat_delegate_(NULL),
|
||||
copy_from_menu_(NULL),
|
||||
uat_(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -44,6 +46,7 @@ UatFrame::UatFrame(QWidget *parent) :
|
|||
ui->moveUpToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||
ui->moveDownToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||
ui->clearToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||
ui->copyFromProfileButton->setAttribute(Qt::WA_MacSmallSize, true);
|
||||
ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true);
|
||||
#endif
|
||||
|
||||
|
@ -66,6 +69,7 @@ UatFrame::~UatFrame()
|
|||
delete ui;
|
||||
delete uat_delegate_;
|
||||
delete uat_model_;
|
||||
delete copy_from_menu_;
|
||||
}
|
||||
|
||||
void UatFrame::setUat(epan_uat *uat)
|
||||
|
@ -82,6 +86,13 @@ void UatFrame::setUat(epan_uat *uat)
|
|||
title = uat_->name;
|
||||
}
|
||||
|
||||
if (uat->from_profile) {
|
||||
copy_from_menu_ = new CopyFromProfileMenu(uat_->filename);
|
||||
ui->copyFromProfileButton->setMenu(copy_from_menu_);
|
||||
ui->copyFromProfileButton->setEnabled(copy_from_menu_->haveProfiles());
|
||||
connect(copy_from_menu_, SIGNAL(triggered(QAction *)), this, SLOT(copyFromProfile(QAction *)));
|
||||
}
|
||||
|
||||
QString abs_path = gchar_free_to_qstring(uat_get_actual_filename(uat_, FALSE));
|
||||
ui->pathLabel->setText(abs_path);
|
||||
ui->pathLabel->setUrl(QUrl::fromLocalFile(abs_path).toString());
|
||||
|
@ -104,6 +115,25 @@ void UatFrame::setUat(epan_uat *uat)
|
|||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
void UatFrame::copyFromProfile(QAction *action)
|
||||
{
|
||||
QString filename = action->data().toString();
|
||||
|
||||
gchar *err = NULL;
|
||||
if (uat_load(uat_, filename.toUtf8().constData(), &err)) {
|
||||
uat_->changed = TRUE;
|
||||
uat_model_->reloadUat();
|
||||
} else {
|
||||
report_failure("Error while loading %s: %s", uat_->name, err);
|
||||
g_free(err);
|
||||
}
|
||||
}
|
||||
|
||||
void UatFrame::showEvent(QShowEvent *)
|
||||
{
|
||||
ui->copyFromProfileButton->setFixedHeight(ui->copyToolButton->geometry().height());
|
||||
}
|
||||
|
||||
void UatFrame::applyChanges()
|
||||
{
|
||||
if (!uat_) return;
|
||||
|
@ -224,7 +254,7 @@ void UatFrame::modelRowsRemoved()
|
|||
void UatFrame::modelRowsReset()
|
||||
{
|
||||
ui->deleteToolButton->setEnabled(false);
|
||||
ui->clearToolButton->setEnabled(false);
|
||||
ui->clearToolButton->setEnabled(uat_model_->rowCount() != 0);
|
||||
ui->copyToolButton->setEnabled(false);
|
||||
ui->moveUpToolButton->setEnabled(false);
|
||||
ui->moveDownToolButton->setEnabled(false);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include <ui/qt/models/uat_model.h>
|
||||
#include <ui/qt/models/uat_delegate.h>
|
||||
|
||||
class CopyFromProfileMenu;
|
||||
|
||||
namespace Ui {
|
||||
class UatFrame;
|
||||
}
|
||||
|
@ -33,11 +35,15 @@ public:
|
|||
void acceptChanges();
|
||||
void rejectChanges();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
|
||||
private:
|
||||
Ui::UatFrame *ui;
|
||||
|
||||
UatModel *uat_model_;
|
||||
UatDelegate *uat_delegate_;
|
||||
CopyFromProfileMenu *copy_from_menu_;
|
||||
struct epan_uat *uat_;
|
||||
|
||||
void checkForErrorHint(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
|
@ -46,6 +52,7 @@ private:
|
|||
void applyChanges();
|
||||
|
||||
private slots:
|
||||
void copyFromProfile(QAction *action);
|
||||
void modelDataChanged(const QModelIndex &topLeft);
|
||||
void modelRowsRemoved();
|
||||
void modelRowsReset();
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,1">
|
||||
<item>
|
||||
<widget class="QToolButton" name="newToolButton">
|
||||
<property name="toolTip">
|
||||
|
@ -140,6 +140,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyFromProfileButton">
|
||||
<property name="toolTip">
|
||||
<string>Copy entries from another profile.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy from</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ElidedLabel" name="pathLabel">
|
||||
<property name="sizePolicy">
|
||||
|
|
Loading…
Reference in New Issue