aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-21 23:58:40 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-21 23:58:40 +0000
commitdc3c42586733e84bc5d92c037f837f5a83e96bd9 (patch)
tree435ba2f797d5d2589a92b619c05bd5d713f12fab /src/base
parent7a9910634301c97ef9b785913ce4d72af8bfcfbc (diff)
downloadusdx-dc3c42586733e84bc5d92c037f837f5a83e96bd9.tar.gz
usdx-dc3c42586733e84bc5d92c037f837f5a83e96bd9.tar.xz
usdx-dc3c42586733e84bc5d92c037f837f5a83e96bd9.zip
- cleanup
- made TSortingType an enum git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2271 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UCatCovers.pas7
-rw-r--r--src/base/UIni.pas19
-rw-r--r--src/base/USongs.pas10
3 files changed, 21 insertions, 15 deletions
diff --git a/src/base/UCatCovers.pas b/src/base/UCatCovers.pas
index d33bbbe1..433763d8 100644
--- a/src/base/UCatCovers.pas
+++ b/src/base/UCatCovers.pas
@@ -92,6 +92,7 @@ var
Ini: TMemIniFile;
List: TStringlist;
I, J: Integer;
+ SortType: TSortingType;
Filename: IPath;
Name, TmpName: UTF8String;
CatCover: IPath;
@@ -131,12 +132,12 @@ begin
Filename := CoversPath.Append(FileInfo.Name);
Name := FileInfo.Name.SetExtension('').ToUTF8;
- for I := 0 to high(ISorting) do
+ for SortType := Low(TSortingType) to High(TSortingType) do
begin
TmpName := Name;
- if (I = sTitle) and (UTF8Pos('Title', TmpName) <> 0) then
+ if (SortType = sTitle) and (UTF8Pos('Title', TmpName) <> 0) then
UTF8Delete(TmpName, UTF8Pos('Title', TmpName), 5)
- else if (I = sArtist) and (UTF8Pos('Artist', TmpName) <> 0) then
+ else if (SortType = sArtist) and (UTF8Pos('Artist', TmpName) <> 0) then
UTF8Delete(TmpName, UTF8Pos('Artist', TmpName), 6);
if not CoverExists(I, TmpName) then
diff --git a/src/base/UIni.pas b/src/base/UIni.pas
index 36c3cce0..6b93d7ba 100644
--- a/src/base/UIni.pas
+++ b/src/base/UIni.pas
@@ -171,6 +171,10 @@ var
ITheme: TUTF8StringDynArray;
ISkin: TUTF8StringDynArray;
+{*
+ * Options
+ *}
+
const
IPlayers: array[0..4] of UTF8String = ('1', '2', '3', '4', '6');
IPlayersVals: array[0..4] of integer = ( 1 , 2 , 3 , 4 , 6 );
@@ -178,15 +182,12 @@ const
IDifficulty: array[0..2] of UTF8String = ('Easy', 'Medium', 'Hard');
ITabs: array[0..1] of UTF8String = ('Off', 'On');
+const
ISorting: array[0..6] of UTF8String = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Artist2');
- sEdition = 0;
- sGenre = 1;
- sLanguage = 2;
- sFolder = 3;
- sTitle = 4;
- sArtist = 5;
- sArtist2 = 6;
+type
+ TSortingType = (sEdition, sGenre, sLanguage, sFolder, sTitle, sArtist, sArtist2);
+const
IDebug: array[0..1] of UTF8String = ('Off', 'On');
IScreens: array[0..1] of UTF8String = ('1', '2');
@@ -256,6 +257,10 @@ const
IChannelPlayer: array[0..6] of UTF8String = ('Off', '1', '2', '3', '4', '5', '6');
IMicBoost: array[0..3] of UTF8String = ('Off', '+6dB', '+12dB', '+18dB');
+{*
+ * Translated options
+ *}
+
var
ILanguageTranslated: array of UTF8String;
diff --git a/src/base/USongs.pas b/src/base/USongs.pas
index baeec13a..0056d75b 100644
--- a/src/base/USongs.pas
+++ b/src/base/USongs.pas
@@ -61,6 +61,7 @@ uses
{$ENDIF}
UPath,
USong,
+ UIni,
UCatCovers;
type
@@ -111,7 +112,7 @@ type
procedure BrowseDir(Dir: IPath); // should return number of songs in the future
procedure BrowseTXTFiles(Dir: IPath);
procedure BrowseXMLFiles(Dir: IPath);
- procedure Sort(Order: integer);
+ procedure Sort(Order: TSortingType);
property Processing: boolean read fProcessing;
end;
@@ -162,7 +163,6 @@ uses
UFiles,
UGraphic,
UMain,
- UIni,
UPathUtils,
UNote,
UFilesystem,
@@ -394,7 +394,7 @@ begin
Result := UTF8CompareText(TSong(Song1).Language, TSong(Song2).Language);
end;
-procedure TSongs.Sort(Order: integer);
+procedure TSongs.Sort(Order: TSortingType);
var
CompareFunc: TListSortCompare;
begin
@@ -428,7 +428,7 @@ end;
procedure TCatSongs.SortSongs();
begin
- case Ini.Sorting of
+ case TSortingType(Ini.Sorting) of
sEdition: begin
Songs.Sort(sTitle);
Songs.Sort(sArtist);
@@ -528,7 +528,7 @@ begin
// if tabs are on, add section buttons for each new section
if (Ini.Tabs = 1) then
begin
- case (Ini.Sorting) of
+ case (TSortingType(Ini.Sorting)) of
sEdition: begin
if (CompareText(CurCategory, CurSong.Edition) <> 0) then
begin