Commit 8288debb authored by Alexander Stippich's avatar Alexander Stippich
Browse files

remove finddevicesthread from select dialog

parent 3a876d47
......@@ -81,9 +81,6 @@ KSaneDeviceDialog::KSaneDeviceDialog(QWidget *parent)
topLayout->addWidget(bottomButtonBox);
setMinimumHeight(200);
m_findDevThread = FindSaneDevicesThread::getInstance();
connect(m_findDevThread, &FindSaneDevicesThread::finished, this, &KSaneDeviceDialog::updateDevicesList);
reloadDevicesList();
}
......@@ -101,9 +98,7 @@ void KSaneDeviceDialog::reloadDevicesList()
m_gbDevices->layout()->itemAt(0)->widget()->hide(); // explanation
m_btnReloadDevices->setEnabled(false);
if (!m_findDevThread->isRunning()) {
m_findDevThread->start();
}
Q_EMIT requestReloadList();
}
void KSaneDeviceDialog::setAvailable(bool isAvailable)
......@@ -129,11 +124,10 @@ QString KSaneDeviceDialog::getSelectedName() const
return QString();
}
void KSaneDeviceDialog::updateDevicesList()
void KSaneDeviceDialog::updateDevicesList(const QList<KSaneWidget::DeviceInfo> &list)
{
qDeleteAll(m_btnGroupDevices->buttons());
const QList<KSaneWidget::DeviceInfo> list = m_findDevThread->devicesList();
if (list.isEmpty()) {
m_gbDevices->setTitle(i18n("Sorry. No devices found."));
m_gbDevices->layout()->itemAt(0)->widget()->show(); // explanation
......
......@@ -16,7 +16,7 @@
#ifndef KSANE_DEVICE_DIALOG_H
#define KSANE_DEVICE_DIALOG_H
#include "ksanefinddevicesthread.h"
#include "ksanewidget.h"
#include <QGroupBox>
#include <QStringList>
......@@ -43,11 +43,15 @@ public:
void setDefault(const QString &);
public Q_SLOTS:
void updateDevicesList(const QList<KSaneWidget::DeviceInfo> &list);
void reloadDevicesList();
Q_SIGNALS:
void requestReloadList();
private Q_SLOTS:
void setAvailable(bool avail);
void updateDevicesList();
private:
QString m_defaultBackend;
......@@ -56,7 +60,6 @@ private:
QGroupBox *m_gbDevices;
QButtonGroup *m_btnGroupDevices;
QVBoxLayout *m_btnLayout;
FindSaneDevicesThread *m_findDevThread;
QPushButton *m_btnReloadDevices;
QPushButton *m_btnOk;
};
......
......@@ -292,7 +292,9 @@ QString KSaneWidget::selectDevice(QWidget *parent)
{
QString selected_name;
QPointer<KSaneDeviceDialog> sel = new KSaneDeviceDialog(parent);
connect(this, &KSaneWidget::availableDevices, sel, &KSaneDeviceDialog::updateDevicesList);
connect(sel, &KSaneDeviceDialog::requestReloadList, this, &KSaneWidget::initGetDeviceList);
// set default scanner - perhaps application using libksane should remember that
// 2014-01-21: gm: +1
// sel.setDefault(prev_backend);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment