-
Notifications
You must be signed in to change notification settings - Fork 1
/
settingsdialog.cpp
56 lines (44 loc) · 1.14 KB
/
settingsdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
#include <QDebug>
SettingsDialog::SettingsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingsDialog)
{
devices=PcapLiveDeviceList::getInstance().getPcapLiveDevicesList();
if(devices.size())
selectedDevice=devices[0];
else
selectedDevice=NULL;
captureTime=10;
ui->setupUi(this);
SetUpListDevices();
}
SettingsDialog::~SettingsDialog()
{
delete ui;
}
PcapLiveDevice* SettingsDialog::getSelectedDevice(){
return selectedDevice;
}
int SettingsDialog::getCaptureTime(){
return captureTime;
}
void SettingsDialog::SetUpListDevices()
{
for(int i=0;i<devices.size();i++){
//qDebug()<<QString::fromUtf8(devices[i]->getName());
QString label=QString::fromUtf8(devices[i]->getName());
ui->listWidget->addItem(label);
}
}
void SettingsDialog::on_listWidget_itemDoubleClicked(QListWidgetItem *item)
{
for(int i=0;i<devices.size();i++){
if(QString::fromUtf8(devices[i]->getName())==item->text()){
selectedDevice=devices[i];
break;
}
}
this->hide();
}