#include "devicedialog.h" #include "ui_devicedialog.h" DeviceDialog::DeviceDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::DeviceDialog) { m_ui->setupUi(this); selectedDevice = QString(""); } DeviceDialog::~DeviceDialog() { delete m_ui; } void DeviceDialog::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: m_ui->retranslateUi(this); break; default: break; } } void DeviceDialog::on_buttonBox_accepted() { if (m_ui->deviceComboBox->currentText().isEmpty()) { QMessageBox::information(this, tr("Device not selected"), tr("Please select network device.")); } else { selectedDevice = m_ui->deviceComboBox->currentText(); accept(); } } QString DeviceDialog::getSelectedDevice() { return selectedDevice; } void DeviceDialog::addDevice(QString device) { m_ui->deviceComboBox->addItem(device); } void DeviceDialog::addDevices(QStringList devices) { m_ui->deviceComboBox->addItems(devices); } void DeviceDialog::clearDeviceList() { m_ui->deviceComboBox->clear(); }