Projekt

Allgemein

Profil

Eval » Historie » Version 29

Maximilian Seesslen, 01.09.2022 16:45

1 1 Maximilian Seesslen
h1. Eval
2
3
h2. Widgets
4
5 3 Maximilian Seesslen
There is a ODesktop that holds a list of OScreens (or only the curent).
6 1 Maximilian Seesslen
There is a OScreen that holds a list of OWidgets.
7
When the touch is pressed, the corresponding button can be determined.
8
An signal can be emmited.
9
An press-event can be queued, An release-event can be queued. An click-event can be queued if current button matches original pressed button.
10
11
* OButton::draw(): completely draws the widget
12
* OButton::update(): only draw status-relevant items, e.g. pressed, released, time changed...
13
14 2 Maximilian Seesslen
All screens can be prepared at start.
15 1 Maximilian Seesslen
A Screen can be active or inactive.
16 3 Maximilian Seesslen
17 12 Maximilian Seesslen
Only one screen is active plus an navigation-screen?
18
19 3 Maximilian Seesslen
h2. Touch
20
21 16 Maximilian Seesslen
There is an touch class that helps converting raw values to X-Y-coordinates. [[Biwak:touch]]
22 17 Maximilian Seesslen
CTouch will emit signals "pressed, released, clicked" that can be connected to libocelli.
23 2 Maximilian Seesslen
24 1 Maximilian Seesslen
h2. Watch
25
26 5 Maximilian Seesslen
* the OWatch class shows an clock with specific style, analog or digital
27 1 Maximilian Seesslen
28 6 Maximilian Seesslen
h2. Example: Minutnik
29 1 Maximilian Seesslen
30
* Main screen; CWatch, Add-Button
31
* Add-Screen
32
** Espresso, Weisswurst, Weiches Ei, Hartes Ei, Nudeln, Pizza, Waschmaschine, Cancel; Height 32
33
* Alarm Screen
34
* Logo, Splash screen at boot time and stand-by-screen
35 7 Maximilian Seesslen
* Release v2.0.0: Mode-Screen: Minutnik, Clock, StopWatch
36 6 Maximilian Seesslen
37 7 Maximilian Seesslen
h2. Example: CANDis
38 1 Maximilian Seesslen
39 7 Maximilian Seesslen
* Main screen
40 10 Maximilian Seesslen
** Button for Light, Sensemux-Diagram, Activity (TV, Musik, Solder, Off), Miniminutnik
41 7 Maximilian Seesslen
** Header with Clock
42 8 Maximilian Seesslen
* Light-Screen
43
** Power-Widget
44
** Ok-Button
45 7 Maximilian Seesslen
* Clock-Screen (Screen saver)
46 9 Maximilian Seesslen
** Clock, Date, Temperature, Quick-Access-Buttons
47 18 Maximilian Seesslen
48
h2. Pointers
49
50
Like in Qt an widget has an parent.
51
52
h2. Single App class vs. Screens
53
54 27 Maximilian Seesslen
Having everything in an single class may be confusing. It should be splited to per-Screen-classes. The screens have access to the app.
55 19 Maximilian Seesslen
<pre><code class="cpp">
56 18 Maximilian Seesslen
57 1 Maximilian Seesslen
class CApp: Ocelli
58 24 Maximilian Seesslen
{
59 1 Maximilian Seesslen
   public:
60
61 25 Maximilian Seesslen
      CScreenMain *screenMain;
62
      CScreenAlarm *screenAlarm;
63 21 Maximilian Seesslen
      CApp()
64 24 Maximilian Seesslen
      {
65 25 Maximilian Seesslen
         addScreen( screenMain = new CScreenMain() );
66 21 Maximilian Seesslen
      }
67 1 Maximilian Seesslen
}
68
69 25 Maximilian Seesslen
class CScreenClock: public OScreen
70 1 Maximilian Seesslen
{
71
      CApp &app;
72 23 Maximilian Seesslen
      OButton buttonAddTimer;
73 18 Maximilian Seesslen
      OLabel labelTime;
74 25 Maximilian Seesslen
      OLabel labelDate;
75 26 Maximilian Seesslen
      lrtimer_t clickTimer;
76 24 Maximilian Seesslen
77 1 Maximilian Seesslen
   public:
78 20 Maximilian Seesslen
79
      CScreenMain()
80 1 Maximilian Seesslen
         :buttonAddTimer(this)
81 27 Maximilian Seesslen
      {
82 1 Maximilian Seesslen
      }
83
      virtual clicked(int x,int y)
84 25 Maximilian Seesslen
      {
85
         clickTimer=ltNow();
86 26 Maximilian Seesslen
         app.m_pwmBacklight.setPwmValue(800);
87 25 Maximilian Seesslen
      }
88
      void eventLoop()
89
      {
90
         app.m_pwmBacklight.setPwmValue(100);
91
      }
92
      addItemPressed()
93 18 Maximilian Seesslen
      {
94 1 Maximilian Seesslen
         app.switchScreen( eDesktopItems );
95
      }
96 18 Maximilian Seesslen
}
97 24 Maximilian Seesslen
98 23 Maximilian Seesslen
class CScreenMain: public OScreen
99 1 Maximilian Seesslen
{
100
      CApp &app;
101 24 Maximilian Seesslen
102
   public:
103
104
      virtual clicked(int x,int y);
105
}
106
107
class CScreenAlarm: public OScreen
108
{
109
      CApp &app;
110
      OLabel alarmText;
111 1 Maximilian Seesslen
      lrtimer_t activationTimer;
112 24 Maximilian Seesslen
113
   public:
114
      CScreenAlarm()
115
         :alarmText( centerX, centerY-200, "-")
116 27 Maximilian Seesslen
      {
117 24 Maximilian Seesslen
      }
118
      virtual avctivate() override
119
      {
120 1 Maximilian Seesslen
         app.m_buzzer.setBeepMode(alarm);
121
         activationTimer=lrNow();
122
      }
123 24 Maximilian Seesslen
      virtual clicked(int x,int y) override
124
      {
125
         // Dont allow to quit alarm immediately by accident 
126 27 Maximilian Seesslen
         // when playing with the device; 500ms must elapse
127
         if( ! lrElapsed(activationTimer, MSECS_PER_SEC / 2 ) )
128
         {
129 24 Maximilian Seesslen
            return;
130
         }
131
         app.m_buzzer.setBeepMode(nullptr);
132
         app.activatePreviousScreen();
133 29 Maximilian Seesslen
         app.
134 24 Maximilian Seesslen
      }
135 18 Maximilian Seesslen
}
136 19 Maximilian Seesslen
</code></pre>