ae7be3c2539abe57226bdbbb816329771319e115
[nit.git] / contrib / benitlux / src / client / features / debug.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Debugging features accessible from the user preference menu
16 module debug
17
18 import client
19 import push
20 import checkins
21
22 redef class UserWindow
23
24 private var layout_debug = new VerticalLayout(parent=layout)
25
26 private var lbl_debug_title = new Label(parent=layout_debug,
27 text="Debug options".t)
28
29 private var but_test_notif = new Button(parent=layout_debug,
30 text="Test notifications".t)
31
32 private var but_test_checkin = new Button(parent=layout_debug,
33 text="Test checkin".t)
34
35 private var but_test_checkout = new Button(parent=layout_debug,
36 text="Test checkout".t)
37
38 private var but_test_menu = new Button(parent=layout_debug,
39 text="Test menu diff".t)
40
41 init
42 do
43 lbl_debug_title.size = 1.5
44
45 for c in [but_test_notif, but_test_checkin, but_test_checkout, but_test_menu] do
46 c.observers.add self
47 end
48 end
49
50 redef fun on_event(event)
51 do
52 super
53
54 if event isa ButtonPressEvent then
55 var sender = event.sender
56 if sender == but_test_notif then
57 notify("Test Notification", "Some content\nmultiline", 5)
58 else if sender == but_test_checkin then
59 app.on_check_in
60 else if sender == but_test_checkout then
61 app.on_check_out
62 else if sender == but_test_menu then
63 app.request_menu
64 end
65 end
66 end
67 end