mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
parent
6069e8f441
commit
755d7dc6ab
8 changed files with 115 additions and 23 deletions
|
@ -20,6 +20,9 @@ DriveListModel::DriveListModel(QObject *parent)
|
|||
{isScsiRole, "isScsi"},
|
||||
{mountpointsRole, "mountpoints"}
|
||||
};
|
||||
|
||||
// Enumerate drives in seperate thread, but process results in UI thread
|
||||
connect(&_thread, SIGNAL(newDriveList(std::vector<Drivelist::DeviceDescriptor>)), SLOT(processDriveList(std::vector<Drivelist::DeviceDescriptor>)));
|
||||
}
|
||||
|
||||
int DriveListModel::rowCount(const QModelIndex &) const
|
||||
|
@ -45,11 +48,10 @@ QVariant DriveListModel::data(const QModelIndex &index, int role) const
|
|||
return _drivelist.values().at(row)->property(propertyName);
|
||||
}
|
||||
|
||||
void DriveListModel::refreshDriveList()
|
||||
void DriveListModel::processDriveList(std::vector<Drivelist::DeviceDescriptor> l)
|
||||
{
|
||||
bool changes = false;
|
||||
bool filterSystemDrives = DRIVELIST_FILTER_SYSTEM_DRIVES;
|
||||
auto l = Drivelist::ListStorageDevices();
|
||||
QSet<QString> drivesInNewList;
|
||||
|
||||
for (auto &i: l)
|
||||
|
@ -117,3 +119,13 @@ void DriveListModel::refreshDriveList()
|
|||
if (changes)
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void DriveListModel::startPolling()
|
||||
{
|
||||
_thread.start();
|
||||
}
|
||||
|
||||
void DriveListModel::stopPolling()
|
||||
{
|
||||
_thread.stop();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue