From 49fe09bc5847bcec5b70681e71e438aacb9df865 Mon Sep 17 00:00:00 2001 From: Neil Horne Date: Sun, 12 Dec 2021 19:33:57 +1100 Subject: [PATCH] [companion] Default sdcard sync local folder to current profile (#1241) Set the local folder to match that set in the profiles "SD structure path" setting --- companion/src/mainwindow.cpp | 7 +++++++ companion/src/process_sync.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 136641ba1..54d06c071 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -847,6 +847,13 @@ void MainWindow::sdsync() static bool showExtraOptions = false; QStringList errorMsgs; + if (syncOpts.sessionId != g.sessionId()) { + syncOpts.reset(); + syncOpts.folderA = QString(); + syncOpts.folderB = QString(); + syncOpts.sessionId = g.sessionId(); + } + if (syncOpts.folderA.isEmpty()) syncOpts.folderA = g.profile[g.id()].sdPath(); if (syncOpts.folderB.isEmpty()) diff --git a/companion/src/process_sync.h b/companion/src/process_sync.h index 4fffc4d66..146e5209f 100644 --- a/companion/src/process_sync.h +++ b/companion/src/process_sync.h @@ -75,6 +75,7 @@ class SyncProcess : public QObject int flags; // SyncOptionFlags int dirFilterFlags; // QDir::Filters int logLevel; // QtMsgType (see ProgressWidget::addMessage()) + int sessionId; // Last run radio profile void reset() { @@ -86,6 +87,7 @@ class SyncProcess : public QObject logLevel = QtWarningMsg; flags = OPT_RECURSIVE; dirFilterFlags = QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot; + sessionId = -1; } friend inline QDebug operator<<(QDebug debug, const SyncOptions &o) {