gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cash2ecash] branch master updated: testing


From: gnunet
Subject: [cash2ecash] branch master updated: testing
Date: Sat, 28 Dec 2024 13:43:35 +0100

This is an automated email from the git hooks/post-receive script.

manuel-geissbuehler pushed a commit to branch master
in repository cash2ecash.

The following commit(s) were added to refs/heads/master by this push:
     new 2e8d55a  testing
2e8d55a is described below

commit 2e8d55a7b6e1491bb2c0e6697aefc0f2e3e3afd5
Author: Manuel Geissbühler <manuel@debian>
AuthorDate: Sat Dec 28 13:43:18 2024 +0100

    testing
---
 src/cash2ecash.cpp                                 |  2 +-
 .../{screenWelcomme.hpp => #screenWelcomme.hpp#}   |  7 ++--
 src/gui/CMakeLists.txt                             |  8 ++---
 src/gui/screen.hpp                                 | 33 +++++++++++++-----
 src/gui/screenAcceptCash.cpp                       |  1 +
 src/gui/screenAcceptCash.hpp                       | 34 ++++++++++++++++++
 src/gui/screenConnection.cpp                       |  1 +
 src/gui/screenConnection.hpp                       | 40 ++++++++++++++++++++++
 src/gui/screenIdentification.cpp                   |  1 +
 src/gui/screenIdentification.hpp                   | 30 ++++++++++++++++
 src/gui/screenWelcomme.hpp                         | 12 ++-----
 11 files changed, 142 insertions(+), 27 deletions(-)

diff --git a/src/cash2ecash.cpp b/src/cash2ecash.cpp
index 8b4cc76..0b6458d 100644
--- a/src/cash2ecash.cpp
+++ b/src/cash2ecash.cpp
@@ -22,7 +22,7 @@ enum state_e state = INIT;
 char test;
 char *string;
 Gui gui;
-ScreenWelcome welcome(800, 480, &startButtonCb);
+ScreenWelcome welcome(&startButtonCb);
 void guiDriver();
 
 int main(int argc, char *argv[]){
diff --git a/src/gui/screenWelcomme.hpp b/src/gui/#screenWelcomme.hpp#
similarity index 76%
copy from src/gui/screenWelcomme.hpp
copy to src/gui/#screenWelcomme.hpp#
index 8e81bc7..753a187 100644
--- a/src/gui/screenWelcomme.hpp
+++ b/src/gui/#screenWelcomme.hpp#
@@ -3,6 +3,7 @@
 #include "screen.hpp"
 #include <cstdint>
 #include <src/core/lv_obj_event.h>
+#include <src/core/lv_obj_pos.h>
 #include <src/core/lv_obj_style.h>
 #include <src/misc/lv_area.h>
 #include <src/misc/lv_event.h>
@@ -12,7 +13,6 @@
 
 class ScreenWelcome : public Screen {
 private:
-  lv_obj_t *instructionLabel;
   lv_obj_t *startButton;
   
   
@@ -20,11 +20,9 @@ private:
   
   protected:
   public:
-  ScreenWelcome(uint16_t width, uint16_t height, void 
(*startCallback)(lv_event_t *e)) : Screen(width, height){
+  ScreenWelcome(void (*startCallback)(lv_event_t *e)){
       //Set set the "instruction"
-      instructionLabel = lv_label_create(instructionsContainer);
       lv_label_set_text(instructionLabel, "Press Start to begin...");
-      lv_obj_add_style(instructionLabel, &instructionDefaultStyle, 0);
 
 
       //Add button "Start"
@@ -32,6 +30,7 @@ private:
       lv_obj_add_style(startButton, &buttonDefaultStyle, 0);
       lv_obj_t *label = lv_label_create(startButton);
       lv_label_set_text(label, "Start");
+      lv_obj_add_style(label, &buttonLabelDefaultStyle, 0);
       lv_obj_add_event_cb(startButton, startCallback, LV_EVENT_CLICKED, NULL);
     }
 
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 27d4b8a..d691937 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -5,15 +5,15 @@ endforeach()
 
 
 if (LV_USE_LINUX_DRM)
-    add_library(gui gui.cpp screen.cpp screenWelcome.cpp)
+    add_library(gui gui.cpp screen.cpp screenWelcome.cpp 
screenIdentification.cpp screenConnection.cpp screenAcceptCash.cpp)
     target_link_libraries(gui lvgl lvgl::examples lvgl::demos lvgl::thorvg 
${LIBDRM_LIBRARIES} m pthread)
 
 elseif (LV_USE_SDL)
-    add_library(gui gui.cpp screen.cpp screenWelcome.cpp)
+    add_library(gui gui.cpp screen.cpp screenWelcome.cpp 
screenIdentification.cpp screenConnection.cpp screenAcceptCash.cpp)
     target_link_libraries(gui lvgl lvgl::examples lvgl::demos lvgl::thorvg 
${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} m pthread)
 
 elseif (LV_USE_WAYLAND)
-    add_library(gui gui.cpp screen.cpp screenWelcome.cpp 
${WAYLAND_PROTOCOLS_SRC} backends/wayland.c)
+    add_library(gui gui.cpp screen.cpp screenWelcome.cpp 
screenIdentification.cpp screenConnection.cpp screenAcceptCash.cpp 
${WAYLAND_PROTOCOLS_SRC} backends/wayland.c)
     target_compile_definitions(gui PRIVATE LV_CONF_INCLUDE_SIMPLE)
     target_link_libraries(gui lvgl lvgl::examples lvgl::demos lvgl::thorvg m
         wayland-client wayland-cursor xkbcommon)
@@ -21,7 +21,7 @@ elseif (LV_USE_WAYLAND)
 else()
 
     # No specific build steps required for FBDEV
-    add_library(gui gui.cpp screen.cpp screenWelcome.cpp)
+    add_library(gui gui.cpp screen.cpp screenWelcome.cpp 
screenIdentification.cpp screenConnection.cpp screenAcceptCash.cpp)
     target_link_libraries(gui lvgl lvgl::examples lvgl::demos lvgl::thorvg m 
pthread)
     target_include_directories(gui PUBLIC "../extern/lvgl")
 endif()
diff --git a/src/gui/screen.hpp b/src/gui/screen.hpp
index c34314b..7a14d9a 100644
--- a/src/gui/screen.hpp
+++ b/src/gui/screen.hpp
@@ -42,7 +42,6 @@ class Screen {
   lv_style_t buttonsContainerStyle;
 
 
-  
   protected:
   uint16_t width, height;
   lv_obj_t *screenPointer;
@@ -51,12 +50,29 @@ class Screen {
   lv_obj_t *buttonsContainer;
   lv_obj_t *mainContentContainer;
 
+  lv_obj_t *instructionLabel;
+
   lv_style_t buttonDefaultStyle;
+  lv_style_t buttonLabelDefaultStyle;
   lv_style_t instructionDefaultStyle;
 
   public:
-  Screen(uint16_t width, uint16_t height) : width(width), height(height)
+  Screen()
   {
+    //create default style for buttons
+    lv_style_init(&buttonDefaultStyle);
+    lv_style_set_size(&buttonDefaultStyle, LV_PCT(100), 72);
+
+    //create default style for button labels
+    lv_style_init(&buttonLabelDefaultStyle);
+    lv_style_set_align(&buttonLabelDefaultStyle, LV_ALIGN_CENTER);
+    lv_style_set_text_font(&buttonLabelDefaultStyle, &lv_font_montserrat_16);
+
+    //create default style for the instructions Text
+    lv_style_init(&instructionDefaultStyle);
+    lv_style_set_text_font(&instructionDefaultStyle, &lv_font_montserrat_24);
+
+    
     screenPointer = lv_obj_create(NULL);
     //lv_obj_set_size(screenPointer, 800, 480);
 
@@ -86,6 +102,11 @@ class Screen {
     color.red = 0;
     lv_obj_set_style_bg_color(mainContentContainer, color, 0);
 
+    //Add "instructions" label and set style
+    instructionLabel = lv_label_create(instructionsContainer);
+    lv_label_set_text(instructionLabel, "dummytext");
+    lv_obj_add_style(instructionLabel, &instructionDefaultStyle, 0);
+
     //set style & flow of buttons container 
     lv_style_init(&buttonsContainerStyle);
     lv_style_set_flex_flow(&buttonsContainerStyle, 
LV_FLEX_FLOW_COLUMN_REVERSE);
@@ -97,13 +118,7 @@ class Screen {
 
     lv_obj_add_style(buttonsContainer, &buttonsContainerStyle, 0);
 
-    //create default style for buttons
-    lv_style_init(&buttonDefaultStyle);
-    lv_style_set_size(&buttonDefaultStyle, LV_PCT(100), 72);
-
-    //create default style for the instructions Text
-    lv_style_init(&instructionDefaultStyle);
-    lv_style_set_text_font(&instructionDefaultStyle, &lv_font_montserrat_24);
+    
 
     
   }
diff --git a/src/gui/screenAcceptCash.cpp b/src/gui/screenAcceptCash.cpp
new file mode 100644
index 0000000..57c32ac
--- /dev/null
+++ b/src/gui/screenAcceptCash.cpp
@@ -0,0 +1 @@
+#include "screenAcceptCash.hpp"
diff --git a/src/gui/screenAcceptCash.hpp b/src/gui/screenAcceptCash.hpp
new file mode 100644
index 0000000..b85c577
--- /dev/null
+++ b/src/gui/screenAcceptCash.hpp
@@ -0,0 +1,34 @@
+#ifndef SCREEN_ACCEPTCASH_H
+#define SCREEN_ACCEPTCASH_H
+
+#include "screen.hpp"
+#include "lvgl.h"
+#include <src/core/lv_obj_pos.h>
+#include <src/widgets/label/lv_label.h>
+
+class ScreenAcceptCash : public Screen{
+  private:
+  lv_obj_t *finishButton;
+  lv_obj_t *amountLabel;
+  protected:
+  public:
+  ScreenAcceptCash(char* amountString, void (*finishCallback)(lv_event_t *e)){
+    //Set set the "instruction"
+    lv_label_set_text(instructionLabel, "Insert Cash and press Finish if 
you're done");
+
+    //Add button "Finish"
+    finishButton = lv_button_create(buttonsContainer);
+    lv_obj_add_style(finishButton, &buttonDefaultStyle, 0);
+    lv_obj_t *label = lv_label_create(finishButton);
+    lv_label_set_text(label, "Finish");
+    lv_obj_add_style(label, &buttonLabelDefaultStyle, 0);
+    lv_obj_add_event_cb(finishButton, finishCallback, LV_EVENT_CLICKED, NULL);
+
+    //Add field, displaying amount
+    amountLabel = lv_label_create(mainContentContainer);
+    lv_label_set_text_static(amountLabel, amountString);
+    lv_obj_center(amountLabel);
+  }
+};
+
+#endif
diff --git a/src/gui/screenConnection.cpp b/src/gui/screenConnection.cpp
new file mode 100644
index 0000000..5a718b5
--- /dev/null
+++ b/src/gui/screenConnection.cpp
@@ -0,0 +1 @@
+#include "screenConnection.hpp"
diff --git a/src/gui/screenConnection.hpp b/src/gui/screenConnection.hpp
new file mode 100644
index 0000000..99da388
--- /dev/null
+++ b/src/gui/screenConnection.hpp
@@ -0,0 +1,40 @@
+#ifndef SCREEN_CONNECTION_H
+#define SCREEN_CONNECTION_H
+
+#include "screen.hpp"
+#include <cstring>
+#include <src/core/lv_obj_pos.h>
+#include <src/libs/qrcode/lv_qrcode.h>
+#include <src/misc/lv_color.h>
+#include <src/misc/lv_types.h>
+
+class ScreenConnection : public Screen{
+  private:
+  lv_obj_t *abortButton;
+  lv_obj_t *qrCode;
+  protected:
+  public:
+  ScreenConnection(char *uri, void (*abortCallback)(lv_event_t *e)){
+    //Set the "instruction
+    lv_label_set_text(instructionLabel, "Scan the QR-Code with your Taler 
Wallet App");
+
+    //Add button "Abort"
+    abortButton = lv_button_create(buttonsContainer);
+    lv_obj_add_style(abortButton, &buttonDefaultStyle, 0);
+    lv_obj_t *label = lv_label_create(abortButton);
+    lv_label_set_text(label, "Abort");
+    lv_obj_add_style(label, &buttonLabelDefaultStyle, 0);
+    lv_obj_add_event_cb(abortButton, abortCallback, LV_EVENT_CLICKED, NULL);
+
+    //Add QR-Code
+    qrCode = lv_qrcode_create(mainContentContainer);
+    lv_qrcode_set_size(qrCode, LV_PCT(80));
+    lv_qrcode_set_dark_color(qrCode, lv_color_black());
+    lv_qrcode_set_light_color(qrCode, lv_color_white());
+
+    lv_qrcode_update(qrCode, uri, strlen(uri));
+    lv_obj_center(qrCode);
+  }
+};
+
+#endif
diff --git a/src/gui/screenIdentification.cpp b/src/gui/screenIdentification.cpp
new file mode 100644
index 0000000..b6c7c6b
--- /dev/null
+++ b/src/gui/screenIdentification.cpp
@@ -0,0 +1 @@
+#include "screenIdentification.hpp"
diff --git a/src/gui/screenIdentification.hpp b/src/gui/screenIdentification.hpp
new file mode 100644
index 0000000..13538a0
--- /dev/null
+++ b/src/gui/screenIdentification.hpp
@@ -0,0 +1,30 @@
+#ifndef SCREEN_IDENTIFICATION_H
+#define SCREEN_IDENTIFICATION_H
+
+#include "screen.hpp"
+#include <src/misc/lv_types.h>
+#include <src/widgets/label/lv_label.h>
+
+
+
+class ScreenIdentification : public Screen {
+  private:
+  lv_obj_t *abortButton;
+  
+  protected:
+  public:
+  ScreenIdentification(void (*abortCallback)(lv_event_t *e)){
+    //Set the instruction
+    lv_label_set_text(instructionLabel, "Identificate presenting a NFC-Tag to 
the NFC-Reader.");
+
+
+    //Add button "Abort"
+    abortButton = lv_button_create(buttonsContainer);
+    lv_obj_add_style(abortButton, &buttonDefaultStyle, 0);
+    lv_obj_t *label = lv_label_create(abortButton);
+    lv_label_set_text(label, "Abort");
+    lv_obj_add_style(label, &buttonLabelDefaultStyle, 0);
+    lv_obj_add_event_cb(abortButton, abortCallback, LV_EVENT_CLICKED, NULL);
+  }
+};
+#endif
diff --git a/src/gui/screenWelcomme.hpp b/src/gui/screenWelcomme.hpp
index 8e81bc7..4e47024 100644
--- a/src/gui/screenWelcomme.hpp
+++ b/src/gui/screenWelcomme.hpp
@@ -3,6 +3,7 @@
 #include "screen.hpp"
 #include <cstdint>
 #include <src/core/lv_obj_event.h>
+#include <src/core/lv_obj_pos.h>
 #include <src/core/lv_obj_style.h>
 #include <src/misc/lv_area.h>
 #include <src/misc/lv_event.h>
@@ -12,28 +13,21 @@
 
 class ScreenWelcome : public Screen {
 private:
-  lv_obj_t *instructionLabel;
   lv_obj_t *startButton;
   
-  
-
-  
   protected:
   public:
-  ScreenWelcome(uint16_t width, uint16_t height, void 
(*startCallback)(lv_event_t *e)) : Screen(width, height){
+  ScreenWelcome(void (*startCallback)(lv_event_t *e)){
       //Set set the "instruction"
-      instructionLabel = lv_label_create(instructionsContainer);
       lv_label_set_text(instructionLabel, "Press Start to begin...");
-      lv_obj_add_style(instructionLabel, &instructionDefaultStyle, 0);
-
 
       //Add button "Start"
       startButton = lv_button_create(buttonsContainer);
       lv_obj_add_style(startButton, &buttonDefaultStyle, 0);
       lv_obj_t *label = lv_label_create(startButton);
       lv_label_set_text(label, "Start");
+      lv_obj_add_style(label, &buttonLabelDefaultStyle, 0);
       lv_obj_add_event_cb(startButton, startCallback, LV_EVENT_CLICKED, NULL);
     }
-
 };
 #endif

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]