diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 28 | ||||
-rw-r--r-- | src/add_entry_form.ui | 185 | ||||
-rw-r--r-- | src/add_group_form.ui | 131 | ||||
-rw-r--r-- | src/assignmentList.cpp | 80 | ||||
-rw-r--r-- | src/assignmentList.h | 41 | ||||
-rw-r--r-- | src/main.cpp | 12 | ||||
-rw-r--r-- | src/main.ui | 207 | ||||
-rw-r--r-- | src/preferences_dialog.ui | 128 |
9 files changed, 815 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ebc041f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.cache +build +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b07fb66 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.1.0) + +project(assignment-list VERSION 0.0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(CMAKE_VERSION VERSION_LESS "3.7.0") + set(CMAKE_INCLUDE_CURRENT_DIR ON) +endif() + +find_package(Qt5 COMPONENTS Core Gui UiTools Widgets REQUIRED) + +add_executable(assignment-list + "${CMAKE_CURRENT_SOURCE_DIR}/src/add_entry_form.ui" + "${CMAKE_CURRENT_SOURCE_DIR}/src/add_group_form.ui" + "${CMAKE_CURRENT_SOURCE_DIR}/src/assignmentList.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/src/assignmentList.h" + "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/src/main.ui" + "${CMAKE_CURRENT_SOURCE_DIR}/src/preferences_dialog.ui" +) + +target_link_libraries(assignment-list Qt5::Core Qt5::Gui Qt5::UiTools Qt5::Widgets) diff --git a/src/add_entry_form.ui b/src/add_entry_form.ui new file mode 100644 index 0000000..6f60175 --- /dev/null +++ b/src/add_entry_form.ui @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Dialog</class> + <widget class="QDialog" name="Dialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>266</height> + </rect> + </property> + <property name="windowTitle"> + <string>Add Entry</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="descriptionLabel"> + <property name="text"> + <string>Description: </string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="new_entry_desc"/> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="title"> + <property name="font"> + <font> + <family>Arial</family> + <pointsize>18</pointsize> + </font> + </property> + <property name="text"> + <string>Add Entry</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="dueDateLabel"> + <property name="text"> + <string>Due Date: </string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QWidget" name="due_hbox" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QDateTimeEdit" name="new_entry_due"> + <property name="displayFormat"> + <string>MM/dd/yyyy</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="new_entry_due_checkbox"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string/> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="dueDateAltLabel"> + <property name="text"> + <string>Due Date (Alt):</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="new_entry_due_alt"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="linkLabel"> + <property name="text"> + <string>Link:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="new_entry_link"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="colorLabel"> + <property name="text"> + <string>Color:</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLineEdit" name="new_entry_color"/> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="highlightLabel"> + <property name="text"> + <string>Highlight:</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLineEdit" name="new_entry_highlight"/> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>Dialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>Dialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/add_group_form.ui b/src/add_group_form.ui new file mode 100644 index 0000000..cda7d55 --- /dev/null +++ b/src/add_group_form.ui @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Dialog</class> + <widget class="QDialog" name="Dialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>172</height> + </rect> + </property> + <property name="windowTitle"> + <string>Add Entry</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="title"> + <property name="font"> + <font> + <family>Arial</family> + <pointsize>18</pointsize> + </font> + </property> + <property name="text"> + <string>Add Group</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="descriptionLabel"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="new_group_name"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="dueDateLabel"> + <property name="text"> + <string>Column:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="new_group_column"> + <item> + <property name="text"> + <string>Left</string> + </property> + </item> + <item> + <property name="text"> + <string>Right</string> + </property> + </item> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="linkLabel"> + <property name="text"> + <string>Link:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="new_group_link"/> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>Dialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>Dialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/assignmentList.cpp b/src/assignmentList.cpp new file mode 100644 index 0000000..5adacc3 --- /dev/null +++ b/src/assignmentList.cpp @@ -0,0 +1,80 @@ +#include <QAction> +#include <QApplication> +#include <QDate> +#include <QFile> +#include <QMessageBox> +#include <QObject> +#include <QUiLoader> + +#include <QDebug> + +#include "assignmentList.h" + +AssignmentList::AssignmentList() { + // load uic + QFile file("/home/louie/Development/projects/assignment-list-qt/src/main.ui"); + file.open(QIODevice::ReadOnly); + QUiLoader loader; + ui.setupUi(this); + + this->initializeUI(); +} + +void AssignmentList::initializeUI() { + this->createMenu(); + this->createToolbar(); + //Config() // from config.h + this->setupDB(); + this->displayWidgets(); + this->show(); +} + +void AssignmentList::createMenu() { + QObject::connect(ui.actionPreferences, &QAction::triggered, this, &AssignmentList::preferences); + QObject::connect(ui.actionReload, &QAction::triggered, this, &AssignmentList::reload); + QObject::connect(ui.actionExit, &QAction::triggered, this, QApplication::quit); + QObject::connect(ui.actionAdd_Group, &QAction::triggered, this, &AssignmentList::addGroup); + QObject::connect(ui.actionClean_Hidden, &QAction::triggered, this, &AssignmentList::cleanHidden); + QObject::connect(ui.actionAbout, &QAction::triggered, this, &AssignmentList::aboutDialog); +} + +void AssignmentList::createToolbar() { + ui.toolBar->addAction(ui.actionAdd_Group); +} + +void AssignmentList::setupDB() { + qDebug() << "WIP"; +} + +void AssignmentList::displayWidgets() { + QDate today = QDate::currentDate(); + ui.title->setText(today.toString("dddd, MMM d yyyy")); + this->drawGroups(); +} + +// Open the 'addGroup' form +void AssignmentList::addGroup() { + qDebug() << "WIP"; +} + +// Open the 'editGroup; form +void AssignmentList::editGroup(int id) { + qDebug() << "WIP"; +} + +void AssignmentList::preferences() { + qDebug() << "WIP"; +} + +void AssignmentList::reload() { + qDebug() << "WIP"; +} + +void AssignmentList::cleanHidden() { + qDebug() << "WIP"; +} + +void AssignmentList::aboutDialog() { + QMessageBox about; + about.about(this, "About Assignment List", "Created by Louie S. - 2023"); +} diff --git a/src/assignmentList.h b/src/assignmentList.h new file mode 100644 index 0000000..d87397c --- /dev/null +++ b/src/assignmentList.h @@ -0,0 +1,41 @@ +#ifndef ASSIGNMENTLIST_H +#define ASSIGNMENTLIST_H + +#include <QMainWindow> +#include "ui_main.h" + +class AssignmentList : public QMainWindow { + Q_OBJECT + + public: + AssignmentList(); + + private: + Ui::MainWindow ui; + + void initializeUI(); + void createMenu(); + void createToolbar(); + void setupDB(); + void displayWidgets(); + void editGroup(int id); + void removeGroup(int id); + void groupContextMenu(int group_id); + void addEntry(int parent); // TODO figure out type for parameter + void editEntry(int id); + void toggleDoneEntry(int id); + void removeEntry(int id); + void editRules(int id); + void entryContextMenu(int entry_id); + void drawGroups(); + void drawEntries(); + + private slots: + void preferences(); + void reload(); + void addGroup(); + void cleanHidden(); + void aboutDialog(); +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f7d69ee --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,12 @@ +#include <QApplication> +#include <QPushButton> + +#include "assignmentList.h" + +int main(int argc, char **argv) { + QApplication app (argc, argv); + + AssignmentList window; + + return app.exec(); +} diff --git a/src/main.ui b/src/main.ui new file mode 100644 index 0000000..bc3c0fb --- /dev/null +++ b/src/main.ui @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>640</width> + <height>480</height> + </rect> + </property> + <property name="windowTitle"> + <string>Assignment List</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_3"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>620</width> + <height>421</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QVBoxLayout" name="v_box"> + <item> + <layout class="QHBoxLayout" name="title_h_box"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="title"> + <property name="font"> + <font> + <family>Arial</family> + <pointsize>17</pointsize> + </font> + </property> + <property name="text"> + <string>[DATE]</string> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" name="groups_layout"> + <property name="leftMargin"> + <number>20</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>20</number> + </property> + <property name="bottomMargin"> + <number>5</number> + </property> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>640</width> + <height>22</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionPreferences"/> + <addaction name="actionReload"/> + <addaction name="separator"/> + <addaction name="actionExit"/> + </widget> + <widget class="QMenu" name="menuEdit"> + <property name="title"> + <string>Edit</string> + </property> + <addaction name="actionAdd_Group"/> + <addaction name="separator"/> + <addaction name="actionClean_Hidden"/> + </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="actionAbout"/> + </widget> + <addaction name="menuFile"/> + <addaction name="menuEdit"/> + <addaction name="menuHelp"/> + </widget> + <widget class="QToolBar" name="toolBar"> + <property name="windowTitle"> + <string>toolBar</string> + </property> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + </widget> + <action name="actionPreferences"> + <property name="text"> + <string>Preferences</string> + </property> + <property name="shortcut"> + <string>Alt+Return</string> + </property> + </action> + <action name="actionReload"> + <property name="text"> + <string>Reload</string> + </property> + <property name="shortcut"> + <string>F5</string> + </property> + </action> + <action name="actionExit"> + <property name="text"> + <string>Exit</string> + </property> + <property name="shortcut"> + <string>Ctrl+Q</string> + </property> + </action> + <action name="actionAdd_Group"> + <property name="text"> + <string>Add Group</string> + </property> + </action> + <action name="actionClean_Hidden"> + <property name="text"> + <string>Permanently Delete Removed Groups and Entries</string> + </property> + </action> + <action name="actionAbout"> + <property name="text"> + <string>About</string> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/preferences_dialog.ui b/src/preferences_dialog.ui new file mode 100644 index 0000000..244eb26 --- /dev/null +++ b/src/preferences_dialog.ui @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Dialog</class> + <widget class="QDialog" name="Dialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>320</height> + </rect> + </property> + <property name="windowTitle"> + <string>Preferences</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QVBoxLayout" name="main_layout"> + <item> + <widget class="QTabWidget" name="tab_bar"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Paths</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QWidget" name="widget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QFormLayout" name="paths_tab_layout"> + <item row="0" column="0"> + <widget class="QLabel" name="databaseFileLabel"> + <property name="text"> + <string>Database File:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QWidget" name="db_path_hbox" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLineEdit" name="db_path_edit"/> + </item> + <item> + <widget class="QPushButton" name="db_path_button"> + <property name="maximumSize"> + <size> + <width>25</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="buttons_hbox"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="close_button"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="apply_button"> + <property name="text"> + <string>Apply</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="reload_button"> + <property name="text"> + <string>Reload</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |