We were inspired by the sleek GUIs of modern day cellphones, and we wanted to create own interpretation. However, there were some limitations, since the point of the project was to build the foundation of the phone from scratch, we had to ensure that our code was simple but effective. After deciding on the Qt framework for C++, we knew that we could count on lightweight code with great performance.
Since screen real estate was limited (480×272), we were constantly thinking about optimizing the space in our layout. Since our touch screen was resistive touch, we also had to make the buttons fairly big in order for them to register being pressed.
At the heart of the GUI is the stacked widget. The stacked widget is a container class for widget instances. It holds the different pages of the GUI in a stack and allows the user to move around in the stack based on events. The mainwindow contains an action toolbar that holds common pages (home, settings, power, and active call), these are always present, the rest of the screen is dedicated to the stacked widget, allowing the widget in focus to consume the entire screen.
There are a few aspects that are common to all pages:
- access to the serial port
- access to the keyboard (pending)
- page name and index
Using the object orientation present in C++, we were able to create a type that would encompass all pages and allow each specific widget to inherit from it. A UML diagram of the GUI is detailed below As always, we’ll let the code speak for itself: