void DevicesModel::deviceStatusChanged(const QString& id) { Q_UNUSED(id); //FIXME: Emitting dataChanged does not invalidate the view, refreshDeviceList does. //Q_EMIT dataChanged(index(0),index(rowCount())); refreshDeviceList(); }
void DevicesModel::setDisplayFilter(int flags) { m_displayFilter = (StatusFilterFlag)flags; const bool reachableNeeded = (m_displayFilter & StatusFilterFlag::Reachable); if (reachableNeeded) m_dbusInterface->acquireDiscoveryMode(*s_keyId); else m_dbusInterface->releaseDiscoveryMode(*s_keyId); refreshDeviceList(); }
DevicesModel::DevicesModel(QObject *parent) : QAbstractListModel(parent) , m_dbusInterface(new DaemonDbusInterface(this)) , m_displayFilter(DevicesModel::StatusUnknown) { //new ModelTest(this, this); connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SIGNAL(rowsChanged())); connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SIGNAL(rowsChanged())); connect(m_dbusInterface, SIGNAL(deviceAdded(QString)), this, SLOT(deviceAdded(QString))); connect(m_dbusInterface, SIGNAL(deviceVisibilityChanged(QString,bool)), this, SLOT(deviceStatusChanged(QString))); connect(m_dbusInterface, SIGNAL(deviceRemoved(QString)), this, SLOT(deviceRemoved(QString))); refreshDeviceList(); }
void DevicesModel::deviceRemoved(const QString& id) { //TODO: Actually remove instead of refresh Q_UNUSED(id); refreshDeviceList(); }
void DevicesModel::setDisplayFilter(int flags) { m_displayFilter = (StatusFlag)flags; refreshDeviceList(); }