1 /*
2 * Copyright 2013, Jérôme DUVAL.
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
5
6
7 #include "EULAWindow.h"
8
9 #include <Application.h>
10 #include <Box.h>
11 #include <Button.h>
12 #include <Catalog.h>
13 #include <LayoutBuilder.h>
14 #include <LayoutUtils.h>
15 #include <Roster.h>
16 #include <ScrollView.h>
17 #include <SpaceLayoutItem.h>
18
19 #include "tracker_private.h"
20
21 static const uint32 kMsgAgree = 'agre';
22 static const uint32 kMsgNext = 'next';
23
24 #undef B_TRANSLATION_CONTEXT
25 #define B_TRANSLATION_CONTEXT "InstallerApp"
26
27
EULAWindow()28 EULAWindow::EULAWindow()
29 :
30 BWindow(BRect(0, 0, 600, 450), B_TRANSLATE("README"),
31 B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE
32 | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS)
33 {
34 BString infoText;
35 infoText << B_TRANSLATE(
36 "Welcome to the Haiku Installer!\n\n");
37 infoText << B_TRANSLATE(
38 "IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n");
39 infoText << B_TRANSLATE(
40 "This is beta-quality software! It means there is a risk of "
41 "losing important data. Make frequent backups! You have been "
42 "warned.\n\n\n");
43 infoText << B_TRANSLATE(
44 "1) If you are installing Haiku onto real hardware (not inside an "
45 "emulator), you may want to prepare a hard disk partition from "
46 "another OS (you could, for example, use a GParted Live-CD, which "
47 "can also resize existing partitions to make room).\n"
48 "You can also set up partitions by launching DriveSetup from "
49 "Installer, but you won't be able to resize existing partitions with "
50 "it. While DriveSetup has been quite thoroughly tested over the "
51 "years, it's recommended to have up-to-date backups of the other "
52 "partitions on your system. Just in case" B_UTF8_ELLIPSIS);
53 infoText << "\n\n\n";
54 infoText << B_TRANSLATE(
55 "2) The Installer will make the Haiku partition itself bootable, "
56 "but takes no steps to integrate Haiku into an existing boot menu. "
57 "If you have GRUB already installed, you can add Haiku to it.\n"
58 "For details, please consult the guide on booting Haiku on our "
59 "website at https://www.haiku-os.org/guides/booting.\n"
60 "Or you can set up a boot menu from Installer's \"Tools\" menu, see "
61 "the Haiku User Guide's topic on the application \"BootManager\"."
62 "\n\n\n");
63 infoText << B_TRANSLATE(
64 "3) When you successfully boot into Haiku for the first time, make "
65 "sure to read our \"User Guide\" and take the \"Quick Tour\". There "
66 "are links on the Desktop and in WebPositive's bookmarks.\n\n");
67 infoText << B_TRANSLATE(
68 "Have fun and thanks for trying out Haiku!");
69
70 BTextView* textView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW);
71 textView->SetInsets(10, 10, 10, 10);
72 textView->MakeEditable(false);
73 textView->MakeSelectable(false);
74 textView->SetText(infoText);
75
76 BScrollView* scrollView = new BScrollView("eulaScroll",
77 textView, B_WILL_DRAW, false, true);
78
79 BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
80 new BMessage(B_QUIT_REQUESTED));
81 cancelButton->SetTarget(be_app);
82
83 BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
84 new BMessage(kMsgAgree));
85 continueButton->SetTarget(be_app);
86 continueButton->MakeDefault(true);
87
88 if (!be_roster->IsRunning(kTrackerSignature))
89 SetWorkspaces(B_ALL_WORKSPACES);
90
91 BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
92 .SetInsets(B_USE_WINDOW_SPACING)
93 .Add(scrollView)
94 .AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
95 .AddGlue()
96 .Add(cancelButton)
97 .Add(continueButton);
98
99 CenterOnScreen();
100 Show();
101 }
102
103
104 bool
QuitRequested()105 EULAWindow::QuitRequested()
106 {
107 be_app->PostMessage(kMsgNext);
108 return true;
109 }
110