@@ -1501,26 +1501,37 @@ public PresetViewModel SelectedPreset
15011501
15021502 if ( changeSelectedPreset )
15031503 {
1504- this . GenerateOutputFileName ( ) ;
1504+ NotifySelectedPresetChanged ( ) ;
15051505
1506- var encodingWindow = WindowManager . FindWindow ( typeof ( EncodingViewModel ) ) as EncodingViewModel ;
1507- if ( encodingWindow != null )
1506+ // If we're switching away from a temporary queue preset, remove it.
1507+ if ( previouslySelectedPreset != null && previouslySelectedPreset . IsQueue && previouslySelectedPreset != value )
15081508 {
1509- encodingWindow . EditingPreset = this . selectedPreset . Preset ;
1509+ this . AllPresets . Remove ( previouslySelectedPreset ) ;
15101510 }
1511+ }
1512+ }
1513+ }
15111514
1512- var previewWindow = WindowManager . FindWindow ( typeof ( PreviewViewModel ) ) as PreviewViewModel ;
1513- if ( previewWindow != null )
1514- {
1515- previewWindow . RequestRefreshPreviews ( ) ;
1516- }
1515+ private void NotifySelectedPresetChanged ( )
1516+ {
1517+ this . GenerateOutputFileName ( ) ;
15171518
1518- this . NotifyPropertyChanged ( "SelectedPreset" ) ;
1519- }
1519+ var encodingWindow = WindowManager . FindWindow ( typeof ( EncodingViewModel ) ) as EncodingViewModel ;
1520+ if ( encodingWindow != null )
1521+ {
1522+ encodingWindow . EditingPreset = this . selectedPreset . Preset ;
1523+ }
15201524
1521- this . NotifyPropertyChanged ( "ShowChapterMarkerUI" ) ;
1522- Properties . Settings . Default . LastPresetIndex = this . AllPresets . IndexOf ( this . selectedPreset ) ;
1525+ var previewWindow = WindowManager . FindWindow ( typeof ( PreviewViewModel ) ) as PreviewViewModel ;
1526+ if ( previewWindow != null )
1527+ {
1528+ previewWindow . RequestRefreshPreviews ( ) ;
15231529 }
1530+
1531+ this . NotifyPropertyChanged ( "SelectedPreset" ) ;
1532+ this . NotifyPropertyChanged ( "ShowChapterMarkerUI" ) ;
1533+
1534+ Settings . Default . LastPresetIndex = this . AllPresets . IndexOf ( this . selectedPreset ) ;
15241535 }
15251536
15261537 public int SelectedTabIndex
@@ -3165,6 +3176,23 @@ public void EditQueueJob(EncodeJobViewModel jobVM)
31653176 {
31663177 EncodeJob job = jobVM . Job ;
31673178
3179+ if ( this . SelectedPreset . IsModified )
3180+ {
3181+ MessageBoxResult dialogResult = Utilities . MessageBox . Show ( this , "Do you want to save changes to your current preset?" , "Save current preset?" , MessageBoxButton . YesNoCancel ) ;
3182+ if ( dialogResult == MessageBoxResult . Yes )
3183+ {
3184+ this . SavePreset ( ) ;
3185+ }
3186+ else if ( dialogResult == MessageBoxResult . No )
3187+ {
3188+ this . RevertPreset ( userInitiated : false ) ;
3189+ }
3190+ else if ( dialogResult == MessageBoxResult . Cancel )
3191+ {
3192+ return ;
3193+ }
3194+ }
3195+
31683196 if ( jobVM . HandBrakeInstance != null && jobVM . HandBrakeInstance == this . ScanInstance )
31693197 {
31703198 this . ApplyEncodeJobChoices ( jobVM ) ;
@@ -3218,8 +3246,31 @@ public void EditQueueJob(EncodeJobViewModel jobVM)
32183246 this . StartScan ( job . SourcePath , jobVM ) ;
32193247 }
32203248
3249+ // Bring in encoding profile and put in a placeholder preset.
3250+ if ( this . AllPresets [ 0 ] . IsQueue )
3251+ {
3252+ this . AllPresets . RemoveAt ( 0 ) ;
3253+ }
3254+
3255+ var queuePreset = new PresetViewModel (
3256+ new Preset
3257+ {
3258+ IsBuiltIn = false ,
3259+ IsModified = false ,
3260+ IsQueue = true ,
3261+ Name = "Restored from Queue" ,
3262+ EncodingProfile = jobVM . Job . EncodingProfile
3263+ } ) ;
3264+
3265+ this . AllPresets . Insert ( 0 , queuePreset ) ;
3266+
3267+ this . selectedPreset = queuePreset ;
3268+ this . NotifySelectedPresetChanged ( ) ;
3269+
32213270 // Since it's been sent back for editing, remove the queue item
32223271 this . EncodeQueue . Remove ( jobVM ) ;
3272+
3273+ this . SaveUserPresets ( ) ;
32233274 }
32243275
32253276 public void RemoveQueueJob ( EncodeJobViewModel job )
@@ -3427,7 +3478,7 @@ public void SaveUserPresets()
34273478
34283479 foreach ( PresetViewModel presetVM in this . AllPresets )
34293480 {
3430- if ( ! presetVM . Preset . IsBuiltIn || presetVM . Preset . IsModified )
3481+ if ( ( ! presetVM . Preset . IsBuiltIn || presetVM . Preset . IsModified ) && ! presetVM . IsQueue )
34313482 {
34323483 userPresets . Add ( presetVM . Preset ) ;
34333484 }
@@ -4246,7 +4297,7 @@ private string BuildOutputFileName(string sourcePath, string sourceName, int tit
42464297 fileName = sourceName + titleSection + rangeSection ;
42474298 }
42484299
4249- return Utilities . CleanFileName ( fileName ) ;
4300+ return Utilities . CleanFileName ( fileName , allowBackslashes : true ) ;
42504301 }
42514302
42524303 private static string ReplaceTitles ( string inputString , int title )
0 commit comments