root/trunk/Forms/frm_settings.pas
| 473 | 479 | ||
|---|---|---|---|
25 | Forms, | 25 | Forms, |
26 | Dialogs, | 26 | Dialogs, |
27 | StdCtrls, | 27 | StdCtrls, |
28 | RzCmboBx, | ||
29 | RzShellCtrls, | ||
30 | Mask, | 28 | Mask, |
31 | RzEdit, | ||
32 | RzBtnEdt, | ||
33 | RzButton, | ||
34 | RzShellDialogs, | ||
35 | RzTabs, | ||
36 | ExtCtrls, | 29 | ExtCtrls, |
37 | RzPanel, | ||
38 | RzRadGrp, | ||
39 | ComCtrls, | 30 | ComCtrls, |
40 | RzTreeVw, | 31 | ImgList, |
41 | RzSpnEdt, | 32 | unit_AutoCompleteEdit; |
42 | RzCommon, | ||
43 | RzLabel, | ||
44 | RzListVw, | ||
45 | RzSelDir, | ||
46 | ImgList; | ||
47 | 33 | ||
48 | type | 34 | type |
49 | TfrmSettings = class(TForm) | 35 | TfrmSettings = class(TForm) |
50 | RzPanel1: TRzPanel; | ||
51 | btnSave: TRzBitBtn; | ||
52 | btnCancel: TRzBitBtn; | ||
53 | pcSetPages: TPageControl; | 36 | pcSetPages: TPageControl; |
54 | tsDevices: TTabSheet; | 37 | tsDevices: TTabSheet; |
55 | tsReaders: TTabSheet; | 38 | tsReaders: TTabSheet; |
56 | tsInterface: TTabSheet; | 39 | tsInterface: TTabSheet; |
57 | dlgColors: TColorDialog; | 40 | dlgColors: TColorDialog; |
58 | tsInternet: TTabSheet; | 41 | tsInternet: TTabSheet; |
59 | RzGroupBox1: TRzGroupBox; | 42 | edProxyServer: TEdit; |
60 | edProxyServer: TRzEdit; | 43 | edProxyUsername: TEdit; |
61 | edProxyUsername: TRzEdit; | 44 | edProxyPassword: TEdit; |
62 | edProxyPassword: TRzMaskEdit; | 45 | edProxyPort: TEdit; |
63 | edProxyPort: TRzNumericEdit; | 46 | lblProxyServer: TLabel; |
64 | RzLabel1: TRzLabel; | 47 | lblProxyPort: TLabel; |
65 | RzLabel2: TRzLabel; | 48 | lblProxyUser: TLabel; |
66 | RzLabel3: TRzLabel; | 49 | lblProxyPassword: TLabel; |
67 | RzLabel4: TRzLabel; | 50 | lvReaders: TListView; |
68 | RzGroupBox3: TRzGroupBox; | 51 | btnDeleteExt: TButton; |
69 | Label5: TLabel; | 52 | btnChangeExt: TButton; |
70 | Label6: TLabel; | 53 | btnAddExt: TButton; |
71 | cbTranslit: TCheckBox; | 54 | pnASG: TPanel; |
72 | RzGroupBox4: TRzGroupBox; | 55 | pnCT: TPanel; |
73 | edDeviceDir: TRzButtonEdit; | 56 | pnBS: TPanel; |
74 | RzGroupBox8: TRzGroupBox; | 57 | pnCS: TPanel; |
75 | lvReaders: TRzListView; | 58 | pnCA: TPanel; |
76 | btnDeleteExt: TRzBitBtn; | 59 | edShortFontSize: TEdit; |
77 | btnChangeExt: TRzBitBtn; | ||
78 | btnAddExt: TRzBitBtn; | ||
79 | RzGroupBox6: TRzGroupBox; | ||
80 | pnlASG: TRzPanel; | ||
81 | pnlCT: TRzPanel; | ||
82 | pnlBS: TRzPanel; | ||
83 | pnlCS: TRzPanel; | ||
84 | pnlCA: TRzPanel; | ||
85 | seShortFontSize: TRzSpinEdit; | ||
86 | Label9: TLabel; | 60 | Label9: TLabel; |
87 | Label7: TLabel; | 61 | Label7: TLabel; |
88 | seFontSize: TRzSpinEdit; | 62 | edFontSize: TEdit; |
89 | Button1: TButton; | 63 | Button1: TButton; |
90 | RzGroupBox9: TRzGroupBox; | ||
91 | edUpdates: TEdit; | ||
92 | cbCheckColUpdate: TCheckBox; | 64 | cbCheckColUpdate: TCheckBox; |
93 | cbUpdates: TCheckBox; | 65 | cbUpdates: TCheckBox; |
94 | cbPromptPath: TCheckBox; | 66 | tvSections: TTreeView; |
95 | RzPanel2: TRzPanel; | ||
96 | tvSections: TRzTreeView; | ||
97 | tsScripts: TTabSheet; | 67 | tsScripts: TTabSheet; |
98 | RzGroupBox523324: TRzGroupBox; | 68 | lvScripts: TListView; |
99 | lvScripts: TRzListView; | ||
100 | btnDeleteScript: TRzBitBtn; | ||
101 | btnEditScript: TRzBitBtn; | ||
102 | btnAddScript: TRzBitBtn; | ||
103 | RzGroupBox5343245: TRzGroupBox; | ||
104 | cbDefaultAction: TComboBox; | 69 | cbDefaultAction: TComboBox; |
105 | btnHelp: TRzBitBtn; | ||
106 | rgDeviceFormat: TRadioGroup; | ||
107 | RzGroupBox5: TRzGroupBox; | ||
108 | cbSquareFilter: TCheckBox; | ||
109 | RzGroupBox11: TRzGroupBox; | ||
110 | edReadDir: TRzButtonEdit; | ||
111 | dlgSelectDir: TRzSelDirDialog; | ||
112 | tsBehavour: TTabSheet; | 70 | tsBehavour: TTabSheet; |
113 | RzGroupBox7: TRzGroupBox; | ||
114 | cbShowSubGenreBooks: TCheckBox; | 71 | cbShowSubGenreBooks: TCheckBox; |
115 | cbMinimizeToTray: TCheckBox; | 72 | cbMinimizeToTray: TCheckBox; |
116 | cbAutoStartDwnld: TCheckBox; | 73 | cbAutoStartDwnld: TCheckBox; |
117 | cbShowFb2Info: TCheckBox; | 74 | cbShowFb2Info: TCheckBox; |
118 | cbAllowMixedCollections: TCheckBox; | 75 | cbAllowMixedCollections: TCheckBox; |
119 | pnlDwnld: TRzPanel; | 76 | pnDownloadedFontColor: TPanel; |
120 | pnlDeleted: TRzPanel; | 77 | pnDeletedFontColor: TPanel; |
121 | RzPanel5: TRzPanel; | 78 | edTimeOut: TEdit; |
122 | RzGroupBox10: TRzGroupBox; | 79 | RzLabel7: TLabel; |
123 | edTimeOut: TRzNumericEdit; | 80 | edReadTimeOut: TEdit; |
124 | RzLabel7: TRzLabel; | 81 | RzLabel8: TLabel; |
125 | edReadTimeOut: TRzNumericEdit; | ||
126 | RzLabel8: TRzLabel; | ||
127 | cbUseIESettings: TCheckBox; | 82 | cbUseIESettings: TCheckBox; |
128 | edDwnldInterval: TRzNumericEdit; | 83 | edDwnldInterval: TEdit; |
129 | RzLabel9: TRzLabel; | 84 | RzLabel9: TLabel; |
130 | cbAutoRunUpdate: TCheckBox; | 85 | cbAutoRunUpdate: TCheckBox; |
131 | cbDeleteDeleted: TCheckBox; | 86 | cbDeleteDeleted: TCheckBox; |
132 | cbTXTEncoding: TRzComboBox; | ||
133 | Label1: TLabel; | ||
134 | cbAutoLoadReview: TCheckBox; | 87 | cbAutoLoadReview: TCheckBox; |
135 | tsFileSort: TTabSheet; | 88 | tsFileSort: TTabSheet; |
136 | RzGroupBox12: TRzGroupBox; | ||
137 | Label2: TLabel; | 89 | Label2: TLabel; |
138 | Label3: TLabel; | 90 | Label3: TLabel; |
139 | RzToolButton4: TRzToolButton; | 91 | edFBDFolderTemplate: TEdit; |
140 | RzToolButton5: TRzToolButton; | 92 | edFBDFileTemplate: TEdit; |
141 | RzToolButton6: TRzToolButton; | ||
142 | RzToolButton7: TRzToolButton; | ||
143 | RzToolButton8: TRzToolButton; | ||
144 | RzToolButton9: TRzToolButton; | ||
145 | RzToolButton10: TRzToolButton; | ||
146 | edFBDFolderTemplate: TRzEdit; | ||
147 | edFBDFileTemplate: TRzEdit; | ||
148 | RzGroupBox13: TRzGroupBox; | ||
149 | Label4: TLabel; | 93 | Label4: TLabel; |
150 | Label8: TLabel; | 94 | Label8: TLabel; |
151 | RzToolButton11: TRzToolButton; | 95 | edFB2FolderTemplate: TEdit; |
152 | RzToolButton12: TRzToolButton; | 96 | edFB2FileTemplate: TEdit; |
153 | RzToolButton13: TRzToolButton; | ||
154 | RzToolButton14: TRzToolButton; | ||
155 | RzToolButton15: TRzToolButton; | ||
156 | RzToolButton16: TRzToolButton; | ||
157 | RzToolButton17: TRzToolButton; | ||
158 | edFB2FolderTemplate: TRzEdit; | ||
159 | edFB2FileTemplate: TRzEdit; | ||
160 | RzGroupBox14: TRzGroupBox; | ||
161 | cbEnableFileSort: TCheckBox; | 97 | cbEnableFileSort: TCheckBox; |
162 | RzGroupBox15: TRzGroupBox; | 98 | edImportFolder: TMHLAutoCompleteEdit; |
163 | edInputFolder: TRzButtonEdit; | ||
164 | cbDeleteFiles: TCheckBox; | 99 | cbDeleteFiles: TCheckBox; |
165 | RzGroupBox2: TRzGroupBox; | ||
166 | edUpdateDir: TRzButtonEdit; | ||
167 | RzGroupBox16: TRzGroupBox; | ||
168 | Label10: TLabel; | 100 | Label10: TLabel; |
169 | cbOverwriteFB2Info: TCheckBox; | 101 | cbOverwriteFB2Info: TCheckBox; |
170 | beTemplate: TRzButtonEdit; | 102 | edTitleTemplate: TEdit; |
171 | RzGroupBox17: TRzGroupBox; | 103 | pnButtons: TPanel; |
172 | edINPXUrl: TEdit; | 104 | btnOk: TButton; |
173 | edFileNameTemplate: TRzButtonEdit; | 105 | btnCancel: TButton; |
174 | edFolderTemplate: TRzButtonEdit; | 106 | btnHelp: TButton; |
175 | procedure edDeviceDirButtonClick(Sender: TObject); | 107 | Panel1: TPanel; |
176 | procedure btnSaveClick(Sender: TObject); | 108 | Label11: TLabel; |
109 | Panel2: TPanel; | ||
110 | btnAddScript: TButton; | ||
111 | btnEditScript: TButton; | ||
112 | btnDeleteScript: TButton; | ||
113 | Label12: TLabel; | ||
114 | Label13: TLabel; | ||
115 | Label14: TLabel; | ||
116 | pnDeviceOptions: TPanel; | ||
117 | edDeviceDir: TMHLAutoCompleteEdit; | ||
118 | btnDeviceDir: TButton; | ||
119 | pnReadDir: TPanel; | ||
120 | Label15: TLabel; | ||
121 | edReadDir: TMHLAutoCompleteEdit; | ||
122 | btnSelectReadDir: TButton; | ||
123 | cbPromptPath: TCheckBox; | ||
124 | Label16: TLabel; | ||
125 | pnDeviceDir: TPanel; | ||
126 | pnFileFormat: TPanel; | ||
127 | Label17: TLabel; | ||
128 | rgDeviceFormat: TComboBox; | ||
129 | pnNameFormat: TPanel; | ||
130 | Label18: TLabel; | ||
131 | Label19: TLabel; | ||
132 | Label20: TLabel; | ||
133 | btnFolderTemplate: TButton; | ||
134 | btnFileNameTemplate: TButton; | ||
135 | edFolderTemplate: TEdit; | ||
136 | edFileNameTemplate: TEdit; | ||
137 | pnOtherOpt: TPanel; | ||
138 | Label5: TLabel; | ||
139 | cbSquareFilter: TCheckBox; | ||
140 | cbTXTEncoding: TComboBox; | ||
141 | Label1: TLabel; | ||
142 | Panel3: TPanel; | ||
143 | Label6: TLabel; | ||
144 | btnTitleTemplate: TButton; | ||
145 | Panel4: TPanel; | ||
146 | Label21: TLabel; | ||
147 | btnImportFolder: TButton; | ||
148 | Label22: TLabel; | ||
149 | Label23: TLabel; | ||
150 | Label24: TLabel; | ||
151 | btnFB2FolderTemplate: TButton; | ||
152 | btnFB2FileTemplate: TButton; | ||
153 | btnFBDFileTemplate: TButton; | ||
154 | btnFBDFolderTemplate: TButton; | ||
155 | Panel5: TPanel; | ||
156 | Label25: TLabel; | ||
157 | Panel7: TPanel; | ||
158 | Label27: TLabel; | ||
159 | Label26: TLabel; | ||
160 | edUpdateDir: TMHLAutoCompleteEdit; | ||
161 | btnUpdateDir: TButton; | ||
162 | Label28: TLabel; | ||
163 | edINPXUrl: TMHLAutoCompleteEdit; | ||
164 | Label29: TLabel; | ||
165 | edUpdates: TMHLAutoCompleteEdit; | ||
166 | Panel6: TPanel; | ||
167 | Label30: TLabel; | ||
168 | udTimeOut: TUpDown; | ||
169 | udReadTimeOut: TUpDown; | ||
170 | udDwnldInterval: TUpDown; | ||
171 | Panel8: TPanel; | ||
172 | Label31: TLabel; | ||
173 | udFontSize: TUpDown; | ||
174 | udShortFontSize: TUpDown; | ||
175 | pnDefaultFontColor: TPanel; | ||
176 | btnDownloadedFontColor: TButton; | ||
177 | btnDeletedFontColor: TButton; | ||
178 | Panel10: TPanel; | ||
179 | Label32: TLabel; | ||
180 | btnCA: TButton; | ||
181 | btnCS: TButton; | ||
182 | btnASG: TButton; | ||
183 | btnCT: TButton; | ||
184 | btnBS: TButton; | ||
185 | |||
186 | procedure SaveSettingsClick(Sender: TObject); | ||
187 | procedure ShowHelpClick(Sender: TObject); | ||
188 | |||
177 | procedure tvSectionsChange(Sender: TObject; Node: TTreeNode); | 189 | procedure tvSectionsChange(Sender: TObject; Node: TTreeNode); |
178 | procedure pnlCAClick(Sender: TObject); | ||
179 | procedure Button1Click(Sender: TObject); | ||
180 | 190 | ||
191 | procedure SetBackgroundColor(Sender: TObject); | ||
192 | procedure SetDefaultFontColor(Sender: TObject); | ||
193 | procedure SetCustomFontColor(Sender: TObject); | ||
194 | |||
181 | procedure btnAddExtClick(Sender: TObject); | 195 | procedure btnAddExtClick(Sender: TObject); |
182 | procedure btnChangeExtClick(Sender: TObject); | 196 | procedure btnChangeExtClick(Sender: TObject); |
183 | procedure btnDeleteExtClick(Sender: TObject); | 197 | procedure btnDeleteExtClick(Sender: TObject); |
... | ... | ||
185 | procedure btnAddScriptClick(Sender: TObject); | 199 | procedure btnAddScriptClick(Sender: TObject); |
186 | procedure btnEditScriptClick(Sender: TObject); | 200 | procedure btnEditScriptClick(Sender: TObject); |
187 | procedure btnDeleteScriptClick(Sender: TObject); | 201 | procedure btnDeleteScriptClick(Sender: TObject); |
188 | procedure btnHelpClick(Sender: TObject); | 202 | |
189 | procedure FormShow(Sender: TObject); | 203 | procedure FormShow(Sender: TObject); |
190 | procedure pnlDwnldClick(Sender: TObject); | ||
191 | procedure cbUseIESettingsClick(Sender: TObject); | 204 | procedure cbUseIESettingsClick(Sender: TObject); |
192 | procedure cbOverwriteFB2InfoClick(Sender: TObject); | 205 | procedure cbOverwriteFB2InfoClick(Sender: TObject); |
193 | procedure beTemplateButtonClick(Sender: TObject); | 206 | procedure EditFolderTemplate(Sender: TObject); |
194 | procedure edFolderTemplateButtonClick(Sender: TObject); | 207 | procedure EditFileNameTemplate(Sender: TObject); |
195 | procedure edFileNameTemplateButtonClick(Sender: TObject); | 208 | procedure SelectFolder(Sender: TObject); |
209 | procedure EditTextTemplate(Sender: TObject); | ||
210 | procedure cbEnableFileSortClick(Sender: TObject); | ||
211 | procedure cbPromptPathClick(Sender: TObject); | ||
212 | procedure edTimeOutChange(Sender: TObject); | ||
213 | procedure CheckNumValue(Sender: TObject); | ||
196 | 214 | ||
197 | private | 215 | private |
216 | procedure SetPanelFontColor(Value: Graphics.TColor); | ||
217 | |||
198 | procedure EditReader(AItem: TListItem); | 218 | procedure EditReader(AItem: TListItem); |
199 | procedure EditScript(AItem: TListItem); | 219 | procedure EditScript(AItem: TListItem); |
200 | 220 | ||
... | ... | ||
213 | 233 | ||
214 | uses | 234 | uses |
215 | StrUtils, | 235 | StrUtils, |
236 | Character, | ||
216 | unit_Globals, | 237 | unit_Globals, |
217 | unit_Readers, | 238 | unit_Readers, |
218 | unit_Scripts, | 239 | unit_Scripts, |
... | ... | ||
226 | 247 | ||
227 | {$R *.dfm} | 248 | {$R *.dfm} |
228 | 249 | ||
229 | procedure TfrmSettings.edDeviceDirButtonClick(Sender: TObject); | ||
230 | var | ||
231 | AFolder: string; | ||
232 | begin | ||
233 | AFolder := (Sender as TRzButtonEdit).Text; | ||
234 | if GetFolderName(Handle, 'Укажите папку', AFolder) then | ||
235 | (Sender as TRzButtonEdit).Text := AFolder; | ||
236 | end; | ||
237 | |||
238 | procedure TfrmSettings.edFileNameTemplateButtonClick(Sender: TObject); | ||
239 | var | ||
240 | s: string; | ||
241 | begin | ||
242 | s := edFileNameTemplate.Text; | ||
243 | if EditTemplate(TpFile, s) then | ||
244 | edFileNameTemplate.Text := s; | ||
245 | end; | ||
246 | |||
247 | procedure TfrmSettings.edFolderTemplateButtonClick(Sender: TObject); | ||
248 | var | ||
249 | s: string; | ||
250 | begin | ||
251 | s := edFolderTemplate.Text; | ||
252 | if EditTemplate(TpPath, s) then | ||
253 | edFolderTemplate.Text := s; | ||
254 | end; | ||
255 | |||
256 | procedure TfrmSettings.beTemplateButtonClick(Sender: TObject); | ||
257 | var | ||
258 | s: string; | ||
259 | begin | ||
260 | s := beTemplate.Text; | ||
261 | if EditTemplate(TpText, s) then | ||
262 | beTemplate.Text := s; | ||
263 | end; | ||
264 | |||
265 | procedure TfrmSettings.LoadSetting; | 250 | procedure TfrmSettings.LoadSetting; |
266 | var | 251 | var |
267 | i: integer; | 252 | i: integer; |
268 | begin | 253 | begin |
254 | // | ||
269 | // Page 1 - Device settings | 255 | // Page 1 - Device settings |
270 | edDeviceDir.Text := Settings.DevicePath; | 256 | // |
271 | |||
272 | if Settings.ReadPath <> Settings.TempPath then | ||
273 | edReadDir.Text := Settings.ReadPath | ||
274 | else | ||
275 | edReadDir.Text := ''; | ||
276 | |||
277 | cbPromptPath.Checked := Settings.PromptDevicePath; | 257 | cbPromptPath.Checked := Settings.PromptDevicePath; |
258 | edDeviceDir.Text := Settings.DeviceDir; | ||
278 | 259 | ||
279 | rgDeviceFormat.ItemIndex := ord(Settings.ExportMode); | 260 | edReadDir.Text := Settings.ReadDir; |
280 | 261 | ||
281 | cbTXTEncoding.ItemIndex := ord(Settings.TXTEncoding); | 262 | rgDeviceFormat.ItemIndex := Ord(Settings.ExportMode); |
282 | |||
283 | edFolderTemplate.Text := Settings.FolderTemplate; | 263 | edFolderTemplate.Text := Settings.FolderTemplate; |
284 | edFileNameTemplate.Text := Settings.FileNameTemplate; | 264 | edFileNameTemplate.Text := Settings.FileNameTemplate; |
285 | cbTranslit.Checked := Settings.TransliterateFileName; | 265 | // TODO : REMOVE cbTranslit.Checked := Settings.TransliterateFileName; |
286 | cbSquareFilter.Checked := Settings.RemoveSquarebrackets; | 266 | cbSquareFilter.Checked := Settings.RemoveSquarebrackets; |
267 | cbTXTEncoding.ItemIndex := Ord(Settings.TXTEncoding); | ||
287 | 268 | ||
288 | // Page 2 - Readers | 269 | // Page 2 - Readers |
289 | lvReaders.Items.Clear; | 270 | lvReaders.Items.Clear; |
... | ... | ||
296 | end; | 277 | end; |
297 | end; | 278 | end; |
298 | 279 | ||
299 | seFontSize.Value := Settings.TreeFontSize; | 280 | // |
300 | seShortFontSize.Value := Settings.ShortFontSize; | 281 | // Интерфейс |
282 | // | ||
283 | udFontSize.Position := Settings.TreeFontSize; | ||
284 | udShortFontSize.Position := Settings.ShortFontSize; | ||
285 | SetPanelFontColor(Settings.FontColor); | ||
286 | pnDownloadedFontColor.Font.Color := Settings.LocalColor; | ||
287 | pnDeletedFontColor.Font.Color := Settings.DeletedColor; | ||
301 | 288 | ||
302 | pnlCT.Color := Settings.BookColor; | 289 | pnCA.Color := Settings.AuthorColor; |
303 | pnlCS.Color := Settings.SeriesColor; | 290 | pnCS.Color := Settings.SeriesColor; |
304 | pnlCA.Color := Settings.AuthorColor; | 291 | pnASG.Color := Settings.BGColor; |
305 | pnlBS.Color := Settings.SeriesBookColor; | 292 | pnCT.Color := Settings.BookColor; |
306 | pnlASG.Color := Settings.BGColor; | 293 | pnBS.Color := Settings.SeriesBookColor; |
307 | pnlASG.Font.Color := Settings.FontColor; | ||
308 | pnlCS.Font.Color := Settings.FontColor; | ||
309 | pnlCT.Font.Color := Settings.FontColor; | ||
310 | pnlBS.Font.Color := Settings.FontColor; | ||
311 | pnlASG.Font.Color := Settings.FontColor; | ||
312 | 294 | ||
313 | pnlDwnld.Font.Color := Settings.LocalColor; | 295 | // |
314 | pnlDeleted.Font.Color := Settings.DeletedColor; | ||
315 | |||
316 | // Page 4 - Internet | 296 | // Page 4 - Internet |
297 | // | ||
298 | cbUseIESettings.Checked := Settings.UseIESettings; | ||
317 | edProxyServer.Text := Settings.ProxyServer; | 299 | edProxyServer.Text := Settings.ProxyServer; |
300 | edProxyPort.Text := IntToStr(Settings.ProxyPort); | ||
318 | edProxyUsername.Text := Settings.ProxyUsername; | 301 | edProxyUsername.Text := Settings.ProxyUsername; |
319 | edProxyPassword.Text := Settings.ProxyPassword; | 302 | edProxyPassword.Text := Settings.ProxyPassword; |
320 | edProxyPort.Value := Settings.ProxyPort; | ||
321 | 303 | ||
304 | edUpdateDir.Text := Settings.UpdateDir; | ||
305 | edINPXUrl.Text := Settings.InpxURL; | ||
322 | edUpdates.Text := Settings.UpdateURL; | 306 | edUpdates.Text := Settings.UpdateURL; |
307 | |||
323 | cbCheckColUpdate.Checked := Settings.CheckExternalLibUpdate; | 308 | cbCheckColUpdate.Checked := Settings.CheckExternalLibUpdate; |
324 | cbUpdates.Checked := Settings.CheckUpdate; | 309 | cbUpdates.Checked := Settings.CheckUpdate; |
310 | cbAutoRunUpdate.Checked := Settings.AutoRunUpdate; | ||
325 | 311 | ||
326 | edTimeOut.Value := Settings.TimeOut; | 312 | udTimeOut.Position := Settings.TimeOut; |
327 | edReadTimeOut.Value := Settings.ReadTimeOut; | 313 | udReadTimeOut.Position := Settings.ReadTimeOut; |
328 | edDwnldInterval.Value := Settings.DwnldInterval; | 314 | udDwnldInterval.Position := Settings.DwnldInterval; |
329 | 315 | ||
330 | cbUseIESettings.Checked := Settings.UseIESettings; | 316 | // |
331 | cbAutoRunUpdate.Checked := Settings.AutoRunUpdate; | ||
332 | edINPXUrl.Text := Settings.InpxURL; | ||
333 | edUpdateDir.Text := Settings.UpdateDir; | ||
334 | |||
335 | // Page 5 - Scripts | 317 | // Page 5 - Scripts |
318 | // | ||
336 | lvScripts.Items.Clear; | 319 | lvScripts.Items.Clear; |
337 | cbDefaultAction.Items.Clear; | 320 | cbDefaultAction.Items.Clear; |
338 | cbDefaultAction.Items.Add('Стандартное'); | 321 | cbDefaultAction.Items.Add('Стандартное'); |
... | ... | ||
350 | end; | 333 | end; |
351 | cbDefaultAction.ItemIndex := Settings.DefaultScript; | 334 | cbDefaultAction.ItemIndex := Settings.DefaultScript; |
352 | 335 | ||
336 | // | ||
353 | // Page 6 - Behavior | 337 | // Page 6 - Behavior |
354 | 338 | // | |
355 | cbShowFb2Info.Checked := Settings.ShowFb2Info; | 339 | cbShowFb2Info.Checked := Settings.ShowFb2Info; |
356 | cbShowSubGenreBooks.Checked := Settings.ShowSubGenreBooks; | 340 | cbShowSubGenreBooks.Checked := Settings.ShowSubGenreBooks; |
357 | cbMinimizeToTray.Checked := Settings.MinimizeToTray; | 341 | cbMinimizeToTray.Checked := Settings.MinimizeToTray; |
... | ... | ||
359 | cbAllowMixedCollections.Checked := Settings.AllowMixed; | 343 | cbAllowMixedCollections.Checked := Settings.AllowMixed; |
360 | cbDeleteDeleted.Checked := Settings.DeleteDeleted; | 344 | cbDeleteDeleted.Checked := Settings.DeleteDeleted; |
361 | cbAutoLoadReview.Checked := Settings.AutoLoadReview; | 345 | cbAutoLoadReview.Checked := Settings.AutoLoadReview; |
362 | cbOverwriteFB2Info.Checked := Settings.OverwriteFB2Info; | ||
363 | cbDeleteFiles.Checked := Settings.DeleteFiles; | 346 | cbDeleteFiles.Checked := Settings.DeleteFiles; |
364 | 347 | ||
365 | { Установка начального состояния поля ввода шаблона } | 348 | cbOverwriteFB2Info.Checked := Settings.OverwriteFB2Info; |
366 | beTemplate.Enabled := cbOverwriteFB2Info.Checked; | 349 | edTitleTemplate.Text := Settings.BookHeaderTemplate; |
367 | beTemplate.Text := Settings.BookHeaderTemplate; | ||
368 | 350 | ||
351 | // | ||
369 | // Page 6 - FileSort | 352 | // Page 6 - FileSort |
370 | 353 | // | |
371 | cbEnableFileSort.Checked := Settings.EnableSort; | 354 | cbEnableFileSort.Checked := Settings.EnableSort; |
372 | edInputFolder.Text := Settings.InputFolder; | 355 | edImportFolder.Text := Settings.ImportDir; |
373 | edFB2FolderTemplate.Text := Settings.FB2FolderTemplate; | 356 | edFB2FolderTemplate.Text := Settings.FB2FolderTemplate; |
374 | edFB2FileTemplate.Text := Settings.FB2FileTemplate; | 357 | edFB2FileTemplate.Text := Settings.FB2FileTemplate; |
375 | edFBDFolderTemplate.Text := Settings.FBDFolderTemplate; | 358 | edFBDFolderTemplate.Text := Settings.FBDFolderTemplate; |
376 | edFBDFileTemplate.Text := Settings.FBDFileTemplate; | 359 | edFBDFileTemplate.Text := Settings.FBDFileTemplate; |
377 | 360 | ||
361 | // | ||
362 | // настроим GUI - запретим или разрешим контролы | ||
363 | // | ||
364 | cbPromptPathClick(nil); | ||
365 | cbUseIESettingsClick(nil); | ||
366 | cbOverwriteFB2InfoClick(nil); | ||
367 | cbEnableFileSortClick(nil); | ||
368 | |||
378 | tvSections.Select(tvSections.Items[0]); | 369 | tvSections.Select(tvSections.Items[0]); |
379 | |||
380 | cbUseIESettingsClick(Nil); | ||
381 | end; | 370 | end; |
382 | 371 | ||
383 | procedure TfrmSettings.SaveSettings; | 372 | procedure TfrmSettings.SaveSettings; |
384 | begin | 373 | begin |
385 | // Page 1 - Device settings | 374 | // Page 1 - Device settings |
375 | Settings.PromptDevicePath := cbPromptPath.Checked; | ||
386 | Settings.DeviceDir := edDeviceDir.Text; | 376 | Settings.DeviceDir := edDeviceDir.Text; |
377 | |||
387 | Settings.ReadDir := edReadDir.Text; | 378 | Settings.ReadDir := edReadDir.Text; |
388 | 379 | ||
389 | Settings.PromptDevicePath := cbPromptPath.Checked; | ||
390 | case rgDeviceFormat.ItemIndex of | 380 | case rgDeviceFormat.ItemIndex of |
391 | 0: Settings.ExportMode := emFB2; | 381 | 0: Settings.ExportMode := emFB2; |
392 | 1: Settings.ExportMode := emFB2Zip; | 382 | 1: Settings.ExportMode := emFB2Zip; |
... | ... | ||
396 | 5: Settings.ExportMode := emPDF; | 386 | 5: Settings.ExportMode := emPDF; |
397 | end; | 387 | end; |
398 | 388 | ||
389 | Settings.FolderTemplate := edFolderTemplate.Text; | ||
390 | Settings.FileNameTemplate := edFileNameTemplate.Text; | ||
391 | // TODO : REMOVE Settings.TransliterateFileName := cbTranslit.Checked; | ||
392 | |||
399 | case cbTXTEncoding.ItemIndex of | 393 | case cbTXTEncoding.ItemIndex of |
400 | 0: Settings.TXTEncoding := enUTF8; | 394 | 0: Settings.TXTEncoding := enUTF8; |
401 | 1: Settings.TXTEncoding := en1251; | 395 | 1: Settings.TXTEncoding := en1251; |
402 | 2: Settings.TXTEncoding := enUnicode; | 396 | 2: Settings.TXTEncoding := enUnicode; |
403 | end; | 397 | end; |
404 | 398 | ||
405 | Settings.FolderTemplate := edFolderTemplate.Text; | ||
406 | Settings.FileNameTemplate := edFileNameTemplate.Text; | ||
407 | Settings.TransliterateFileName := cbTranslit.Checked; | ||
408 | Settings.RemoveSquarebrackets := cbSquareFilter.Checked; | 399 | Settings.RemoveSquarebrackets := cbSquareFilter.Checked; |
409 | Settings.AutoStartDwnld := cbAutoStartDwnld.Checked; | ||
410 | 400 | ||
411 | // Page 2 - Readers | 401 | // Page 2 - Readers |
412 | SaveReaders; | 402 | SaveReaders; |
413 | 403 | ||
414 | // Page 3 - Interface | 404 | // Page 3 - Interface |
415 | 405 | ||
416 | Settings.TreeFontSize := Trunc(seFontSize.Value); | 406 | Settings.TreeFontSize := udFontSize.Position; |
417 | Settings.ShortFontSize := Trunc(seShortFontSize.Value); | 407 | Settings.ShortFontSize := udShortFontSize.Position; |
418 | Settings.BookColor := pnlCT.Color; | 408 | Settings.FontColor := pnDefaultFontColor.Font.Color; |
419 | Settings.SeriesColor := pnlCS.Color; | 409 | Settings.LocalColor := pnDownloadedFontColor.Font.Color; |
420 | Settings.AuthorColor := pnlCA.Color; | 410 | Settings.DeletedColor := pnDeletedFontColor.Font.Color; |
421 | Settings.SeriesBookColor := pnlBS.Color; | ||
422 | Settings.BGColor := pnlASG.Color; | ||
423 | Settings.FontColor := pnlASG.Font.Color; | ||
424 | 411 | ||
425 | Settings.LocalColor := pnlDwnld.Font.Color; | 412 | Settings.AuthorColor := pnCA.Color; |
426 | Settings.DeletedColor := pnlDeleted.Font.Color; | 413 | Settings.SeriesColor := pnCS.Color; |
414 | Settings.BGColor := pnASG.Color; | ||
415 | Settings.BookColor := pnCT.Color; | ||
416 | Settings.SeriesBookColor := pnBS.Color; | ||
427 | 417 | ||
428 | // Page 4 - Internet | 418 | // Page 4 - Internet |
419 | Settings.UseIESettings := cbUseIESettings.Checked; | ||
429 | Settings.ProxyServer := edProxyServer.Text; | 420 | Settings.ProxyServer := edProxyServer.Text; |
421 | Settings.ProxyPort := StrToIntDef(edProxyPort.Text, 0); | ||
430 | Settings.ProxyUsername := edProxyUsername.Text; | 422 | Settings.ProxyUsername := edProxyUsername.Text; |
431 | Settings.ProxyPassword := edProxyPassword.Text; | 423 | Settings.ProxyPassword := edProxyPassword.Text; |
432 | Settings.ProxyPort := Round(edProxyPort.Value); | ||
433 | Settings.UpdateURL := edUpdates.Text; | 424 | Settings.UpdateURL := edUpdates.Text; |
434 | Settings.CheckExternalLibUpdate := cbCheckColUpdate.Checked; | 425 | Settings.CheckExternalLibUpdate := cbCheckColUpdate.Checked; |
435 | Settings.CheckUpdate := cbUpdates.Checked; | 426 | Settings.CheckUpdate := cbUpdates.Checked; |
436 | Settings.TimeOut := Round(edTimeOut.Value); | 427 | Settings.TimeOut := udTimeOut.Position; |
437 | Settings.ReadTimeOut := Round(edReadTimeOut.Value); | 428 | Settings.ReadTimeOut := udReadTimeOut.Position; |
438 | Settings.DwnldInterval := Round(edDwnldInterval.Value); | 429 | Settings.DwnldInterval := udDwnldInterval.Position; |
439 | Settings.UseIESettings := cbUseIESettings.Checked; | ||
440 | Settings.AutoRunUpdate := cbAutoRunUpdate.Checked; | 430 | Settings.AutoRunUpdate := cbAutoRunUpdate.Checked; |
441 | Settings.InpxURL := InclideUrlSlash(edINPXUrl.Text); | 431 | Settings.InpxURL := InclideUrlSlash(edINPXUrl.Text); |
442 | 432 | ||
... | ... | ||
455 | Settings.AllowMixed := cbAllowMixedCollections.Checked; | 445 | Settings.AllowMixed := cbAllowMixedCollections.Checked; |
456 | Settings.DeleteDeleted := cbDeleteDeleted.Checked; | 446 | Settings.DeleteDeleted := cbDeleteDeleted.Checked; |
457 | Settings.AutoLoadReview := cbAutoLoadReview.Checked; | 447 | Settings.AutoLoadReview := cbAutoLoadReview.Checked; |
448 | Settings.DeleteFiles := cbDeleteFiles.Checked; | ||
458 | Settings.OverwriteFB2Info := cbOverwriteFB2Info.Checked; | 449 | Settings.OverwriteFB2Info := cbOverwriteFB2Info.Checked; |
459 | Settings.DeleteFiles := cbDeleteFiles.Checked; | 450 | Settings.BookHeaderTemplate := edTitleTemplate.Text; |
460 | { Сохранение свойства шаблона заголовка книги } | 451 | Settings.AutoStartDwnld := cbAutoStartDwnld.Checked; |
461 | Settings.BookHeaderTemplate := beTemplate.Text; | ||
462 | 452 | ||
463 | // Page 6 - FileSort | 453 | // Page 6 - FileSort |
464 | 454 | ||
465 | Settings.EnableSort := cbEnableFileSort.Checked; | 455 | Settings.EnableSort := cbEnableFileSort.Checked; |
466 | Settings.InputFolder := IncludeTrailingPathDelimiter(edInputFolder.Text); | 456 | Settings.ImportDir := edImportFolder.Text; |
467 | Settings.FB2FolderTemplate := edFB2FolderTemplate.Text; | 457 | Settings.FB2FolderTemplate := edFB2FolderTemplate.Text; |
468 | Settings.FB2FileTemplate := edFB2FileTemplate.Text; | 458 | Settings.FB2FileTemplate := edFB2FileTemplate.Text; |
469 | Settings.FBDFolderTemplate := edFBDFolderTemplate.Text; | 459 | Settings.FBDFolderTemplate := edFBDFolderTemplate.Text; |
470 | Settings.FBDFileTemplate := edFBDFileTemplate.Text; | 460 | Settings.FBDFileTemplate := edFBDFileTemplate.Text; |
471 | |||
472 | end; | 461 | end; |
473 | 462 | ||
474 | procedure TfrmSettings.SaveReaders; | 463 | procedure TfrmSettings.SaveReaders; |
... | ... | ||
493 | Scripts.Clear; | 482 | Scripts.Clear; |
494 | for i := 0 to lvScripts.Items.Count - 1 do | 483 | for i := 0 to lvScripts.Items.Count - 1 do |
495 | begin | 484 | begin |
496 | Scripts.Add(lvScripts.Items[i].Caption, lvScripts.Items[i].SubItems[0], | 485 | Scripts.Add(lvScripts.Items[i].Caption, lvScripts.Items[i].SubItems[0], lvScripts.Items[i].SubItems[1]); |
497 | lvScripts.Items[i].SubItems[1]); | ||
498 | end; | 486 | end; |
499 | end; | 487 | end; |
500 | 488 | ||
501 | procedure TfrmSettings.btnHelpClick(Sender: TObject); | 489 | procedure TfrmSettings.ShowHelpClick(Sender: TObject); |
502 | begin | 490 | begin |
503 | HtmlHelp(Application.Handle, PChar(Settings.SystemFileName[sfAppHelp]), | 491 | HtmlHelp(Application.Handle, PChar(Settings.SystemFileName[sfAppHelp]), HH_HELP_CONTEXT, pcSetPages.ActivePage.HelpContext); |
504 | HH_HELP_CONTEXT, pcSetPages.ActivePage.HelpContext); | ||
505 | end; | 492 | end; |
506 | 493 | ||
507 | procedure TfrmSettings.btnSaveClick(Sender: TObject); | 494 | procedure TfrmSettings.SaveSettingsClick(Sender: TObject); |
508 | begin | 495 | begin |
509 | if cbOverwriteFB2Info.Checked and (beTemplate.Text = '') then | 496 | if cbOverwriteFB2Info.Checked and (edTitleTemplate.Text = '') then |
510 | begin | 497 | begin |
511 | ShowMessage( | 498 | ShowMessage('Необходимо задать шаблон для заголовка книги в разделе "Разное"'); |
512 | 'Необходимо задать шаблон для заголовка книги в разделе "Разное"'); | ||
513 | tvSections.Select(tvSections.Items[5]); | 499 | tvSections.Select(tvSections.Items[5]); |
514 | Exit; | 500 | Exit; |
515 | end; | 501 | end; |
... | ... | ||
530 | begin | 516 | begin |
531 | frmEditReader := TfrmEditReader.Create(Self); | 517 | frmEditReader := TfrmEditReader.Create(Self); |
532 | try | 518 | try |
533 | frmEditReader.Caption := IfThen(Assigned(AItem), 'Изменение типа файлов', | 519 | frmEditReader.Caption := IfThen(Assigned(AItem), 'Изменение типа файлов', 'Добавление типа файлов'); |
534 | 'Добавление типа файлов'); | ||
535 | if Assigned(AItem) then | 520 | if Assigned(AItem) then |
536 | begin | 521 | begin |
537 | frmEditReader.Extension := AItem.Caption; | 522 | frmEditReader.Extension := AItem.Caption; |
... | ... | ||
548 | Exit; | 533 | Exit; |
549 | end; | 534 | end; |
550 | 535 | ||
551 | if lvReaders.FindCaption(0, frmEditReader.Extension, False, True, False) | 536 | if lvReaders.FindCaption(0, frmEditReader.Extension, False, True, False) <> nil then |
552 | <> nil then | ||
553 | begin | 537 | begin |
554 | // Это расширение уже зарегистрировано | 538 | // Это расширение уже зарегистрировано |
555 | MessageDlg('Тип "' + frmEditReader.Extension + '" уже есть в списке!', | 539 | MessageDlg('Тип "' + frmEditReader.Extension + '" уже есть в списке!', mtError, [mbOk], 0); |
556 | mtError, [mbOk], 0); | ||
557 | Exit; | 540 | Exit; |
558 | end; | 541 | end; |
559 | 542 | ||
... | ... | ||
600 | procedure TfrmSettings.EditScript(AItem: TListItem); | 583 | procedure TfrmSettings.EditScript(AItem: TListItem); |
601 | var | 584 | var |
602 | frmEditScript: TfrmEditScript; | 585 | frmEditScript: TfrmEditScript; |
586 | nIndex: Integer; | ||
603 | begin | 587 | begin |
604 | frmEditScript := TfrmEditScript.Create(Self); | 588 | frmEditScript := TfrmEditScript.Create(Self); |
605 | try | 589 | try |
606 | frmEditReader.Caption := IfThen(Assigned(AItem), | 590 | frmEditReader.Caption := IfThen(Assigned(AItem), 'Изменение параметров скрипта', 'Добавление скрипта'); |
607 | 'Изменение параметров скрипта', 'Добавление скрипта'); | ||
608 | if Assigned(AItem) then | 591 | if Assigned(AItem) then |
609 | begin | 592 | begin |
610 | frmEditScript.Title := AItem.Caption; | 593 | frmEditScript.Title := AItem.Caption; |
... | ... | ||
616 | begin | 599 | begin |
617 | if Assigned(AItem) then | 600 | if Assigned(AItem) then |
618 | begin | 601 | begin |
602 | nIndex := cbDefaultAction.ItemIndex; | ||
619 | cbDefaultAction.Items[AItem.Index + 1] := frmEditScript.Title; | 603 | cbDefaultAction.Items[AItem.Index + 1] := frmEditScript.Title; |
620 | { TODO -oNickR -cpossible bug : Странно, после редактирования скрипт становится скриптом по-умолчанию } | 604 | cbDefaultAction.ItemIndex := nIndex; |
621 | // cbDefaultAction.ItemIndex := AItem.Index + 1; | ||
622 | end | 605 | end |
623 | else | 606 | else |
624 | cbDefaultAction.Items.Add(frmEditScript.Title); | 607 | cbDefaultAction.Items.Add(frmEditScript.Title); |
... | ... | ||
669 | Exit; | 652 | Exit; |
670 | 653 | ||
671 | if cbDefaultAction.Items.Count > 1 then | 654 | if cbDefaultAction.Items.Count > 1 then |
655 | begin | ||
672 | cbDefaultAction.Items.Delete(lvScripts.Selected.Index + 1); | 656 | cbDefaultAction.Items.Delete(lvScripts.Selected.Index + 1); |
657 | cbDefaultAction.ItemIndex := 0; | ||
658 | end; | ||
673 | lvScripts.DeleteSelected; | 659 | lvScripts.DeleteSelected; |
674 | end; | 660 | end; |
675 | 661 | ||
676 | procedure TfrmSettings.pnlCAClick(Sender: TObject); | 662 | // |
663 | // Настройки интерфейса
// | ||
664 | procedure TfrmSettings.SetBackgroundColor(Sender: TObject); | ||
665 | var | ||
666 | PanelControl: TPanel; | ||
677 | begin | 667 | begin |
678 | dlgColors.Color := (Sender as TRzPanel).Color; | 668 | if Sender = btnCA then |
679 | if dlgColors.Execute then (Sender as TRzPanel) | 669 | PanelControl := pnCA |
680 | .Color := dlgColors.Color; | 670 | else if Sender = btnCS then |
671 | PanelControl := pnCS | ||
672 | else if Sender = btnASG then | ||
673 | PanelControl := pnASG | ||
674 | else if Sender = btnCT then | ||
675 | PanelControl := pnCT | ||
676 | else if Sender = btnBS then | ||
677 | PanelControl := pnBS | ||
678 | else | ||
679 | begin | ||
680 | Assert(False); | ||
681 | Exit; | ||
682 | end; | ||
683 | |||
684 | dlgColors.Color := PanelControl.Color; | ||
685 | if dlgColors.Execute then | ||
686 | PanelControl.Color := dlgColors.Color; | ||
681 | end; | 687 | end; |
682 | 688 | ||
683 | procedure TfrmSettings.pnlDwnldClick(Sender: TObject); | 689 | procedure TfrmSettings.SetPanelFontColor(Value: Graphics.TColor); |
684 | begin | 690 | begin |
685 | dlgColors.Color := (Sender as TRzPanel).Font.Color; | 691 | pnDefaultFontColor.Font.Color := Value; |
686 | if dlgColors.Execute then (Sender as TRzPanel) | 692 | pnCA.Font.Color := Value; |
687 | .Font.Color := dlgColors.Color; | 693 | pnCS.Font.Color := Value; |
694 | pnASG.Font.Color := Value; | ||
695 | pnCT.Font.Color := Value; | ||
696 | pnBS.Font.Color := Value; | ||
688 | end; | 697 | end; |
689 | 698 | ||
690 | procedure TfrmSettings.tvSectionsChange(Sender: TObject; Node: TTreeNode); | 699 | procedure TfrmSettings.SetDefaultFontColor(Sender: TObject); |
691 | begin | 700 | begin |
692 | pcSetPages.ActivePageIndex := tvSections.Selected.Index; | 701 | dlgColors.Color := pnDefaultFontColor.Font.Color; |
702 | if dlgColors.Execute then | ||
703 | SetPanelFontColor(dlgColors.Color); | ||
693 | end; | 704 | end; |
694 | 705 | ||
695 | procedure TfrmSettings.Button1Click(Sender: TObject); | 706 | procedure TfrmSettings.SetCustomFontColor(Sender: TObject); |
707 | var | ||
708 | PanelControl: TPanel; | ||
696 | begin | 709 | begin |
697 | if dlgColors.Execute then | 710 | if Sender = btnDownloadedFontColor then |
711 | PanelControl := pnDownloadedFontColor | ||
712 | else if Sender = btnDeletedFontColor then | ||
713 | PanelControl := pnDeletedFontColor | ||
714 | else | ||
698 | begin | 715 | begin |
699 | pnlCA.Font.Color := dlgColors.Color; | 716 | Assert(False); |
700 | pnlCS.Font.Color := dlgColors.Color; | 717 | Exit; |
701 | pnlCT.Font.Color := dlgColors.Color; | ||
702 | pnlBS.Font.Color := dlgColors.Color; | ||
703 | pnlASG.Font.Color := dlgColors.Color; | ||
704 | end; | 718 | end; |
719 | |||
720 | dlgColors.Color := PanelControl.Font.Color; | ||
721 | if dlgColors.Execute then | ||
722 | PanelControl.Font.Color := dlgColors.Color; | ||
705 | end; | 723 | end; |
706 | 724 | ||
725 | // | ||
726 | // | ||
727 | // | ||
728 | procedure TfrmSettings.tvSectionsChange(Sender: TObject; Node: TTreeNode); | ||
729 | begin | ||
730 | pcSetPages.ActivePageIndex := tvSections.Selected.Index; | ||
731 | end; | ||
732 | |||
733 | procedure TfrmSettings.cbEnableFileSortClick(Sender: TObject); | ||
734 | begin | ||
735 | edImportFolder.Enabled := cbEnableFileSort.Checked; | ||
736 | edFB2FolderTemplate.Enabled := cbEnableFileSort.Checked; | ||
737 | edFB2FileTemplate.Enabled := cbEnableFileSort.Checked; | ||
738 | edFBDFolderTemplate.Enabled := cbEnableFileSort.Checked; | ||
739 | edFBDFileTemplate.Enabled := cbEnableFileSort.Checked; | ||
740 | btnImportFolder.Enabled := cbEnableFileSort.Checked; | ||
741 | btnFB2FolderTemplate.Enabled := cbEnableFileSort.Checked; | ||
742 | btnFB2FileTemplate.Enabled := cbEnableFileSort.Checked; | ||
743 | btnFBDFolderTemplate.Enabled := cbEnableFileSort.Checked; | ||
744 | btnFBDFileTemplate.Enabled := cbEnableFileSort.Checked; | ||
745 | end; | ||
746 | |||
707 | procedure TfrmSettings.cbOverwriteFB2InfoClick(Sender: TObject); | 747 | procedure TfrmSettings.cbOverwriteFB2InfoClick(Sender: TObject); |
708 | begin | 748 | begin |
709 | { Включение и отключение поля ввода шаблона } | 749 | edTitleTemplate.Enabled := cbOverwriteFB2Info.Checked; |
710 | beTemplate.Enabled := cbOverwriteFB2Info.Checked; | 750 | btnTitleTemplate.Enabled := cbOverwriteFB2Info.Checked; |
711 | end; | 751 | end; |
712 | 752 | ||
753 | procedure TfrmSettings.cbPromptPathClick(Sender: TObject); | ||
754 | begin | ||
755 | edDeviceDir.Enabled := not cbPromptPath.Checked; | ||
756 | btnDeviceDir.Enabled := not cbPromptPath.Checked; | ||
757 | end; | ||
758 | |||
713 | procedure TfrmSettings.cbUseIESettingsClick(Sender: TObject); | 759 | procedure TfrmSettings.cbUseIESettingsClick(Sender: TObject); |
714 | begin | 760 | begin |
715 | edProxyServer.Enabled := not cbUseIESettings.Checked; | 761 | edProxyServer.Enabled := not cbUseIESettings.Checked; |
... | ... | ||
718 | edProxyPassword.Enabled := not cbUseIESettings.Checked; | 765 | edProxyPassword.Enabled := not cbUseIESettings.Checked; |
719 | end; | 766 | end; |
720 | 767 | ||
768 | procedure TfrmSettings.CheckNumValue(Sender: TObject); | ||
769 | var | ||
770 | EditControl: TEdit; | ||
771 | UpDownControl: TUpDown; | ||
772 | strValue: string; | ||
773 | ch: Char; | ||
774 | nValue: Integer; | ||
775 | nMinValue: Integer; | ||
776 | nMaxValue: Integer; | ||
777 | begin | ||
778 | EditControl := Sender as TEdit; | ||
779 | if EditControl = edProxyPort then | ||
780 | UpDownControl := nil | ||
781 | else if EditControl = edTimeOut then | ||
782 | UpDownControl := udTimeOut | ||
783 | else if EditControl = edDwnldInterval then | ||
784 | UpDownControl := udDwnldInterval | ||
785 | else if EditControl = edReadTimeOut then | ||
786 | UpDownControl := udReadTimeOut | ||
787 | else if EditControl = edFontSize then | ||
788 | UpDownControl := udFontSize | ||
789 | else if EditControl = edShortFontSize then | ||
790 | UpDownControl := udShortFontSize | ||
791 | else | ||
792 | begin | ||
793 | Assert(False); | ||
794 | Exit; | ||
795 | end; | ||
796 | |||
797 | if EditControl = edProxyPort then | ||
798 | begin | ||
799 | nMinValue := 0; | ||
800 | nMaxValue := 65535; | ||
801 | end | ||
802 | else | ||
803 | begin | ||
804 | Assert(Assigned(UpDownControl)); | ||
805 | nMinValue := UpDownControl.Min; | ||
806 | nMaxValue := UpDownControl.Max; | ||
807 | end; | ||
808 | |||
809 | for ch in EditControl.Text do | ||
810 | begin | ||
811 | if IsNumber(ch) then | ||
812 | strValue := strValue + ch; | ||
813 | end; | ||
814 | nValue := StrToIntDef(strValue, 0); | ||
815 | |||
816 | if (nMinValue <= nValue) and (nValue <= nMaxValue) then | ||
817 | Exit; | ||
818 | |||
819 | if nValue < nMinValue then | ||
820 | nValue := nMinValue | ||
821 | else if nValue > nMaxValue then | ||
822 | nValue := nMaxValue; | ||
823 | |||
824 | EditControl.Text := IntToStr(nValue); | ||
825 | end; | ||
826 | |||
827 | // ============================================================================ | ||
828 | |||
829 | procedure TfrmSettings.SelectFolder(Sender: TObject); | ||
830 | var | ||
831 | EditControl: TEdit; | ||
832 | AFolder: string; | ||
833 | begin | ||
834 | if Sender = btnImportFolder then | ||
835 | EditControl := edImportFolder | ||
836 | else if Sender = btnSelectReadDir then | ||
837 | EditControl := edReadDir | ||
838 | else if Sender = btnDeviceDir then | ||
839 | EditControl := edDeviceDir | ||
840 | else if Sender = btnUpdateDir then | ||
841 | EditControl := edUpdateDir | ||
842 | else | ||
843 | begin | ||
844 | Assert(False); | ||
845 | Exit; | ||
846 | end; | ||
847 | |||
848 | AFolder := EditControl.Text; | ||
849 | if GetFolderName(Handle, 'Укажите папку', AFolder) then | ||
850 | EditControl.Text := AFolder; | ||
851 | end; | ||
852 | |||
853 | procedure TfrmSettings.EditFolderTemplate(Sender: TObject); | ||
854 | var | ||
855 | EditControl: TEdit; | ||
856 | s: string; | ||
857 | begin | ||
858 | if Sender = btnFolderTemplate then | ||
859 | EditControl := edFolderTemplate | ||
860 | else if Sender = btnFB2FolderTemplate then | ||
861 | EditControl := edFB2FolderTemplate | ||
862 | else if Sender = btnFBDFolderTemplate then | ||
863 | EditControl := edFBDFolderTemplate | ||
864 | //else if Sender = then | ||
865 | else | ||
866 | begin | ||
867 | Assert(False); | ||
868 | Exit; | ||
869 | end; | ||
870 | |||
871 | s := EditControl.Text; | ||
872 | if EditTemplate(TpPath, s) then | ||
873 | EditControl.Text := s; | ||
874 | end; | ||
875 | |||
876 | procedure TfrmSettings.EditFileNameTemplate(Sender: TObject); | ||
877 | var | ||
878 | EditControl: TEdit; | ||
879 | s: string; | ||
880 | begin | ||
881 | if Sender = btnFileNameTemplate then | ||
882 | EditControl := edFileNameTemplate | ||
883 | else if Sender = btnFB2FileTemplate then | ||
884 | EditControl := edFB2FileTemplate | ||
885 | else if Sender = btnFBDFileTemplate then | ||
886 | EditControl := edFBDFileTemplate | ||
887 | //else if Sender = then | ||
888 | else | ||
889 | begin | ||
890 | Assert(False); | ||
891 | Exit; | ||
892 | end; | ||
893 | |||
894 | s := EditControl.Text; | ||
895 | if EditTemplate(TpFile, s) then | ||
896 | EditControl.Text := s; | ||
897 | end; | ||
898 | |||
899 | procedure TfrmSettings.EditTextTemplate(Sender: TObject); | ||
900 | var | ||
901 | s: string; | ||
902 | begin | ||
903 | s := edTitleTemplate.Text; | ||
904 | if EditTemplate(TpText, s) then | ||
905 | edTitleTemplate.Text := s; | ||
906 | end; | ||
907 | |||
908 | procedure TfrmSettings.edTimeOutChange(Sender: TObject); | ||
909 | begin | ||
910 | // | ||
911 | end; | ||
912 | |||
721 | end. | 913 | end. |
Download diff