Projekt

Allgemein

Profil

Eval » Historie » Revision 45

Revision 44 (Maximilian Seesslen, 02.09.2022 17:02) → Revision 45/46 (Maximilian Seesslen, 02.09.2022 17:07)

h1. Eval

h2. Widgets

There is a ODesktop that holds a list of OScreens (or only the curent).
There is a OScreen that holds a list of OWidgets.
When the touch is pressed, the corresponding button can be determined.
An signal can be emmited.
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.

* OButton::draw(): completely draws the widget
* OButton::update(): only draw status-relevant items, e.g. pressed, released, time changed...

All screens can be prepared at start.
A Screen can be active or inactive.

Only one screen is active plus an navigation-screen?

h2. Touch

There is an touch class that helps converting raw values to X-Y-coordinates. [[Biwak:touch]]
CTouch will emit signals "pressed, released, clicked" that can be connected to libocelli.

h2. Watch

* the OWatch class shows an clock with specific style, analog or digital

h2. Example: Minutnik

* Main screen; CWatch, Add-Button
* Add-Screen
** Espresso, Weisswurst, Weiches Ei, Hartes Ei, Nudeln, Pizza, Waschmaschine, Cancel; Height 32
* Alarm Screen
* Logo, Splash screen at boot time and stand-by-screen
* Release v2.0.0: Mode-Screen: Minutnik, Clock, StopWatch

h2. Example: CANDis

* Main screen
** Button for Light, Sensemux-Diagram, Activity (TV, Musik, Solder, Off), Miniminutnik
** Header with Clock
* Light-Screen
** Power-Widget
** Ok-Button
* Clock-Screen (Screen saver)
** Clock, Date, Temperature, Quick-Access-Buttons

h2. Pointers

Like in Qt an widget has an parent.

h2. Single App class vs. Screens

h3. Inherited screens outside of app

Having everything in an single class may be confusing. It should be splited to per-Screen-classes. The screens have access to the app.
The ocelli-app does not know about the screens directly -, it just holds the pointers to them in Ocelli object-.
After instanciating the app, also the screens get instanciated and added to the ocelli-app.

h3. Screens created inside of the app

The app creates the screens at startup and adds them to Ocelli object.
No Screen is inherited, only signals are used to create the logic.
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.

h3. Cross-references / Cross-depencies

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.

<pre><code class="cpp">

class CApp: Ocelli
{
public:
enum class EScreens
{
minutnik,
addItem,
screensaver
}
// CScreen *screenMain;
// CScreen *screenAlarm;
CApp()
{
// addScreen( screenMain = new CScreenMain() );
}
}

class CScreenClock: public OScreen
{
CApp &app;
OButton buttonAddTimer;
OLabel labelTime;
OLabel labelDate;
lrtimer_t clickTimer;

public:

CScreenMain()
:buttonAddTimer(this)
{
}
virtual clicked(int x,int y)
{
clickTimer=ltNow();
app.m_pwmBacklight.setPwmValue(800);
}
void eventLoop()
{
app.m_pwmBacklight.setPwmValue(100);
}
addItemPressed()
{
app.switchScreen( eDesktopItems );
}
}

class CScreenMain: public OScreen
{
CApp &app;

public:

virtual clicked(int x,int y);
}

class CScreenAlarm: public OScreen
{
CApp &app;
OLabel alarmText;
lrtimer_t activationTimer;

public:
CScreenAlarm()
:alarmText( centerX, centerY-200, "-")
{
}
virtual avctivate() override
{
app.m_buzzer.setBeepMode(alarm);
activationTimer=lrNow();
}
virtual clicked(int x,int y) override
{
// Dont allow to quit alarm immediately by accident
// when playing with the device; 500ms must elapse
if( ! lrElapsed(activationTimer, MSECS_PER_SEC / 2 ) )
{
return;
}
app.m_buzzer.setBeepMode(nullptr);
app.activatePreviousScreen();
app.
}
}

int main()
{
CApp *pApp=new( CApp );
pApp->addScreen( new CScreen() );
}
</code></pre>

h2. Navigator-Screen

Statische Seit, 4 Buttons, Kopfleiste.
** Mainmenu
** Back
** 2 Direktstart Buttons

** Android:
*** Bedienung über 2 Schaltflächen: zwei Schaltflächen – eine für "Startbildschirm" und eine für "Zurück"
*** Bedienung über 3 Schaltflächen: drei Schaltflächen – eine für "Startbildschirm", eine für "Zurück" und eine für "App-Übersicht"

Kopfleiste macht wenig Sinn. Inhalt stehen schon auf dem Screensaver.
Muss deaktiviert werden koennen e.g. fuer Alarm.

https://www.flaticon.com/de/autoren/freepik
https://fonts.google.com/icons?icon.set=Material+Icons&icon.query=food
<pre><code class="shell">
#!/bin/bash

set -e -u

mkdir -p 32
mkdir -p 48

for ifile in *.png; do
convert $ifile -define h:format=a -depth 1 -background white -alpha off -resize 32x32 32/${ifile%.*}.h
convert $ifile -define h:format=rgb -depth 1 -background white -alpha off -resize 32x32 32/${ifile%.*}.png
convert $ifile -define h:format=rgb -depth 1 -background white -resize 48x48 48/${ifile%.*}.png
# convert $ifile -background white -alpha remove -flatten -alpha off -depth 1 -resize 32x32 -negate 32/${ifile%.*}.png

convert $ifile -define h:format=rgb -background white -alpha remove -flatten -alpha off -resize 32x32 32/${ifile%.*}_8.h
convert 32/${ifile%.*}.png -monochrome 32/${ifile%.*}_1.png

done
</code></pre>

Symbole:
* Egg
* Mainmenu
* Back
* Network

Minutnik:
* Weisswurst
* Espresse
* Spaghetti
* Ei
* Waschmaschine