added setup file option to toggle setup menu option to upload all tapes
authorHolger Schemel <info@artsoft.org>
Mon, 6 Sep 2021 22:03:19 +0000 (00:03 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 6 Sep 2021 22:06:07 +0000 (00:06 +0200)
src/files.c
src/libgame/system.h
src/screens.c

index 20f5102594962e230d669b28ed2e551e99f9153b..e13641b9dddb8051d5afa7704bd8a8a60bd9a630 100644 (file)
@@ -9772,6 +9772,10 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_SWITCH,
     &setup.ask_for_uploading_tapes,            "ask_for_uploading_tapes"
   },
+  {
+    TYPE_SWITCH,
+    &setup.provide_uploading_tapes,            "provide_uploading_tapes"
+  },
   {
     TYPE_STRING,
     &setup.touch.control_type,                 "touch.control_type"
@@ -10412,6 +10416,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->api_server_hostname = getStringCopy(API_SERVER_HOSTNAME);
   si->api_server_password = getStringCopy(UNDEFINED_PASSWORD);
   si->ask_for_uploading_tapes = TRUE;
+  si->provide_uploading_tapes = TRUE;
 
   si->touch.control_type = getStringCopy(TOUCH_CONTROL_DEFAULT);
   si->touch.move_distance = TOUCH_MOVE_DISTANCE_DEFAULT;       // percent
index ed246f0d4baee50a94f724b3306001fc4568c04d..b512d1cf513eaf211b86d654f5b0632dda74ed1b 100644 (file)
@@ -1501,6 +1501,7 @@ struct SetupInfo
   char *api_server_hostname;
   char *api_server_password;
   boolean ask_for_uploading_tapes;
+  boolean provide_uploading_tapes;
 
   struct SetupAutoSetupInfo auto_setup;
   struct SetupLevelSetupInfo level_setup;
index 27d35a301e254902e17a69034545a30c6c5dd53e..553b24109c939556ad4be8ddfca81ab8bac02e3e 100644 (file)
@@ -9879,11 +9879,20 @@ static boolean OfferUploadTapes(void)
 
   Request(message, REQ_CONFIRM);
 
+  // after all tapes have been uploaded, remove entry from setup menu
+  setup.provide_uploading_tapes = FALSE;
+  setHideSetupEntry(execOfferUploadTapes);
+
+  SaveSetup();
+
   return (num_tapes_uploaded > 0);
 }
 
 void CheckUploadTapes(void)
 {
+  if (!setup.provide_uploading_tapes)
+    setHideSetupEntry(execOfferUploadTapes);
+
   if (!setup.ask_for_uploading_tapes)
     return;
 
@@ -9895,7 +9904,14 @@ void CheckUploadTapes(void)
       Request("You can upload your tapes from the setup menu later!",
              REQ_CONFIRM);
   }
+  else
+  {
+    // if tapes directory does not exist yet, never offer uploading all tapes
+    setup.provide_uploading_tapes = FALSE;
+    setHideSetupEntry(execOfferUploadTapes);
+  }
 
+  // after asking for uploading all tapes once, do not ask again
   setup.ask_for_uploading_tapes = FALSE;
 
   SaveSetup();