-
Notifications
You must be signed in to change notification settings - Fork 1
/
USettingsForm.cpp
73 lines (67 loc) · 2.27 KB
/
USettingsForm.cpp
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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "USettingsForm.h"
#include "UMainForm.h"
#include <IniFiles.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmSettings *frmSettings;
bool bAnalyze[7] = {false};
bool bDontUseInternalListfile = false;
bool bMapRename = true;
TMPQCompression nCompression = mcBZIP2;
//---------------------------------------------------------------------------
void __fastcall TfrmSettings::SaveMiscSettings()
{
TIniFile* ini = new TIniFile(IniPath);
ini->WriteBool("Advanced", "MapRename", chkMapRename->Checked);
ini->WriteBool("Advanced", "NotUseInternalListfile", chkInternalListfile->Checked);
ini->WriteInteger("Advanced", "Compression", cbbCompression->ItemIndex);
LOOP(7)
{
ini->WriteBool("Advanced", "Analyze" + IntToStr(i), chklstAnalyze->Checked[i]);
}
VCL_FREE(ini);
}
void __fastcall TfrmSettings::LoadMiscSettings()
{
TIniFile* ini = new TIniFile(IniPath);
chkMapRename->Checked = ini->ReadBool("Advanced", "MapRename", chkMapRename->Checked);
chkInternalListfile->Checked = ini->ReadBool("Advanced", "NotUseInternalListfile", chkInternalListfile->Checked);
cbbCompression->ItemIndex = ini->ReadInteger("Advanced", "Compression", cbbCompression->ItemIndex);
LOOP(7)
{
chklstAnalyze->Checked[i] = ini->ReadBool("Advanced", "Analyze" + IntToStr(i), true);
}
VCL_FREE(ini);
AdvSettingsFromFormToVars();
}
void TfrmSettings::AdvSettingsFromFormToVars()
{
bDontUseInternalListfile = chkInternalListfile->Checked;
bMapRename = chkMapRename->Checked;
nCompression = cbbCompression->ItemIndex;
LOOP(7)
{
bAnalyze[i] = chklstAnalyze->Checked[i];
}
}
__fastcall TfrmSettings::TfrmSettings(TComponent* Owner)
: TForm(Owner)
{
LoadMiscSettings();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSettings::btnOkClick(TObject *Sender)
{
SaveMiscSettings();
AdvSettingsFromFormToVars();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSettings::btnCancelClick(TObject *Sender)
{
LoadMiscSettings();
}
//---------------------------------------------------------------------------