Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions Store/Store/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 3.5)

project(COS3711 VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(COS3711
MANUAL_FINALIZATION
${PROJECT_SOURCES}
customer.h customer.cpp
item.h item.cpp
transaction.h transaction.cpp
mymodel.h mymodel.cpp
addcustomerdialog.h addcustomerdialog.cpp
additemdialog.h additemdialog.cpp
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET COS3711 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(COS3711 SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(COS3711
${PROJECT_SOURCES}
)
endif()
endif()

target_link_libraries(COS3711 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.COS3711)
endif()
set_target_properties(COS3711 PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)

include(GNUInstallDirs)
install(TARGETS COS3711
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(COS3711)
endif()
420 changes: 420 additions & 0 deletions Store/Store/CMakeLists.txt.user

Large diffs are not rendered by default.

Binary file added Store/Store/Images/Open_document.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/Open_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/customers.ico
Binary file not shown.
Binary file added Store/Store/Images/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/saveas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/undo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Store/Store/Images/xml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions Store/Store/UDP/UDPListen.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-07-24T10:26:36
#
#-------------------------------------------------

QT += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = UDPListen
TEMPLATE = app


SOURCES += main.cpp \
udplisten.cpp

HEADERS += \
udplisten.h
269 changes: 269 additions & 0 deletions Store/Store/UDP/UDPListen.pro.user

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Store/Store/UDP/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <QApplication>
#include "udplisten.h"

int main(int argc, char **argv)
{
QApplication app(argc, argv);
UDPListen chat;
chat.setWindowTitle("UDP Listen");
chat.show();
return app.exec();
}
41 changes: 41 additions & 0 deletions Store/Store/UDP/udplisten.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "udplisten.h"
#include <QLayout>
#include <QTextEdit>
#include <QPushButton>
#include <QUdpSocket>

UDPListen::UDPListen(QWidget *parent) : QWidget(parent)
{
socket = 0;

QVBoxLayout* layout = new QVBoxLayout(this);
QPushButton* listen = new QPushButton("&Listen");
display = new QTextEdit();
display->setReadOnly(true);
layout->addWidget(listen);
layout->addWidget(display);
resize(300, 500);

connect(listen, SIGNAL(clicked()), this, SLOT(startListening()));
}

void UDPListen::startListening()
{
display->setText("Started listening...");
socket = new QUdpSocket(this);
socket->bind(34567);
connect(socket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
}

void UDPListen::processPendingDatagrams()
{
QByteArray buffer;
buffer.resize(socket->pendingDatagramSize());
socket->readDatagram(buffer.data(), buffer.size());

QDataStream stream(buffer);
stream.setVersion(QDataStream::Qt_4_0);
stream >> line;
display->append("");
display->append(line);
}
26 changes: 26 additions & 0 deletions Store/Store/UDP/udplisten.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef UDP_H
#define UDP_H

#include <QtWidgets>

class QLineEdit;
class QTextEdit;
class QUdpSocket;

class UDPListen : public QWidget
{
Q_OBJECT
public:
explicit UDPListen(QWidget *parent = 0);
signals:

public slots:
void startListening();
void processPendingDatagrams();
private:
QTextEdit* display;
QUdpSocket *socket;
QString line;
};

#endif // UDP_H
87 changes: 87 additions & 0 deletions Store/Store/addcustomerdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#include "addcustomerdialog.h"
#include <QGridLayout>
#include <QPushButton>
#include <QTextEdit>
#include <QLineEdit>
#include <QComboBox>
#include <QSpinBox>
#include <QLabel>

AddCustomerDialog::AddCustomerDialog(QWidget *parent):QDialog(parent)
,edtCust(new QComboBox),
edtItem(new QComboBox),edtQuantity(new QSpinBox),
edtAddItem(new QPushButton("Add Item"))
,txtEdt(new QTextEdit),edtDone(new QPushButton("Done"))
{
setWindowTitle("Add Customer");

setupGUI();
connect(edtAddItem, &QPushButton::clicked, this, &AddCustomerDialog::accept);
connect(edtAddItem, &QPushButton::clicked, this, &AddCustomerDialog::addCustomer);

connect(edtDone, &QPushButton::clicked, this, &AddCustomerDialog::reject);
}
Customer AddCustomerDialog::getCustomer() const
{
return Customer(edtAddItem->text());
}

void AddCustomerDialog::addCustomer()
{
txtEdt->show();

}

void AddCustomerDialog::setupGUI(){

// Declare widgets
QGridLayout *layout(new QGridLayout(this));

QLabel*lblTop{new QLabel("Complete the required data")};
QLabel *lblCustomer(new QLabel("Select the Customer"));
QLabel *lblItem(new QLabel("Select the item"));
QLabel *lblType(new QLabel("Item Type"));
QLabel *lblQuantity(new QLabel("item quantity"));




// Setup layout
layout->addWidget(lblTop);
layout->addWidget(lblCustomer,1,0);
layout->addWidget(edtCust,1,1);

layout->addWidget(lblItem,2,0);
layout->addWidget(edtItem,2,1);

layout->addWidget(lblType,3,0);


layout->addWidget(lblQuantity,4,0);
layout->addWidget(edtQuantity,4,1);
layout->addWidget(edtAddItem,4,2);

layout->addWidget(txtEdt,5,0,2,4);
layout->addWidget(edtDone,7,1,2,1);



// Initialize widgets
QStringList listOne = QStringList() <<" " <<"Customer1" << "Customer2" << "Customer3" << "Customer4" ;
edtCust->addItems(listOne);

QStringList listTwo = QStringList() <<" " << "Book1" << "Book2"<<"Book3"<< "Magazine1" << "Magazine2"<<"Magazine3" ;
edtItem->addItems(listTwo);


edtQuantity->setMaximum(9999);
edtQuantity->setMinimum(0);

edtQuantity->setAlignment(Qt::AlignRight);



}



45 changes: 45 additions & 0 deletions Store/Store/addcustomerdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef ADDCUSTOMERDIALOG_H
#define ADDCUSTOMERDIALOG_H
#include <QDialog>
#include <QObject>
#include<QLineEdit>
#include<QtWidgets>
#include "Customer.h"
//#include"customerlist.h"
class QPushButton;
class QLineEdit;
class QTextEdit;
class QComboBox;
class QDoubleSpinBox;
class QSpinBox;
class CustomerList;

class Customer;
class AddCustomerDialog : public QDialog
{
Q_OBJECT
public:
AddCustomerDialog(QWidget *parent = nullptr);

Customer getCustomer() const;

private slots:

void addCustomer();
private:

void setupGUI();

QComboBox *edtCust;
QComboBox *edtItem;
QSpinBox*edtQuantity;

QPushButton*edtAddItem;
QTextEdit*txtEdt;
QPushButton*edtDone;

// CustomerList list;
Customer*customer;

};
#endif // ADDCUSTOMERDIALOG_H
79 changes: 79 additions & 0 deletions Store/Store/additemdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include "additemdialog.h"
#include"item.h"
#include <QLineEdit>
#include <QLabel>
#include<QGridLayout>
#include<QCloseEvent>
#include<QPushButton>
#include<QMessageBox>
#include<QComboBox>

AddItemDialog::AddItemDialog(QWidget *parent)
: QDialog(parent),edtType{new QComboBox},edtItemName{new QLineEdit}
,edtAddItem{new QPushButton("Add item")}
{
setWindowTitle("Add Item");
setupGUI();
connect(edtAddItem, &QPushButton::clicked, this, &AddItemDialog::accept);
// connect(edtDone, &QPushButton::clicked, this, &AddItemDialog::reject);

}

Item AddItemDialog::getItem() const
{
return Item(edtItemName->text());
}

void AddItemDialog::addCustomer()
{


}

void AddItemDialog::readList()
{

}

void AddItemDialog::writeList()
{

}

void AddItemDialog::setupGUI()
{
// Setup layout

QGridLayout*layout(new QGridLayout(this));

QLabel*lblTop{new QLabel("Complete the required data")};

lblTop->setAlignment(Qt::AlignCenter);
QLabel*lblType{new QLabel("Item Type")};
QLabel*lblItem{new QLabel("Name of Item")};




layout->addWidget(lblTop);


layout->addWidget(lblType,1,0);
layout->addWidget(edtType,1,1);

layout->addWidget(lblItem,2,0);
layout->addWidget(edtItemName,2,1);

layout->addWidget(edtAddItem,3,1);

this->setLayout(layout);

// initialize widgets

QStringList type =QStringList()<<" "<<"B"<<"M";
edtType->addItems(type);

}



Loading