Browse Source

Download files from http://binary.dmdirc.com/ not http://shanemcc.co.uk/dmdirc-binaries/

Rework Windows installer a bit so that the JRE Downloader has a UAC Manifest (Thus no longer requiring vistas work around for files with "install" in the name)
Add Vista.pas which changes the fonts of the downloader to Vista fonts, and gives Vista native message dialogs
Make the UAC Manifest also have a dependancy on ComCtls v6, Now the buttons and progress bars in the downloader look native (on XP and Vista, previously the looked liek Win9X or so)
Edit some of the messages given in popup boxes.
In theory the Setup.exe will now compile in delphi on windows aswell (altho in practice this is still a PITA)
Add missing license header to launcher.dpr
Windows Launchers also have the ComCtl v6 dependancy, and the vista native dialogs (and the version has been bumped up 1)


git-svn-id: http://svn.dmdirc.com/trunk@4174 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 years ago
parent
commit
6b559d730d

+ 1
- 1
installer/osx/makeInstallerOSX.sh View File

@@ -373,7 +373,7 @@ if [ "" = "${HDIUTIL}" ]; then
373 373
 
374 374
 	# Compres it \o
375 375
 	if [ ! -e "${PWD}/compress-dmg" ]; then
376
-		wget http://shanemcc.co.uk/dmdirc-binaries/dmg -O compress-dmg
376
+		wget http://binary.dmdirc.com/dmg -O compress-dmg
377 377
 		chmod a+x compress-dmg
378 378
 	fi;
379 379
 	if [ ! -e "${PWD}/compress-dmg" ]; then

+ 24
- 0
installer/windows/Launcher.dpr View File

@@ -1,3 +1,27 @@
1
+{*
2
+ * This application launches the dmdirc java-based installer.
3
+ * 
4
+ * DMDirc - Open Source IRC Client
5
+ * Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes
6
+ * 
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ * 
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ * 
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ *}
1 25
 program Launcher;
2 26
 {$MODE Delphi}
3 27
 {$APPTYPE GUI}

+ 58
- 21
installer/windows/Setup.dpr View File

@@ -23,7 +23,12 @@
23 23
  * SOFTWARE.
24 24
  *}
25 25
 program Setup;
26
-{$MODE Delphi}
26
+
27
+{$R most.res}
28
+
29
+{$IFDEF FPC}
30
+	{$MODE Delphi}
31
+{$ENDIF}
27 32
 // Use this instead of {$APPTYPE XXX}
28 33
 // APP_XXX is the same as {$APPTYPE XXX}
29 34
 // Defaults to console
@@ -56,8 +61,8 @@ program Setup;
56 61
 // {$UNDEF LAZARUS}
57 62
 
58 63
 uses 
59
-	{$IFDEF LAZARUS}Interfaces, Forms, ComCtrls, Buttons, Messages, Controls, StdCtrls,{$ENDIF}
60
-	Windows, SysUtils, classes, registry, strutils;
64
+	{$IFDEF LAZARUS}Interfaces, Forms, ComCtrls, Buttons, Messages, Controls, StdCtrls, {$ENDIF}
65
+	Vista, Windows, SysUtils, classes, registry, strutils {$IFNDEF FPC},masks{$ENDIF};
61 66
 
62 67
 {$IFDEF LAZARUS}
63 68
 	type
@@ -122,8 +127,10 @@ var
122 127
 		CancelButton.Caption := 'Cancel';
123 128
 		CancelButton.onClick := self.onButtonClick;
124 129
 		
125
-		self.Caption := pChar('DMDirc Setup - '+CaptionLabel.Caption);;
130
+		self.Caption := pChar('DMDirc Setup');
126 131
 		Application.Title := self.Caption;
132
+		
133
+		SetVistaFonts(self);
127 134
 	end;
128 135
 	
129 136
 	procedure TProgressForm.onButtonClick(Sender: TObject);
@@ -135,17 +142,17 @@ var
135 142
 	begin
136 143
 		ProgressBar.Position := value;
137 144
 		CaptionLabel.Caption := pchar('Downloading JRE - '+inttostr(value)+'%');
138
-		self.Caption := pChar('DMDirc Setup - '+CaptionLabel.Caption);;
145
+		self.Caption := pChar('DMDirc Setup - '+CaptionLabel.Caption);
139 146
 		Application.Title := self.Caption;
140 147
 	end;
141 148
 {$ENDIF}
142 149
 
143 150
 function askQuestion(Question: String): boolean;
144 151
 begin
145
-	Result := MessageBox(0, PChar(Question), 'DMDirc Setup', MB_YESNO or MB_ICONQUESTION) = IDYES;
152
+	Result := TaskDialog(0, 'DMDirc Setup', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
146 153
 end;
147 154
 
148
-procedure showError(ErrorMessage: String; addFooter: boolean = true);
155
+procedure showError(ErrorMessage: String; addFooter: boolean = true; includeDescInXP: boolean = true);
149 156
 begin
150 157
 	if IsConsole then begin
151 158
 		writeln('');
@@ -161,32 +168,33 @@ begin
161 168
 			writeln('please feel free to contact us.');
162 169
 		end;
163 170
 		writeln('-----------------------------------------------------------------------');
164
-		readln();
171
+		readln;
165 172
 	end
166 173
 	else begin
167 174
 		if addFooter then begin
168 175
 			ErrorMessage := ErrorMessage+#13#10;
169 176
 			ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
170
-			ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
177
+			if not IsWindowsVista then ErrorMessage := ErrorMessage+#13#10;
178
+			ErrorMessage := ErrorMessage+'please feel free to contact us.';
171 179
 		end;
172 180
 		
173
-		MessageBox(0, PChar(ErrorMessage), 'Sorry, setup is unable to continue', MB_OK + MB_ICONSTOP);
181
+		TaskDialog(0, 'DMDirc Setup', 'Sorry, setup is unable to continue.', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, includeDescInXP, false);
174 182
 	end;
175 183
 end;
176 184
 
177
-procedure showmessage(message: String);
185
+procedure showmessage(message: String; context:String = 'Information');
178 186
 begin
179 187
 	if IsConsole then begin
180 188
 		writeln('');
181 189
 		writeln('-----------------------------------------------------------------------');
182
-		writeln('Information:!');
190
+		writeln(context+':');
183 191
 		writeln('-----------------------------------------------------------------------');
184 192
 		writeln(message);
185 193
 		writeln('-----------------------------------------------------------------------');
186
-		readln();
194
+		readln;
187 195
 	end
188 196
 	else begin
189
-		MessageBox(0, PChar(message), 'DMDirc Setup', MB_OK + MB_ICONINFORMATION);
197
+		TaskDialog(0, 'DMDirc Setup', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
190 198
 	end;
191 199
 end;
192 200
 
@@ -234,6 +242,7 @@ function GetFileSizeByName(name: String): Integer;
234 242
 var
235 243
 	hand: THandle;
236 244
 begin
245
+	hand := 0;
237 246
 	Result := 0;
238 247
 	if FileExists(name) then begin
239 248
 		try
@@ -241,7 +250,7 @@ begin
241 250
 			Result := GetFileSize(hand, nil);
242 251
 		finally
243 252
 			try
244
-				CloseHandle(hand);
253
+				if (hand <> 0) then CloseHandle(hand);
245 254
 			except
246 255
 				Result := -1;
247 256
 			end;
@@ -249,6 +258,23 @@ begin
249 258
 	end;
250 259
 end;
251 260
 
261
+function DoMatch(Input: String; Wildcard: String): boolean;
262
+begin
263
+	{$ifdef FPC}
264
+		Result := IsWild(Input,Wildcard,True);
265
+	{$else}
266
+		Result := MatchesMask(Input,Wildcard);
267
+	{$endif}
268
+end;
269
+
270
+{$IFNDEF VER150}
271
+function AnsiMidStr(Source: String; Start: Integer; Count: Integer): String;
272
+begin
273
+	// Not perfectly accurate, but does the job
274
+	Result := Copy(Source, Start, Count);
275
+end;
276
+{$ENDIF}
277
+
252 278
 function downloadJRE(message: String = 'Would you like to download the java JRE?'): boolean;
253 279
 var
254 280
 	ProcessInfo: TProcessInformation;
@@ -275,7 +301,7 @@ begin
275 301
 	match := false;
276 302
 	while not Eof(f) do begin
277 303
 		ReadLn(f, line);
278
-		match := IsWild(line,'Length:*',True);
304
+		match := DoMatch(line,'Length:*');
279 305
 		if match then break;
280 306
 	end;
281 307
 	if match then begin
@@ -324,7 +350,18 @@ begin
324 350
 					{$ENDIF}
325 351
 				end
326 352
 				else Result := processResult = 0;
327
-				if not Result then showError('JRE Download Failed', false);
353
+				if not Result then begin
354
+					if not terminateDownload then begin
355
+						showError('JRE Download Failed', false);
356
+					end
357
+					else begin
358
+						// If the download was cancelled by the form, this error will already
359
+						// have been given.
360
+						{$IFNDEF LAZARUS}
361
+							showError('JRE Download was aborted', false);
362
+						{$ENDIF}
363
+					end;
364
+				end;
328 365
 			end;
329 366
 		finally
330 367
 			bits.free;
@@ -357,7 +394,7 @@ begin
357 394
 	if canContinue then begin
358 395
 		// Final result of this function is the return value of installing java.
359 396
 		if needDownload or askQuestion(question) then begin
360
-			showmessage('The Java installer will now run. Please follow the instructions given.'+#13#10+'The DMDirc installation will continue afterwards.');
397
+			showmessage('The Java installer will now run. Please follow the instructions given. '+#13#10+'The DMDirc installation will continue afterwards.');
361 398
 			Result := (ExecAndWait('jre.exe') = 0);
362 399
 		end;
363 400
 	end
@@ -374,7 +411,7 @@ begin
374 411
 		Application.Initialize;
375 412
 		Application.CreateForm(TProgressForm, form);
376 413
 	{$ENDIF}
377
-		
414
+	
378 415
 	if IsConsole then begin
379 416
 		writeln('-----------------------------------------------------------------------');
380 417
 		writeln('Welcome to the DMDirc installer.');
@@ -398,7 +435,7 @@ begin
398 435
 		if (ExecAndWait(javaCommand+' -version') <> 0) then begin
399 436
 			dowriteln('Failed!');
400 437
 			if not installJRE(false) then begin
401
-				showError('Sorry, DMDirc setup can not continue without java', false);
438
+				showError('DMDirc setup can not continue without java. Please install java and try again', false, false);
402 439
 				exit;
403 440
 			end;
404 441
 		end
@@ -426,7 +463,7 @@ begin
426 463
 		if (ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main '+params) <> 0) then begin
427 464
 			dowriteln('Failed!');
428 465
 			if not installJRE(true) then begin
429
-				showError('Sorry, DMDirc setup can not continue without an updated version of java', false);
466
+				showError('Sorry, DMDirc setup can not continue without an updated version of java.', false, false);
430 467
 				exit;
431 468
 			end
432 469
 			else begin

+ 7
- 1
installer/windows/UAC.manifest View File

@@ -1,6 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 2
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
-  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="UACAwareApplication" type="win32"/>
3
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="DMDirc Installer" type="win32"/>
4
+  <description>DMDirc Installer</description>
5
+  <dependency>
6
+    <dependentAssembly>
7
+      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
8
+    </dependentAssembly>
9
+  </dependency>
4 10
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
5 11
     <security>
6 12
       <requestedPrivileges>

+ 114
- 114
installer/windows/makeInstallerWindows.sh View File

@@ -255,118 +255,12 @@ fi
255 255
 
256 256
 echo "	ReleaseNumber: String = '${isRelease}';" > SetupConsts.inc
257 257
 
258
-FILES="DMDirc.jar Setup.exe";
259
-if [ "" != "${jre}" ]; then
260
-	if [ ! -e "../common/${jrename}.exe" ]; then
261
-		echo "Downloading JRE to include in installer"
262
-		wget ${jre} -O ../common/${jrename}.exe
263
-	fi
264
-	ln -sf ../common/${jrename}.exe jre.exe
265
-	FILES="${FILES} jre.exe"
266
-fi;
267
-DELETEFILES=${FILES}
268
-FPC=`which fpc`
269
-lazarusDir="/usr/share/lazarus"
270
-if [ ! -e "${lazarusDir}/lcl" ]; then
271
-	lazarusDir="/usr/lib/lazarus/"
272
-fi;
273
-compilerFlags="-Sd -Twin32 ${compilerFlags}";
274
-if [ ! -e "Setup.exe"  -o "${compileSetup}" = "true" ]; then
275
-	echo "Setup.exe does not exist. Lets try and compile it."
276
-	if [ "${FPC}" = "" ]; then
277
-		echo "FPC Compiler not found, Setup.exe can not be built."
278
-		exit 1;
279
-	else
280
-		echo "Building Setup.exe..."
281
-		extraFlags=""
282
-		if [ -e "${lazarusDir}/lcl" ]; then
283
-			echo "Using Lazarus"
284
-			mkdir -p ${PWD}/lazarus-build
285
-			extraFlags="-dLAZARUS -FU${PWD}/lazarus-build -Fu${PWD}/lazarus-build -Fu${lazarusDir}/lcl/widgetset/ -Fu${lazarusDir}/lcl/interfaces/win32/ -Fu${lazarusDir}/lcl/ -Fi${lazarusDir}/lcl/include/"
286
-		else
287
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
288
-			echo "@        Building installer *WITHOUT* lazarus.        @";
289
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
290
-		fi;
291
-		${FPC} ${compilerFlags} ${extraFlags} Setup.dpr
292
-		if [ $? -ne 0 ]; then
293
-			if [ -e "Setup.exe" -a "${useOldSetup}" = "true" ]; then
294
-				echo "Unable to compile Setup.exe, using existing version."
295
-			else
296
-				echo "Unable to compile Setup.exe, terminating."
297
-				exit 1;
298
-			fi
299
-		fi;
300
-	fi
301
-fi
302
-
303
-ls
304
-if [ ! -e "Setup.exe" ]; then
305
-	echo "Still can't find Setup.exe, terminating."
306
-	exit 1;
307
-fi
308
-
309
-echo "Compressing files.."
310
-
311
-#if [ -e "../common/installer.jar" ]; then
312
-#	ln -sf ../common/installer.jar ./installer.jar
313
-#	FILES="${FILES} installer.jar"
314
-#	DELETEFILES="${DELETEFILES} installer.jar"
315
-#else
316
-#	echo "[WARNING] Creating installer-less archive - relying on Setup.exe"
317
-#fi
318
-
258
+FILES=""
259
+# Icon Res file
319 260
 if [ -e ${jarPath}"/src/com/dmdirc/res/icon.ico" ]; then
320 261
 	ln -sf ${jarPath}"/src/com/dmdirc/res/icon.ico" ./icon.ico
321 262
 	FILES="${FILES} icon.ico"
322
-	DELETEFILES="${DELETEFILES} icon.ico"
323
-fi
324
-
325
-# Shortcut.exe is from http://www.optimumx.com/download/#Shortcut
326
-if [ ! -e Shortcut.exe ]; then
327
-	wget http://shanemcc.co.uk/dmdirc-binaries/Shortcut.zip
328
-	unzip -q Shortcut.zip Shortcut.exe
329
-	rm Shortcut.zip
330
-fi
331
-FILES="${FILES} Shortcut.exe"
332
-DELETEFILES="${DELETEFILES} Shortcut.exe"
333
-
334
-if [ "${isRelease}" != "" ]; then
335
-	DOCSDIR=${jarPath}
336
-else
337
-	DOCSDIR="../common"
338 263
 fi
339
-
340
-if [ -e "${DOCSDIR}/README.TXT" ]; then
341
-	ln -sf "${DOCSDIR}/README.TXT" .
342
-	FILES="${FILES} README.TXT"
343
-	DELETEFILES="${DELETEFILES} README.TXT"
344
-fi
345
-
346
-if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
347
-	ln -sf "${DOCSDIR}/CHANGES.TXT" .
348
-	FILES="${FILES} CHANGES.TXT"
349
-	DELETEFILES="${DELETEFILES} CHANGES.TXT"
350
-elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
351
-	ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
352
-	FILES="${FILES} CHANGELOG.TXT"
353
-	DELETEFILES="${DELETEFILES} CHANGELOG.TXT"
354
-fi
355
-
356
-if [ -e "${jarPath}/launcher/windows" ]; then
357
-	# Try to compile all
358
-	olddir=${PWD}
359
-	cd "${jarPath}/launcher/windows/"
360
-	sh compile.sh
361
-	cd ${olddir}
362
-	# Now add to file list.
363
-	for thisfile in `ls -1 ${jarPath}/launcher/windows/*.exe`; do
364
-		ln -sf ${thisfile} .
365
-		FILES="${FILES} ${thisfile}"
366
-	done
367
-fi
368
-
369
-# Icon Res file
370 264
 echo "icon.ico ICON icon.ico" > icon.rc
371 265
 
372 266
 # Other resources
@@ -468,6 +362,116 @@ cat uninstallversion.rc >> all.rc
468 362
 cat icon.rc >> uninstall.rc
469 363
 windres -F pe-i386 -i uninstall.rc -o uninstall.res
470 364
 
365
+cat UAC.rc > all.rc
366
+cat version.rc >> all.rc
367
+cat files.rc >> all.rc
368
+cat icon.rc >> all.rc
369
+# Build later after extractor.exe exists
370
+
371
+cat UAC.rc > most.rc
372
+cat version.rc >> most.rc
373
+cat icon.rc >> most.rc
374
+
375
+windres -F pe-i386 -i most.rc -o most.res
376
+
377
+FILES="${FILES} DMDirc.jar Setup.exe";
378
+if [ "" != "${jre}" ]; then
379
+	if [ ! -e "../common/${jrename}.exe" ]; then
380
+		echo "Downloading JRE to include in installer"
381
+		wget ${jre} -O ../common/${jrename}.exe
382
+	fi
383
+	ln -sf ../common/${jrename}.exe jre.exe
384
+	FILES="${FILES} jre.exe"
385
+fi;
386
+DELETEFILES=${FILES}
387
+FPC=`which fpc`
388
+lazarusDir="/usr/share/lazarus"
389
+if [ ! -e "${lazarusDir}/lcl" ]; then
390
+	lazarusDir="/usr/lib/lazarus/"
391
+fi;
392
+
393
+compilerFlags="-Sd -Twin32 ${compilerFlags}";
394
+if [ ! -e "Setup.exe"  -o "${compileSetup}" = "true" ]; then
395
+	echo "Setup.exe does not exist. Lets try and compile it."
396
+	if [ "${FPC}" = "" ]; then
397
+		echo "FPC Compiler not found, Setup.exe can not be built."
398
+		exit 1;
399
+	else
400
+		echo "Building Setup.exe..."
401
+		extraFlags=""
402
+		if [ -e "${lazarusDir}/lcl" ]; then
403
+			echo "Using Lazarus"
404
+			mkdir -p ${PWD}/lazarus-build
405
+			extraFlags="-dLAZARUS -FU${PWD}/lazarus-build -Fu${PWD}/lazarus-build -Fu${lazarusDir}/lcl/widgetset/ -Fu${lazarusDir}/lcl/interfaces/win32/ -Fu${lazarusDir}/lcl/ -Fi${lazarusDir}/lcl/include/"
406
+		else
407
+			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
408
+			echo "@        Building installer *WITHOUT* lazarus.        @";
409
+			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
410
+		fi;
411
+		${FPC} ${compilerFlags} ${extraFlags} Setup.dpr
412
+		if [ $? -ne 0 ]; then
413
+			if [ -e "Setup.exe" -a "${useOldSetup}" = "true" ]; then
414
+				echo "Unable to compile Setup.exe, using existing version."
415
+			else
416
+				echo "Unable to compile Setup.exe, terminating."
417
+				exit 1;
418
+			fi
419
+		fi;
420
+	fi
421
+fi
422
+
423
+ls
424
+if [ ! -e "Setup.exe" ]; then
425
+	echo "Still can't find Setup.exe, terminating."
426
+	exit 1;
427
+fi
428
+
429
+echo "Compressing files.."
430
+
431
+# Shortcut.exe is from http://www.optimumx.com/download/#Shortcut
432
+if [ ! -e Shortcut.exe ]; then
433
+	wget http://binary.dmdirc.com/Shortcut.zip
434
+	unzip -q Shortcut.zip Shortcut.exe
435
+	rm Shortcut.zip
436
+fi
437
+FILES="${FILES} Shortcut.exe"
438
+DELETEFILES="${DELETEFILES} Shortcut.exe"
439
+
440
+if [ "${isRelease}" != "" ]; then
441
+	DOCSDIR=${jarPath}
442
+else
443
+	DOCSDIR="../common"
444
+fi
445
+
446
+if [ -e "${DOCSDIR}/README.TXT" ]; then
447
+	ln -sf "${DOCSDIR}/README.TXT" .
448
+	FILES="${FILES} README.TXT"
449
+	DELETEFILES="${DELETEFILES} README.TXT"
450
+fi
451
+
452
+if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
453
+	ln -sf "${DOCSDIR}/CHANGES.TXT" .
454
+	FILES="${FILES} CHANGES.TXT"
455
+	DELETEFILES="${DELETEFILES} CHANGES.TXT"
456
+elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
457
+	ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
458
+	FILES="${FILES} CHANGELOG.TXT"
459
+	DELETEFILES="${DELETEFILES} CHANGELOG.TXT"
460
+fi
461
+
462
+if [ -e "${jarPath}/launcher/windows" ]; then
463
+	# Try to compile all
464
+	olddir=${PWD}
465
+	cd "${jarPath}/launcher/windows/"
466
+	sh compile.sh
467
+	cd ${olddir}
468
+	# Now add to file list.
469
+	for thisfile in `ls -1 ${jarPath}/launcher/windows/*.exe`; do
470
+		ln -sf ${thisfile} .
471
+		FILES="${FILES} ${thisfile}"
472
+	done
473
+fi
474
+
471 475
 ${FPC} ${compilerFlags} ${3}Uninstaller.dpr
472 476
 if [ -e "Uninstaller.exe" ]; then
473 477
 	FILES="${FILES} Uninstaller.exe"
@@ -476,7 +480,7 @@ fi
476 480
 
477 481
 # Add wget to allow downloading jre
478 482
 if [ ! -e "wget.exe" ]; then
479
-	wget http://shanemcc.co.uk/dmdirc-binaries/wget.exe
483
+	wget http://binary.dmdirc.com/wget.exe
480 484
 fi;
481 485
 
482 486
 if [ ! -e "wget.exe" ]; then
@@ -502,7 +506,7 @@ echo ";!@InstallEnd@!" >> 7zip.conf
502 506
 
503 507
 if [ ! -e "7zS.sfx" ]; then
504 508
 	echo "Obtaining sfx stub.."
505
-	wget http://shanemcc.co.uk/dmdirc-binaries/7zS.sfx
509
+	wget http://binary.dmdirc.com/7zS.sfx
506 510
 fi
507 511
 
508 512
 if [ ! -e "7zS.sfx" ]; then
@@ -556,10 +560,6 @@ if [ "${MD5SUM}" != "" ]; then
556 560
 	echo "end;" >> ExtractCode.inc
557 561
 fi
558 562
 
559
-cat UAC.rc > all.rc
560
-cat version.rc >> all.rc
561
-cat files.rc >> all.rc
562
-cat icon.rc >> all.rc
563 563
 windres -F pe-i386 -i all.rc -o all.res
564 564
 
565 565
 ${FPC} ${compilerFlags} ${3}Launcher.dpr

+ 29
- 6
launcher/windows/DMDirc.dpr View File

@@ -2,10 +2,33 @@ program DMDirc;
2 2
 {$MODE Delphi}
3 3
 {$APPTYPE GUI}
4 4
 
5
+{$R comctl.rc}
5 6
 {$R icon.rc}
6 7
 {$R version.rc}
7 8
 
8
-uses Windows, SysUtils, classes, StrUtils;
9
+uses Windows, SysUtils, classes, StrUtils, Vista;
10
+
11
+function askQuestion(Question: String): boolean;
12
+begin
13
+	Result := TaskDialog(0, 'DMDirc Setup', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
14
+end;
15
+
16
+procedure showError(ErrorMessage: String; addFooter: boolean = true);
17
+begin
18
+	if addFooter then begin
19
+		ErrorMessage := ErrorMessage+#13#10;
20
+		ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
21
+		ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
22
+	end;
23
+	
24
+	TaskDialog(0, 'DMDirc Setup', 'Sorry, setup is unable to continue', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, true);
25
+end;
26
+
27
+procedure showmessage(message: String; context:String = 'Information');
28
+begin
29
+	TaskDialog(0, 'DMDirc Setup', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
30
+end;
31
+
9 32
 
10 33
 // Run an application and wait for it to finish.
11 34
 function ExecAndWait(sProgramToRun: String): Longword;
@@ -52,7 +75,7 @@ begin
52 75
 end;
53 76
 
54 77
 const
55
-	launcherVersion: String = '1';
78
+	launcherVersion: String = '2';
56 79
 var
57 80
 	errorMessage: String;
58 81
 	javaCommand: String = 'javaw.exe';
@@ -96,7 +119,7 @@ begin
96 119
 				errorMessage := errorMessage+#13#10;
97 120
 				errorMessage := errorMessage+#13#10+'Please click ''Allow'' on the UAC prompt to complete the update, or click no';
98 121
 				errorMessage := errorMessage+#13#10+'here to continue without updating.';
99
-				if MessageBox(0, PChar(errorMessage), 'Windows Vista', MB_YESNO) = IDYES then begin
122
+				if askQuestion(errorMessage) then begin
100 123
 					RunProgram('"'+ExtractFileDir(paramstr(0))+'\DMDircUpdater.exe" --UpdateSourceDir "'+directory+'"', not launcherUpdate);
101 124
 				end;
102 125
 			end
@@ -116,7 +139,7 @@ begin
116 139
 			errorMessage := errorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
117 140
 			errorMessage := errorMessage+#13#10+'please feel free to contact us.';
118 141
 			
119
-			MessageBox(0, PChar(errorMessage), 'Sorry, DMDirc is unable to continue', MB_OK + MB_ICONSTOP);
142
+			showError(errorMessage);
120 143
 		end
121 144
 		// Else try and run client. (This only asks for help output to check that client
122 145
 		// runs on this OS, otherwise later segfaults or so would cause the error to
@@ -131,7 +154,7 @@ begin
131 154
 				errorMessage := errorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
132 155
 				errorMessage := errorMessage+#13#10+'please feel free to contact us.';
133 156
 				
134
-				MessageBox(0, PChar(errorMessage), 'Sorry, DMDirc is unable to continue', MB_OK + MB_ICONSTOP);
157
+				showError(errorMessage);
135 158
 			end
136 159
 			else begin
137 160
 				Launch(javaCommand+' -ea -jar "'+jarName+'"'+' -l windows-'+launcherVersion+' '+cliParams)
@@ -139,7 +162,7 @@ begin
139 162
 		end
140 163
 		else begin
141 164
 			errorMessage := 'Your DMDirc installation has been broken. DMDirc.jar no longer exists.';
142
-			MessageBox(0, PChar(errorMessage), 'Sorry, DMDirc is unable to continue', MB_OK + MB_ICONSTOP);
165
+			showError(errorMessage);
143 166
 		end;
144 167
 	end;
145 168
 end.

BIN
launcher/windows/DMDirc.exe View File


+ 33
- 12
launcher/windows/DMDircUpdater.dpr View File

@@ -4,7 +4,28 @@ program DMDircUpdater;
4 4
 
5 5
 {$R UAC.rc}
6 6
 
7
-uses Windows, SysUtils, classes, StrUtils;
7
+uses Windows, SysUtils, classes, StrUtils, Vista;
8
+
9
+function askQuestion(Question: String): boolean;
10
+begin
11
+	Result := TaskDialog(0, 'DMDirc Setup', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
12
+end;
13
+
14
+procedure showError(ErrorMessage: String; addFooter: boolean = true);
15
+begin
16
+	if addFooter then begin
17
+		ErrorMessage := ErrorMessage+#13#10;
18
+		ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
19
+		ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
20
+	end;
21
+	
22
+	TaskDialog(0, 'DMDirc Setup', 'Sorry, setup is unable to continue', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, true);
23
+end;
24
+
25
+procedure showmessage(message: String; context:String = 'Information');
26
+begin
27
+	TaskDialog(0, 'DMDirc Setup', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
28
+end;
8 29
 
9 30
 // Run an application and don't wait for it to finish.
10 31
 procedure Launch(sProgramToRun: String);
@@ -57,32 +78,32 @@ begin
57 78
 					Launch('"'+thisDir+'\DMDircLauncherUpdater.exe" '+cliParams);
58 79
 				end
59 80
 				else begin
60
-					MessageBox(0, 'Unable to overwrite launcher', 'Launcher Update Failed', MB_ICONSTOP);
81
+					showmessage('Unable to overwrite launcher', 'Update Failed');
61 82
 				end;
62 83
 			end
63 84
 			else begin
64 85
 				launcherUpdate := true;
65 86
 				if FileExists(pchar(thisDir+'\DMDirc.exe')) then begin
66 87
 					if not DeleteFile(pchar(thisDir+'\DMDirc.exe')) then begin
67
-						MessageBox(0, 'Unable to delete DMDirc.exe', 'Update Failed', MB_ICONSTOP);
88
+						showmessage('Unable to delete DMDirc.exe', 'Launcher Update Failed');
68 89
 					end;
69 90
 				end;
70 91
 				
71 92
 				if not FileExists(pchar(thisDir+'\DMDirc.exe')) and MoveFile(pchar(sourceDir+'\.DMDirc.exe'), pchar(thisDir+'\DMDirc.exe')) then begin
72 93
 					if FileExists(pchar(thisDir+'\DMDircUpdater.exe')) then begin
73 94
 						if not DeleteFile(pchar(thisDir+'\DMDircUpdater.exe')) then begin
74
-							MessageBox(0, 'Unable to delete DMDircUpdater.exe', 'Update Failed', MB_ICONSTOP);
95
+							showmessage('Unable to delete DMDircUpdater.exe', 'Launcher Update Failed');
75 96
 						end;
76 97
 					end;
77 98
 					if not FileExists(pchar(thisDir+'\DMDircUpdater.exe')) and MoveFile(pchar(sourceDir+'\.DMDircUpdater.exe'), pchar(thisDir+'\DMDircUpdater.exe')) then begin
78
-						MessageBox(0, 'Launcher update was successful.', 'Launcher Update Completed', MB_OK);
99
+						showmessage('Launcher update was successful');
79 100
 					end
80 101
 					else begin
81
-						MessageBox(0, pchar('Unable to update DMDircUpdater.exe'), 'Launcher Update Failed', MB_ICONSTOP);
102
+						showmessage('Unable to update DMDircUpdater.exe', 'Launcher Update Failed');
82 103
 					end;
83 104
 				end
84 105
 				else begin
85
-					MessageBox(0, pchar('Unable to update DMDirc.exe'), 'Launcher Update Failed', MB_ICONSTOP);
106
+					showmessage('Unable to update DMDirc.exe', 'Launcher Update Failed');
86 107
 				end;
87 108
 			end;
88 109
 		end;
@@ -92,24 +113,24 @@ begin
92 113
 			if FileExists(pchar(sourceDir+'\.DMDirc.jar')) then begin
93 114
 				if FileExists(pchar(jarName)) then begin
94 115
 					if not DeleteFile(pchar(jarName)) then begin
95
-						MessageBox(0, 'Unable to delete DMDirc.jar', 'Update Failed', MB_ICONSTOP);
116
+						showmessage('Unable to update DMDirc.jar', 'Launcher Update Failed');
96 117
 					end;
97 118
 				end;
98 119
 				
99 120
 				if MoveFile(pchar(sourceDir+'\.DMDirc.jar'), pchar(jarName)) then begin
100
-					MessageBox(0, 'Client update was successful.', 'Update Completed', MB_OK);
121
+					showmessage('Client update was successful');
101 122
 				end
102 123
 				else begin
103
-					MessageBox(0, pchar('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName), 'Update Failed', MB_ICONSTOP);
124
+					showmessage('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName, 'Update Failed');
104 125
 				end;
105 126
 			end;
106 127
 			
107 128
 			if launcherUpdate then begin
108
-				MessageBox(0, 'The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'Restart Required', MB_OK);
129
+				showmessage('The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'Restart Required');
109 130
 			end;
110 131
 		end;
111 132
 	end
112 133
 	else begin
113
-		MessageBox(0, 'This program can not be run on its own.', 'Error', MB_ICONSTOP);
134
+		showError('This program can not be run on its own.');
114 135
 	end;
115 136
 end.

BIN
launcher/windows/DMDircUpdater.exe View File


+ 0
- 11
launcher/windows/UAC.manifest View File

@@ -1,11 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
-  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="UACAwareApplication" type="win32"/>
4
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
5
-    <security>
6
-      <requestedPrivileges>
7
-        <requestedExecutionLevel level="requireAdministrator"/>
8
-      </requestedPrivileges>
9
-    </security>
10
-  </trustInfo>
11
-</assembly>

+ 0
- 1
launcher/windows/UAC.rc View File

@@ -1 +0,0 @@
1
-1 24 "UAC.manifest"

+ 10
- 0
launcher/windows/comctl.manifest View File

@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="DMDirc Updater" type="win32"/>
4
+  <description>DMDirc Updater</description>
5
+  <dependency>
6
+    <dependentAssembly>
7
+      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
8
+    </dependentAssembly>
9
+  </dependency>
10
+</assembly>

+ 1
- 0
launcher/windows/comctl.rc View File

@@ -0,0 +1 @@
1
+1 24 "comctl.manifest"

+ 4
- 1
launcher/windows/compile.sh View File

@@ -1,8 +1,11 @@
1 1
 #!/bin/sh
2
+rm Vista.pas UAC.manifest UAC.rc
3
+cp ../../installer/windows/Vista.pas ../../installer/windows/UAC.manifest  ../../installer/windows/UAC.rc .
4
+
2 5
 rm -Rf ./*.exe
3 6
 fpc -Sd -Twin32 DMDirc.dpr
4 7
 fpc -Sd -Twin32 DMDircUpdater.dpr
5
-rm -Rf ./*.o ./*.or
8
+rm -Rf ./*.o ./*.or ./*.ppu
6 9
 if [ -e DMDircUpdater.exe -a -e DMDirc.exe ]; then
7 10
 	exit 0;
8 11
 else

Loading…
Cancel
Save