| 1 | unit UOptionsWindow;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|---|
| 7 | Dialogs, StdCtrls, ComCtrls, ExtCtrls, cUtils, cWinSock, Menus, Spin,
|
|---|
| 8 | cWindows, ShellAPI, Buttons, ExtDlgs, ImgList, GIFImage, UTextFileStream,
|
|---|
| 9 | ActnList, XPStyleActnCtrls, ActnMan, UMainWindow;
|
|---|
| 10 |
|
|---|
| 11 | const
|
|---|
| 12 | SmileysDefFile = 'Smileys\Smileys.def';
|
|---|
| 13 |
|
|---|
| 14 | type
|
|---|
| 15 | TOptionsWindow = class(TForm)
|
|---|
| 16 | PageControl1: TPageControl;
|
|---|
| 17 | TabSheet1: TTabSheet;
|
|---|
| 18 | Label1: TLabel;
|
|---|
| 19 | Button1: TButton;
|
|---|
| 20 | Edit1: TEdit;
|
|---|
| 21 | TabSheet3: TTabSheet;
|
|---|
| 22 | Label2: TLabel;
|
|---|
| 23 | TrackBar1: TTrackBar;
|
|---|
| 24 | CheckBox1: TCheckBox;
|
|---|
| 25 | CheckBox2: TCheckBox;
|
|---|
| 26 | CheckBox3: TCheckBox;
|
|---|
| 27 | CheckBox4: TCheckBox;
|
|---|
| 28 | CheckBox5: TCheckBox;
|
|---|
| 29 | CheckBox6: TCheckBox;
|
|---|
| 30 | CheckBox7: TCheckBox;
|
|---|
| 31 | CheckBox8: TCheckBox;
|
|---|
| 32 | Label4: TLabel;
|
|---|
| 33 | Edit2: TEdit;
|
|---|
| 34 | Label5: TLabel;
|
|---|
| 35 | Shape1: TShape;
|
|---|
| 36 | ColorDialog1: TColorDialog;
|
|---|
| 37 | CheckBox9: TCheckBox;
|
|---|
| 38 | CheckBox10: TCheckBox;
|
|---|
| 39 | CheckBox11: TCheckBox;
|
|---|
| 40 | CheckBox13: TCheckBox;
|
|---|
| 41 | CheckBox14: TCheckBox;
|
|---|
| 42 | CheckBox15: TCheckBox;
|
|---|
| 43 | TabSheet4: TTabSheet;
|
|---|
| 44 | Label7: TLabel;
|
|---|
| 45 | ListBox1: TListBox;
|
|---|
| 46 | GroupBox1: TGroupBox;
|
|---|
| 47 | CheckBox16: TCheckBox;
|
|---|
| 48 | CheckBox17: TCheckBox;
|
|---|
| 49 | Edit3: TEdit;
|
|---|
| 50 | Button2: TButton;
|
|---|
| 51 | CheckBox18: TCheckBox;
|
|---|
| 52 | Edit4: TEdit;
|
|---|
| 53 | Button3: TButton;
|
|---|
| 54 | CheckBox19: TCheckBox;
|
|---|
| 55 | CheckBox20: TCheckBox;
|
|---|
| 56 | CheckBox21: TCheckBox;
|
|---|
| 57 | Edit5: TEdit;
|
|---|
| 58 | OpenDialog1: TOpenDialog;
|
|---|
| 59 | Button4: TButton;
|
|---|
| 60 | CheckBox22: TCheckBox;
|
|---|
| 61 | Edit6: TEdit;
|
|---|
| 62 | Label8: TLabel;
|
|---|
| 63 | Label10: TLabel;
|
|---|
| 64 | SpinEdit3: TSpinEdit;
|
|---|
| 65 | Button6: TButton;
|
|---|
| 66 | SpinEdit1: TSpinEdit;
|
|---|
| 67 | Label6: TLabel;
|
|---|
| 68 | Label11: TLabel;
|
|---|
| 69 | Button7: TButton;
|
|---|
| 70 | SaveDialog1: TSaveDialog;
|
|---|
| 71 | Label12: TLabel;
|
|---|
| 72 | CheckBox12: TCheckBox;
|
|---|
| 73 | SpinEdit4: TSpinEdit;
|
|---|
| 74 | GroupBox2: TGroupBox;
|
|---|
| 75 | TrackBar2: TTrackBar;
|
|---|
| 76 | SpeedButton4: TSpeedButton;
|
|---|
| 77 | TabSheet5: TTabSheet;
|
|---|
| 78 | Label13: TLabel;
|
|---|
| 79 | ListBox2: TListBox;
|
|---|
| 80 | GroupBox3: TGroupBox;
|
|---|
| 81 | SpeedButton5: TSpeedButton;
|
|---|
| 82 | CheckBox23: TCheckBox;
|
|---|
| 83 | CheckBox24: TCheckBox;
|
|---|
| 84 | Edit7: TEdit;
|
|---|
| 85 | Button5: TButton;
|
|---|
| 86 | CheckBox25: TCheckBox;
|
|---|
| 87 | Edit8: TEdit;
|
|---|
| 88 | Button8: TButton;
|
|---|
| 89 | CheckBox27: TCheckBox;
|
|---|
| 90 | CheckBox28: TCheckBox;
|
|---|
| 91 | Edit9: TEdit;
|
|---|
| 92 | GroupBox4: TGroupBox;
|
|---|
| 93 | SpeedButton3: TSpeedButton;
|
|---|
| 94 | SpeedButton2: TSpeedButton;
|
|---|
| 95 | SpeedButton1: TSpeedButton;
|
|---|
| 96 | Edit10: TEdit;
|
|---|
| 97 | FontDialog1: TFontDialog;
|
|---|
| 98 | RichEdit1: TRichEdit;
|
|---|
| 99 | Label15: TLabel;
|
|---|
| 100 | Button9: TButton;
|
|---|
| 101 | CheckBox26: TCheckBox;
|
|---|
| 102 | ComboBox2: TComboBox;
|
|---|
| 103 | CheckBox29: TCheckBox;
|
|---|
| 104 | CheckBox30: TCheckBox;
|
|---|
| 105 | Edit11: TEdit;
|
|---|
| 106 | GroupBox5: TGroupBox;
|
|---|
| 107 | Label3: TLabel;
|
|---|
| 108 | ComboBox1: TComboBox;
|
|---|
| 109 | SpinEdit2: TSpinEdit;
|
|---|
| 110 | Label9: TLabel;
|
|---|
| 111 | Label14: TLabel;
|
|---|
| 112 | ComboBox3: TComboBox;
|
|---|
| 113 | SpeedButton7: TSpeedButton;
|
|---|
| 114 | Edit12: TEdit;
|
|---|
| 115 | Button10: TButton;
|
|---|
| 116 | Edit13: TEdit;
|
|---|
| 117 | Label16: TLabel;
|
|---|
| 118 | Label17: TLabel;
|
|---|
| 119 | ComboBox4: TComboBox;
|
|---|
| 120 | CheckBox31: TCheckBox;
|
|---|
| 121 | Button11: TButton;
|
|---|
| 122 | OpenPictureDialog1: TOpenPictureDialog;
|
|---|
| 123 | CheckBox32: TCheckBox;
|
|---|
| 124 | Edit14: TEdit;
|
|---|
| 125 | Button12: TButton;
|
|---|
| 126 | CheckBox33: TCheckBox;
|
|---|
| 127 | SpeedButton8: TSpeedButton;
|
|---|
| 128 | PopupMenu1: TPopupMenu;
|
|---|
| 129 | Pidat1: TMenuItem;
|
|---|
| 130 | Zmnitjmnoudlosti1: TMenuItem;
|
|---|
| 131 | S1: TMenuItem;
|
|---|
| 132 | Posunoutudlostnahoru1: TMenuItem;
|
|---|
| 133 | Posunoutudlostdol1: TMenuItem;
|
|---|
| 134 | Nastudlostisobrzkyzesouboru1: TMenuItem;
|
|---|
| 135 | ActionManager1: TActionManager;
|
|---|
| 136 | ActionAddUserEvent: TAction;
|
|---|
| 137 | ActionDeleteUserEvent: TAction;
|
|---|
| 138 | ActionMoveUserEventUp: TAction;
|
|---|
| 139 | ActionMoveUserEventDown: TAction;
|
|---|
| 140 | ActionImportUserEventList: TAction;
|
|---|
| 141 | ActionEditUserEventCaption: TAction;
|
|---|
| 142 | ActionInsertToMessage: TAction;
|
|---|
| 143 | ActionDeleteAllUserEvents: TAction;
|
|---|
| 144 | SpeedButton6: TSpeedButton;
|
|---|
| 145 | Smazatvechnyudlosti1: TMenuItem;
|
|---|
| 146 | Vloittextdozprvy1: TMenuItem;
|
|---|
| 147 | ActionSaveUserEventsList: TAction;
|
|---|
| 148 | Uloitseznamudlostdosouboru1: TMenuItem;
|
|---|
| 149 | RadioGroup1: TRadioGroup;
|
|---|
| 150 | Label18: TLabel;
|
|---|
| 151 | Label19: TLabel;
|
|---|
| 152 | procedure Button1Click(Sender: TObject);
|
|---|
| 153 | procedure FormShow(Sender: TObject);
|
|---|
| 154 | procedure Shape1MouseDown(Sender: TObject; Button: TMouseButton;
|
|---|
| 155 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 156 | procedure TrackBar1Change(Sender: TObject);
|
|---|
| 157 | procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 158 | procedure Edit2KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 159 | procedure ListBox1Click(Sender: TObject);
|
|---|
| 160 | procedure CheckBox16Click(Sender: TObject);
|
|---|
| 161 | procedure CheckBox19Click(Sender: TObject);
|
|---|
| 162 | procedure CheckBox20Click(Sender: TObject);
|
|---|
| 163 | procedure CheckBox17Click(Sender: TObject);
|
|---|
| 164 | procedure CheckBox18Click(Sender: TObject);
|
|---|
| 165 | procedure CheckBox21Click(Sender: TObject);
|
|---|
| 166 | procedure Button2Click(Sender: TObject);
|
|---|
| 167 | procedure Button3Click(Sender: TObject);
|
|---|
| 168 | procedure Edit3Change(Sender: TObject);
|
|---|
| 169 | procedure Edit4Change(Sender: TObject);
|
|---|
| 170 | procedure Edit5Change(Sender: TObject);
|
|---|
| 171 | procedure Button4Click(Sender: TObject);
|
|---|
| 172 | procedure CheckBox22Click(Sender: TObject);
|
|---|
| 173 | procedure Button6Click(Sender: TObject);
|
|---|
| 174 | procedure Button7Click(Sender: TObject);
|
|---|
| 175 | procedure FormCreate(Sender: TObject);
|
|---|
| 176 | procedure SpeedButton4Click(Sender: TObject);
|
|---|
| 177 | procedure Button9Click(Sender: TObject);
|
|---|
| 178 | procedure Button10Click(Sender: TObject);
|
|---|
| 179 | procedure Edit12Change(Sender: TObject);
|
|---|
| 180 | procedure ComboBox1Change(Sender: TObject);
|
|---|
| 181 | procedure CheckBox9Click(Sender: TObject);
|
|---|
| 182 | procedure Button11Click(Sender: TObject);
|
|---|
| 183 | procedure ListBox2Click(Sender: TObject);
|
|---|
| 184 | procedure CheckBox29Click(Sender: TObject);
|
|---|
| 185 | procedure Edit10Change(Sender: TObject);
|
|---|
| 186 | procedure CheckBox26Click(Sender: TObject);
|
|---|
| 187 | procedure ComboBox2Change(Sender: TObject);
|
|---|
| 188 | procedure CheckBox30Click(Sender: TObject);
|
|---|
| 189 | procedure Edit11Change(Sender: TObject);
|
|---|
| 190 | procedure CheckBox23Click(Sender: TObject);
|
|---|
| 191 | procedure CheckBox27Click(Sender: TObject);
|
|---|
| 192 | procedure CheckBox24Click(Sender: TObject);
|
|---|
| 193 | procedure CheckBox33Click(Sender: TObject);
|
|---|
| 194 | procedure Edit7Change(Sender: TObject);
|
|---|
| 195 | procedure CheckBox25Click(Sender: TObject);
|
|---|
| 196 | procedure Edit8Change(Sender: TObject);
|
|---|
| 197 | procedure CheckBox28Click(Sender: TObject);
|
|---|
| 198 | procedure Edit9Change(Sender: TObject);
|
|---|
| 199 | procedure CheckBox32Click(Sender: TObject);
|
|---|
| 200 | procedure Edit14Change(Sender: TObject);
|
|---|
| 201 | procedure SpeedButton5Click(Sender: TObject);
|
|---|
| 202 | procedure Button5Click(Sender: TObject);
|
|---|
| 203 | procedure Button8Click(Sender: TObject);
|
|---|
| 204 | procedure Button12Click(Sender: TObject);
|
|---|
| 205 | procedure Button14Click(Sender: TObject);
|
|---|
| 206 | procedure ListBox2DblClick(Sender: TObject);
|
|---|
| 207 | procedure ActionAddUserEventExecute(Sender: TObject);
|
|---|
| 208 | procedure ActionDeleteUserEventExecute(Sender: TObject);
|
|---|
| 209 | procedure ActionMoveUserEventUpExecute(Sender: TObject);
|
|---|
| 210 | procedure ActionMoveUserEventDownExecute(Sender: TObject);
|
|---|
| 211 | procedure ActionImportUserEventListExecute(Sender: TObject);
|
|---|
| 212 | procedure ActionEditUserEventCaptionExecute(Sender: TObject);
|
|---|
| 213 | procedure ActionInsertToMessageExecute(Sender: TObject);
|
|---|
| 214 | procedure ActionDeleteAllUserEventsExecute(Sender: TObject);
|
|---|
| 215 | procedure ActionSaveUserEventsListExecute(Sender: TObject);
|
|---|
| 216 | procedure TrackBar2Change(Sender: TObject);
|
|---|
| 217 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|---|
| 218 | private
|
|---|
| 219 | { Private declarations }
|
|---|
| 220 | public
|
|---|
| 221 | AppEvents: array of TAppEvent;
|
|---|
| 222 | AppUserEvents: array of TAppUserEvent;
|
|---|
| 223 | procedure LoadEventOptions;
|
|---|
| 224 | procedure LoadUserEventOptions;
|
|---|
| 225 | procedure ListBox2Reload;
|
|---|
| 226 | procedure SaveUserEvents;
|
|---|
| 227 | end;
|
|---|
| 228 |
|
|---|
| 229 | var
|
|---|
| 230 | OptionsWindow: TOptionsWindow;
|
|---|
| 231 |
|
|---|
| 232 | implementation
|
|---|
| 233 |
|
|---|
| 234 | uses
|
|---|
| 235 | ULocalization, DateUtils, UJobProgressView, SunriseChatNetworkCoreUnit,
|
|---|
| 236 | SunriseChatCoreUnit;
|
|---|
| 237 |
|
|---|
| 238 | {$R *.dfm}
|
|---|
| 239 |
|
|---|
| 240 | // Closing dialog and saving options
|
|---|
| 241 | procedure TOptionsWindow.Button1Click(Sender: TObject);
|
|---|
| 242 | var
|
|---|
| 243 | I: Integer;
|
|---|
| 244 | DiffrentAppUserEvents: Boolean;
|
|---|
| 245 | begin
|
|---|
| 246 | with MainWindow, SunriseChatNetworkCore1, OptionsWindow do begin
|
|---|
| 247 | if LocalUser.Nick <> Edit1.Text then LocalUser.Nick := Edit1.Text;
|
|---|
| 248 | if NetworkInterface <> TNetworkInterface(NetworkInterfaces[ComboBox1.ItemIndex]).GUID then begin
|
|---|
| 249 | SelectNetworkInterfaceByGUID(TNetworkInterface(NetworkInterfaces[ComboBox1.ItemIndex]).GUID);
|
|---|
| 250 | NetworkInterface := TNetworkInterface(NetworkInterfaces[ComboBox1.ItemIndex]).GUID;
|
|---|
| 251 | end;
|
|---|
| 252 |
|
|---|
| 253 | NetworkPort:= SpinEdit2.Value;
|
|---|
| 254 | if UDPPort <> NetworkPort then begin
|
|---|
| 255 | UDPPort := NetworkPort;
|
|---|
| 256 | ShowMessage('Změna se projeví až po restartu aplikace!');
|
|---|
| 257 | //SunriseChatCore.StartNetwork;
|
|---|
| 258 | end;
|
|---|
| 259 | LocalUser.Color := Shape1.Brush.Color;
|
|---|
| 260 | ShowMainMenu := CheckBox1.Checked;
|
|---|
| 261 | MainMenu1.Items.Visible := ShowMainMenu;
|
|---|
| 262 | RunOnLogon := CheckBox2.Checked;
|
|---|
| 263 | ChangeRunOnLogon;
|
|---|
| 264 | MinimizeToTray := CheckBox3.Checked;
|
|---|
| 265 | MainWindow.InitTrayIcon;
|
|---|
| 266 | StartInTray := CheckBox4.Checked;
|
|---|
| 267 | OnTop := CheckBox5.Checked;
|
|---|
| 268 | ToolButton5.Marked := OnTop;
|
|---|
| 269 | ShowOnMessage := CheckBox6.Checked;
|
|---|
| 270 | ShowMessageTime := CheckBox7.Checked;
|
|---|
| 271 | TabControl1Change(Self);
|
|---|
| 272 | ShowBallonHint := CheckBox8.Checked;
|
|---|
| 273 | ServiceFunction := CheckBox9.Checked;
|
|---|
| 274 | MinimalizeOnCloseWindow := CheckBox10.Checked;
|
|---|
| 275 | ShowRightToolBar := CheckBox11.Checked;
|
|---|
| 276 | AutoAwayDelay := SpinEdit1.Value;
|
|---|
| 277 | OneAppInstance := CheckBox13.Checked;
|
|---|
| 278 | SoundDisable := CheckBox14.Checked;
|
|---|
| 279 | SnapWindow := CheckBox15.Checked;
|
|---|
| 280 | MainWindow.ScreenSnap := SnapWindow;
|
|---|
| 281 | ToolButton4.Marked := SoundDisable;
|
|---|
| 282 | LocalUser.DetailInfo := Edit6.Text;
|
|---|
| 283 | if MinimumVisibleUsersCount <> SpinEdit4.Value then begin
|
|---|
| 284 | MinimumVisibleUsersCount := SpinEdit4.Value;
|
|---|
| 285 | ListView1.Items.Clear;
|
|---|
| 286 | MainWindow.ShowUserList;
|
|---|
| 287 | end;
|
|---|
| 288 | SoundVolume := 1000-TrackBar2.Position;
|
|---|
| 289 | InvisibledOnStart := CheckBox31.Checked;
|
|---|
| 290 | AutoChangeWindowHeight := CheckBox12.Checked;
|
|---|
| 291 | AutoChangeWindowHeightDirectionDown := ComboBox4.ItemIndex = 1;
|
|---|
| 292 | MinimumVisibleUsersCount := SpinEdit4.Value;
|
|---|
| 293 | if MaxNumberOfRoomLines <> SpinEdit3.Value then begin
|
|---|
| 294 | MaxNumberOfRoomLines := SpinEdit3.Value;
|
|---|
| 295 | MaxRoomLines := MaxNumberOfRoomLines;
|
|---|
| 296 | TabControl1Change(Self);
|
|---|
| 297 | end;
|
|---|
| 298 |
|
|---|
| 299 | Panel5.Visible := ShowRightToolBar;
|
|---|
| 300 | //Panel2.Visible := False;
|
|---|
| 301 | //Panel2.Visible := True;
|
|---|
| 302 | AlphaBlendWindow := TrackBar1.Position;
|
|---|
| 303 | MainWindow.AlphaBlendValue := AlphaBlendWindow;
|
|---|
| 304 | AlphaBlend := AlphaBlendValue < 255;
|
|---|
| 305 |
|
|---|
| 306 | // ChangeMenuVisibility(ShowMainMenu);
|
|---|
| 307 | DefaultReason:= Edit2.Text;
|
|---|
| 308 | InitTrayIcon;
|
|---|
| 309 |
|
|---|
| 310 | BroadcastType := TBroadCastType(RadioGroup1.ItemIndex);
|
|---|
| 311 | BroadcastTypeI := RadioGroup1.ItemIndex;
|
|---|
| 312 |
|
|---|
| 313 | SetLength(MainWindow.AppEvents,Length(AppEvents));
|
|---|
| 314 | for I:= 0 to High(AppEvents) do
|
|---|
| 315 | MainWindow.AppEvents[I]:= AppEvents[I];
|
|---|
| 316 | MainWindow.SaveAppEventsToRegistry;
|
|---|
| 317 |
|
|---|
| 318 | // Save user events
|
|---|
| 319 | DiffrentAppUserEvents := False;
|
|---|
| 320 | if Length(AppUserEvents) <> Length(MainWindow.AppUserEvents) then
|
|---|
| 321 | DiffrentAppUserEvents := True
|
|---|
| 322 | else begin
|
|---|
| 323 | for I := 0 to High(AppUserEvents) do begin
|
|---|
| 324 | if (MainWindow.AppUserEvents[I].ConditionTextEnable <> AppUserEvents[I].ConditionTextEnable) or
|
|---|
| 325 | (MainWindow.AppUserEvents[I].ConditionText <> AppUserEvents[I].ConditionText) or
|
|---|
| 326 | (MainWindow.AppUserEvents[I].ConditionUserEnable <> AppUserEvents[I].ConditionUserEnable) or
|
|---|
| 327 | (MainWindow.AppUserEvents[I].ConditionUser <> AppUserEvents[I].ConditionUser) or
|
|---|
| 328 | (MainWindow.AppUserEvents[I].ConditionAppEventEnable <> AppUserEvents[I].ConditionAppEventEnable) or
|
|---|
| 329 | (MainWindow.AppUserEvents[I].ConditionAppEvent <> AppUserEvents[I].ConditionAppEvent) or
|
|---|
| 330 | (MainWindow.AppUserEvents[I].EventName <> AppUserEvents[I].EventName) or
|
|---|
| 331 | (MainWindow.AppUserEvents[I].ShowWindow <> AppUserEvents[I].ShowWindow) or
|
|---|
| 332 | (MainWindow.AppUserEvents[I].ShowBalloonHint <> AppUserEvents[I].ShowBalloonHint) or
|
|---|
| 333 | (MainWindow.AppUserEvents[I].PlaySound <> AppUserEvents[I].PlaySound) or
|
|---|
| 334 | (MainWindow.AppUserEvents[I].ShowAlertIcon <> AppUserEvents[I].ShowAlertIcon) or
|
|---|
| 335 | (MainWindow.AppUserEvents[I].IconFile <> AppUserEvents[I].IconFile) or
|
|---|
| 336 | (MainWindow.AppUserEvents[I].PlayBeep <> AppUserEvents[I].PlayBeep) or
|
|---|
| 337 | (MainWindow.AppUserEvents[I].SoundFile <> AppUserEvents[I].SoundFile) or
|
|---|
| 338 | (MainWindow.AppUserEvents[I].ExecuteApplication <> AppUserEvents[I].ExecuteApplication) or
|
|---|
| 339 | (MainWindow.AppUserEvents[I].ApplicationFile <> AppUserEvents[I].ApplicationFile) or
|
|---|
| 340 | (MainWindow.AppUserEvents[I].ShowImage <> AppUserEvents[I].ShowImage) or
|
|---|
| 341 | (MainWindow.AppUserEvents[I].ImageFile <> AppUserEvents[I].ImageFile) then
|
|---|
| 342 | DiffrentAppUserEvents := True;
|
|---|
| 343 | end;
|
|---|
| 344 | end;
|
|---|
| 345 | if DiffrentAppUserEvents then begin
|
|---|
| 346 | SetLength(MainWindow.AppUserEvents, Length(AppUserEvents));
|
|---|
| 347 | for I := 0 to High(AppUserEvents) do
|
|---|
| 348 | MainWindow.AppUserEvents[I] := AppUserEvents[I];
|
|---|
| 349 | SetLength(MainWindow.AppUserEventsOptions, Length(AppUserEvents));
|
|---|
| 350 | MainWindow.AppUserEventsCount := Length(AppUserEvents);
|
|---|
| 351 |
|
|---|
| 352 | JobProgressView.AddJob('Načtení z registrů', SaveUserEvents);
|
|---|
| 353 | JobProgressView.AddJob('Uložení do registrů', MainWindow.SaveAppUserEventsToRegistry);
|
|---|
| 354 | JobProgressView.Start;
|
|---|
| 355 | ReloadImages;
|
|---|
| 356 | end;
|
|---|
| 357 | MainWindow.LanguageIndex := ComboBox3.ItemIndex;
|
|---|
| 358 | Localization.Activate(MainWindow.LanguageIndex);
|
|---|
| 359 | end;
|
|---|
| 360 | MainWindow.Options.SaveToRegistry;
|
|---|
| 361 | Close;
|
|---|
| 362 | end;
|
|---|
| 363 |
|
|---|
| 364 | procedure TOptionsWindow.FormShow(Sender: TObject);
|
|---|
| 365 | var
|
|---|
| 366 | I: Integer;
|
|---|
| 367 | begin
|
|---|
| 368 | with MainWindow.SunriseChatNetworkCore1 do begin
|
|---|
| 369 | Shape1.Brush.Color := LocalUser.Color;
|
|---|
| 370 | Edit1.Text := LocalUser.Nick;
|
|---|
| 371 | Edit2.Text := MainWindow.DefaultReason;
|
|---|
| 372 | Edit6.Text := LocalUser.DetailInfo;
|
|---|
| 373 | CheckBox1.Checked := MainWindow.ShowMainMenu;
|
|---|
| 374 | CheckBox2.Checked := MainWindow.RunOnLogon;
|
|---|
| 375 | CheckBox3.Checked := MainWindow.MinimizeToTray;
|
|---|
| 376 | CheckBox4.Checked := MainWindow.StartInTray;
|
|---|
| 377 | CheckBox5.Checked := MainWindow.OnTop;
|
|---|
| 378 | CheckBox6.Checked := MainWindow.ShowOnMessage;
|
|---|
| 379 | CheckBox7.Checked := MainWindow.ShowMessageTime;
|
|---|
| 380 | CheckBox8.Checked := MainWindow.ShowBallonHint;
|
|---|
| 381 | CheckBox9.Checked := MainWindow.ServiceFunction;
|
|---|
| 382 | CheckBox10.Checked := MainWindow.MinimalizeOnCloseWindow;
|
|---|
| 383 | CheckBox11.Checked := MainWindow.ShowRightToolBar;
|
|---|
| 384 | CheckBox12.Checked := MainWindow.AutoChangeWindowHeight;
|
|---|
| 385 | CheckBox13.Checked := MainWindow.OneAppInstance;
|
|---|
| 386 | CheckBox14.Checked := MainWindow.SoundDisable;
|
|---|
| 387 | CheckBox15.Checked := MainWindow.SnapWindow;
|
|---|
| 388 | CheckBox31.Checked := MainWindow.InvisibledOnStart;
|
|---|
| 389 | SpinEdit1.Value := AutoAwayDelay;
|
|---|
| 390 | SpinEdit3.Value := MainWindow.MaxNumberOfRoomLines;
|
|---|
| 391 | SpinEdit2.Value := MainWindow.NetworkPort;
|
|---|
| 392 | SpinEdit4.Value := MainWindow.MinimumVisibleUsersCount;
|
|---|
| 393 | TrackBar1.Position := MainWindow.AlphaBlendWindow;
|
|---|
| 394 | TrackBar2.Position := 1000 - MainWindow.SoundVolume;
|
|---|
| 395 | if MainWindow.AutoChangeWindowHeightDirectionDown then
|
|---|
| 396 | ComboBox4.ItemIndex := 1 else ComboBox4.ItemIndex:= 0;
|
|---|
| 397 | RadioGroup1.ItemIndex := MainWindow.BroadcastTypeI;
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 | // Fill network interfaces list
|
|---|
| 401 | ComboBox1.Items.Clear;
|
|---|
| 402 | for I := 0 to NetworkInterfaces.Count-1 do ComboBox1.Items.Add(TNetworkInterface(NetworkInterfaces[I]).Name);
|
|---|
| 403 | ComboBox1.ItemIndex := NetworkInterfaces.IndexOf(ActiveNetworkInterface);
|
|---|
| 404 |
|
|---|
| 405 | ComboBox3.Items.Clear;
|
|---|
| 406 | for I := 0 to High(Localization.Languages) do ComboBox3.Items.Add(Localization.Languages[I].Name);
|
|---|
| 407 | if MainWindow.LanguageIndex < ComboBox3.Items.Count then ComboBox3.ItemIndex := MainWindow.LanguageIndex;
|
|---|
| 408 | ComboBox1Change(Self);
|
|---|
| 409 |
|
|---|
| 410 | // Load AppEvents
|
|---|
| 411 | // ShowMessage(IntToStr(Length(MainWindow.AppEvents)));
|
|---|
| 412 | SetLength(AppEvents,Length(MainWindow.AppEvents));
|
|---|
| 413 | for I := 0 to High(AppEvents) do
|
|---|
| 414 | AppEvents[I] := MainWindow.AppEvents[I];
|
|---|
| 415 | ListBox1.Items.BeginUpdate;
|
|---|
| 416 | ListBox1.Items.Clear;
|
|---|
| 417 | for I := 0 to High(AppEvents) do ListBox1.Items.Add(AppEvents[I].EventName);
|
|---|
| 418 | ListBox1.Items.EndUpdate;
|
|---|
| 419 | ListBox1.ItemIndex := 0;
|
|---|
| 420 | ListBox1Click(Self);
|
|---|
| 421 |
|
|---|
| 422 | // Load AppUserEvents
|
|---|
| 423 | SetLength(AppUserEvents,Length(MainWindow.AppUserEvents));
|
|---|
| 424 | for I := 0 to High(AppUserEvents) do
|
|---|
| 425 | AppUserEvents[I] := MainWindow.AppUserEvents[I];
|
|---|
| 426 | ListBox2.Items.BeginUpdate;
|
|---|
| 427 | ListBox2.Items.Clear;
|
|---|
| 428 | for I := 0 to High(AppUserEvents) do ListBox2.Items.Add(AppUserEvents[I].EventName);
|
|---|
| 429 | ListBox2.Items.EndUpdate;
|
|---|
| 430 | ListBox2.ItemIndex := 0;
|
|---|
| 431 | ComboBox2.Items.Clear;
|
|---|
| 432 | for I := 0 to High(AppEvents) do ComboBox2.Items.Add(AppEvents[I].EventName);
|
|---|
| 433 | LoadUserEventOptions;
|
|---|
| 434 | SendCommand(scUserInfo);
|
|---|
| 435 | end;
|
|---|
| 436 | end;
|
|---|
| 437 |
|
|---|
| 438 | procedure TOptionsWindow.Shape1MouseDown(Sender: TObject;
|
|---|
| 439 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|---|
| 440 | begin
|
|---|
| 441 | if ColorDialog1.Execute then Shape1.Brush.Color := ColorDialog1.Color;
|
|---|
| 442 | end;
|
|---|
| 443 |
|
|---|
| 444 | procedure TOptionsWindow.TrackBar1Change(Sender: TObject);
|
|---|
| 445 | begin
|
|---|
| 446 | MainWindow.AlphaBlendValue := TrackBar1.Position;
|
|---|
| 447 | end;
|
|---|
| 448 |
|
|---|
| 449 | procedure TOptionsWindow.Edit1KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 450 | begin
|
|---|
| 451 | if Key = #13 then begin
|
|---|
| 452 | Key := #0;
|
|---|
| 453 | Button1Click(Self);
|
|---|
| 454 | end;
|
|---|
| 455 | end;
|
|---|
| 456 |
|
|---|
| 457 | procedure TOptionsWindow.Edit2KeyPress(Sender: TObject; var Key: Char);
|
|---|
| 458 | begin
|
|---|
| 459 | if Key = #13 then begin
|
|---|
| 460 | Key:= #0;
|
|---|
| 461 | Button1Click(Self);
|
|---|
| 462 | end;
|
|---|
| 463 | end;
|
|---|
| 464 |
|
|---|
| 465 | procedure TOptionsWindow.ListBox1Click(Sender: TObject);
|
|---|
| 466 | begin
|
|---|
| 467 | LoadEventOptions;
|
|---|
| 468 | end;
|
|---|
| 469 |
|
|---|
| 470 | procedure TOptionsWindow.LoadEventOptions;
|
|---|
| 471 | begin
|
|---|
| 472 | with AppEvents[ListBox1.ItemIndex] do begin
|
|---|
| 473 | CheckBox16.Checked := ShowWindow;
|
|---|
| 474 | CheckBox19.Checked := ShowAlertIcon;
|
|---|
| 475 | Edit12.Text := IconFile;
|
|---|
| 476 | CheckBox20.Checked := ShowBalloonHint;
|
|---|
| 477 | CheckBox17.Checked := PlaySound;
|
|---|
| 478 | CheckBox22.Checked := PlayBeep;
|
|---|
| 479 | Edit3.Text := SoundFile;
|
|---|
| 480 | CheckBox18.Checked := ExecuteApplication;
|
|---|
| 481 | Edit4.Text := ApplicationFile;
|
|---|
| 482 | CheckBox21.Checked := ShowMessage;
|
|---|
| 483 | Edit5.Text := MessageText;
|
|---|
| 484 | FontDialog1.Font := MessageFont;
|
|---|
| 485 | RichEdit1.SelectAll;
|
|---|
| 486 | RichEdit1.SelAttributes.Name := MessageFont.Name;
|
|---|
| 487 | RichEdit1.SelAttributes.Charset := MessageFont.Charset;
|
|---|
| 488 | RichEdit1.SelAttributes.Color := MessageFont.Color;
|
|---|
| 489 | RichEdit1.SelAttributes.Style := MessageFont.Style;
|
|---|
| 490 | RichEdit1.SelAttributes.Size := MessageFont.Size;
|
|---|
| 491 | RichEdit1.SelAttributes.Pitch := MessageFont.Pitch;
|
|---|
| 492 | end;
|
|---|
| 493 | end;
|
|---|
| 494 |
|
|---|
| 495 | procedure TOptionsWindow.CheckBox16Click(Sender: TObject);
|
|---|
| 496 | begin
|
|---|
| 497 | AppEvents[ListBox1.ItemIndex].ShowWindow:= CheckBox16.Checked;
|
|---|
| 498 | end;
|
|---|
| 499 |
|
|---|
| 500 | procedure TOptionsWindow.CheckBox19Click(Sender: TObject);
|
|---|
| 501 | begin
|
|---|
| 502 | AppEvents[ListBox1.ItemIndex].ShowAlertIcon:= CheckBox19.Checked;
|
|---|
| 503 | end;
|
|---|
| 504 |
|
|---|
| 505 | procedure TOptionsWindow.CheckBox20Click(Sender: TObject);
|
|---|
| 506 | begin
|
|---|
| 507 | AppEvents[ListBox1.ItemIndex].ShowBalloonHint:= CheckBox20.Checked;
|
|---|
| 508 | end;
|
|---|
| 509 |
|
|---|
| 510 | procedure TOptionsWindow.CheckBox17Click(Sender: TObject);
|
|---|
| 511 | begin
|
|---|
| 512 | AppEvents[ListBox1.ItemIndex].PlaySound:= CheckBox17.Checked;
|
|---|
| 513 | end;
|
|---|
| 514 |
|
|---|
| 515 | procedure TOptionsWindow.CheckBox18Click(Sender: TObject);
|
|---|
| 516 | begin
|
|---|
| 517 | AppEvents[ListBox1.ItemIndex].ExecuteApplication:= CheckBox18.Checked;
|
|---|
| 518 | end;
|
|---|
| 519 |
|
|---|
| 520 | procedure TOptionsWindow.CheckBox21Click(Sender: TObject);
|
|---|
| 521 | begin
|
|---|
| 522 | AppEvents[ListBox1.ItemIndex].ShowMessage:= CheckBox21.Checked;
|
|---|
| 523 | end;
|
|---|
| 524 |
|
|---|
| 525 | procedure TOptionsWindow.Button2Click(Sender: TObject);
|
|---|
| 526 | begin
|
|---|
| 527 | OpenDialog1.Filter:= 'Soubory WAV|*.wav|Všechny soubory|*.*';
|
|---|
| 528 | OpenDialog1.FileName:= Edit3.Text;
|
|---|
| 529 | if OpenDialog1.Execute then begin
|
|---|
| 530 | CheckBox17.Checked := True;
|
|---|
| 531 | Edit3.Text:= OpenDialog1.FileName;
|
|---|
| 532 | AppEvents[ListBox1.ItemIndex].SoundFile:= OpenDialog1.FileName;
|
|---|
| 533 | end;
|
|---|
| 534 | end;
|
|---|
| 535 |
|
|---|
| 536 | procedure TOptionsWindow.Button3Click(Sender: TObject);
|
|---|
| 537 | begin
|
|---|
| 538 | OpenDialog1.Filter:= 'Spustitelné soubory|*.exe|Všechny soubory|*.*';
|
|---|
| 539 | OpenDialog1.FileName:= Edit4.Text;
|
|---|
| 540 | if OpenDialog1.Execute then begin
|
|---|
| 541 | CheckBox18.Checked := True;
|
|---|
| 542 | Edit4.Text:= OpenDialog1.FileName;
|
|---|
| 543 | AppEvents[ListBox1.ItemIndex].ApplicationFile:= OpenDialog1.FileName;
|
|---|
| 544 | end;
|
|---|
| 545 | end;
|
|---|
| 546 |
|
|---|
| 547 | procedure TOptionsWindow.Edit3Change(Sender: TObject);
|
|---|
| 548 | begin
|
|---|
| 549 | AppEvents[ListBox1.ItemIndex].SoundFile:= Edit3.Text;
|
|---|
| 550 | end;
|
|---|
| 551 |
|
|---|
| 552 | procedure TOptionsWindow.Edit4Change(Sender: TObject);
|
|---|
| 553 | begin
|
|---|
| 554 | AppEvents[ListBox1.ItemIndex].ApplicationFile:= Edit4.Text;
|
|---|
| 555 | end;
|
|---|
| 556 |
|
|---|
| 557 | procedure TOptionsWindow.Edit5Change(Sender: TObject);
|
|---|
| 558 | begin
|
|---|
| 559 | AppEvents[ListBox1.ItemIndex].MessageText:= Edit5.Text;
|
|---|
| 560 | end;
|
|---|
| 561 |
|
|---|
| 562 | procedure TOptionsWindow.Button4Click(Sender: TObject);
|
|---|
| 563 | begin
|
|---|
| 564 | Close;
|
|---|
| 565 | end;
|
|---|
| 566 |
|
|---|
| 567 | procedure TOptionsWindow.CheckBox22Click(Sender: TObject);
|
|---|
| 568 | begin
|
|---|
| 569 | AppEvents[ListBox1.ItemIndex].PlayBeep:= CheckBox22.Checked;
|
|---|
| 570 | end;
|
|---|
| 571 |
|
|---|
| 572 | procedure TOptionsWindow.Button6Click(Sender: TObject);
|
|---|
| 573 | var
|
|---|
| 574 | I: Integer;
|
|---|
| 575 | begin
|
|---|
| 576 | // SetLength(AppEvents,0);
|
|---|
| 577 | with MainWindow do begin
|
|---|
| 578 | Options.Delete;
|
|---|
| 579 | for I:= 0 to High(AppEventsOptions) do begin
|
|---|
| 580 | AppEventsOptions[I].Delete;
|
|---|
| 581 | AppEventsOptions[I].Free;
|
|---|
| 582 | end;
|
|---|
| 583 | SetLength(AppEventsOptions,0);
|
|---|
| 584 | InitSettings;
|
|---|
| 585 | end;
|
|---|
| 586 | FormShow(Self);
|
|---|
| 587 | end;
|
|---|
| 588 |
|
|---|
| 589 | procedure TOptionsWindow.Button7Click(Sender: TObject);
|
|---|
| 590 | begin
|
|---|
| 591 | SaveDialog1.FileName:= 'Nastavení '+ApplicationName+'u '+DateToStr(Now)+'.reg';
|
|---|
| 592 | if SaveDialog1.Execute then
|
|---|
| 593 | //ShowMessage(IntToStr(
|
|---|
| 594 | ShellExecute(0, 'open', PChar('regedit.exe'), PChar('/e "'+SaveDialog1.FileName+'" "HKEY_CURRENT_USER'+RegistryPath+'"'), '', SW_SHOWNORMAL);
|
|---|
| 595 | end;
|
|---|
| 596 |
|
|---|
| 597 | procedure TOptionsWindow.FormCreate(Sender: TObject);
|
|---|
| 598 | begin
|
|---|
| 599 | if MainWindow.OnTop then FormStyle := fsStayOnTop
|
|---|
| 600 | else FormStyle := fsNormal;
|
|---|
| 601 | PageControl1.ActivePageIndex := 0;
|
|---|
| 602 | end;
|
|---|
| 603 |
|
|---|
| 604 | procedure TOptionsWindow.SpeedButton4Click(Sender: TObject);
|
|---|
| 605 | begin
|
|---|
| 606 | with MainWindow do try
|
|---|
| 607 | MediaPlayer1.FileName:= Edit3.Text;
|
|---|
| 608 | MediaPlayer1.Open;
|
|---|
| 609 | MediaPlayer1.Play;
|
|---|
| 610 | except
|
|---|
| 611 | Dialogs.ShowMessage(Localization.Item('AudioFileNotFound'));
|
|---|
| 612 | end;
|
|---|
| 613 | end;
|
|---|
| 614 |
|
|---|
| 615 | procedure TOptionsWindow.Button9Click(Sender: TObject);
|
|---|
| 616 | begin
|
|---|
| 617 | with AppEvents[ListBox1.ItemIndex] do
|
|---|
| 618 | if FontDialog1.Execute then begin
|
|---|
| 619 | MessageFont.Name := FontDialog1.Font.Name;
|
|---|
| 620 | MessageFont.Charset := FontDialog1.Font.Charset;
|
|---|
| 621 | MessageFont.Color := FontDialog1.Font.Color;
|
|---|
| 622 | MessageFont.Style := FontDialog1.Font.Style;
|
|---|
| 623 | MessageFont.Size := FontDialog1.Font.Size;
|
|---|
| 624 | MessageFont.Pitch := FontDialog1.Font.Pitch;
|
|---|
| 625 |
|
|---|
| 626 | RichEdit1.SelectAll;
|
|---|
| 627 | RichEdit1.SelAttributes.Name := MessageFont.Name;
|
|---|
| 628 | RichEdit1.SelAttributes.Charset := MessageFont.Charset;
|
|---|
| 629 | RichEdit1.SelAttributes.Color := MessageFont.Color;
|
|---|
| 630 | RichEdit1.SelAttributes.Style := MessageFont.Style;
|
|---|
| 631 | RichEdit1.SelAttributes.Size := MessageFont.Size;
|
|---|
| 632 | RichEdit1.SelAttributes.Pitch := MessageFont.Pitch;
|
|---|
| 633 | end;
|
|---|
| 634 | end;
|
|---|
| 635 |
|
|---|
| 636 | procedure TOptionsWindow.Button10Click(Sender: TObject);
|
|---|
| 637 | begin
|
|---|
| 638 | OpenDialog1.Filter:= 'Ikony|*.ico|Všechny soubory|*.*';
|
|---|
| 639 | OpenDialog1.FileName:= Edit12.Text;
|
|---|
| 640 | if OpenDialog1.Execute then begin
|
|---|
| 641 | CheckBox19.Checked := True;
|
|---|
| 642 | Edit12.Text:= OpenDialog1.FileName;
|
|---|
| 643 | AppEvents[ListBox1.ItemIndex].IconFile:= OpenDialog1.FileName;
|
|---|
| 644 | end;
|
|---|
| 645 | end;
|
|---|
| 646 |
|
|---|
| 647 | procedure TOptionsWindow.Edit12Change(Sender: TObject);
|
|---|
| 648 | begin
|
|---|
| 649 | AppEvents[ListBox1.ItemIndex].IconFile:= Edit12.Text;
|
|---|
| 650 | end;
|
|---|
| 651 |
|
|---|
| 652 | procedure TOptionsWindow.ComboBox1Change(Sender: TObject);
|
|---|
| 653 | begin
|
|---|
| 654 | Edit13.Text := TNetworkInterface(MainWindow.SunriseChatNetworkCore1.NetworkInterfaces[ComboBox1.ItemIndex]).IPAddress;
|
|---|
| 655 | end;
|
|---|
| 656 |
|
|---|
| 657 | procedure TOptionsWindow.CheckBox9Click(Sender: TObject);
|
|---|
| 658 | begin
|
|---|
| 659 | MainWindow.ServiceFunction:= CheckBox9.Checked;
|
|---|
| 660 | SpinEdit2.Visible:= MainWindow.ServiceFunction;
|
|---|
| 661 | Label16.Visible:= MainWindow.ServiceFunction;
|
|---|
| 662 | Edit13.Visible:= MainWindow.ServiceFunction;
|
|---|
| 663 | Label9.Visible:= MainWindow.ServiceFunction;
|
|---|
| 664 | end;
|
|---|
| 665 |
|
|---|
| 666 | procedure TOptionsWindow.Button11Click(Sender: TObject);
|
|---|
| 667 | begin
|
|---|
| 668 | OpenPictureDialog1.FileName:= Edit9.Text;
|
|---|
| 669 | if OpenPictureDialog1.Execute then begin
|
|---|
| 670 | CheckBox28.Checked := True;
|
|---|
| 671 | Edit9.Text:= OpenPictureDialog1.FileName;
|
|---|
| 672 | AppUserEvents[ListBox2.ItemIndex].SoundFile:= OpenPictureDialog1.FileName;
|
|---|
| 673 | end;
|
|---|
| 674 | end;
|
|---|
| 675 |
|
|---|
| 676 | procedure TOptionsWindow.LoadUserEventOptions;
|
|---|
| 677 | begin
|
|---|
| 678 | if (ListBox2.ItemIndex>=0) and (ListBox2.ItemIndex < ListBox2.Items.Count) then
|
|---|
| 679 | with AppUserEvents[ListBox2.ItemIndex] do begin
|
|---|
| 680 | CheckBox29.Checked:= ConditionTextEnable;
|
|---|
| 681 | Edit10.Text:= ConditionText;
|
|---|
| 682 | CheckBox26.Checked:= ConditionAppEventEnable;
|
|---|
| 683 | ComboBox2.ItemIndex:= Integer(ConditionAppEvent);
|
|---|
| 684 | CheckBox30.Checked:= ConditionUserEnable;
|
|---|
| 685 | Edit11.Text:= ConditionUser;
|
|---|
| 686 |
|
|---|
| 687 | CheckBox23.Checked:= ShowWindow;
|
|---|
| 688 | CheckBox27.Checked:= ShowBalloonHint;
|
|---|
| 689 | CheckBox24.Checked:= PlaySound;
|
|---|
| 690 | CheckBox33.Checked:= PlayBeep;
|
|---|
| 691 | CheckBox32.Checked:= ShowAlertIcon;
|
|---|
| 692 | Edit14.Text:= IconFile;
|
|---|
| 693 | Edit7.Text:= SoundFile;
|
|---|
| 694 | CheckBox25.Checked:= ExecuteApplication;
|
|---|
| 695 | Edit8.Text:= ApplicationFile;
|
|---|
| 696 | CheckBox28.Checked:= ShowImage;
|
|---|
| 697 | Edit9.Text:= ImageFile;
|
|---|
| 698 | end;
|
|---|
| 699 | end;
|
|---|
| 700 |
|
|---|
| 701 | procedure TOptionsWindow.ListBox2Click(Sender: TObject);
|
|---|
| 702 | begin
|
|---|
| 703 | LoadUserEventOptions;
|
|---|
| 704 | end;
|
|---|
| 705 |
|
|---|
| 706 | procedure TOptionsWindow.CheckBox29Click(Sender: TObject);
|
|---|
| 707 | begin
|
|---|
| 708 | AppUserEvents[ListBox2.ItemIndex].ConditionTextEnable:= CheckBox29.Checked;
|
|---|
| 709 | end;
|
|---|
| 710 |
|
|---|
| 711 | procedure TOptionsWindow.Edit10Change(Sender: TObject);
|
|---|
| 712 | begin
|
|---|
| 713 | AppUserEvents[ListBox2.ItemIndex].ConditionText:= Edit10.Text;
|
|---|
| 714 | end;
|
|---|
| 715 |
|
|---|
| 716 | procedure TOptionsWindow.CheckBox26Click(Sender: TObject);
|
|---|
| 717 | begin
|
|---|
| 718 | AppUserEvents[ListBox2.ItemIndex].ConditionAppEventEnable:= CheckBox26.Checked;
|
|---|
| 719 | end;
|
|---|
| 720 |
|
|---|
| 721 | procedure TOptionsWindow.ComboBox2Change(Sender: TObject);
|
|---|
| 722 | begin
|
|---|
| 723 | AppUserEvents[ListBox2.ItemIndex].ConditionAppEvent:= ComboBox2.ItemIndex;
|
|---|
| 724 | end;
|
|---|
| 725 |
|
|---|
| 726 | procedure TOptionsWindow.CheckBox30Click(Sender: TObject);
|
|---|
| 727 | begin
|
|---|
| 728 | AppUserEvents[ListBox2.ItemIndex].ConditionUserEnable:= CheckBox30.Checked;
|
|---|
| 729 | end;
|
|---|
| 730 |
|
|---|
| 731 | procedure TOptionsWindow.Edit11Change(Sender: TObject);
|
|---|
| 732 | begin
|
|---|
| 733 | AppUserEvents[ListBox2.ItemIndex].ConditionUser:= Edit11.Text;
|
|---|
| 734 | end;
|
|---|
| 735 |
|
|---|
| 736 | procedure TOptionsWindow.CheckBox23Click(Sender: TObject);
|
|---|
| 737 | begin
|
|---|
| 738 | AppUserEvents[ListBox2.ItemIndex].ShowWindow:= CheckBox23.Checked;
|
|---|
| 739 | end;
|
|---|
| 740 |
|
|---|
| 741 | procedure TOptionsWindow.CheckBox27Click(Sender: TObject);
|
|---|
| 742 | begin
|
|---|
| 743 | AppUserEvents[ListBox2.ItemIndex].ShowBalloonHint:= CheckBox27.Checked;
|
|---|
| 744 | end;
|
|---|
| 745 |
|
|---|
| 746 | procedure TOptionsWindow.CheckBox24Click(Sender: TObject);
|
|---|
| 747 | begin
|
|---|
| 748 | AppUserEvents[ListBox2.ItemIndex].PlaySound:= CheckBox24.Checked;
|
|---|
| 749 | end;
|
|---|
| 750 |
|
|---|
| 751 | procedure TOptionsWindow.CheckBox33Click(Sender: TObject);
|
|---|
| 752 | begin
|
|---|
| 753 | AppUserEvents[ListBox2.ItemIndex].PlayBeep:= CheckBox33.Checked;
|
|---|
| 754 | end;
|
|---|
| 755 |
|
|---|
| 756 | procedure TOptionsWindow.Edit7Change(Sender: TObject);
|
|---|
| 757 | begin
|
|---|
| 758 | AppUserEvents[ListBox2.ItemIndex].SoundFile:= Edit7.Text;
|
|---|
| 759 | end;
|
|---|
| 760 |
|
|---|
| 761 | procedure TOptionsWindow.CheckBox25Click(Sender: TObject);
|
|---|
| 762 | begin
|
|---|
| 763 | AppUserEvents[ListBox2.ItemIndex].ExecuteApplication:= CheckBox25.Checked;
|
|---|
| 764 | end;
|
|---|
| 765 |
|
|---|
| 766 | procedure TOptionsWindow.Edit8Change(Sender: TObject);
|
|---|
| 767 | begin
|
|---|
| 768 | AppUserEvents[ListBox2.ItemIndex].ApplicationFile:= Edit8.Text;
|
|---|
| 769 | end;
|
|---|
| 770 |
|
|---|
| 771 | procedure TOptionsWindow.CheckBox28Click(Sender: TObject);
|
|---|
| 772 | begin
|
|---|
| 773 | AppUserEvents[ListBox2.ItemIndex].ShowImage:= CheckBox28.Checked;
|
|---|
| 774 | end;
|
|---|
| 775 |
|
|---|
| 776 | procedure TOptionsWindow.Edit9Change(Sender: TObject);
|
|---|
| 777 | begin
|
|---|
| 778 | AppUserEvents[ListBox2.ItemIndex].ImageFile:= Edit9.Text;
|
|---|
| 779 | end;
|
|---|
| 780 |
|
|---|
| 781 | procedure TOptionsWindow.CheckBox32Click(Sender: TObject);
|
|---|
| 782 | begin
|
|---|
| 783 | AppUserEvents[ListBox2.ItemIndex].ShowAlertIcon:= CheckBox32.Checked;
|
|---|
| 784 | end;
|
|---|
| 785 |
|
|---|
| 786 | procedure TOptionsWindow.Edit14Change(Sender: TObject);
|
|---|
| 787 | begin
|
|---|
| 788 | AppUserEvents[ListBox2.ItemIndex].IconFile:= Edit14.Text;
|
|---|
| 789 | end;
|
|---|
| 790 |
|
|---|
| 791 | procedure TOptionsWindow.SpeedButton5Click(Sender: TObject);
|
|---|
| 792 | begin
|
|---|
| 793 | with MainWindow do try
|
|---|
| 794 | MediaPlayer1.FileName:= Edit7.Text;
|
|---|
| 795 | MediaPlayer1.Open;
|
|---|
| 796 | MediaPlayer1.Play;
|
|---|
| 797 | except
|
|---|
| 798 | Dialogs.ShowMessage(Localization.Item('AudioFileNotFound'));
|
|---|
| 799 | end;
|
|---|
| 800 |
|
|---|
| 801 | end;
|
|---|
| 802 |
|
|---|
| 803 | procedure TOptionsWindow.Button5Click(Sender: TObject);
|
|---|
| 804 | begin
|
|---|
| 805 | OpenDialog1.Filter:= 'Soubory WAV|*.wav|Všechny soubory|*.*';
|
|---|
| 806 | OpenDialog1.FileName:= Edit7.Text;
|
|---|
| 807 | if OpenDialog1.Execute then begin
|
|---|
| 808 | CheckBox24.Checked := True;
|
|---|
| 809 | Edit7.Text:= OpenDialog1.FileName;
|
|---|
| 810 | AppUserEvents[ListBox2.ItemIndex].SoundFile:= OpenDialog1.FileName;
|
|---|
| 811 | end;
|
|---|
| 812 | end;
|
|---|
| 813 |
|
|---|
| 814 | procedure TOptionsWindow.Button8Click(Sender: TObject);
|
|---|
| 815 | begin
|
|---|
| 816 | OpenDialog1.Filter:= 'Spustitelné soubory|*.exe|Všechny soubory|*.*';
|
|---|
| 817 | OpenDialog1.FileName:= Edit8.Text;
|
|---|
| 818 | if OpenDialog1.Execute then begin
|
|---|
| 819 | CheckBox25.Checked := True;
|
|---|
| 820 | Edit8.Text:= OpenDialog1.FileName;
|
|---|
| 821 | AppUserEvents[ListBox2.ItemIndex].ApplicationFile:= OpenDialog1.FileName;
|
|---|
| 822 | end;
|
|---|
| 823 | end;
|
|---|
| 824 |
|
|---|
| 825 | procedure TOptionsWindow.Button12Click(Sender: TObject);
|
|---|
| 826 | begin
|
|---|
| 827 | OpenDialog1.Filter:= 'Ikony|*.ico|Všechny soubory|*.*';
|
|---|
| 828 | OpenDialog1.FileName:= Edit14.Text;
|
|---|
| 829 | if OpenDialog1.Execute then begin
|
|---|
| 830 | CheckBox32.Checked := True;
|
|---|
| 831 | Edit14.Text:= OpenDialog1.FileName;
|
|---|
| 832 | AppUserEvents[ListBox2.ItemIndex].IconFile:= OpenDialog1.FileName;
|
|---|
| 833 | end;
|
|---|
| 834 | end;
|
|---|
| 835 |
|
|---|
| 836 | procedure TOptionsWindow.ListBox2Reload;
|
|---|
| 837 | var
|
|---|
| 838 | I: Integer;
|
|---|
| 839 | begin
|
|---|
| 840 | ListBox2.Items.BeginUpdate;
|
|---|
| 841 | ListBox2.Items.Clear;
|
|---|
| 842 | for I:= 0 to High(AppUserEvents) do ListBox2.Items.Add(AppUserEvents[I].EventName);
|
|---|
| 843 | ListBox2.Items.EndUpdate;
|
|---|
| 844 | ListBox2.ItemIndex:= 0;
|
|---|
| 845 | LoadUserEventOptions;
|
|---|
| 846 | ListBox2Click(Self);
|
|---|
| 847 | end;
|
|---|
| 848 |
|
|---|
| 849 | procedure TOptionsWindow.Button14Click(Sender: TObject);
|
|---|
| 850 | begin
|
|---|
| 851 | OpenDialog1.Filter:= 'Definiční soubor|*.def|Všechny soubory|*.*';
|
|---|
| 852 | if OpenDialog1.Execute then begin
|
|---|
| 853 | end;
|
|---|
| 854 | end;
|
|---|
| 855 |
|
|---|
| 856 | procedure TOptionsWindow.ListBox2DblClick(Sender: TObject);
|
|---|
| 857 | begin
|
|---|
| 858 | ActionInsertToMessageExecute(Self);
|
|---|
| 859 | end;
|
|---|
| 860 |
|
|---|
| 861 | procedure TOptionsWindow.ActionAddUserEventExecute(Sender: TObject);
|
|---|
| 862 | begin
|
|---|
| 863 | SetLength(AppUserEvents,Length(AppUserEvents)+1);
|
|---|
| 864 | AppUserEvents[High(AppUserEvents)].EventName:= 'Nový '+IntToStr(High(AppUserEvents)+1);
|
|---|
| 865 | ListBox2Reload;
|
|---|
| 866 | end;
|
|---|
| 867 |
|
|---|
| 868 | procedure TOptionsWindow.ActionDeleteUserEventExecute(Sender: TObject);
|
|---|
| 869 | var
|
|---|
| 870 | I: Integer;
|
|---|
| 871 | begin
|
|---|
| 872 | with ListBox2 do if (ItemIndex>=0) and (ItemIndex<Count) then begin
|
|---|
| 873 | for I:= ItemIndex+1 to High(AppUserEvents) do
|
|---|
| 874 | AppUserEvents[I-1]:= AppUserEvents[I];
|
|---|
| 875 | SetLength(AppUserEvents,High(AppUserEvents));
|
|---|
| 876 | Items.Delete(ItemIndex);
|
|---|
| 877 | ListBox2Reload;
|
|---|
| 878 | end;
|
|---|
| 879 | end;
|
|---|
| 880 |
|
|---|
| 881 | procedure TOptionsWindow.ActionMoveUserEventUpExecute(Sender: TObject);
|
|---|
| 882 | var
|
|---|
| 883 | TempItem: TAppUserEvent;
|
|---|
| 884 | I: Integer;
|
|---|
| 885 | begin
|
|---|
| 886 | with ListBox2 do if (ItemIndex>0) and (ItemIndex<Count) then begin
|
|---|
| 887 | I:= ItemIndex;
|
|---|
| 888 | TempItem:= AppUserEvents[ItemIndex];
|
|---|
| 889 | AppUserEvents[ItemIndex]:= AppUserEvents[ItemIndex-1];
|
|---|
| 890 | AppUserEvents[ItemIndex-1]:= TempItem;
|
|---|
| 891 | ListBox2Reload;
|
|---|
| 892 | ItemIndex:= I-1;
|
|---|
| 893 | end;
|
|---|
| 894 | end;
|
|---|
| 895 |
|
|---|
| 896 | procedure TOptionsWindow.ActionMoveUserEventDownExecute(Sender: TObject);
|
|---|
| 897 | var
|
|---|
| 898 | I: Integer;
|
|---|
| 899 | TempItem: TAppUserEvent;
|
|---|
| 900 | begin
|
|---|
| 901 | with ListBox2 do if (ItemIndex>=0) and (ItemIndex<(Count-1)) then begin
|
|---|
| 902 | I:= ItemIndex;
|
|---|
| 903 | TempItem:= AppUserEvents[ItemIndex];
|
|---|
| 904 | AppUserEvents[ItemIndex]:= AppUserEvents[ItemIndex+1];
|
|---|
| 905 | AppUserEvents[ItemIndex+1]:= TempItem;
|
|---|
| 906 | ListBox2Reload;
|
|---|
| 907 | ItemIndex:= I+1;
|
|---|
| 908 | end;
|
|---|
| 909 | end;
|
|---|
| 910 |
|
|---|
| 911 | procedure TOptionsWindow.ActionImportUserEventListExecute(Sender: TObject);
|
|---|
| 912 | const
|
|---|
| 913 | Separator = '|';
|
|---|
| 914 | var
|
|---|
| 915 | Row: string;
|
|---|
| 916 | begin
|
|---|
| 917 | OpenDialog1.Filter:= 'Definiční soubor|*.def|Všechny soubory|*.*';
|
|---|
| 918 | if OpenDialog1.Execute then begin
|
|---|
| 919 | with TTextFileStream.Create(OpenDialog1.FileName,fmOpenRead) do try
|
|---|
| 920 | repeat
|
|---|
| 921 | Row:= Trim(ReadLn);
|
|---|
| 922 | if Row <> '' then begin
|
|---|
| 923 | SetLength(AppUserEvents, Length(AppUserEvents)+1);
|
|---|
| 924 | with AppUserEvents[High(AppUserEvents)] do begin
|
|---|
| 925 | EventName:= Copy(Row, 1, Pos(Separator, Row)-1);
|
|---|
| 926 | ConditionTextEnable:= True;
|
|---|
| 927 | ConditionText:= EventName;
|
|---|
| 928 | ShowImage:= True;
|
|---|
| 929 | ImageFile:= ExtractFileDir(OpenDialog1.FileName) + '\' + Copy(Row, Pos(Separator, Row)+1, Length(Row));
|
|---|
| 930 | end;
|
|---|
| 931 | end;
|
|---|
| 932 | until Position = Size;
|
|---|
| 933 | ListBox2Reload;
|
|---|
| 934 | finally
|
|---|
| 935 | Free;
|
|---|
| 936 | end;
|
|---|
| 937 | end;
|
|---|
| 938 | end;
|
|---|
| 939 |
|
|---|
| 940 | procedure TOptionsWindow.ActionEditUserEventCaptionExecute(
|
|---|
| 941 | Sender: TObject);
|
|---|
| 942 | begin
|
|---|
| 943 | if ListBox2.Count>0 then
|
|---|
| 944 | if not InputQuery('Změna jména události','Zadejte nové jméno uživatelské události:',AppUserEvents[ListBox2.ItemIndex].EventName) then Exit;
|
|---|
| 945 | ListBox2Reload;
|
|---|
| 946 | end;
|
|---|
| 947 |
|
|---|
| 948 | procedure TOptionsWindow.ActionInsertToMessageExecute(Sender: TObject);
|
|---|
| 949 | begin
|
|---|
| 950 | with MainWindow.ComboBox1 do Text:= Text + ListBox2.Items[ListBox2.ItemIndex];
|
|---|
| 951 | Close;
|
|---|
| 952 | end;
|
|---|
| 953 |
|
|---|
| 954 | procedure TOptionsWindow.ActionDeleteAllUserEventsExecute(Sender: TObject);
|
|---|
| 955 | begin
|
|---|
| 956 | ListBox2.Items.Clear;
|
|---|
| 957 | SetLength(AppUserEvents,0);
|
|---|
| 958 | ListBox2Reload;
|
|---|
| 959 | end;
|
|---|
| 960 |
|
|---|
| 961 | procedure TOptionsWindow.ActionSaveUserEventsListExecute(Sender: TObject);
|
|---|
| 962 | const
|
|---|
| 963 | Separator = '|';
|
|---|
| 964 | var
|
|---|
| 965 | // Row: string;
|
|---|
| 966 | I: Integer;
|
|---|
| 967 | FileMode: Word;
|
|---|
| 968 | begin
|
|---|
| 969 | SaveDialog1.Filter:= 'Definiční soubor|*.def|Všechny soubory|*.*';
|
|---|
| 970 | if SaveDialog1.Execute then begin
|
|---|
| 971 | if FileExists(SaveDialog1.FileName) then FileMode:= fmOpenWrite else
|
|---|
| 972 | FileMode:= fmCreate;
|
|---|
| 973 | with TTextFileStream.Create(SaveDialog1.FileName, FileMode) do try
|
|---|
| 974 | for I:= 0 to High(AppUserEvents) do with AppUserEvents[I] do
|
|---|
| 975 | WriteLn(ConditionText + Separator + ExtractFileName(ImageFile));
|
|---|
| 976 | finally
|
|---|
| 977 | Free;
|
|---|
| 978 | end;
|
|---|
| 979 | end;
|
|---|
| 980 | end;
|
|---|
| 981 |
|
|---|
| 982 | procedure TOptionsWindow.SaveUserEvents;
|
|---|
| 983 | begin
|
|---|
| 984 | MainWindow.LoadAppUserEventsFromRegistry(True);
|
|---|
| 985 | end;
|
|---|
| 986 |
|
|---|
| 987 | procedure TOptionsWindow.TrackBar2Change(Sender: TObject);
|
|---|
| 988 | begin
|
|---|
| 989 | with MainWindow do begin
|
|---|
| 990 | MPSetVolume(MediaPlayer1, 1000 - TrackBar2.Position);
|
|---|
| 991 | end;
|
|---|
| 992 | end;
|
|---|
| 993 |
|
|---|
| 994 | procedure TOptionsWindow.FormClose(Sender: TObject;
|
|---|
| 995 | var Action: TCloseAction);
|
|---|
| 996 | begin
|
|---|
| 997 | with MainWindow do MPSetVolume(MediaPlayer1, SoundVolume);
|
|---|
| 998 | end;
|
|---|
| 999 |
|
|---|
| 1000 | end.
|
|---|