/
ConfigurationDialog.h
239 lines (196 loc) · 8.09 KB
/
ConfigurationDialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2010 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <wx/wx.h>
#include <wx/propdlg.h>
#include "AppCommon.h"
#include "ApplyState.h"
#include "App.h"
namespace Panels
{
class BaseSelectorPanel;
class McdConfigPanel_Toggles;
class BaseMcdListPanel;
}
wxDECLARE_EVENT(pxEvt_SomethingChanged, wxCommandEvent);
namespace Dialogs
{
// --------------------------------------------------------------------------------------
// BaseConfigurationDialog
// --------------------------------------------------------------------------------------
class BaseConfigurationDialog : public BaseApplicableDialog
{
typedef BaseApplicableDialog _parent;
protected:
wxListbook* m_listbook;
wxArrayString m_labels;
bool m_allowApplyActivation;
public:
virtual ~BaseConfigurationDialog() = default;
BaseConfigurationDialog(wxWindow* parent, const wxString& title, int idealWidth);
public:
void AddOkCancel( wxSizer* sizer=NULL );
void AddListbook( wxSizer* sizer=NULL );
void CreateListbook( wxImageList& bookicons );
virtual void SomethingChanged();
template< typename T >
void AddPage( const wxChar* label, int iconid );
void AllowApplyActivation( bool allow=true );
virtual bool SomethingChanged_StateModified_IsChanged(){ //returns the state of the apply button.
if( wxWindow* apply = FindWindow( wxID_APPLY ) )
return apply->IsEnabled();
return false;
}
protected:
void OnOk_Click( wxCommandEvent& evt );
void OnCancel_Click( wxCommandEvent& evt );
void OnApply_Click( wxCommandEvent& evt );
void OnScreenshot_Click( wxCommandEvent& evt );
void OnSetSettingsPage( wxCommandEvent& evt );
void OnSomethingChanged( wxCommandEvent& evt );
virtual wxString& GetConfSettingsTabName() const=0;
virtual void Apply() {};
virtual void Cancel() {};
};
// --------------------------------------------------------------------------------------
// SysConfigDialog
// --------------------------------------------------------------------------------------
class SysConfigDialog : public BaseConfigurationDialog
{
public:
virtual ~SysConfigDialog() = default;
SysConfigDialog(wxWindow* parent=NULL);
static wxString GetNameStatic() { return L"CoreSettings"; }
wxString GetDialogName() const { return GetNameStatic(); }
void Apply();
void Cancel();
//Stores the state of the apply button in a global var.
//This var will be used by KB shortcuts commands to decide if the gui should be modified (only when no intermediate changes)
virtual bool SomethingChanged_StateModified_IsChanged(){
return g_ConfigPanelChanged = BaseConfigurationDialog::SomethingChanged_StateModified_IsChanged();
}
protected:
virtual wxString& GetConfSettingsTabName() const { return g_Conf->SysSettingsTabName; }
pxCheckBox* m_check_presets;
wxSlider* m_slider_presets;
pxStaticText* m_msg_preset;
void AddPresetsControl();
void Preset_Scroll(wxScrollEvent &event);
void Presets_Toggled(wxCommandEvent &event);
void UpdateGuiForPreset ( int presetIndex, bool presetsEnabled );
};
// --------------------------------------------------------------------------------------
// InterfaceLanguageDialog
// --------------------------------------------------------------------------------------
class InterfaceLanguageDialog : public BaseConfigurationDialog
{
public:
InterfaceLanguageDialog(wxWindow* parent = NULL);
virtual ~InterfaceLanguageDialog() = default;
static wxString GetNameStatic() { return L"InterfaceLanguage"; }
wxString GetDialogName() const { return GetNameStatic(); }
protected:
virtual wxString& GetConfSettingsTabName() const { return g_Conf->AppSettingsTabName; }
};
// --------------------------------------------------------------------------------------
// McdConfigDialog
// --------------------------------------------------------------------------------------
class McdConfigDialog : public BaseConfigurationDialog
{
typedef BaseConfigurationDialog _parent;
protected:
Panels::BaseMcdListPanel* m_panel_mcdlist;
public:
virtual ~McdConfigDialog() = default;
McdConfigDialog(wxWindow* parent=NULL);
static wxString GetNameStatic() { return L"McdConfig"; }
wxString GetDialogName() const { return GetNameStatic(); }
protected:
virtual wxString& GetConfSettingsTabName() const { return g_Conf->McdSettingsTabName; }
//void OnMultitapClicked( wxCommandEvent& evt );
};
// --------------------------------------------------------------------------------------
// GameDatabaseDialog
// --------------------------------------------------------------------------------------
class GameDatabaseDialog : public BaseConfigurationDialog
{
public:
virtual ~GameDatabaseDialog() = default;
GameDatabaseDialog(wxWindow* parent=NULL);
static wxString GetNameStatic() { return L"GameDatabase"; }
wxString GetDialogName() const { return GetNameStatic(); }
protected:
virtual wxString& GetConfSettingsTabName() const { return g_Conf->GameDatabaseTabName; }
};
// --------------------------------------------------------------------------------------
// ComponentsConfigDialog
// --------------------------------------------------------------------------------------
class ComponentsConfigDialog : public BaseConfigurationDialog
{
protected:
public:
virtual ~ComponentsConfigDialog() = default;
ComponentsConfigDialog(wxWindow* parent=NULL);
static wxString GetNameStatic() { return L"AppSettings"; }
wxString GetDialogName() const { return GetNameStatic(); }
protected:
virtual wxString& GetConfSettingsTabName() const { return g_Conf->ComponentsTabName; }
};
// --------------------------------------------------------------------------------------
// CreateMemoryCardDialog
// --------------------------------------------------------------------------------------
class CreateMemoryCardDialog : public wxDialogWithHelpers
{
protected:
wxDirName m_mcdpath;
wxString m_mcdfile;
wxTextCtrl* m_text_filenameInput;
//wxFilePickerCtrl* m_filepicker;
pxRadioPanel* m_radio_CardSize;
#ifdef __WXMSW__
pxCheckBox* m_check_CompressNTFS;
#endif
pxCheckBox* m_check_psx;
public:
virtual ~CreateMemoryCardDialog() = default;
CreateMemoryCardDialog( wxWindow* parent, const wxDirName& mcdpath, const wxString& suggested_mcdfileName);
//duplicate of MemoryCardFile::Create. Don't know why the existing method isn't used. - avih
static bool CreateIt( const wxString& mcdFile, uint sizeInMB, bool isPSX );
wxString result_createdMcdFilename;
//wxDirName GetPathToMcds() const;
protected:
void CreateControls();
void OnOk_Click( wxCommandEvent& evt );
};
// --------------------------------------------------------------------------------------
// ConvertMemoryCardDialog
// --------------------------------------------------------------------------------------
class ConvertMemoryCardDialog : public wxDialogWithHelpers
{
protected:
wxDirName m_mcdPath;
wxString m_mcdSourceFilename;
wxTextCtrl* m_text_filenameInput;
pxRadioPanel* m_radio_CardType;
public:
virtual ~ConvertMemoryCardDialog() = default;
ConvertMemoryCardDialog( wxWindow* parent, const wxDirName& mcdPath, const AppConfig::McdOptions& mcdSourceConfig );
protected:
void CreateControls( const MemoryCardType sourceType );
void OnOk_Click( wxCommandEvent& evt );
bool ConvertToFile( const wxFileName& sourcePath, const wxFileName& targetPath, const u32 sizeInMB );
bool ConvertToFolder( const wxFileName& sourcePath, const wxFileName& targetPath );
};
}