Code
The codebase can be found at https://github.com/SyedAnasAlam/Productivity-App
To run it you need QT
What is it?
This productivity app uses the QT framework and JSON for storing data, it has the following features:
- Todo list
- For everyday errands and tasks that are not recurring
- Habit tracker
- Helping form new habits, check every day if I have completed the habit for 66 days (as far as I know there is no exact number of days one must keep doing a habit until it is formed but 66 days seem to be average)
- Weekly schedule
- The weekly recurring tasks I have
- Impossible list (bucket list)
- Read more about Impossible List here
Why?
The four above-mentioned tools are what I use every day, and I would like to combine them in one place. You may have other tools that you use, you can easily modify the source to add features you need and remove those you don't.
Structure
A JSON array is used to store data. Each "feature" has its own JSON array, the ID of some data is given by its index in the JSON array.
Instead of classic Model-View-Controller architecture this application structures each "feature" as a class. To add a new feature to the application simply inherit from Feature and QWidget. The Feature class holds the JSON array as a protected member __database and provides a method for saving the database. Furthermore, a virtual method v_display must be overridden which handles the drawing of GUI elements. Inside `v_display` each feature must add its GUI elements to the parent widget which is a tab widget.
Convention
- Private members are prepended with two underscores __
- Methods that deal with data are prepended with m_
- Methods that deal with a view are prepended with v_
- Slots are named widget_action
Adding a feature
- Create a class and inherit from Feature and QWidget
- Instantiate Feature with the name of the features database and Call m_openDatabase() in the constructor
- After this, the data in the JSON file can now be read from the JSON array __database, which is a protected member of Feature
- When changes are to be saved call m_saveDatabase and give as argument a JSON array. The JSON file will then be overridden by the contents of the JSON array given as an argument.
- Provide a definition for the virtual method v_display, where the GUI elements are set. In the end, add the GUI elements to the parent widget which is a tab widget, this is done using addTab. The parent widget is provided as an argument.