1 /*  Copyright (c) MediaArea.net SARL. All Rights Reserved.
2  *
3  *  Use of this source code is governed by a BSD-style license that can
4  *  be found in the License.html file in the root of the source tree.
5  */
6 
7 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 //
9 // Manage preferences of MediaInfo
10 //
11 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 
13 //---------------------------------------------------------------------------
14 #ifndef PreferencesH
15 #define PreferencesH
16 //---------------------------------------------------------------------------
17 
18 //---------------------------------------------------------------------------
19 #include "ZenLib/ZtringListListF.h"
20 //---------------------------------------------------------------------------
21 
22 //---------------------------------------------------------------------------
23 // For Unicode management
24 // Here only because this is useful in all MediaInfo
25 #ifdef _UNICODE
26     static std::wstring String_Void;
27     #define GUI_Text(A) A.w_str()
28 #else
29     static std::string String_Void;
30     #define GUI_Text(A) (A?Ztring().From_Unicode(A.c_bstr()).c_str():String_Void.c_str())
31 #endif //_UNICODE
32 //---------------------------------------------------------------------------
33 
34 //---------------------------------------------------------------------------
35 #define MediaInfo_Version_GUI __T("21.09")
36 //---------------------------------------------------------------------------
37 
38 //---------------------------------------------------------------------------
39 enum Prefs_t
40 {
41     Prefs_Language,           //List of words in the good language ("Name;Translation")
42     Prefs_Sheet,              //Customized Sheet ("StreamKind|Name;Percentage of view")
43     Prefs_Tree,               //Customized Tree  ("StreamKind|Name;Y or N")
44     Prefs_Custom,             //Customized Text  ("StreamKind;Text for this streamKind")
45     Prefs_Language_English,   //List of words in English ("Name;Translation")
46     Prefs_Language_List,      //List of language translation in their language("Name;Translation")
47     Prefs_Max,
48 };
49 
50 //---------------------------------------------------------------------------
51 
52 class Preferences
53 {
54 public:
55     Preferences();
56 
57     //Infos
58     ZenLib::Ztring          BaseFolder; //Folder of the Configuration files
59     ZenLib::ZtringListListF Config;     //Configuration file
60     ZenLib::ZtringList      FilesList[Prefs_Max];  //List of available files for an Item
61     ZenLib::ZtringListListF Details[Prefs_Max];
62     ZenLib::ZtringListList  SponsorMessage;
63     ZenLib::ZtringListList  SponsorUrl;
64 
65     //Useful functions about preferences
66     int Config_Create       ();
67     int Config_Load         (); //Load the configuration, or create it if no exist. 1=Loaded, 2=Created
68     int Config_Save         ();
69     int Config_Remove       ();
70     int RefreshFilesList    (Prefs_t KindOfList);
71     int Create              (Prefs_t KindOfList, const ZenLib::Ztring &Name);
72     int Copy                (Prefs_t KindOfList, const ZenLib::Ztring &From, const ZenLib::Ztring &To);
73     int Load                (Prefs_t KindOfList, const ZenLib::Ztring &Name);
74     int Remove              (Prefs_t KindOfList, const ZenLib::Ztring &Name);
75 
76     //Related to user preferences - Action only if Preferences are OK
77     int InternetCheck       (); //Test if there is new update
78     int ExplorerShell       (); //To be availble with right clic in Explorer
79     int ShellToolTip        (); //To be available with mouse in Explorer
80 
81     //Special things
82     ZenLib::Ztring &Translate (ZenLib::Ztring Name); //return in the good language, or in English if not found
83 
84     //Info abou Lists
85     ZenLib::ZtringList FolderNames;  //List of list_t --> Foldernames
86     ZenLib::ZtringList DefaultNames; //List of list_t --> Default Filenames for a kind
87 
88     //Donate
89     bool Donated;
90     bool Donate_Display;
91     bool NewVersion_Display;
92 
93     //Sponsor
94     bool Sponsored;
95 
96     //Plugins
97     ZenLib::Ztring GraphPluginURL;
98     ZenLib::Ztring GraphPluginVersion;
99 };
100 
101 //General preference for the whole program
102 extern Preferences* Prefs;
103 
104 #endif
105