alternative to assert
[gtkD.git] / gtkD / installer / ui / Main.d
blob65f7939d4f3d518c6910807e747f194763174c72
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 module ui.Main;
21 //version = leds;
22 version = gtkDdev;
23 version = gtkDtest;
24 //version = difiles
25 //version = compiler;
26 version(linux)
28 version = gtkDgl;
29 version = gtkDgltest;
31 version = dmd;
32 //version = gdc;
34 private import ui.Installer;
36 private import ui.gtkDLogo;
38 private import gtk.GtkD;
39 private import gtk.Alignment;
40 private import gtk.MainWindow;
41 private import gtk.VBox;
42 private import gtk.HBox;
43 private import gtk.Button;
44 private import gtk.Label;
45 private import gtk.Frame;
46 private import gtk.ButtonBox;
47 private import gtk.HButtonBox;
48 private import gtk.Entry;
49 private import gtk.CheckButton;
50 private import gtk.Notebook;
51 private import gtk.Widget;
52 private import gtk.Image;
53 private import gtkc.gtktypes;
54 private import gtk.SizeGroup;
55 private import gtk.HSeparator;
56 private import gtk.PopupBox;
58 private import gtkc.gtktypes;
60 private import gdk.Event;
61 private import std.stdio;
62 private import std.process;
63 private import std.string;
65 private import std.c.stdlib;
67 interface InstallerUI
69 void setUserPanel(UserPanel panel);
70 void addSelection(char[] id, CheckButton check);
71 CheckButton getSelectionButton(char[] id);
72 bool getSelection(char[] id);
73 void setSelection(char[] id, bool state);
74 void setSensitive(char[] id, bool state);
76 void addDirectory(char[] id, Entry entry);
77 char[] getDirectory(char[] id);
78 void setDirectory(char[] id, char[] value);
80 //void nextPanel();
81 //void prevPanel();
84 public class MainInstaller : MainWindow , InstallerUI
87 HBox topBox;
88 VBox leftBox;
89 VBox tasksBox;
90 VBox mainBox;
91 Notebook notebook;
92 ButtonBox buttonBox;
94 Button backButton;
95 Button nextButton;
96 Button exitButton;
97 Button installButton;
99 UserPanel[] userPanels;
100 UserPanel currentUserPanel;
101 CheckButton[char[]] selections;
102 Entry[char[]] directories;
104 int movingDirection; // going back or next, 0=don't know
106 this()
108 version(leds)
110 super("GtkD and Leds installer");
112 else
114 super("GtkD installer");
116 setup();
117 addPanels();
118 setUserPanel(0);
119 showAll();
122 public void addSelection(char[] id, CheckButton check)
124 selections[id] = check;
127 public CheckButton getSelectionButton(char[] id)
129 CheckButton check;
130 if ( id in selections )
132 check = selections[id];
134 return check;
137 public bool getSelection(char[] id)
139 if ( id in selections )
141 return cast(bool)selections[id].getActive();
143 return false;
145 public void setSelection(char[] id, bool active)
147 if ( id in selections )
149 selections[id].setActive(active);
152 public void setSensitive(char[] id, bool active)
154 if ( id in selections )
156 selections[id].setSensitive(active);
160 public void addDirectory(char[] id, Entry entry)
162 directories[id] = entry;
164 public char[] getDirectory(char[] id)
166 if ( id in directories )
168 return directories[id].getText();
170 return null;
172 public void setDirectory(char[] id, char[] value)
174 if ( id in directories )
176 return directories[id].setText(value);
180 public void nextPanel()
182 movingDirection = 1;
183 notebook.nextPage();
184 setUserPanel(notebook.getCurrentPage());
187 public void prevPanel()
189 movingDirection = -1;
190 notebook.prevPage();
191 setUserPanel(notebook.getCurrentPage());
194 private void setup()
196 topBox = new HBox(false, 2);
197 leftBox = new VBox(false, 7);
198 tasksBox = new VBox(false, 7);
199 mainBox = new VBox(false, 2);
200 notebook = new Notebook;
201 notebook.setShowTabs(false);
202 notebook.setSizeRequest(400,300);
203 buttonBox = HButtonBox.createActionBox();
205 exitButton = makeButton(null, StockID.QUIT, "Exit", "exit");
206 buttonBox.packStart(Alignment.west(exitButton), true, true, 7);
208 version(Win32)
210 backButton = makeButton(buttonBox, StockID.GO_BACK, "<< Back", "back");
211 nextButton = makeButton(buttonBox, StockID.GO_FORWARD, "Next >>", "next");
212 installButton = makeButton(buttonBox, StockID.OK, "Install", "install");
214 else
216 backButton = makeButton(buttonBox, StockID.GO_BACK, "Back", "back");
217 nextButton = makeButton(buttonBox, StockID.GO_FORWARD, "Next", "next");
218 installButton = makeButton(buttonBox, StockID.OK, "Install", "install");
221 // Button logo = new Button();
222 // logo.setImage(getGtkDLogo());
223 // logo.addOnButtonPress(&logoClicked);
224 // logo.setRelief(ReliefStyle.NONE);
225 // logo.setFocusOnClick(false);
227 mainBox.packStart(Alignment.west(getGtkDLogo()), false, false, 2);
228 mainBox.packStart(notebook, true, true, 2);
229 mainBox.packStart(buttonBox, false, false, 2);
231 topBox.packStart(new Frame(tasksBox,""), false, false, 2);
232 topBox.packStart(mainBox, true, true, 2);
234 add(topBox);
237 private int logoClicked(GdkEventButton* event, Widget widget)
240 PopupBox.information(this, "Help with the graphics design is apreciated", "GtkDLogo");
241 return false;
244 private Button makeButton(ButtonBox box,StockID id, char[] label, char[] action)
246 Button button = new Button();
247 button.setActionName(action);
248 button.removeAll();
249 button.setImage(new Image(id, IconSize.BUTTON));
250 button.setLabel(label);
251 if ( box !is null )
253 box.packStart(button, false, false, 7);
255 button.addOnClicked(&userActions);
256 return button;
259 private void addPanels()
261 addPanel(new SelectionsPanel(this));
262 version(gtkDdev)addPanel(new DevPanel(this));
263 version(leds) addPanel(new LedsPanel(this));
264 version(compiler) addPanel(new MainCompilerPanel(this));
265 addPanel(new LocalPanel(this));
266 addPanel(new InstallPanel(this));
267 addPanel(new TestPanel(this));
270 CheckButton[char[]] tasksList;
272 private void addPanel(UserPanel userPanel)
274 notebook.appendPage(userPanel.getWidget(), userPanel.getName());
276 if ( userPanel.getName().length > 0 )
278 HBox hbox = new HBox(false, 1);
279 CheckButton check = new CheckButton();
280 hbox.packStart(check, false, false, 4);
281 hbox.packStart(Alignment.west(new Label(userPanel.getName())), false, false, 4);
282 tasksBox.packStart(hbox, false, false, 4);
283 tasksList[userPanel.getName()] = check;
284 check.setSensitive(false);
286 userPanels ~= userPanel;
289 private void userActions(Button button)
291 char[] action = button.getActionName();
292 switch ( action )
294 case "exit":
295 GtkD.exit(0);
296 break;
298 case "back":
299 prevPanel();
300 break;
302 case "next":
303 nextPanel();
304 break;
306 case "install":
307 hide();
308 new Installer(this);
309 nextPanel();
310 break;
312 default:
313 writefln("userAction = %s", action);
314 break;
319 private void setUserPanel(uint number)
321 if ( number < userPanels.length )
323 UserPanel panel = userPanels[number];
324 setUserPanel(panel);
328 public void setUserPanel(UserPanel panel)
330 if ( currentUserPanel !is null )
332 currentUserPanel.exited();
334 while ( !panel.selected()
335 && movingDirection != 0
338 if ( movingDirection > 0 )
340 nextPanel();
342 else
344 prevPanel();
346 return;
348 backButton.setSensitive(panel.allowBack());
349 nextButton.setSensitive(panel.allowNext());
350 bool allowInstall = true;
351 foreach ( UserPanel userPanel ; userPanels )
353 if ( !userPanel.complete() )
355 allowInstall = false;
357 if ( userPanel.getName in tasksList )
359 tasksList[userPanel.getName()].setActive(userPanel.complete());
362 installButton.setSensitive(allowInstall);
363 currentUserPanel = panel;
367 class UserPanel
369 InstallerUI installerUI;
371 bool completed = false;
375 abstract Widget getWidget();
376 abstract char[] getName();
377 public this(InstallerUI installerUI)
379 this.installerUI = installerUI;
382 public bool allowNext()
384 return true;
386 public bool allowBack()
388 return true;
390 public bool selected()
392 return true;
394 public bool exited()
396 return selected();
398 public bool complete()
400 return completed;
403 protected HBox newSelection(char[] selection, char[] id)
405 HBox box = new HBox(false, 2);
407 Button button = new Button(StockID.HELP, &userHelp, true);
408 button.setActionName(id);
409 button.setImage(new Image(StockID.HELP, IconSize.MENU));
410 CheckButton check = new CheckButton(selection, &userSelection);
411 check.setActionName(id);
413 box.packStart(button, false, false, 2);
414 box.packStart(check, false, false, 2);
415 installerUI.addSelection(id, check);
416 return box;
419 protected HBox newDirectory(char[] label, char[] id, SizeGroup sizeGroup)
421 HBox box = new HBox(false, 2);
422 Button button = new Button(StockID.HELP, &userHelp, true);
423 button.setActionName(id);
424 button.setImage(new Image(StockID.HELP, IconSize.MENU));
425 Entry entry = new Entry();
427 box.packStart(button, false, false, 2);
428 Label l = new Label(label);
429 Alignment alig = Alignment.west(l);
430 sizeGroup.addWidget(alig);
431 box.packStart(alig, false, false, 2);
432 box.packStart(entry, true, true, 2);
433 button = new Button(StockID.INDEX, &userDirectory);
434 button.setActionName(id);
435 button.setLabel("Browse");
436 button.setImage(new Image(StockID.INDEX, IconSize.MENU));
437 box.packStart(button, false, false, 2);
438 installerUI.addDirectory(id, entry);
439 return box;
442 protected HBox newButton(Button actionButton, char[] id)
444 HBox box = new HBox(false, 2);
446 Button button = new Button(StockID.HELP, &userHelp, true);
447 button.setActionName(id);
448 button.setImage(new Image(StockID.HELP, IconSize.MENU));
450 box.packStart(button, false, false, 2);
451 box.packStart(actionButton, false, false, 2);
452 return box;
455 void userSelection(CheckButton check)
457 switch ( check.getActionName() )
460 case "leds":
461 bool active = cast(bool)check.getActive();
462 installerUI.setSensitive("ledsGtkD", active);
463 installerUI.setSensitive("ledsLeds", active);
464 installerUI.setSensitive("ledsDool", active);
465 installerUI.setSensitive("ledsDante", active);
466 installerUI.setSensitive("ledsPhobos", active);
467 break;
469 default:
470 // nothing
471 break;
475 void userHelp(Button button)
479 private import gtk.FileChooserDialog;
480 private import gtk.FileChooser;
481 void userDirectory(Button button)
483 char[] id = button.getActionName();
484 char[] dir = installerUI.getDirectory(id);
485 if ( dir != null )
487 FileChooserDialog chooserDialog = new FileChooserDialog(
488 "Select directory",
489 mainInstaller,
490 FileChooserAction.SELECT_FOLDER
492 FileChooser chooser = chooserDialog.getFileChooser();
493 chooser.setCurrentFolder(dir);
494 ResponseType response = cast(ResponseType)chooserDialog.run();
495 if ( response == ResponseType.GTK_RESPONSE_OK )
497 installerUI.setDirectory(id, chooser.getCurrentFolder());
499 chooserDialog.hide(); // is it released ?
504 class SelectionsPanel : UserPanel
506 VBox vbox;
508 public this(InstallerUI installerUI)
510 super(installerUI);
512 public char[] getName()
514 return "Selections";
516 public Widget getWidget()
518 if ( vbox is null )
520 vbox = new VBox(false, 2);
521 setup();
523 return vbox;
526 public bool allowBack()
528 return false;
531 public bool selected()
533 completed = true;
534 return true;
537 private void setup()
539 vbox.packStart(new Label("Select the components to install"), false, false, 14);
540 vbox.packStart(newSelection("Install GtkD", "gtkD"), false, false, 2);
541 version(gtkDdev) vbox.packStart(newSelection("Install GtkD for development", "gtkDDev"), false, false, 2);
542 version(gtkDgl) vbox.packStart(newSelection("Install GtkDgl", "gtkDgl"), false, false, 2);
543 version(gtkDdev) version(gtkDgl) vbox.packStart(newSelection("Install GtkDgl for development", "duiglDev"), false, false, 2);
544 version(leds) vbox.packStart(newSelection("Install Leds", "leds"), false, false, 2);
546 installerUI.setSelection("gtkD", true);
547 version(gtkDdev) installerUI.setSelection("gtkDDev", true);
548 version(gtkDgl) installerUI.setSelection("gtkDgl", true);
549 version(gtkDdev) version(gtkDgl) installerUI.setSelection("duiglDev", true);
550 version(leds) installerUI.setSelection("leds", true);
556 class DevPanel : UserPanel
558 VBox vbox;
560 public this(InstallerUI installerUI)
562 super(installerUI);
564 public char[] getName()
566 return "GtkD Development";
568 public Widget getWidget()
570 if ( vbox is null )
572 vbox = new VBox(false, 2);
573 setup();
575 return vbox;
578 public bool selected()
580 completed = true;
581 return installerUI.getSelection("gtkDDev")
582 || installerUI.getSelection("gtkDglDev");
585 private void setup()
587 vbox.packStart(new Label("Select GtkD modules"), false, false, 14);
588 version(difiles) vbox.packStart(newSelection("GtkD .di files", "gtkDdi"), false, false, 2);
589 vbox.packStart(newSelection("GtkD source files", "gtkDSource"), false, false, 2);
590 vbox.packStart(newSelection("GtkDTests - general UI tests", "gtkDTests"), false, false, 2);
591 version(gtkDgl) vbox.packStart(newSelection("SimpleGL - simplest GL test", "gtkDglSimple"), false, false, 2);
592 version(gtkDgl) vbox.packStart(newSelection("ShapesGL - showing more of openGL integration", "gtkDglShapes"), false, false, 2);
594 version(difiles) installerUI.setSelection("gtkDdi", true);
595 installerUI.setSelection("gtkDSource", true);
596 installerUI.setSelection("gtkDTests", true);
597 version(gtkDgl) installerUI.setSelection("gtkDglSimple", true);
598 version(gtkDgl) installerUI.setSelection("gtkDglShapes", true);
605 class LedsPanel : UserPanel
607 VBox vbox;
609 public this(InstallerUI installerUI)
611 super(installerUI);
613 public char[] getName()
615 return "Leds projects";
617 public Widget getWidget()
619 if ( vbox is null )
621 vbox = new VBox(false, 2);
622 setup();
624 return vbox;
627 public bool selected()
629 completed = true;
630 return installerUI.getSelection("leds");
633 private void setup()
635 vbox.packStart(new Label("Select the leds projects to create"), false, false, 14);
636 vbox.packStart(newSelection("Create a leds project for GtkD", "ledsGtkD"), false, false, 2);
637 vbox.packStart(newSelection("Create a leds project for Leds", "ledsLeds"), false, false, 2);
638 vbox.packStart(newSelection("Create a leds project for Dool", "ledsDool"), false, false, 2);
639 vbox.packStart(newSelection("Create a leds project for Dante", "ledsDante"), false, false, 2);
640 vbox.packStart(newSelection("Create a leds project for phobos", "ledsPhobos"), false, false, 2);
642 installerUI.setSelection("ledsGtkD", true);
643 installerUI.setSelection("ledsLeds", true);
644 installerUI.setSelection("ledsDool", true);
645 installerUI.setSelection("ledsDante", true);
646 installerUI.setSelection("ledsPhobos", true);
653 class MainCompilerPanel : UserPanel
655 VBox vbox;
657 public this(InstallerUI installerUI)
659 super(installerUI);
661 public char[] getName()
663 return "D Compiler";
665 public Widget getWidget()
667 if ( vbox is null )
669 vbox = new VBox(false, 2);
670 setup();
672 return vbox;
675 public bool selected()
677 completed = true;
678 return true;
681 private void setup()
683 vbox.packStart(new Label("Select your D compiler"), false, false, 14);
685 vbox.packStart(new Label("For the installation"), false, false, 7);
686 vbox.packStart(newSelection("Digital Mars DMD", "instalCompilerDMD"), false, false, 2);
687 vbox.packStart(newSelection("gnu D GDC", "installCompilerGDC"), false, false, 2);
689 vbox.packStart(new Label("For your leds projects"), false, false, 7);
690 vbox.packStart(newSelection("Digital Mars DMD", "ledsCompilerDMD"), false, false, 2);
691 vbox.packStart(newSelection("gnu D GDC", "ledsCompilerGDC"), false, false, 2);
693 installerUI.setSelection("instalCompilerDMD", true);
694 installerUI.setSelection("installCompilerGDC", false);
695 version(leds) installerUI.setSelection("ledsCompilerDMD", true);
696 version(leds) installerUI.setSelection("ledsCompilerGDC", false);
698 installerUI.setSensitive("instalCompilerDMD", false);
699 installerUI.setSensitive("installCompilerGDC", false);
700 version(leds) installerUI.setSensitive("ledsCompilerDMD", false);
701 version(leds) installerUI.setSensitive("ledsCompilerGDC", false);
708 class LocalPanel : UserPanel
710 VBox vbox;
711 SizeGroup sizeGroup;
713 char[] home;
715 public this(InstallerUI installerUI)
717 super(installerUI);
718 sizeGroup = new SizeGroup(SizeGroupMode.HORIZONTAL);
719 version(Win32)
721 home = std.string.toString(getenv("HOMEPATH"));
723 else
725 home = std.string.toString(getenv("HOME"));
729 public char[] getName()
731 return "Local";
734 private import std.path;
735 private import std.file;
737 private bool validDir(char[] dir)
739 bool valid = dir.length > 0;
740 return valid;
743 public bool validDMDHome()
745 bool valid = false;
746 char[] dir = installerUI.getDirectory("dmdHome");
747 valid = validDir(dir);
748 if ( valid )
752 version(Win32) char[] dmd = std.path.join(std.path.join(dir ,"bin"), "dmd.exe");
753 else char[] dmd = std.path.join(std.path.join(dir ,"bin"), "dmd");
754 std.file.isfile(dmd);
755 version(Win32)
757 char[] dm = std.path.join(std.path.join(dir,"..\\dm"),"bin");
758 char[] link = std.path.join(dm, "link.exe");
759 std.file.isfile(link);
760 char[] lib = std.path.join(dm, "lib.exe");
761 std.file.isfile(lib);
763 else char[] link = std.path.join(std.path.join(dir ,"bin"), "dmd");
764 valid = true;
766 catch ( FileException pe )
768 valid = false;
772 return valid;
775 // class GuessFile
776 // {
777 // char[] guess;
778 // char[] fetch;
779 // char[] userChoice;
780 // bool create;
781 // bool confirmed;
783 // bool isDir(char[] dir)
784 // {
785 // bool ok = false;
786 // try
787 // {
788 // ok = cast(bool)std.file.isfile(dir);
789 // }
790 // catch ( FileException fe )
791 // {
792 // ok = false;
793 // }
794 // return ok;
795 // }
797 // bool exists(char[] fileName)
798 // {
799 // bool ok = false;
800 // try
801 // {
802 // ok = cast(bool)std.file.exists(fileName);
803 // }
804 // catch ( FileException fe )
805 // {
806 // ok = false;
807 // }
808 // return ok;
809 // }
810 // }
812 public char[] guessDMDHome()
814 char[] guess;
815 version(Win32)
817 guess = "\\dmd";
819 else
821 guess = std.path.join(home, "dmd");
823 return guess;
826 public char[] guessGtkHome()
828 char[] guess;
829 version(Win32)
831 guess = "\\Program Files\\Common Files\\GTK\\2.0\\bin";
833 else
835 guess = "/usr/lib";
837 return guess;
840 public char[] guessGtkDLibHome()
842 char[] guess;
843 version(Win32)
845 guess = "\\Program Files\\Common Files\\GTK\\2.0\\bin";
847 else
849 guess = "/home/ruimt/usr/lib";
851 return guess;
854 public char[] guessGtkDDevHome()
856 char[] guess;
857 version(Win32)
859 guess = "\\testRelease";
861 else
863 guess = std.path.join(home, "devel/D/testInstall/GtkD1");
865 return guess;
868 public char[] guessLedsHome()
870 char[] guess;
871 version(Win32)
873 guess = "\\Program Files\\Common Files\\org\\dsource\\leds";
875 else
877 guess = std.path.join(home, "devel/D/Leds1");
879 return guess;
883 public bool selected()
885 completed = true;
886 version(dmd)
888 if ( completed )
890 completed = validDMDHome();
893 version(gtkDdev)
895 if ( completed )
897 completed = installerUI.getDirectory("gtkDDevHome").length > 0;
900 version(leds)
902 if ( completed )
904 completed = installerUI.getDirectory("ledsHome").length > 0;
908 if ( completed )
910 completed = installerUI.getDirectory("gtkHome").length > 0;
912 if ( completed )
914 completed = installerUI.getDirectory("gtkDLibHome").length > 0;
917 return true;
919 public Widget getWidget()
921 if ( vbox is null )
923 vbox = new VBox(false, 2);
924 setup();
926 return vbox;
928 private void setup()
930 vbox.packStart(new Label("Select the paths for installation"), false, false, 14);
931 vbox.packStart(newDirectory("DMD home", "dmdHome", sizeGroup), false, false, 2);
932 vbox.packStart(newDirectory("Gtk lib home", "gtkHome", sizeGroup), false, false, 2);
933 vbox.packStart(newDirectory("GtkD lib home", "gtkDLibHome", sizeGroup), false, false, 2);
934 version(gtkDdev) vbox.packStart(newDirectory("GtkD dev home", "gtkDDevHome", sizeGroup), false, false, 2);
935 version(leds) vbox.packStart(newDirectory("leds home", "ledsHome", sizeGroup), false, false, 2);
937 installerUI.setDirectory("dmdHome", guessDMDHome());
938 installerUI.setDirectory("gtkHome", guessGtkHome());
939 installerUI.setDirectory("gtkDLibHome", guessGtkDLibHome());
940 version(gtkDdev) installerUI.setDirectory("gtkDDevHome", guessGtkDDevHome());
941 version(leds) installerUI.setDirectory("ledsHome", guessLedsHome());
945 class InstallPanel : UserPanel
947 VBox vbox;
948 //bool installed = false;
949 public this(InstallerUI installerUI)
951 super(installerUI);
953 public bool selected()
955 completed = true;
956 return true;
958 public char[] getName()
960 return "Install";
962 public Widget getWidget()
964 if ( vbox is null )
966 vbox = new VBox(false, 2);
967 setup();
969 return vbox;
972 bool allowNext()
974 return false;
977 private void setup()
979 Label label = new Label(
980 "Thank you for installing GtkD\n"
981 ~"press Install to continue"
983 vbox.packStart(label, true, true, 2);
985 version(gtkDtest) vbox.packStart(newSelection("Create desktop icon for gtkD tests", "gtkDTestsIcon"), false, false, 2);
986 version(leds) vbox.packStart(newSelection("Create desktop icon for leds", "ledsIcon"), false, false, 2);
987 version(leds) vbox.packStart(newSelection("set leds as your D editor", "ledsDEditor"), false, false, 2);
989 version(gtkDtest) installerUI.setSelection("gtkDTestsIcon", false);
990 version(leds) installerUI.setSelection("ledsIcon", false);
991 version(leds) installerUI.setSelection("ledsDEditor", false);
993 version(gtkDtest) installerUI.setSensitive("gtkDTestsIcon", false);
994 version(leds) installerUI.setSensitive("ledsIcon", false);
995 version(leds) installerUI.setSensitive("ledsDEditor", false);
999 class TestPanel : UserPanel
1001 VBox vbox;
1002 bool active;
1003 //bool installed = false;
1004 public this(InstallerUI installerUI)
1006 super(installerUI);
1008 public bool complete()
1010 return !active;
1012 public bool selected()
1014 active = true;
1015 completed = true;
1016 return true;
1018 public char[] getName()
1020 return "";
1022 public Widget getWidget()
1024 if ( vbox is null )
1026 vbox = new VBox(false, 2);
1027 setup();
1029 return vbox;
1032 bool allowNext()
1034 return false;
1037 bool allowBack()
1039 return false;
1042 private void testButtonAction(Button button)
1044 switch ( button.getActionName() )
1047 default:
1048 writefln("testButtonAction going for %s", button.getActionName());
1049 std.process.system(button.getActionName());
1050 break;
1055 private void setup()
1057 Label label = new Label(
1058 "Installation is complete\n"
1059 ~"press Exit to quit the installer\n"
1060 ~"or execute the test programs"
1062 vbox.packStart(label, false, false, 2);
1064 Button button;
1066 version(gtkDtest)
1068 if ( installerUI.getSelection("gtkDTests") )
1070 button = new Button("gtkD Tests");
1071 vbox.packStart(newButton(button, "helpGtkDTests"), false, false, 2);
1072 button.setActionName(installerUI.getDirectory("gtkDDevHome")~"/gtkDTests");
1073 button.addOnClicked(&testButtonAction);
1076 version(gtkDgltest)
1078 if ( installerUI.getSelection("gtkDglSimple") )
1080 button = new Button("SimpleGL test");
1081 button.setActionName(installerUI.getDirectory("gtkDDevHome")~"/SimpleGL");
1082 button.addOnClicked(&testButtonAction);
1083 vbox.packStart(newButton(button, "helpSimpleGLTest"), false, false, 2);
1085 if ( installerUI.getSelection("gtkDglShapes") )
1087 button = new Button("ShapesGL test");
1088 button.setActionName(installerUI.getDirectory("gtkDDevHome")~"/ShapesGL");
1089 button.addOnClicked(&testButtonAction);
1090 vbox.packStart(newButton(button, "helpShapesGLTest"), false, false, 2);
1093 version(leds)
1095 if ( installerUI.getSelection("leds") )
1097 button = new Button("Leds");
1098 button.setActionName(installerUI.getDirectory("ledsHome")~"/leds");
1099 button.addOnClicked(&testButtonAction);
1100 vbox.packStart(newButton(button, "helpLedsTest"), false, false, 2);
1107 MainInstaller mainInstaller;
1109 int main(char[][] args)
1111 version(Win32)
1113 GtkD.init(args);
1115 else
1117 GtkD.initMultiThread(args);
1119 mainInstaller = new MainInstaller();
1120 GtkD.main();
1121 return 0;