From 9276db1f7d466668b5e5a0dd13a05eb3cf328c70 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 9 May 2025 08:56:05 +0200 Subject: Enhance usb-storage Make it possible to define more than just one usb storage and store them to the new QSettings item "paths/usball", a QStringList while repurposing the old setting "paths/usb" for writing. When reading, iterate over all entries in usball until the file is found. For writing, or moving files to archive, use paths/usb as target. --- randomtab.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'randomtab.cpp') diff --git a/randomtab.cpp b/randomtab.cpp index b80fd9b..2d83d9e 100644 --- a/randomtab.cpp +++ b/randomtab.cpp @@ -211,15 +211,17 @@ void RandomTab::readSettings(){ QStringList RandomTab::validDvdNos(){ QStringList retval; QSettings s; - QString usbDir = s.value("paths/usb").toString(); - logMessage(QString(tr("Traversing %1")).arg(usbDir)); - QDirIterator it(usbDir); - while(it.hasNext()){ - it.next(); - QString next = it.fileName(); - if(next.startsWith("DVD_")){ - QString no = QString(next.right(3)); - retval << no; + QStringList allUsbPaths = s.value("paths/usball").toStringList(); + for(const QString &up : std::as_const(allUsbPaths)){ + logMessage(QString(tr("Traversing %1")).arg(up)); + QDirIterator it(up); + while(it.hasNext()){ + it.next(); + QString next = it.fileName(); + if(next.startsWith("DVD_")){ + QString no = QString(next.right(3)); + retval << no; + } } } logMessage(QString(tr("Found %1 valid Dirs: (%2)")).arg(QString::number(retval.count()), retval.join(','))); -- cgit v1.2.3-70-g09d2