File tree Expand file tree Collapse file tree 2 files changed +26
-25
lines changed Expand file tree Collapse file tree 2 files changed +26
-25
lines changed Original file line number Diff line number Diff line change @@ -82,9 +82,14 @@ public string IcoPath
82
82
public bool RoundedIcon { get ; set ; } = false ;
83
83
84
84
/// <summary>
85
- /// Full image used for preview window
85
+ /// Full image used for preview panel
86
86
/// </summary>
87
- public string PreviewImage { get ; set ; }
87
+ public string PreviewImage { get ; set ; } = null ;
88
+
89
+ /// <summary>
90
+ /// Determines if the preview image should occupy the full width of the preveiw panel.
91
+ /// </summary>
92
+ public bool UseBigThumbnail { get ; set ; } = false ;
88
93
89
94
/// <summary>
90
95
/// Delegate function, see <see cref="Icon"/>
@@ -234,5 +239,23 @@ public ValueTask<bool> ExecuteAsync(ActionContext context)
234
239
/// </summary>
235
240
/// <default>#26a0da (blue)</default>
236
241
public string ProgressBarColor { get ; set ; } = "#26a0da" ;
242
+
243
+ /// <summary>
244
+ /// Suggests a result's file extension should use full width of the default preview panel.
245
+ /// </summary>
246
+ /// <param name="extension">File extension. Dot included.</param>
247
+ public static bool ShouldUseBigThumbnail ( string extension )
248
+ {
249
+ return extension is ".jpg"
250
+ or ".png"
251
+ or ".avi"
252
+ or ".mkv"
253
+ or ".bmp"
254
+ or ".gif"
255
+ or ".wmv"
256
+ or ".mp3"
257
+ or ".flac"
258
+ or ".mp4" ;
259
+ }
237
260
}
238
261
}
Original file line number Diff line number Diff line change 9
9
using System . IO ;
10
10
using System . Drawing . Text ;
11
11
using System . Collections . Generic ;
12
- using System . Drawing ;
13
12
14
13
namespace Flow . Launcher . ViewModel
15
14
{
@@ -28,13 +27,6 @@ public ResultViewModel(Result result, Settings settings)
28
27
}
29
28
Result = result ;
30
29
31
- var extension = Path . GetExtension ( result . PreviewImage ) ;
32
- if ( ! string . IsNullOrEmpty ( extension ) )
33
- {
34
- // only when explicitly specified PreviewImage
35
- UseBigThumbnail = IsMedia ( extension . ToLowerInvariant ( ) ) ;
36
- }
37
-
38
30
if ( Result . Glyph is { FontFamily : not null } glyph )
39
31
{
40
32
// Checks if it's a system installed font, which does not require path to be provided.
@@ -177,21 +169,7 @@ public ImageSource PreviewImage
177
169
/// <summary>
178
170
/// Determines if to use the full width of the preview panel
179
171
/// </summary>
180
- public bool UseBigThumbnail { get ; set ; } = false ;
181
-
182
- public static bool IsMedia ( string extension )
183
- {
184
- return extension is ".jpg"
185
- or ".png"
186
- or ".avi"
187
- or ".mkv"
188
- or ".bmp"
189
- or ".gif"
190
- or ".wmv"
191
- or ".mp3"
192
- or ".flac"
193
- or ".mp4" ;
194
- }
172
+ public bool UseBigThumbnail => Result . UseBigThumbnail ;
195
173
196
174
public GlyphInfo Glyph { get ; set ; }
197
175
You can’t perform that action at this time.
0 commit comments