Skip to content

Commit 0ab1b0c

Browse files
committed
Initial commit
0 parents  commit 0ab1b0c

55 files changed

Lines changed: 2193 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Studies Organizer
2+
> *Studies Organizer* is a Qt/QML Android application to track Your weekly schedule, add notes and save future events.
3+
4+
## Table of contents
5+
* [General info](#general-info)
6+
* [Screenshots](#screenshots)
7+
* [Technologies](#technologies)
8+
* [Setup](#setup)
9+
10+
## General info
11+
Organize all of Your schedules, dates of future exams, due projects or save little details that otherwise You would have forgotten! *Studies Organizer* with its simplistic design lets You store all of that information in a fast, lightweight application, that can be useful for students at any level of education.
12+
13+
## Screenshots
14+
<p>
15+
<img src="./screenshots/eventsScreenshot.png" width="196" height="308"/>
16+
<img src="./screenshots/tuesdayScreenshot.png" width="196" height="308"/>
17+
<img src="./screenshots/notesScreenshot.png" width="196" height="308"/>
18+
<img src="./screenshots/addEventScreenshot.png" width="196" height="308"/>
19+
<img src="./screenshots/menuScreenshot.png" width="196" height="308"/>
20+
</p>
21+
22+
## Technologies
23+
* Qt 5.15.1 for Android
24+
* SQLite 3.33.0
25+
* Java JDK 8u271
26+
* Android SDK - API Level 30
27+
* Android NDK ver. 21.3.6528147
28+
29+
## Setup
30+
* Download `android-build-release-signed.apk`,
31+
* Put it e.g. in a `Downloads` folder in Your Android device,
32+
* Go to the `Downloads` folder on the Android device,
33+
* Tap the file and install - the file doesn't require any special permissions.

android/AndroidManifest.xml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0"?>
2+
<manifest package="com.sweak.studiesorganizer" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
3+
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
4+
Remove the comment if you do not require these default permissions. -->
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
8+
9+
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
10+
Remove the comment if you do not require these default features. -->
11+
12+
13+
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
14+
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Studies Organizer" android:extractNativeLibs="true" android:icon="@drawable/icon">
15+
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Studies Organizer" android:screenOrientation="portrait" android:launchMode="singleTop">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN"/>
18+
<category android:name="android.intent.category.LAUNCHER"/>
19+
</intent-filter>
20+
<!-- Application arguments -->
21+
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
22+
<!-- Application arguments -->
23+
<meta-data android:name="android.app.lib_name" android:value="StudiesOrganizerApp"/>
24+
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
25+
<meta-data android:name="android.app.repository" android:value="default"/>
26+
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
27+
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
28+
<!-- Deploy Qt libs as part of package -->
29+
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
30+
<!-- Run with local libs -->
31+
<meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
32+
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
33+
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
34+
<meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroidBearer.jar"/>
35+
<meta-data android:name="android.app.static_init_classes" android:value=""/>
36+
<!-- Used to specify custom system library path to run with local system libs -->
37+
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
38+
<!-- Messages maps -->
39+
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
40+
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
41+
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
42+
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
43+
<!-- Messages maps -->
44+
<!-- Splash screen -->
45+
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
46+
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
47+
use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
48+
are done populating your window with content. -->
49+
<!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
50+
<!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
51+
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
52+
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
53+
<!-- Splash screen -->
54+
<!-- Background running -->
55+
<!-- Warning: changing this value to true may cause unexpected crashes if the
56+
application still try to draw after
57+
"applicationStateChanged(Qt::ApplicationSuspended)"
58+
signal is sent! -->
59+
<meta-data android:name="android.app.background_running" android:value="false"/>
60+
<!-- Background running -->
61+
<!-- auto screen scale factor -->
62+
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
63+
<!-- auto screen scale factor -->
64+
<!-- extract android style -->
65+
<!-- available android:values :
66+
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
67+
* full - useful QWidget & Quick Controls 1 apps
68+
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
69+
* none - useful for apps that don't use any of the above Qt modules
70+
-->
71+
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
72+
<!-- extract android style -->
73+
<meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait"/>
74+
</activity>
75+
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
76+
</application>
77+
78+
</manifest>

android/res/icon.png

25.9 KB
Loading

android/res/logo_portrait.png

1.44 MB
Loading

inc/AbstractSqlModel.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#pragma once
2+
3+
#include "DatabaseException.h"
4+
#include <QObject>
5+
#include <QSqlQueryModel>
6+
#include <QSqlQuery>
7+
8+
class AbstractSqlModel : public QSqlQueryModel
9+
{
10+
Q_OBJECT
11+
12+
Q_PROPERTY(QString query READ queryString WRITE setQueryStringAndRefresh NOTIFY queryStringChanged)
13+
14+
public:
15+
explicit AbstractSqlModel(QObject* parent = Q_NULLPTR);
16+
17+
Q_INVOKABLE void refresh();
18+
QHash<int, QByteArray> roleNames() const override;
19+
QVariant data(const QModelIndex &index, int role) const override;
20+
21+
QString queryString() const noexcept;
22+
void setQueryStringAndRefresh(const QString &query);
23+
24+
private:
25+
QSqlDatabase database = QSqlDatabase::database("studiesorganizer");
26+
QSqlQuery databaseQuery;
27+
void openDatabase() throw(DatabaseException);
28+
29+
QString m_queryString;
30+
31+
signals:
32+
void queryStringChanged();
33+
};

inc/DatabaseException.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <QString>
4+
5+
class DatabaseException
6+
{
7+
public:
8+
DatabaseException(const QString message);
9+
QString getMessage() const noexcept;
10+
11+
private:
12+
QString _message;
13+
};

inc/DatabaseHandler.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#pragma once
2+
#pragma warning(disable:4290)
3+
4+
#include "DatabaseException.h"
5+
#include <QObject>
6+
#include <QSqlDatabase>
7+
#include <QSqlQuery>
8+
9+
class DatabaseHandler : public QObject
10+
{
11+
Q_OBJECT
12+
public:
13+
explicit DatabaseHandler(QObject *parent = nullptr);
14+
15+
Q_INVOKABLE void resetDatabase();
16+
17+
Q_INVOKABLE void addEvent(QString eventName, QString eventTime, QString eventDate);
18+
Q_INVOKABLE void addActivity(QString dayName, QString eventName, QString eventTime);
19+
Q_INVOKABLE void addNote(QString noteName);
20+
21+
Q_INVOKABLE void deleteEvent(int primaryKey);
22+
Q_INVOKABLE void deleteActivity(QString dayName, int primaryKey);
23+
Q_INVOKABLE void deleteNote(int primaryKey);
24+
25+
Q_INVOKABLE void editEvent(int primaryKey, QString eventName, QString eventTime, QString eventDate);
26+
Q_INVOKABLE void editActivity(QString dayName, int primaryKey, QString activityName, QString activityTime);
27+
Q_INVOKABLE void editNote(int primaryKey, QString noteName);
28+
29+
private:
30+
QSqlDatabase database = QSqlDatabase::addDatabase("QSQLITE", "studiesorganizer");
31+
QSqlQuery databaseQuery;
32+
33+
QString databaseName = "studiesorganizer.sqlite";
34+
35+
void openDatabase() throw(DatabaseException);
36+
void executeQuery(QString queryString) throw(DatabaseException);
37+
void createNoteTable();
38+
void createDaysTables();
39+
void createEventTable();
40+
};

inc/ModelUtilityFunctions.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#pragma once
2+
3+
#include "DatabaseException.h"
4+
#include <QtDebug>
5+
#include <QString>
6+
#include <QSqlDatabase>
7+
#include <QSqlQueryModel>
8+
#include <QSqlQuery>
9+
#include <QSqlError>
10+
11+
namespace ModelUtilityFunctions {
12+
13+
extern void openDatabase(QSqlDatabase& database) throw(DatabaseException)
14+
{
15+
if (database.open() == false)
16+
throw(DatabaseException("Could not open the database!"));
17+
else
18+
qDebug("Database successfully opened!");
19+
}
20+
21+
extern void executeQuery(QString queryString, QSqlQuery& query) throw(DatabaseException)
22+
{
23+
if (query.exec(queryString) == false)
24+
throw(DatabaseException("Exception: Could not complete the query: " + query.lastQuery() + "!"));
25+
else
26+
qDebug() << query.lastQuery() + " query completed!";
27+
}
28+
29+
extern void updateModel(QSqlQueryModel& model, QSqlQuery& databaseQuery) throw(DatabaseException)
30+
{
31+
if (databaseQuery.isActive() && databaseQuery.isForwardOnly() == false)
32+
{
33+
model.setQuery(databaseQuery);
34+
35+
if (model.lastError().type() != QSqlError::NoError)
36+
throw(DatabaseException("Exception: Could not update the model with query: "
37+
+ databaseQuery.lastQuery() + "!"));
38+
else
39+
qDebug() << "Model set with query: " + databaseQuery.lastQuery() + "!";
40+
}
41+
else
42+
throw(DatabaseException(QString("Exception: Could not update the model, ")
43+
+ QString("the query is not Active or is forwardOnly!")));
44+
}
45+
}

inc/TableStructures.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#pragma once
2+
3+
#include <QList>
4+
#include <QString>
5+
6+
struct dayTableStructure {
7+
QList<QString> tableNames = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
8+
QString primaryKeyName = "ID";
9+
QString timeColumnName = "ActivityTime";
10+
QString activityColumnName = "ActivityName";
11+
};
12+
13+
struct noteTableStructure {
14+
QString tableName = "Notes";
15+
QString primaryKeyName = "ID";
16+
QString noteColumnName = "NoteName";
17+
};
18+
19+
struct eventTableStructure {
20+
QString tableName = "Events";
21+
QString primaryKeyName = "ID";
22+
QString timeColumnName = "EventTime";
23+
QString dateColumnName = "EventDate";
24+
QString eventColumnName = "EventName";
25+
QString secsSinceEpochColumnName = "SecsSinceEpoch";
26+
};
27+
28+
extern struct noteTableStructure databaseNoteTableStructure;
29+
extern struct dayTableStructure databaseDayTableStructure;
30+
extern struct eventTableStructure databaseEventTableStructure;

screenshots/addEventScreenshot.png

34.2 KB
Loading

0 commit comments

Comments
 (0)