![Gerald Combs](/assets/img/avatar_default.png)
Convert QTableWidget to QTreeWidget. It looks like the GTK+ version has a separate set of apply/save buttons for each tab which *only* operates on that tab. This can result unexpected behavior which throws away changes if the user updates more than one tab. Use a single "OK" button that applies all of our changes instead. Reorder the tabs. Put Local Interfaces first and select it by default. Always show Remote Interfaces. Disable it on platforms that don't have PCAP_REMOTE. Automatically start editing when we add a new pipe. Don't immediately update pipe interface settings. Wait until we hit "OK" instead. Rename NewFileDelegate to PathChooserDelegate. Note that we might want to move it use it elsewhere in the application. Try switching the user-facing terminology from "Hide" to the more positive "Show". Tell the user that we don't save pipe or remote interface settings. Add a help URL for the "Manage Interfaces" dialog box. Use the GLib and Qt string functions and classes to split and join comma-separated preferences. This makes sure capture_dev_user_descr_find doesn't skip over the first interface. It also keeps the Qt code from adding a leading comma to our capture preferences. Add a note about strings to README.qt. Summary: Use QStrings. For another day: - If we *do* save remote settings we need to store credentials securely, e.g. with CryptProtectData. - Get rid of the remote settings dialogs. Their controls should fit in the remote settings tab. - Add an extcap tab. - We need getter/setter functions for global_capture_opts.all_ifaces. We iterate over it *way* too much. Change-Id: Ib7b61972f3ece4325e0230f725e7f2678acbb24b Reviewed-on: https://code.wireshark.org/review/3873 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
103 lines
3.6 KiB
C++
103 lines
3.6 KiB
C++
/* remote_settings_dialog.cpp
|
|
*
|
|
* Wireshark - Network traffic analyzer
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
* Copyright 1998 Gerald Combs
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
// XXX This shouldn't exist. These controls should be in ManageInterfacesDialog instead.
|
|
|
|
#include "config.h"
|
|
#ifdef HAVE_PCAP_REMOTE
|
|
#include "remote_settings_dialog.h"
|
|
#include "ui_remote_settings_dialog.h"
|
|
|
|
RemoteSettingsDialog::RemoteSettingsDialog(QWidget *parent, interface_t *iface) :
|
|
QDialog(parent),
|
|
ui(new Ui::RemoteSettingsDialog)
|
|
{
|
|
ui->setupUi(this);
|
|
mydevice.name = g_strdup(iface->name);
|
|
ui->rpcapBox->setCheckState(iface->remote_opts.remote_host_opts.nocap_rpcap?Qt::Checked:Qt::Unchecked);
|
|
ui->udpBox->setCheckState(iface->remote_opts.remote_host_opts.datatx_udp?Qt::Checked:Qt::Unchecked);
|
|
#ifdef HAVE_PCAP_SETSAMPLING
|
|
switch (iface->remote_opts.sampling_method)
|
|
{
|
|
case CAPTURE_SAMP_NONE:
|
|
ui->sampleNone->setChecked(true);
|
|
break;
|
|
case CAPTURE_SAMP_BY_COUNT:
|
|
ui->samplePkt->setChecked(true);
|
|
ui->spinPkt->setValue(iface->remote_opts.sampling_param);
|
|
break;
|
|
case CAPTURE_SAMP_BY_TIMER:
|
|
ui->sampleTime->setChecked(true);
|
|
ui->spinTime->setValue(iface->remote_opts.sampling_param);
|
|
break;
|
|
}
|
|
#else
|
|
ui->sampleLabel->setVisible(false);
|
|
ui->sampleNone->setVisible(false);
|
|
ui->samplePkt->setVisible(false);
|
|
ui->sampleTime->setVisible(false);
|
|
ui->spinPkt->setVisible(false);
|
|
ui->spinTime->setVisible(false);
|
|
ui->pktLabel->setVisible(false);
|
|
ui->timeLabel->setVisible(false);
|
|
resize(width(), height() - ui->sampleLabel->height() - 3 * ui->sampleNone->height());
|
|
#endif
|
|
connect(this, SIGNAL(remoteSettingsChanged(interface_t *)), parent, SIGNAL(remoteSettingsChanged(interface_t *)));
|
|
}
|
|
|
|
RemoteSettingsDialog::~RemoteSettingsDialog()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void RemoteSettingsDialog::on_buttonBox_accepted()
|
|
{
|
|
mydevice.remote_opts.remote_host_opts.nocap_rpcap = (ui->rpcapBox->checkState()==Qt::Checked)?true:false;
|
|
mydevice.remote_opts.remote_host_opts.datatx_udp = (ui->udpBox->checkState()==Qt::Checked)?true:false;
|
|
#ifdef HAVE_PCAP_SETSAMPLING
|
|
if (ui->sampleNone->isChecked()) {
|
|
mydevice.remote_opts.sampling_method = CAPTURE_SAMP_NONE;
|
|
mydevice.remote_opts.sampling_param = 0;
|
|
} else if (ui->samplePkt->isChecked()) {
|
|
mydevice.remote_opts.sampling_method = CAPTURE_SAMP_BY_COUNT;
|
|
mydevice.remote_opts.sampling_param = ui->spinPkt->value();
|
|
} else {
|
|
mydevice.remote_opts.sampling_method = CAPTURE_SAMP_BY_TIMER;
|
|
mydevice.remote_opts.sampling_param = ui->spinTime->value();
|
|
}
|
|
#endif
|
|
emit remoteSettingsChanged(&mydevice);
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Editor modelines
|
|
*
|
|
* Local Variables:
|
|
* c-basic-offset: 4
|
|
* tab-width: 8
|
|
* indent-tabs-mode: nil
|
|
* End:
|
|
*
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
*/
|