Eval » Historie » Version 39
Maximilian Seesslen, 02.09.2022 15:01
| 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 | 31 | Maximilian Seesslen | h3. Inherited screens outside of app |
| 55 | |||
| 56 | 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. |
| 57 | 35 | Maximilian Seesslen | The ocelli-app does not know about the screens directly -, it just holds the pointers to them in Ocelli object-. |
| 58 | 30 | Maximilian Seesslen | After instanciating the app, also the screens get instanciated and added to the ocelli-app. |
| 59 | 31 | Maximilian Seesslen | |
| 60 | h3. Screens created inside of the app |
||
| 61 | |||
| 62 | The app creates the screens at startup and adds them to Ocelli object. |
||
| 63 | No Screen is inherited, only signals are used to create the logic. |
||
| 64 | This is quite easy but can be confusing in bigger applications because all slots and functionality of different screens are mixed up in a single class. |
||
| 65 | 30 | Maximilian Seesslen | |
| 66 | 32 | Maximilian Seesslen | h3. Cross-references / Cross-depencies |
| 67 | 33 | Maximilian Seesslen | |
| 68 | 32 | Maximilian Seesslen | e.g. the Minutnik-Add-Screen needs access to Minutnik-Screen to add items. The Minutnik-Screen only needs the screen pointer to Minutnik-Add-Screen to show it when the "+"-Button is pressed. |
| 69 | |||
| 70 | 19 | Maximilian Seesslen | <pre><code class="cpp"> |
| 71 | 18 | Maximilian Seesslen | |
| 72 | 1 | Maximilian Seesslen | class CApp: Ocelli |
| 73 | { |
||
| 74 | public: |
||
| 75 | 34 | Maximilian Seesslen | enum class EScreens |
| 76 | { |
||
| 77 | minutnik, |
||
| 78 | addItem, |
||
| 79 | screensaver |
||
| 80 | } |
||
| 81 | // CScreen *screenMain; |
||
| 82 | // CScreen *screenAlarm; |
||
| 83 | 21 | Maximilian Seesslen | CApp() |
| 84 | 24 | Maximilian Seesslen | { |
| 85 | 32 | Maximilian Seesslen | // addScreen( screenMain = new CScreenMain() ); |
| 86 | 21 | Maximilian Seesslen | } |
| 87 | 1 | Maximilian Seesslen | } |
| 88 | |||
| 89 | 25 | Maximilian Seesslen | class CScreenClock: public OScreen |
| 90 | 1 | Maximilian Seesslen | { |
| 91 | CApp &app; |
||
| 92 | 23 | Maximilian Seesslen | OButton buttonAddTimer; |
| 93 | 18 | Maximilian Seesslen | OLabel labelTime; |
| 94 | 25 | Maximilian Seesslen | OLabel labelDate; |
| 95 | 26 | Maximilian Seesslen | lrtimer_t clickTimer; |
| 96 | 24 | Maximilian Seesslen | |
| 97 | 1 | Maximilian Seesslen | public: |
| 98 | 20 | Maximilian Seesslen | |
| 99 | CScreenMain() |
||
| 100 | 1 | Maximilian Seesslen | :buttonAddTimer(this) |
| 101 | 27 | Maximilian Seesslen | { |
| 102 | 1 | Maximilian Seesslen | } |
| 103 | virtual clicked(int x,int y) |
||
| 104 | 25 | Maximilian Seesslen | { |
| 105 | clickTimer=ltNow(); |
||
| 106 | 26 | Maximilian Seesslen | app.m_pwmBacklight.setPwmValue(800); |
| 107 | 25 | Maximilian Seesslen | } |
| 108 | void eventLoop() |
||
| 109 | { |
||
| 110 | app.m_pwmBacklight.setPwmValue(100); |
||
| 111 | } |
||
| 112 | addItemPressed() |
||
| 113 | 18 | Maximilian Seesslen | { |
| 114 | 1 | Maximilian Seesslen | app.switchScreen( eDesktopItems ); |
| 115 | } |
||
| 116 | 18 | Maximilian Seesslen | } |
| 117 | 24 | Maximilian Seesslen | |
| 118 | 23 | Maximilian Seesslen | class CScreenMain: public OScreen |
| 119 | 1 | Maximilian Seesslen | { |
| 120 | CApp &app; |
||
| 121 | 24 | Maximilian Seesslen | |
| 122 | public: |
||
| 123 | |||
| 124 | virtual clicked(int x,int y); |
||
| 125 | } |
||
| 126 | |||
| 127 | class CScreenAlarm: public OScreen |
||
| 128 | { |
||
| 129 | CApp &app; |
||
| 130 | OLabel alarmText; |
||
| 131 | 1 | Maximilian Seesslen | lrtimer_t activationTimer; |
| 132 | 24 | Maximilian Seesslen | |
| 133 | public: |
||
| 134 | CScreenAlarm() |
||
| 135 | :alarmText( centerX, centerY-200, "-") |
||
| 136 | 27 | Maximilian Seesslen | { |
| 137 | 24 | Maximilian Seesslen | } |
| 138 | virtual avctivate() override |
||
| 139 | { |
||
| 140 | 1 | Maximilian Seesslen | app.m_buzzer.setBeepMode(alarm); |
| 141 | activationTimer=lrNow(); |
||
| 142 | } |
||
| 143 | 24 | Maximilian Seesslen | virtual clicked(int x,int y) override |
| 144 | { |
||
| 145 | // Dont allow to quit alarm immediately by accident |
||
| 146 | 27 | Maximilian Seesslen | // when playing with the device; 500ms must elapse |
| 147 | if( ! lrElapsed(activationTimer, MSECS_PER_SEC / 2 ) ) |
||
| 148 | { |
||
| 149 | 24 | Maximilian Seesslen | return; |
| 150 | } |
||
| 151 | app.m_buzzer.setBeepMode(nullptr); |
||
| 152 | 1 | Maximilian Seesslen | app.activatePreviousScreen(); |
| 153 | app. |
||
| 154 | } |
||
| 155 | 34 | Maximilian Seesslen | } |
| 156 | |||
| 157 | int main() |
||
| 158 | { |
||
| 159 | CApp *pApp=new( CApp ); |
||
| 160 | pApp->addScreen( new CScreen() ); |
||
| 161 | 18 | Maximilian Seesslen | } |
| 162 | 19 | Maximilian Seesslen | </code></pre> |
| 163 | 36 | Maximilian Seesslen | |
| 164 | h2. Navigator-Screen |
||
| 165 | |||
| 166 | Statische Seit, 4 Buttons, Kopfleiste. |
||
| 167 | ** Mainmenu |
||
| 168 | ** Back |
||
| 169 | 38 | Maximilian Seesslen | |
| 170 | 39 | Maximilian Seesslen | ** Android: |
| 171 | 38 | Maximilian Seesslen | *** Bedienung über 2 Schaltflächen: zwei Schaltflächen – eine für "Startbildschirm" und eine für "Zurück" |
| 172 | *** Bedienung über 3 Schaltflächen: drei Schaltflächen – eine für "Startbildschirm", eine für "Zurück" und eine für "App-Übersicht" |
||
| 173 | 37 | Maximilian Seesslen | |
| 174 | Kopfleiste macht wenig sinn. Inhalt stehen schon auf dem Screensaver. |
||
| 175 | Muss deaktiviert werden koennen e.g. fuer Alarm. |