Merge branch 'develop' into SongListView
This commit is contained in:
commit
91fd13855f
2 files changed
+28
-16
No files matched your search
+26
-15
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -40,10 +41,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static CTextureRef NoCover { get; private set; }
|
public static CTextureRef NoCover { get; private set; }
|
||||||
|
|
||||||
public static void Init()
|
public static bool Init()
|
||||||
{
|
{
|
||||||
_LoadCoverThemes();
|
_LoadCoverThemes();
|
||||||
_LoadCovers(CConfig.Config.Theme.CoverTheme);
|
return _CoverThemes.Count != 0 && _LoadCovers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Close()
|
public static void Close()
|
||||||
@@ -91,7 +92,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong)
|
public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong)
|
||||||
{
|
{
|
||||||
CTextureRef texture = CDraw.CopyTexture(NoCover);
|
CTextureRef texture = Cover(text);
|
||||||
|
if (texture != NoCover)
|
||||||
|
return texture;
|
||||||
|
texture = CDraw.CopyTexture(NoCover);
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
_CancelToken.Token.ThrowIfCancellationRequested();
|
_CancelToken.Token.ThrowIfCancellationRequested();
|
||||||
@@ -127,7 +131,7 @@ namespace Vocaluxe.Base
|
|||||||
public static void ReloadCovers()
|
public static void ReloadCovers()
|
||||||
{
|
{
|
||||||
_UnloadCovers();
|
_UnloadCovers();
|
||||||
_LoadCovers(CConfig.Config.Theme.CoverTheme);
|
_LoadCovers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _UnloadCovers()
|
private static void _UnloadCovers()
|
||||||
@@ -150,14 +154,15 @@ namespace Vocaluxe.Base
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a SCoverTheme by cover-theme-name
|
/// Returns a SCoverTheme by cover-theme-name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static SThemeCover _CoverTheme(string coverThemeName)
|
private static SThemeCover _GetCoverTheme()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _CoverThemes.Count; i++)
|
int index = GetCoverThemeIndex();
|
||||||
|
if (index < 0)
|
||||||
{
|
{
|
||||||
if (_CoverThemes[i].Info.Name == coverThemeName)
|
index = 0;
|
||||||
return _CoverThemes[i];
|
CConfig.Config.Theme.CoverTheme = _CoverThemes[0].Info.Name;
|
||||||
}
|
}
|
||||||
return new SThemeCover();
|
return _CoverThemes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -184,7 +189,7 @@ namespace Vocaluxe.Base
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme.Info.Folder != "" && theme.Info.Name != "")
|
if (!String.IsNullOrEmpty(theme.Info.Folder) && !String.IsNullOrEmpty(theme.Info.Name))
|
||||||
{
|
{
|
||||||
theme.FolderPath = Path.Combine(folderPath, theme.Info.Folder);
|
theme.FolderPath = Path.Combine(folderPath, theme.Info.Folder);
|
||||||
_CoverThemes.Add(theme);
|
_CoverThemes.Add(theme);
|
||||||
@@ -195,12 +200,11 @@ namespace Vocaluxe.Base
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads all covers from the theme
|
/// Loads all covers from the theme
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void _LoadCovers(string coverThemeName)
|
private static bool _LoadCovers()
|
||||||
{
|
{
|
||||||
SThemeCover coverTheme = _CoverTheme(coverThemeName);
|
SThemeCover coverTheme = _GetCoverTheme();
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(coverTheme.Info.Name))
|
Debug.Assert(!String.IsNullOrEmpty(coverTheme.Info.Name));
|
||||||
return;
|
|
||||||
|
|
||||||
List<string> files = CHelper.ListImageFiles(coverTheme.FolderPath, true, true);
|
List<string> files = CHelper.ListImageFiles(coverTheme.FolderPath, true, true);
|
||||||
|
|
||||||
@@ -213,9 +217,16 @@ namespace Vocaluxe.Base
|
|||||||
else if (_CoverExists(_NoCoverNameAlt))
|
else if (_CoverExists(_NoCoverNameAlt))
|
||||||
NoCover = _Covers[_NoCoverNameAlt];
|
NoCover = _Covers[_NoCoverNameAlt];
|
||||||
else
|
else
|
||||||
CBase.Log.LogError("Covertheme \"" + coverThemeName + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true);
|
{
|
||||||
|
CBase.Log.LogError("Covertheme \"" + coverTheme.Info.Name + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true);
|
||||||
|
_UnloadCovers();
|
||||||
|
// Remove current theme and recursively try the other themes
|
||||||
|
_CoverThemes.Remove(coverTheme);
|
||||||
|
return _CoverThemes.Count > 0 && _LoadCovers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_LoadCoverGenerators(coverTheme);
|
_LoadCoverGenerators(coverTheme);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ECoverGeneratorType _SongSortingToType(ESongSorting sorting)
|
public static ECoverGeneratorType _SongSortingToType(ESongSorting sorting)
|
||||||
|
|||||||
+2
-1
@@ -199,7 +199,8 @@ namespace Vocaluxe
|
|||||||
|
|
||||||
// Load Cover
|
// Load Cover
|
||||||
CLog.StartBenchmark("Init Cover");
|
CLog.StartBenchmark("Init Cover");
|
||||||
CCover.Init();
|
if (!CCover.Init())
|
||||||
|
throw new CLoadingException("covertheme");
|
||||||
CLog.StopBenchmark("Init Cover");
|
CLog.StopBenchmark("Init Cover");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|||||||
Reference in new issue
Block a user