[education/kstars] kstars/ekos/capture: Auto-default remote directory based on frame type in capture module

Jasem Mutlaq <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 371f3544374116d0e8455ec0bddff025f0453a22 by Jasem Mutlaq.
Committed on 30/07/2026 at 18:55.
Pushed by mutlaqja into branch 'master'.

Auto-default remote directory based on frame type in capture module

checkFrameType() already forces upload mode to "Remotely" when the
Video frame type is selected, and restricts the Local/Both upload
modes while a video type is active. Extend checkUploadMode(), which
backs both that auto-switch and manual selection of "Remotely"/"Both"
for image frame types, so it also fills in the remote directory field
with a %h-based default (%h/Videos for Video, %h/Pictures otherwise)
whenever the field is empty or still holds a previously auto-generated
%h path. User-entered remote paths that don't start with %h are left
untouched. %h is expanded by INDI to the remote host's home directory,
which cannot be known locally in advance.

M  +14   -0    kstars/ekos/capture/camera_config.cpp

https://invent.kde.org/education/kstars/-/commit/371f3544374116d0e8455ec0bddff025f0453a22

diff --git a/kstars/ekos/capture/camera_config.cpp b/kstars/ekos/capture/camera_config.cpp
index ed5decddc3..32ebbd8619 100644
--- a/kstars/ekos/capture/camera_config.cpp
+++ b/kstars/ekos/capture/camera_config.cpp
@@ -1020,6 +1020,20 @@ void Camera::checkUploadMode(int index)
                                  (model->item(2)->flags() | Qt::ItemIsEnabled));
     }
 
+    // When uploading remotely (or both locally and remotely), make sure the remote
+    // directory has a sensible default matching the current frame type. Only touch it
+    // if it is empty, or if it still holds an auto-generated %h-based path from a
+    // previous frame type change, so a directory the user typed in manually is never
+    // overwritten. %h is expanded by INDI to the remote system's home directory since
+    // it cannot be known in advance.
+    if (index != ISD::Camera::UPLOAD_CLIENT)
+    {
+        const QString suffix = isVideo ? QLatin1String("Videos") : QLatin1String("Pictures");
+        const QString remoteDir = fileRemoteDirT->text();
+        if (remoteDir.isEmpty() || remoteDir.startsWith(QLatin1String("%h/")))
+            fileRemoteDirT->setText(QLatin1String("%h/") + suffix);
+    }
+
     generatePreviewFilename();
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.