Skip to content

Commit

Permalink
Merge pull request #34 from mitchcamza/feature/book-input
Browse files Browse the repository at this point in the history
Feature/book input
  • Loading branch information
mitchcamza authored Aug 5, 2024
2 parents 90bc23f + d577b48 commit 8ebed7e
Show file tree
Hide file tree
Showing 17 changed files with 422 additions and 42 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
push:
branches:
- main
- dev
- COS3711-03-01
- feature/*
- workflows

pull_request:
branches:
- main
- dev
- COS3711-03-01
- workflows

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Qt and dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev qt6-base-dev qt6-tools-dev qt6-tools-dev-tools cmake g++
- name: Build project
run: |
mkdir -p build
cd build
cmake ../COS3711-03-01/
make
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: build/

outputs:
build-success: ${{ steps.build.outcome == 'success' }}
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
test:
needs: Build
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Qt and dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev qt6-base-dev qt6-tools-dev qt6-tools-dev-tools cmake g++
- name: Build project
run: |
mkdir -p build
cd build
cmake ..
make
- name: Build and run unit tests
run: |
cd build
ctest --output-on-failure
- name: Build and run integration tests
run: |
cd build/tests/integration
ctest --output-on-failure
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: build/tests/
3 changes: 0 additions & 3 deletions COS3711-03-01/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ set(CMAKE_CXX_STANDARD 17)
# Add subdirectories
add_subdirectory(src/)
add_subdirectory(tests/)

# Enable testing
enable_testing()
40 changes: 20 additions & 20 deletions COS3711-03-01/COS3711-03-01.drawio
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<mxfile host="Electron" modified="2024-07-28T20:07:41.802Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.4 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="cwJQNhiL4IcJnoZKe6Cd" version="24.6.4" type="device">
<diagram id="6iuWq0UelAJ61aAoiBDy" name="Library Managament System">
<mxGraphModel dx="1337" dy="1349" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<mxfile host="Electron" modified="2024-07-30T16:36:34.755Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.4 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="k-16yr9vJ6ULwAqXtUkk" version="24.6.4" type="device">
<diagram id="6iuWq0UelAJ61aAoiBDy" name="Book Shelf">
<mxGraphModel dx="1696" dy="1716" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="gvHln3FCuM-_E14BoruI-1" value="Book&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry x="-30" y="-340" width="360" height="290" as="geometry" />
<mxGeometry x="-30" y="-340" width="360" height="260" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-2" value="- title: QString&lt;div&gt;- authors: QStringList&lt;/div&gt;&lt;div&gt;- isbn: QString&lt;/div&gt;&lt;div&gt;- publicationDate: QDate&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="gvHln3FCuM-_E14BoruI-1" vertex="1">
<mxGeometry y="26" width="360" height="64" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-3" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;labelBackgroundColor=none;" parent="gvHln3FCuM-_E14BoruI-1" vertex="1">
<mxGeometry y="90" width="360" height="8" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-4" value="+ Book()&lt;div&gt;+ Book(t: QString, a: QStringList, i: QString, p: QDate)&lt;/div&gt;&lt;div&gt;+ setTitle(t: QString)&lt;/div&gt;&lt;div&gt;+ setAuthors(a: QStringList)&lt;/div&gt;&lt;div&gt;+ setIsbn(i: QString)&lt;/div&gt;&lt;div&gt;+ setPublicationDate(p: QDate)&lt;/div&gt;&lt;div&gt;+ getTitle(): QString&lt;/div&gt;&lt;div&gt;+ getAuthors(): QStringList&lt;/div&gt;&lt;div&gt;+ getIsbn(): QString&lt;/div&gt;&lt;div&gt;+ getPublicationDate(): QDate&lt;/div&gt;&lt;div&gt;+ obtainBookInfo()&lt;/div&gt;&lt;div&gt;+ saveBook(b: Book&amp;amp;)&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="gvHln3FCuM-_E14BoruI-1" vertex="1">
<mxGeometry y="98" width="360" height="192" as="geometry" />
<mxCell id="gvHln3FCuM-_E14BoruI-4" value="+ Book()&lt;div&gt;+ Book(t: QString, a: QStringList, i: QString, p: QDate)&lt;/div&gt;&lt;div&gt;+ setTitle(t: QString)&lt;/div&gt;&lt;div&gt;+ setAuthors(a: QStringList)&lt;/div&gt;&lt;div&gt;+ setIsbn(i: QString)&lt;/div&gt;&lt;div&gt;+ setPublicationDate(p: QDate)&lt;/div&gt;&lt;div&gt;+ getTitle(): QString&lt;/div&gt;&lt;div&gt;+ getAuthors(): QStringList&lt;/div&gt;&lt;div&gt;+ getIsbn(): QString&lt;/div&gt;&lt;div&gt;+ getPublicationDate(): QDate&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="gvHln3FCuM-_E14BoruI-1" vertex="1">
<mxGeometry y="98" width="360" height="162" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-26" value="&lt;div&gt;Author&lt;/div&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry x="-500" y="-340" width="360" height="150" as="geometry" />
Expand All @@ -28,18 +28,6 @@
<mxCell id="gvHln3FCuM-_E14BoruI-29" value="&lt;div&gt;+ Author(firstName: QString, lastName: QString)&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;+ getFirstName(): QString&lt;/span&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;+ getLastName(): QString&lt;br&gt;&lt;/div&gt;&lt;div&gt;+ toString(): QString&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="gvHln3FCuM-_E14BoruI-26" vertex="1">
<mxGeometry y="78" width="360" height="72" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-30" value="" style="endArrow=diamondThin;endFill=1;endSize=24;html=1;rounded=0;" parent="1" source="gvHln3FCuM-_E14BoruI-26" target="gvHln3FCuM-_E14BoruI-1" edge="1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="-490" y="434.96" as="sourcePoint" />
<mxPoint x="116.07999999999993" y="69.99999999999997" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-32" value="" style="endArrow=diamondThin;endFill=1;endSize=24;html=1;rounded=0;" parent="1" source="gvHln3FCuM-_E14BoruI-65" target="gvHln3FCuM-_E14BoruI-1" edge="1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="-130" y="228.9622641509436" as="sourcePoint" />
<mxPoint x="490" y="540" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-35" value="" style="endArrow=diamondThin;endFill=1;endSize=24;html=1;rounded=0;" parent="1" source="gvHln3FCuM-_E14BoruI-61" target="gvHln3FCuM-_E14BoruI-51" edge="1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="1510" y="135.608695652174" as="sourcePoint" />
Expand Down Expand Up @@ -77,7 +65,7 @@
<mxGeometry y="68" width="360" height="62" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-65" value="&lt;div&gt;BookInput&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry x="-540" y="-70" width="410" height="250" as="geometry" />
<mxGeometry x="1740" y="130" width="410" height="250" as="geometry" />
</mxCell>
<mxCell id="gvHln3FCuM-_E14BoruI-66" value="- lineEditTitle: QLineEdit&lt;div&gt;- lineEditAuthors: QLineEdit&lt;/div&gt;&lt;div&gt;- lineEditIsbn: QLineEdit&lt;/div&gt;&lt;div&gt;- dateEditPublicationDate: QDateEdit&lt;/div&gt;&lt;div&gt;- pushButtonAdd: QPushButton&lt;/div&gt;&lt;div&gt;- pushButtonCancel: QPushButton&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" parent="gvHln3FCuM-_E14BoruI-65" vertex="1">
<mxGeometry y="26" width="410" height="94" as="geometry" />
Expand Down Expand Up @@ -130,7 +118,7 @@
<mxCell id="we9DT2KBn4o6eFFRd77e-7" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;labelBackgroundColor=none;" vertex="1" parent="we9DT2KBn4o6eFFRd77e-5">
<mxGeometry y="210" width="500" height="8" as="geometry" />
</mxCell>
<mxCell id="we9DT2KBn4o6eFFRd77e-8" value="&lt;div&gt;&lt;div&gt;+ MainWindow(parent: QWidget)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;+ ~MainWindow()&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;+ setupUI()&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;- on_actionAddBook_triggered()&lt;/div&gt;&lt;div&gt;- on_actionExportBooks_triggered()&lt;/div&gt;&lt;div&gt;- on_actionClearFilterTriggered()&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" vertex="1" parent="we9DT2KBn4o6eFFRd77e-5">
<mxCell id="we9DT2KBn4o6eFFRd77e-8" value="&lt;div&gt;&lt;div&gt;+ MainWindow(parent: QWidget)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;+ ~MainWindow()&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;+ setupUI()&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;- addBook()&lt;/div&gt;&lt;div&gt;- exportBooks()&lt;/div&gt;&lt;div&gt;- clearFilter()&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;labelBackgroundColor=none;" vertex="1" parent="we9DT2KBn4o6eFFRd77e-5">
<mxGeometry y="218" width="500" height="142" as="geometry" />
</mxCell>
<mxCell id="we9DT2KBn4o6eFFRd77e-9" value="" style="endArrow=diamondThin;endFill=1;endSize=24;html=1;rounded=0;" edge="1" parent="1" source="gvHln3FCuM-_E14BoruI-74" target="we9DT2KBn4o6eFFRd77e-5">
Expand Down Expand Up @@ -181,6 +169,18 @@
<mxPoint x="540" y="-320" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="8dgmckmYpp2PSS6kHg5K-1" value="" style="endArrow=diamondThin;endFill=0;endSize=24;html=1;rounded=0;" edge="1" parent="1" source="gvHln3FCuM-_E14BoruI-26" target="gvHln3FCuM-_E14BoruI-1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="-160" y="-260" as="sourcePoint" />
<mxPoint y="-260" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="8dgmckmYpp2PSS6kHg5K-2" value="" style="endArrow=diamondThin;endFill=0;endSize=24;html=1;rounded=0;" edge="1" parent="1" source="gvHln3FCuM-_E14BoruI-65" target="we9DT2KBn4o6eFFRd77e-8">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="2290" y="10" as="sourcePoint" />
<mxPoint x="2450" y="10" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
Expand Down
11 changes: 11 additions & 0 deletions COS3711-03-01/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
7 changes: 7 additions & 0 deletions COS3711-03-01/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{}

MainWindow::~MainWindow() {}
14 changes: 14 additions & 0 deletions COS3711-03-01/mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
};
#endif // MAINWINDOW_H
32 changes: 13 additions & 19 deletions COS3711-03-01/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,36 @@ find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
author.cpp
author.h
book.h
book.cpp
resources.qrc
mainwindow.h mainwindow.cpp
author.h author.cpp
book.h book.cpp
bookinput.h bookinput.cpp
)

# Create a library target from the sources
add_library(MyProjectLib STATIC
mainwindow.cpp
mainwindow.h
author.cpp
author.h
book.h
book.cpp
)
# Create library
add_library(MyProjectLib ${PROJECT_SOURCES})

# Include directories for the library
target_include_directories(MyProjectLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# Link the library to the executable
target_link_libraries(MyProjectLib PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

# Create the main executable
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(COS3711-03-01
MANUAL_FINALIZATION
${PROJECT_SOURCES}
main.cpp
)
else()
if(ANDROID)
add_library(COS3711-03-01 SHARED
${PROJECT_SOURCES}
main.cpp
)
else()
add_executable(COS3711-03-01
${PROJECT_SOURCES}
main.cpp
)
endif()
endif()
Expand Down
Loading

0 comments on commit 8ebed7e

Please sign in to comment.