[subtitles] change settings logic for subtitle storage location (make it a spinner)
authorda-anda <da-anda@xbmc.org>
Thu, 19 Dec 2013 11:12:11 +0000 (12:12 +0100)
committerJonathan Marshall <jmarshall@never.you.mind>
Wed, 26 Feb 2014 22:53:07 +0000 (11:53 +1300)
language/English/strings.po
system/settings/settings.xml
xbmc/video/dialogs/GUIDialogSubtitles.cpp
xbmc/video/dialogs/GUIDialogSubtitles.h

index dd02310..9fc73cf 100755 (executable)
@@ -12178,7 +12178,7 @@ msgstr ""
 #. Description of setting "Videos -> Subtitles -> Save subtitles to movie folder" with label #24115
 #: system/settings/settings.xml
 msgctxt "#24106"
-msgid "If not saved to movie folder subtitles will be downloaded to custom subtitle folder."
+msgid "Specify where downloaded subtitles should be saved, the same location as the video or a custom location."
 msgstr ""
 
 #: xbmc/dialogs/GUIDialogSubtitles.cpp
@@ -12224,7 +12224,7 @@ msgstr ""
 
 #: system/settings/settings.xml
 msgctxt "#24115"
-msgid "Save subtitles to movie folder"
+msgid "Subtitle storage location"
 msgstr ""
 
 #: system/settings/settings.xml
@@ -12271,7 +12271,17 @@ msgctxt "#24123"
 msgid "Pause the current video while searching for subtitles and resume once the subtitle is available."
 msgstr ""
 
-#empty strings from id 24124 to 24999
+#: system/settings/settings.xml
+msgctxt "#24124"
+msgid "Next to the video"
+msgstr ""
+
+#: system/settings/settings.xml
+msgctxt "#24125"
+msgid "Custom location"
+msgstr ""
+
+#empty strings from id 24126 to 24999
 
 msgctxt "#25000"
 msgid "Notifications"
index 2eb2e64..616a9d0 100644 (file)
         </setting>
       </group>
       <group id="4">
-        <setting id="subtitles.savetomoviefolder" type="boolean" label="24115" help="24106">
+        <setting id="subtitles.storagemode" type="integer" label="24115" help="24106">
           <level>1</level>
-          <default>true</default>
-          <control type="toggle" />
+          <default>0</default>
+          <constraints>
+            <options>
+              <option label="24124">0</option> <!-- SUBTITLE_STORAGEMODE_MOVIEPATH -->
+              <option label="24125">1</option> <!-- SUBTITLE_STORAGEMODE_CUSTOMPATH -->
+            </options>
+          </constraints>
+          <control type="spinner" format="integer" />
         </setting>
-        <setting id="subtitles.custompath" type="path" label="21366" help="36191">
+        <setting id="subtitles.custompath" parent="subtitles.storagemode" type="path" label="21366" help="36191">
           <level>1</level>
           <default></default>
           <constraints>
               <source>videos</source>
             </sources>
           </constraints>
+          <dependencies>
+            <dependency type="enable" setting="subtitles.storagemode" operator="is">1</dependency>
+          </dependencies>
           <control type="button" format="path">
             <heading>657</heading>
           </control>
index 162c0a1..e072070 100644 (file)
@@ -404,6 +404,8 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
     return;
   }
 
+  SUBTITLE_STORAGEMODE storageMode = (SUBTITLE_STORAGEMODE) CSettings::Get().GetInt("subtitles.storagemode");
+
   // Get (unstacked) path
   const CStdString &strCurrentFile = g_application.CurrentUnstackedItem().GetPath();
 
@@ -419,7 +421,7 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
       strDownloadPath = subPath;
 
     strFileName = URIUtils::GetFileName(strCurrentFile);
-    if (CSettings::Get().GetBool("subtitles.savetomoviefolder") &&
+    if (storageMode == SUBTITLE_STORAGEMODE_MOVIEPATH &&
         CUtil::SupportsWriteFileOperations(strCurrentFilePath))
     {
       strDestPath = strCurrentFilePath;
index f72e9fd..614e31f 100644 (file)
 #include "threads/CriticalSection.h"
 #include "utils/JobManager.h"
 
+enum SUBTITLE_STORAGEMODE
+{
+  SUBTITLE_STORAGEMODE_MOVIEPATH = 0,
+  SUBTITLE_STORAGEMODE_CUSTOMPATH
+};
+
 class CFileItem;
 class CFileItemList;