├── screenshots ├── ss_panel_login.png ├── ss_panel_main-list.png ├── ss_panel_register.png ├── ss_panel_main-search.png └── ss_panel_product-edit.png ├── diagrams ├── uml │ ├── diagram_uml_program.png │ └── diagram_uml_database.png ├── sequence │ ├── diagram_sequence_login.png │ ├── diagram_sequence_register.png │ ├── diagram_sequence_product-add.png │ ├── diagram_sequence_product-remove.png │ └── diagram_sequence_product-update.png ├── usecase │ └── diagram_usecase_general.png ├── activity │ └── diagram_activity_general.png ├── statechart │ ├── diagram_statechart_list.png │ ├── diagram_statechart_login.png │ ├── diagram_statechart_register.png │ └── diagram_statechart_product-operation.png └── collabration │ └── diagram_collaboration_general.png ├── .gitignore ├── src ├── main.cpp ├── frmAbout.h ├── mainwindow.cpp ├── frmAbout.cpp ├── mainwindow.h ├── frmRegister.h ├── frmLogin.h ├── dbcontroller.h ├── frmProduct.h ├── dbcontroller.cpp ├── frmAbout.ui ├── ProductManagementTool.pro ├── dialog.ui ├── call_once.h ├── frmMain.h ├── singleton.h ├── mainwindow.ui ├── frmLogin.cpp ├── frmRegister.cpp ├── frmProduct.ui ├── frmLogin.ui ├── frmRegister.ui ├── frmProduct.cpp ├── frmMain.ui └── frmMain.cpp ├── sql └── ProductManagementTool.sql ├── README.md └── LICENSE /screenshots/ss_panel_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/screenshots/ss_panel_login.png -------------------------------------------------------------------------------- /screenshots/ss_panel_main-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/screenshots/ss_panel_main-list.png -------------------------------------------------------------------------------- /screenshots/ss_panel_register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/screenshots/ss_panel_register.png -------------------------------------------------------------------------------- /diagrams/uml/diagram_uml_program.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/uml/diagram_uml_program.png -------------------------------------------------------------------------------- /screenshots/ss_panel_main-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/screenshots/ss_panel_main-search.png -------------------------------------------------------------------------------- /diagrams/uml/diagram_uml_database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/uml/diagram_uml_database.png -------------------------------------------------------------------------------- /screenshots/ss_panel_product-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/screenshots/ss_panel_product-edit.png -------------------------------------------------------------------------------- /diagrams/sequence/diagram_sequence_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/sequence/diagram_sequence_login.png -------------------------------------------------------------------------------- /diagrams/usecase/diagram_usecase_general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/usecase/diagram_usecase_general.png -------------------------------------------------------------------------------- /diagrams/activity/diagram_activity_general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/activity/diagram_activity_general.png -------------------------------------------------------------------------------- /diagrams/sequence/diagram_sequence_register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/sequence/diagram_sequence_register.png -------------------------------------------------------------------------------- /diagrams/statechart/diagram_statechart_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/statechart/diagram_statechart_list.png -------------------------------------------------------------------------------- /diagrams/statechart/diagram_statechart_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/statechart/diagram_statechart_login.png -------------------------------------------------------------------------------- /diagrams/sequence/diagram_sequence_product-add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/sequence/diagram_sequence_product-add.png -------------------------------------------------------------------------------- /diagrams/statechart/diagram_statechart_register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/statechart/diagram_statechart_register.png -------------------------------------------------------------------------------- /diagrams/sequence/diagram_sequence_product-remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/sequence/diagram_sequence_product-remove.png -------------------------------------------------------------------------------- /diagrams/sequence/diagram_sequence_product-update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/sequence/diagram_sequence_product-update.png -------------------------------------------------------------------------------- /diagrams/collabration/diagram_collaboration_general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/collabration/diagram_collaboration_general.png -------------------------------------------------------------------------------- /diagrams/statechart/diagram_statechart_product-operation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dentrax/ProductManagementTool/HEAD/diagrams/statechart/diagram_statechart_product-operation.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | *.dll 10 | *.dylib 11 | 12 | # Qt-es 13 | object_script.*.Release 14 | object_script.*.Debug 15 | *_plugin_import.cpp 16 | /.qmake.cache 17 | /.qmake.stash 18 | *.pro.user 19 | *.pro.user.* 20 | *.qbs.user 21 | *.qbs.user.* 22 | *.moc 23 | moc_*.cpp 24 | moc_*.h 25 | qrc_*.cpp 26 | ui_*.h 27 | *.qmlc 28 | *.jsc 29 | Makefile* 30 | *build-* 31 | 32 | # Qt unit tests 33 | target_wrapper.* 34 | 35 | # QtCreator 36 | *.autosave 37 | 38 | # QtCreator Qml 39 | *.qmlproject.user 40 | *.qmlproject.user.* 41 | 42 | # QtCreator CMake 43 | CMakeLists.txt.user* 44 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "mainwindow.h" 9 | #include "frmMain.h" 10 | #include 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | QApplication a(argc, argv); 15 | frmMain w; 16 | w.show(); 17 | w.hide(); 18 | 19 | return a.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /src/frmAbout.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #ifndef FRMABOUT_H 9 | #define FRMABOUT_H 10 | 11 | #include 12 | 13 | namespace Ui { 14 | class frmAbout; 15 | } 16 | 17 | class frmAbout : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit frmAbout(QWidget *parent = 0); 23 | ~frmAbout(); 24 | 25 | private slots: 26 | void on_btnOK_clicked(); 27 | 28 | private: 29 | Ui::frmAbout *ui; 30 | }; 31 | 32 | #endif // FRMABOUT_H 33 | -------------------------------------------------------------------------------- /src/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "mainwindow.h" 9 | #include "ui_mainwindow.h" 10 | #include "frmLogin.h" 11 | 12 | MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ 13 | ui->setupUi(this); 14 | } 15 | 16 | MainWindow::~MainWindow() 17 | { 18 | delete ui; 19 | } 20 | 21 | void MainWindow::on_pushButton_clicked() 22 | { 23 | frmLogin login; 24 | login.setModal(true); 25 | login.exec(); 26 | } 27 | -------------------------------------------------------------------------------- /src/frmAbout.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "frmAbout.h" 9 | #include "ui_frmAbout.h" 10 | 11 | frmAbout::frmAbout(QWidget *parent) : QDialog(parent), ui(new Ui::frmAbout){ 12 | ui->setupUi(this); 13 | 14 | this->setFixedSize(this->maximumSize()); 15 | setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 16 | } 17 | 18 | frmAbout::~frmAbout() 19 | { 20 | delete ui; 21 | } 22 | 23 | void frmAbout::on_btnOK_clicked() 24 | { 25 | this->close(); 26 | } 27 | -------------------------------------------------------------------------------- /src/mainwindow.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #ifndef MAINWINDOW_H 9 | #define MAINWINDOW_H 10 | 11 | #include 12 | 13 | namespace Ui { 14 | class MainWindow; 15 | } 16 | 17 | class MainWindow : public QMainWindow 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit MainWindow(QWidget *parent = 0); 23 | ~MainWindow(); 24 | 25 | private slots: 26 | void on_pushButton_clicked(); 27 | 28 | private: 29 | Ui::MainWindow *ui; 30 | }; 31 | 32 | #endif // MAINWINDOW_H 33 | -------------------------------------------------------------------------------- /src/frmRegister.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #ifndef FRMREGISTER_H 9 | #define FRMREGISTER_H 10 | 11 | #include 12 | 13 | namespace Ui { 14 | class frmRegister; 15 | } 16 | 17 | class frmRegister : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | private: 22 | void Clear(); 23 | bool CheckInputs(); 24 | 25 | public: 26 | explicit frmRegister(QWidget *parent = 0); 27 | ~frmRegister(); 28 | 29 | private slots: 30 | void on_btnRegister_clicked(); 31 | 32 | private: 33 | Ui::frmRegister *ui; 34 | }; 35 | 36 | #endif // FRMREGISTER_H 37 | -------------------------------------------------------------------------------- /src/frmLogin.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #ifndef FRMLOGIN_H 9 | #define FRMLOGIN_H 10 | 11 | #include 12 | 13 | namespace Ui { 14 | class frmLogin; 15 | } 16 | 17 | class frmLogin : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit frmLogin(QWidget *parent = 0); 23 | ~frmLogin(); 24 | 25 | signals: 26 | void LoginOK(QString name); 27 | 28 | private slots: 29 | void on_btnRegister_clicked(); 30 | 31 | void on_btnLogin_clicked(); 32 | 33 | private: 34 | Ui::frmLogin *ui; 35 | 36 | void closeEvent (QCloseEvent *event); 37 | }; 38 | 39 | #endif // FRMLOGIN_H 40 | -------------------------------------------------------------------------------- /src/dbcontroller.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #pragma once 9 | 10 | #ifndef DBCONTROLLER_H 11 | #define DBCONTROLLER_H 12 | 13 | #include 14 | #include 15 | 16 | class DBController : public QObject 17 | { 18 | Q_OBJECT 19 | 20 | private: 21 | QSqlDatabase m_db; 22 | DBController(QObject* parent = 0); 23 | static DBController* createInstance(); 24 | public: 25 | ~DBController(); 26 | void SetupDB(); 27 | bool IsOpen(); 28 | bool Connect(); 29 | void Disconnect(); 30 | QString GetError(); 31 | QSqlDatabase GetDB(); 32 | 33 | static DBController* instance(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/frmProduct.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #ifndef FRMPRODUCT_H 9 | #define FRMPRODUCT_H 10 | 11 | #include 12 | 13 | namespace Ui { 14 | class frmProduct; 15 | } 16 | 17 | class frmProduct : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit frmProduct(QWidget *parent = 0); 23 | ~frmProduct(); 24 | 25 | void Clear(); 26 | void LoadProduct(const int index); 27 | 28 | 29 | private: 30 | bool m_isReadonly; 31 | 32 | bool CheckInputs(); 33 | void LoadProduct(const QString barcode); 34 | void LoadProductsToComboBox(); 35 | 36 | signals: 37 | void Refresh(); 38 | 39 | 40 | public slots: 41 | 42 | void on_btnAdd_clicked(); 43 | 44 | void on_btnUpdate_clicked(); 45 | 46 | void on_btnDelete_clicked(); 47 | 48 | void on_cbID_activated(int index); 49 | 50 | void on_cbReadonly_stateChanged(int arg1); 51 | 52 | private: 53 | Ui::frmProduct *ui; 54 | }; 55 | 56 | #endif // FRMPRODUCT_H 57 | -------------------------------------------------------------------------------- /src/dbcontroller.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "dbcontroller.h" 9 | #include 10 | #include "singleton.h" 11 | #include 12 | #include 13 | 14 | DBController::DBController(QObject* parent): QObject(parent){ 15 | 16 | } 17 | 18 | DBController* DBController::createInstance() 19 | { 20 | return new DBController(); 21 | } 22 | 23 | DBController::~DBController() 24 | { 25 | } 26 | 27 | DBController* DBController::instance() 28 | { 29 | return Singleton::instance(DBController::createInstance); 30 | } 31 | 32 | void DBController::SetupDB(){ 33 | m_db = QSqlDatabase::addDatabase("QMYSQL"); 34 | m_db.setHostName("localhost"); 35 | m_db.setPort(3306); 36 | m_db.setDatabaseName("pmt"); 37 | m_db.setUserName("root"); 38 | m_db.setPassword("1234"); 39 | } 40 | 41 | bool DBController::IsOpen(){ 42 | return m_db.isOpen(); 43 | } 44 | 45 | bool DBController::Connect(){ 46 | return m_db.open(); 47 | } 48 | 49 | void DBController::Disconnect(){ 50 | m_db.close(); 51 | } 52 | 53 | QString DBController::GetError(){ 54 | return m_db.lastError().text(); 55 | } 56 | 57 | QSqlDatabase DBController::GetDB(){ 58 | return m_db; 59 | } 60 | -------------------------------------------------------------------------------- /src/frmAbout.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | frmAbout 4 | 5 | 6 | 7 | 0 8 | 0 9 | 204 10 | 153 11 | 12 | 13 | 14 | About 15 | 16 | 17 | 18 | 19 | 11 20 | 11 21 | 185 22 | 144 23 | 24 | 25 | 26 | <html><head/><body><p align="center"><span style=" font-size:10pt; font-weight:600; color:#ff0000;">PRODUCT MANAGEMENT TOOL</span><br/><br/>ver. 1.0.0</p><p align="center">Copyright <span style=" font-family:'arial,sans-serif'; color:#222222;">© 2018 Furkan Türkal</span></p><p align="center">This project under MIT license<br/></p><p><br/></p></body></html> 27 | 28 | 29 | 30 | 31 | 32 | 60 33 | 120 34 | 75 35 | 23 36 | 37 | 38 | 39 | OK 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/ProductManagementTool.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2018-03-29T19:37:47 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | QT += sql 9 | 10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 11 | 12 | TARGET = ProductManagementTool 13 | TEMPLATE = app 14 | 15 | # The following define makes your compiler emit warnings if you use 16 | # any feature of Qt which has been marked as deprecated (the exact warnings 17 | # depend on your compiler). Please consult the documentation of the 18 | # deprecated API in order to know how to port your code away from it. 19 | DEFINES += QT_DEPRECATED_WARNINGS 20 | 21 | # You can also make your code fail to compile if you use deprecated APIs. 22 | # In order to do so, uncomment the following line. 23 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 24 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 25 | 26 | 27 | SOURCES += \ 28 | main.cpp \ 29 | mainwindow.cpp \ 30 | frmLogin.cpp \ 31 | frmRegister.cpp \ 32 | frmMain.cpp \ 33 | frmProduct.cpp \ 34 | frmAbout.cpp \ 35 | dbcontroller.cpp 36 | 37 | HEADERS += \ 38 | mainwindow.h \ 39 | frmLogin.h \ 40 | frmRegister.h \ 41 | frmMain.h \ 42 | frmProduct.h \ 43 | frmAbout.h \ 44 | dbcontroller.h \ 45 | singleton.h \ 46 | call_once.h 47 | 48 | FORMS += \ 49 | mainwindow.ui \ 50 | frmLogin.ui \ 51 | frmRegister.ui \ 52 | frmMain.ui \ 53 | frmProduct.ui \ 54 | frmAbout.ui 55 | 56 | DISTFILES += 57 | -------------------------------------------------------------------------------- /src/dialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dialog 6 | 7 | 8 | 9 | 0 10 | 0 11 | 400 12 | 300 13 | 14 | 15 | 16 | Dialog 17 | 18 | 19 | 20 | 21 | 30 22 | 240 23 | 341 24 | 32 25 | 26 | 27 | 28 | Qt::Horizontal 29 | 30 | 31 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | buttonBox 40 | accepted() 41 | Dialog 42 | accept() 43 | 44 | 45 | 248 46 | 254 47 | 48 | 49 | 157 50 | 274 51 | 52 | 53 | 54 | 55 | buttonBox 56 | rejected() 57 | Dialog 58 | reject() 59 | 60 | 61 | 316 62 | 260 63 | 64 | 65 | 286 66 | 274 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/call_once.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | // Reference: https://wiki.qt.io/Qt_thread-safe_singleton 9 | 10 | #ifndef CALL_ONCE_H 11 | #define CALL_ONCE_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace CallOnce { 21 | enum ECallOnce { 22 | CO_Request, 23 | CO_InProgress, 24 | CO_Finished 25 | }; 26 | 27 | Q_GLOBAL_STATIC(QThreadStorage, once_flag) 28 | } 29 | 30 | template 31 | inline static void qCallOnce(Function func, QBasicAtomicInt& flag) 32 | { 33 | using namespace CallOnce; 34 | 35 | #if QT_VERSION < 0x050000 36 | int protectFlag = flag.fetchAndStoreAcquire(flag); 37 | #elif QT_VERSION >= 0x050000 38 | int protectFlag = flag.fetchAndStoreAcquire(flag.load()); 39 | #endif 40 | 41 | if (protectFlag == CO_Finished) 42 | return; 43 | if (protectFlag == CO_Request && flag.testAndSetRelaxed(protectFlag, 44 | CO_InProgress)) { 45 | func(); 46 | flag.fetchAndStoreRelease(CO_Finished); 47 | } 48 | else { 49 | do { 50 | QThread::yieldCurrentThread(); 51 | } 52 | while (!flag.testAndSetAcquire(CO_Finished, CO_Finished)); 53 | } 54 | } 55 | 56 | template 57 | inline static void qCallOncePerThread(Function func) 58 | { 59 | using namespace CallOnce; 60 | if (!once_flag()->hasLocalData()) { 61 | once_flag()->setLocalData(new QAtomicInt(CO_Request)); 62 | qCallOnce(func, *once_flag()->localData()); 63 | } 64 | } 65 | 66 | #endif // CALL_ONCE_H 67 | -------------------------------------------------------------------------------- /src/frmMain.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #ifndef FRMMAIN_H 9 | #define FRMMAIN_H 10 | 11 | #include 12 | #include "frmProduct.h" 13 | #include "frmLogin.h" 14 | #include 15 | 16 | namespace Ui { 17 | class frmMain; 18 | } 19 | 20 | class frmMain : public QMainWindow 21 | { 22 | Q_OBJECT 23 | 24 | private: 25 | frmProduct *m_frmProduct; 26 | frmLogin *m_frmLogin; 27 | 28 | public: 29 | explicit frmMain(QWidget *parent = 0); 30 | ~frmMain(); 31 | void LoadProducts(); 32 | 33 | private slots: 34 | 35 | void loginOKWith(QString name); 36 | 37 | void showMenuAbout(); 38 | 39 | void quitApp(); 40 | 41 | void on_btnRefresh_clicked(); 42 | 43 | void on_btnProductOperations_clicked(); 44 | 45 | void on_tblProducts_activated(const QModelIndex &index); 46 | 47 | void on_tblProducts_pressed(const QModelIndex &index); 48 | 49 | void on_btnSearch_clicked(); 50 | 51 | void on_btnSearchReset_clicked(); 52 | 53 | void on_btnClear_clicked(); 54 | 55 | void on_cbSearchByName_stateChanged(int arg1); 56 | 57 | void on_cbSearchByDate_stateChanged(int arg1); 58 | 59 | void on_cbSearchByQuantity_stateChanged(int arg1); 60 | 61 | void on_cbSearchByPrice_stateChanged(int arg1); 62 | 63 | void on_cbSearchByDateAdd_stateChanged(int arg1); 64 | 65 | void on_cbSearchByDateUpdate_stateChanged(int arg1); 66 | 67 | void on_cbSearchByPricePurchase_stateChanged(int arg1); 68 | 69 | void on_cbSearchByPriceSale_stateChanged(int arg1); 70 | 71 | private: 72 | Ui::frmMain *ui; 73 | void LoadProductInfoToLabel(const QModelIndex &index); 74 | void closeEvent (QCloseEvent *event); 75 | 76 | }; 77 | 78 | #endif // FRMMAIN_H 79 | -------------------------------------------------------------------------------- /src/singleton.h: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | // Reference: https://wiki.qt.io/Qt_thread-safe_singleton 9 | 10 | 11 | #ifndef SINGLETON_H 12 | #define SINGLETON_H 13 | 14 | #include 15 | #include 16 | #include "call_once.h" 17 | 18 | template 19 | class Singleton 20 | { 21 | private: 22 | typedef T* (*CreateInstanceFunction)(); 23 | public: 24 | static T* instance(CreateInstanceFunction create); 25 | private: 26 | static void init(); 27 | 28 | Singleton(); 29 | ~Singleton(); 30 | Q_DISABLE_COPY(Singleton) 31 | static QBasicAtomicPointer create; 32 | static QBasicAtomicInt flag; 33 | static QBasicAtomicPointer tptr; 34 | bool inited; 35 | }; 36 | 37 | template 38 | T* Singleton::instance(CreateInstanceFunction create) 39 | { 40 | Singleton::create.store(create); 41 | qCallOnce(init, flag); 42 | return (T*)tptr.load(); 43 | } 44 | 45 | template 46 | void Singleton::init() 47 | { 48 | static Singleton singleton; 49 | if (singleton.inited) { 50 | CreateInstanceFunction createFunction = (CreateInstanceFunction)Singleton::create.load(); 51 | tptr.store(createFunction()); 52 | } 53 | } 54 | 55 | template 56 | Singleton::Singleton() { 57 | inited = true; 58 | }; 59 | 60 | template 61 | Singleton::~Singleton() { 62 | T* createdTptr = (T*)tptr.fetchAndStoreOrdered(nullptr); 63 | if (createdTptr) { 64 | delete createdTptr; 65 | } 66 | create.store(nullptr); 67 | } 68 | 69 | template QBasicAtomicPointer Singleton::create = Q_BASIC_ATOMIC_INITIALIZER(nullptr); 70 | template QBasicAtomicInt Singleton::flag = Q_BASIC_ATOMIC_INITIALIZER(CallOnce::CO_Request); 71 | template QBasicAtomicPointer Singleton::tptr = Q_BASIC_ATOMIC_INITIALIZER(nullptr); 72 | 73 | #endif // SINGLETON_H 74 | -------------------------------------------------------------------------------- /src/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 730 10 | 463 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 260 21 | 180 22 | 431 23 | 201 24 | 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | Tab 1 32 | 33 | 34 | 35 | 36 | Tab 2 37 | 38 | 39 | 40 | 41 | 42 | 43 | 40 44 | 60 45 | 75 46 | 23 47 | 48 | 49 | 50 | PushButton 51 | 52 | 53 | 54 | 55 | 56 | 40 57 | 120 58 | 391 59 | 23 60 | 61 | 62 | 63 | 24 64 | 65 | 66 | 67 | 68 | 69 | 70 | 0 71 | 0 72 | 730 73 | 21 74 | 75 | 76 | 77 | 78 | 79 | TopToolBarArea 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | pushButton 92 | pressed() 93 | progressBar 94 | raise() 95 | 96 | 97 | 91 98 | 104 99 | 100 | 101 | 98 102 | 161 103 | 104 | 105 | 106 | 107 | tabWidget 108 | currentChanged(int) 109 | progressBar 110 | setValue(int) 111 | 112 | 113 | 435 114 | 281 115 | 116 | 117 | 254 118 | 168 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/frmLogin.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "frmLogin.h" 9 | #include "ui_frmLogin.h" 10 | #include "frmRegister.h" 11 | #include "frmMain.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "dbcontroller.h" 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | frmLogin::frmLogin(QWidget *parent) : QDialog(parent), ui(new Ui::frmLogin) 25 | { 26 | qApp->setQuitOnLastWindowClosed(false); 27 | 28 | ui->setupUi(this); 29 | window()->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, window()->size(), qApp->desktop()->availableGeometry())); 30 | 31 | this->setFixedSize(this->maximumSize()); 32 | setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 33 | 34 | if(DBController::instance()->IsOpen()){ 35 | ui->lblStatus->setText("Database connection succeeded!"); 36 | QTextStream(stdout) << "Connect OK!"; 37 | } else { 38 | ui->lblStatus->setText("Database connection fault!"); 39 | QTextStream(stdout) << "Connect Fail!"; 40 | } 41 | } 42 | 43 | frmLogin::~frmLogin() 44 | { 45 | this->setFixedSize(this->width(),this->height()); 46 | delete ui; 47 | } 48 | 49 | void frmLogin::closeEvent (QCloseEvent *event) 50 | { 51 | QMessageBox::StandardButton mboxSelect = QMessageBox::question( this, "Ürün Takip Yazılımı", "Çıkmak istediğinizden emin misiniz?", QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes); 52 | 53 | if (mboxSelect != QMessageBox::Yes) { 54 | event->ignore(); 55 | } else { 56 | event->accept(); 57 | QApplication::quit(); 58 | } 59 | } 60 | 61 | void frmLogin::on_btnRegister_clicked() 62 | { 63 | frmRegister *r = new frmRegister(this); 64 | r->setModal(true); 65 | r->show(); 66 | } 67 | 68 | void frmLogin::on_btnLogin_clicked() 69 | { 70 | QString username = ui->txtUsername->text().trimmed(); 71 | QString password = ui->txtPassword->text().trimmed(); 72 | 73 | 74 | if (username.isEmpty()) { 75 | ui->lblStatus->setText("Kullanıcıadı boş bırakılamaz!"); 76 | return; 77 | } else if (password.isEmpty()) { 78 | ui->lblStatus->setText("Şifre boş bırakılamaz!"); 79 | return; 80 | } 81 | 82 | QSqlQuery query; 83 | 84 | query.prepare( 85 | "SELECT * FROM " 86 | "user " 87 | "WHERE " 88 | "username = :username AND password = :password" 89 | ); 90 | 91 | query.bindValue(":username", username); 92 | query.bindValue(":password", password); 93 | 94 | if(query.exec()){ 95 | if(query.isActive()){ 96 | int count = 0; 97 | 98 | while(query.next()){ 99 | count++; 100 | } 101 | 102 | if(count == 1){ 103 | ui->lblStatus->setText("Giriş başarılı."); 104 | this->hide(); 105 | this->LoginOK(username); 106 | return; 107 | } else if (count > 1){ 108 | ui->lblStatus->setText("Birden fazla Kullanıcıadı ve Şifre tespit edildi."); 109 | } else if (count < 1){ 110 | ui->lblStatus->setText("Geçersiz Kullanıcıadı ve Şifre"); 111 | } 112 | } else { 113 | ui->lblStatus->setText("Query aktif değil!"); 114 | qDebug() << query.lastError(); 115 | } 116 | } else { 117 | ui->lblStatus->setText("Veritabanı hatası oluştu."); 118 | qDebug() << query.lastError(); 119 | } 120 | 121 | 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/frmRegister.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "frmRegister.h" 9 | #include "ui_frmRegister.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "dbcontroller.h" 21 | 22 | frmRegister::frmRegister(QWidget *parent) : QDialog(parent), ui(new Ui::frmRegister) { 23 | ui->setupUi(this); 24 | 25 | this->setFixedSize(this->maximumSize()); 26 | setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 27 | } 28 | 29 | frmRegister::~frmRegister() 30 | { 31 | this->setFixedSize(this->width(),this->height()); 32 | delete ui; 33 | } 34 | 35 | bool frmRegister::CheckInputs(){ 36 | QString name = ui->txtName->text().trimmed(); 37 | QString surname = ui->txtSurname->text().trimmed(); 38 | QString username = ui->txtUsername->text().trimmed(); 39 | QString password = ui->txtPassword->text().trimmed(); 40 | QString password2 = ui->txtPassword2->text().trimmed(); 41 | QString mailAddress = ui->txtMail->text().trimmed(); 42 | QString mobilePhone = ui->txtPhoneNumber->text().trimmed(); 43 | QString homeAddress = ui->txtAddress->toPlainText().trimmed(); 44 | 45 | bool flag = true; 46 | 47 | QRegExp regexMail("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b"); 48 | regexMail.setCaseSensitivity(Qt::CaseInsensitive); 49 | regexMail.setPatternSyntax(QRegExp::RegExp); 50 | 51 | QRegExp regexPhone("^[0-9]{10}$"); 52 | regexPhone.setCaseSensitivity(Qt::CaseInsensitive); 53 | regexPhone.setPatternSyntax(QRegExp::RegExp); 54 | 55 | if (name.isEmpty()) { 56 | QMessageBox::warning(this, "Kayıt", "İsim boş bırakılamaz!"); 57 | flag = false; 58 | } else if (surname.isEmpty()) { 59 | QMessageBox::warning(this, "Kayıt", "Soyad boş bırakılamaz!"); 60 | flag = false; 61 | } else if (username.isEmpty()) { 62 | QMessageBox::warning(this, "Kayıt", "Kullanıcıadı boş bırakılamaz!"); 63 | flag = false; 64 | } else if (password.isEmpty()) { 65 | QMessageBox::warning(this, "Kayıt", "Şifre boş bırakılamaz!"); 66 | flag = false; 67 | } else if (password2.isEmpty()) { 68 | QMessageBox::warning(this, "Kayıt", "Şifre boş bırakılamaz!"); 69 | flag = false; 70 | } else if (QString::compare(password, password2, Qt::CaseSensitive) != 0) { 71 | QMessageBox::warning(this, "Kayıt", "Şifreler eşleşmiyor!"); 72 | flag = false; 73 | } else if (mailAddress.isEmpty()) { 74 | QMessageBox::warning(this, "Kayıt", "Mail adresi boş bırakılamaz!"); 75 | flag = false; 76 | } else if (!regexMail.exactMatch(mailAddress)) { 77 | QMessageBox::warning(this, "Kayıt", "Lütfen mail adresinizi doğru şekilde giriniz!"); 78 | flag = false; 79 | } else if (mobilePhone.isEmpty()) { 80 | QMessageBox::warning(this, "Kayıt", "Telefon numarasaı boş bırakılamaz!"); 81 | flag = false; 82 | } else if (!regexPhone.exactMatch(mobilePhone)) { 83 | QMessageBox::warning(this, "Kayıt", "Lütfen telefon numaranızı doğru şekilde ve 11 hane olarak giriniz!"); 84 | flag = false; 85 | } else if (homeAddress.isEmpty()) { 86 | QMessageBox::warning(this, "Kayıt", "Ev adresi boş bırakılamaz!"); 87 | flag = false; 88 | } else if (!ui->chkTermsOfService->checkState()) { 89 | QMessageBox::warning(this, "Kayıt", "Lütfen kayıt şartlarını kabul ediniz!"); 90 | flag = false; 91 | } 92 | 93 | return flag; 94 | } 95 | 96 | void frmRegister::Clear(){ 97 | ui->txtName->clear(); 98 | ui->txtSurname->clear(); 99 | ui->txtUsername->clear(); 100 | ui->txtPassword->clear(); 101 | ui->txtPassword2->clear(); 102 | ui->txtMail->clear(); 103 | ui->txtPhoneNumber->clear(); 104 | ui->txtAddress->clear(); 105 | } 106 | 107 | void frmRegister::on_btnRegister_clicked() 108 | { 109 | if(this->CheckInputs()){ 110 | if(DBController::instance()->IsOpen()){ 111 | 112 | QSqlQuery query; 113 | 114 | query.prepare( 115 | "INSERT INTO " 116 | "user " 117 | "(username, password, name, surname, phone, mail, address, dateRegister, dateLastLogin, authorityLevel) " 118 | "VALUES " 119 | "(:username, :password, :name, :surname, :phone, :mail, :address, NOW(), NOW(), :authorityLevel)" 120 | ); 121 | 122 | query.bindValue(":username", ui->txtUsername->text().trimmed()); 123 | query.bindValue(":password", ui->txtPassword->text().trimmed()); 124 | query.bindValue(":name", ui->txtName->text().trimmed()); 125 | query.bindValue(":surname", ui->txtSurname->text().trimmed()); 126 | query.bindValue(":phone", ui->txtPhoneNumber->text().trimmed()); 127 | query.bindValue(":mail", ui->txtMail->text().trimmed()); 128 | query.bindValue(":address", ui->txtAddress->toPlainText().trimmed()); 129 | query.bindValue(":authorityLevel", 1); 130 | 131 | if(query.exec()){ 132 | if(query.isActive()){ 133 | this->Clear(); 134 | QMessageBox::information(this, "Kayıt", "Kullanıcı kayıdı başarılı!"); 135 | qDebug() << "Database query OK."; 136 | this->close(); 137 | return; 138 | } 139 | } else { 140 | QMessageBox::warning(this, "Kayıt", "Kullanıcı kaydı sırasında bir hata oluştu!"); 141 | qDebug() << query.lastError(); 142 | return; 143 | } 144 | } else { 145 | QMessageBox::warning(this, "Ürün", "Veritabanı bağlantısı kapalı!"); 146 | qDebug() << "Database connection closed."; 147 | return; 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/frmProduct.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | frmProduct 4 | 5 | 6 | 7 | 0 8 | 0 9 | 378 10 | 476 11 | 12 | 13 | 14 | Product Edit 15 | 16 | 17 | 18 | 19 | 10 20 | 10 21 | 359 22 | 451 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Barcode: 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Read-only mode 45 | 46 | 47 | 48 | 49 | 50 | 51 | Add Date: 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | true 62 | 63 | 64 | 65 | 66 | 67 | 68 | true 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Quantity: 79 | 80 | 81 | 82 | 83 | 84 | 85 | Name: 86 | 87 | 88 | 89 | 90 | 91 | 92 | Purchase Price: 93 | 94 | 95 | 96 | 97 | 98 | 99 | Update Date: 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | Description: 110 | 111 | 112 | 113 | 114 | 115 | 116 | Sale Price: 117 | 118 | 119 | 120 | 121 | 122 | 123 | ID: 124 | 125 | 126 | 127 | 128 | 129 | 130 | Qt::Vertical 131 | 132 | 133 | 134 | 20 135 | 40 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | Qt::Vertical 144 | 145 | 146 | 147 | 20 148 | 40 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | Add 167 | 168 | 169 | 170 | 171 | 172 | 173 | Update 174 | 175 | 176 | 177 | 178 | 179 | 180 | Delete 181 | 182 | 183 | 184 | 185 | 186 | 187 | Cancel 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | btnCancel 200 | clicked() 201 | frmProduct 202 | close() 203 | 204 | 205 | 330 206 | 450 207 | 208 | 209 | 371 210 | 412 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /src/frmLogin.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | frmLogin 4 | 5 | 6 | 7 | 0 8 | 0 9 | 492 10 | 191 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 16777215 22 | 16777215 23 | 24 | 25 | 26 | Login 27 | 28 | 29 | 1.000000000000000 30 | 31 | 32 | 33 | 34 | 10 35 | 10 36 | 471 37 | 171 38 | 39 | 40 | 41 | 42 | 20 43 | 44 | 45 | 20 46 | 47 | 48 | 49 | 50 | 51 | 10 52 | 53 | 54 | 55 | Username: 56 | 57 | 58 | txtUsername 59 | 60 | 61 | 62 | 63 | 64 | 65 | <html><head/><body><p>Sisteme giriş yapmak için kullanacağınız <span style=" color:#ff0000;">kullanıcı adınız</span></p></body></html> 66 | 67 | 68 | -1 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 10 83 | 84 | 85 | 86 | Password: 87 | 88 | 89 | txtPassword 90 | 91 | 92 | 93 | 94 | 95 | 96 | <html><head/><body><p>Sisteme giriş yapmak için kullanacağınız <span style=" color:#ff0000;">şifreniz</span></p></body></html> 97 | 98 | 99 | QLineEdit::Password 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | true 110 | 111 | 112 | 113 | <html><head/><body><p>Kullanıcı hesabınız ile sisteme <span style=" color:#ff0000;">giriş yapar</span></p></body></html> 114 | 115 | 116 | Login 117 | 118 | 119 | 120 | 121 | 122 | 123 | <html><head/><body><p>Sisteme <span style=" color:#ff0000;">kayıt olma</span> penceresini açar</p></body></html> 124 | 125 | 126 | Register 127 | 128 | 129 | 130 | 131 | 132 | 133 | <html><head/><body><p>Programdan <span style=" color:#ff0000;">çıkış yapar</span></p></body></html> 134 | 135 | 136 | Exit 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 7 147 | 75 148 | true 149 | false 150 | PreferAntialias 151 | true 152 | 153 | 154 | 155 | <html><head/><body><p>Please type your username and password and click<span style=" text-decoration: underline;"> 'Login</span>' button</p></body></html> 156 | 157 | 158 | 159 | 160 | 161 | 162 | Ready... 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | txtUsername 171 | txtPassword 172 | btnLogin 173 | btnRegister 174 | btnQuit 175 | 176 | 177 | 178 | 179 | btnQuit 180 | clicked() 181 | frmLogin 182 | close() 183 | 184 | 185 | 478 186 | 145 187 | 188 | 189 | 562 190 | 165 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /sql/ProductManagementTool.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS `pmt` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_turkish_ci */; 2 | USE `pmt`; 3 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) 4 | -- 5 | -- Host: localhost Database: pmt 6 | -- ------------------------------------------------------ 7 | -- Server version 8.0.11 8 | 9 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 10 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 11 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 12 | /*!40101 SET NAMES utf8 */; 13 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 14 | /*!40103 SET TIME_ZONE='+00:00' */; 15 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 16 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 17 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 18 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 19 | 20 | -- 21 | -- Table structure for table `product` 22 | -- 23 | 24 | DROP TABLE IF EXISTS `product`; 25 | /*!40101 SET @saved_cs_client = @@character_set_client */; 26 | /*!40101 SET character_set_client = utf8 */; 27 | CREATE TABLE `product` ( 28 | `id` int(11) NOT NULL AUTO_INCREMENT, 29 | `barcode` varchar(13) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, 30 | `name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, 31 | `description` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, 32 | `quantity` int(11) NOT NULL, 33 | `purchasePrice` double NOT NULL, 34 | `salePrice` double NOT NULL, 35 | `dateAdd` datetime DEFAULT CURRENT_TIMESTAMP, 36 | `dateUpdate` datetime DEFAULT CURRENT_TIMESTAMP, 37 | PRIMARY KEY (`id`), 38 | UNIQUE KEY `id_UNIQUE` (`id`), 39 | UNIQUE KEY `barcode_UNIQUE` (`barcode`) 40 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 41 | /*!40101 SET character_set_client = @saved_cs_client */; 42 | 43 | -- 44 | -- Dumping data for table `product` 45 | -- 46 | 47 | LOCK TABLES `product` WRITE; 48 | /*!40000 ALTER TABLE `product` DISABLE KEYS */; 49 | /*!40000 ALTER TABLE `product` ENABLE KEYS */; 50 | UNLOCK TABLES; 51 | 52 | -- 53 | -- Table structure for table `recipt` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `recipt`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!40101 SET character_set_client = utf8 */; 59 | CREATE TABLE `recipt` ( 60 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 61 | `sale_id` int(10) unsigned NOT NULL, 62 | `seller_id` int(10) unsigned NOT NULL, 63 | `buyer_id` int(10) unsigned NOT NULL, 64 | `date` date NOT NULL, 65 | PRIMARY KEY (`id`), 66 | UNIQUE KEY `id_UNIQUE` (`id`), 67 | UNIQUE KEY `sale_id_UNIQUE` (`sale_id`) 68 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; 69 | /*!40101 SET character_set_client = @saved_cs_client */; 70 | 71 | -- 72 | -- Dumping data for table `recipt` 73 | -- 74 | 75 | LOCK TABLES `recipt` WRITE; 76 | /*!40000 ALTER TABLE `recipt` DISABLE KEYS */; 77 | /*!40000 ALTER TABLE `recipt` ENABLE KEYS */; 78 | UNLOCK TABLES; 79 | 80 | -- 81 | -- Table structure for table `refund` 82 | -- 83 | 84 | DROP TABLE IF EXISTS `refund`; 85 | /*!40101 SET @saved_cs_client = @@character_set_client */; 86 | /*!40101 SET character_set_client = utf8 */; 87 | CREATE TABLE `refund` ( 88 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 89 | `s_id` int(11) NOT NULL, 90 | `description` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL, 91 | `date` date NOT NULL, 92 | PRIMARY KEY (`id`), 93 | UNIQUE KEY `id_UNIQUE` (`id`) 94 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; 95 | /*!40101 SET character_set_client = @saved_cs_client */; 96 | 97 | -- 98 | -- Dumping data for table `refund` 99 | -- 100 | 101 | LOCK TABLES `refund` WRITE; 102 | /*!40000 ALTER TABLE `refund` DISABLE KEYS */; 103 | /*!40000 ALTER TABLE `refund` ENABLE KEYS */; 104 | UNLOCK TABLES; 105 | 106 | -- 107 | -- Table structure for table `sale` 108 | -- 109 | 110 | DROP TABLE IF EXISTS `sale`; 111 | /*!40101 SET @saved_cs_client = @@character_set_client */; 112 | /*!40101 SET character_set_client = utf8 */; 113 | CREATE TABLE `sale` ( 114 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 115 | `p_id` int(11) unsigned NOT NULL, 116 | `decription` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL, 117 | `date` date NOT NULL, 118 | PRIMARY KEY (`id`), 119 | UNIQUE KEY `id_UNIQUE` (`id`), 120 | UNIQUE KEY `p_id_UNIQUE` (`p_id`), 121 | KEY `p_id_idx` (`p_id`) 122 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; 123 | /*!40101 SET character_set_client = @saved_cs_client */; 124 | 125 | -- 126 | -- Dumping data for table `sale` 127 | -- 128 | 129 | LOCK TABLES `sale` WRITE; 130 | /*!40000 ALTER TABLE `sale` DISABLE KEYS */; 131 | /*!40000 ALTER TABLE `sale` ENABLE KEYS */; 132 | UNLOCK TABLES; 133 | 134 | -- 135 | -- Table structure for table `stock` 136 | -- 137 | 138 | DROP TABLE IF EXISTS `stock`; 139 | /*!40101 SET @saved_cs_client = @@character_set_client */; 140 | /*!40101 SET character_set_client = utf8 */; 141 | CREATE TABLE `stock` ( 142 | `id` int(11) NOT NULL AUTO_INCREMENT, 143 | `name` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL, 144 | `type` varchar(45) COLLATE utf8_turkish_ci DEFAULT NULL, 145 | PRIMARY KEY (`id`), 146 | UNIQUE KEY `id_UNIQUE` (`id`) 147 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; 148 | /*!40101 SET character_set_client = @saved_cs_client */; 149 | 150 | -- 151 | -- Dumping data for table `stock` 152 | -- 153 | 154 | LOCK TABLES `stock` WRITE; 155 | /*!40000 ALTER TABLE `stock` DISABLE KEYS */; 156 | /*!40000 ALTER TABLE `stock` ENABLE KEYS */; 157 | UNLOCK TABLES; 158 | 159 | -- 160 | -- Table structure for table `user` 161 | -- 162 | 163 | DROP TABLE IF EXISTS `user`; 164 | /*!40101 SET @saved_cs_client = @@character_set_client */; 165 | /*!40101 SET character_set_client = utf8 */; 166 | CREATE TABLE `user` ( 167 | `id` int(11) NOT NULL AUTO_INCREMENT, 168 | `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_turkish_ci NOT NULL, 169 | `password` varchar(32) CHARACTER SET utf8 COLLATE utf8_turkish_ci NOT NULL, 170 | `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_turkish_ci DEFAULT NULL, 171 | `surname` varchar(20) CHARACTER SET utf8 COLLATE utf8_turkish_ci DEFAULT NULL, 172 | `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_turkish_ci DEFAULT NULL, 173 | `mail` varchar(50) CHARACTER SET utf8 COLLATE utf8_turkish_ci DEFAULT NULL, 174 | `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_turkish_ci DEFAULT NULL, 175 | `dateRegister` date NOT NULL, 176 | `dateLastLogin` date DEFAULT NULL, 177 | `authorityLevel` int(1) NOT NULL, 178 | PRIMARY KEY (`id`), 179 | UNIQUE KEY `id_UNIQUE` (`id`), 180 | UNIQUE KEY `username_UNIQUE` (`username`) 181 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci; 182 | /*!40101 SET character_set_client = @saved_cs_client */; 183 | 184 | -- 185 | -- Dumping data for table `user` 186 | -- 187 | 188 | LOCK TABLES `user` WRITE; 189 | /*!40000 ALTER TABLE `user` DISABLE KEYS */; 190 | /*!40000 ALTER TABLE `user` ENABLE KEYS */; 191 | UNLOCK TABLES; 192 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 193 | 194 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 195 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 196 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 197 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 198 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 199 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 200 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 201 | 202 | -- Dump completed on 2018-06-01 18:53:10 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

ProductManagementTool Public Source Repository

2 | 3 | **Software Engineering Final Project - Advanced Product tracking automation system** 4 | 5 | [What It Is](#what-it-is) 6 | 7 | [How To Use](#how-to-use) 8 | 9 | [Build & Run](#build-run) 10 | 11 | [Requirements](#requirements) 12 | 13 | [Dependencies](#dependencies) 14 | 15 | [About](#about) 16 | 17 | [Collaborators](#collaborators) 18 | 19 | [Branches](#branches) 20 | 21 | [Copyright & Licensing](#copyright--licensing) 22 | 23 | [Contributing](#contributing) 24 | 25 | [Contact](#contact) 26 | 27 | ## What It Is 28 | 29 | **ProductManagementTool with Qt 5** 30 | 31 | ProductManagementTool program for C++ language is an easy and best way to learn how automation systems interact with the database and works in practice. 32 | 33 | **Uses : Please see [Requirements](#requirements) and [Dependencies](#dependencies)** 34 | 35 | **ProductManagementTool** 36 | 37 | --- 38 | 39 | **Who is the target audience?** 40 | 41 | --- 42 | 43 | * Anyone who wants to do project with Qt 44 | 45 | * Students wishing to do their projects using Qt 46 | 47 | * Those who need the Automation Program for their homework 48 | 49 | * `Warning:` This project assumes you have some Intermediate-Level C++ knowledge, and `does not teach C++ itself.` 50 | 51 | * `Warning:` This project are not a `How to create your own automation tool` or `How to design automation tool systems` and will not teach `Automation tooling techniques`. 52 | 53 | **Uses : Please see [Requirements](#requirements) before use** 54 | 55 | # Screenshots - UML Diagrams 56 | 57 | - All UMLs Made with **[StarUML](http://staruml.io)** 58 | 59 | - **[Click here](https://github.com/Dentrax/ProductManagementTool/blob/master/diagrams)** for see the all other UML diagrams. 60 | 61 | ## Program 62 | 63 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/uml/diagram_uml_program.png) 64 | 65 | ## Database 66 | 67 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/uml/diagram_uml_database.png) 68 | 69 | ## Activity 70 | 71 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/activity/diagram_activity_general.png) 72 | 73 | ## Collabration 74 | 75 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/collabration/diagram_collaboration_general.png) 76 | 77 | ## Use Case 78 | 79 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/usecase/diagram_usecase_general.png) 80 | 81 | ## Sequence 82 | 83 | Login 84 | 85 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/sequence/diagram_sequence_login.png) 86 | 87 | - **[Click here](https://github.com/Dentrax/ProductManagementTool/blob/master/diagrams/sequence)** for see the other Squence diagrams. 88 | 89 | ## Statechart 90 | 91 | Login 92 | 93 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/diagrams/statechart/diagram_statechart_login.png) 94 | 95 | - **[Click here](https://github.com/Dentrax/ProductManagementTool/blob/master/diagrams/statechart)** for see the other Statechart diagrams. 96 | 97 | # Screenshots - Program GUI 98 | 99 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/screenshots/ss_panel_login.png) 100 | 101 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/screenshots/ss_panel_register.png) 102 | 103 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/screenshots/ss_panel_product-edit.png) 104 | 105 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/screenshots/ss_panel_main-list.png) 106 | 107 | ![Preview Thumbnail](https://raw.githubusercontent.com/Dentrax/ProductManagementTool/master/screenshots/ss_panel_main-search.png) 108 | 109 | ## Features 110 | 111 | * Account system with Login/Register features 112 | 113 | * Lists the Product fetched from database 114 | 115 | * Lists the Product that have been searched from Search panel 116 | 117 | * Ability to Add product 118 | 119 | * Ability to Update product (exclude ID and Barcode) 120 | 121 | * Ability to Delete product 122 | 123 | * Advanced search options (by Name, by Date, by Quantity, by Price) 124 | 125 | * Product filter 126 | 127 | * Safe inputs from Textboxes (bug-free inputs) 128 | 129 | * Real-time Product list refreshing if any operate handled 130 | 131 | ## TO-DO List 132 | 133 | * User authority level (Permission system) 134 | 135 | * Sales system 136 | 137 | * Invoice & Receipt system for sold products 138 | 139 | * Product should be Refundable after sold 140 | 141 | ## Known Issues 142 | 143 | * Window Fixed Size feature not working on Linux. 144 | 145 | ## How To Use 146 | 147 | 1) git clone https://github.com/dentrax/ProductManagementTool 148 | 149 | 2) Import **[ProductManagementTool.sql](https://github.com/Dentrax/ProductManagementTool/blob/master/sql/ProductManagementTool.sql)** file to the database 150 | 151 | 3) Re-configure your database informations in **[dbcontroller.cpp](https://github.com/Dentrax/ProductManagementTool/blob/master/src/dbcontroller.cpp)**'s `SetupDB()` function. 152 | 153 | 4) [Build and Run!](#build-run) 154 | 155 | ## Build & Run 156 | 157 | `qmake && make && ./ProductManagementTool` 158 | 159 | ## Requirements 160 | 161 | * You should be familiar with Qt applications 162 | * You should be familiar with C++ family 163 | * You will need Qt base environment that can be compiled without any problems. 164 | * You will need a computer on which you have the rights to install obligatory dependencies given below 165 | 166 | ## Dependencies 167 | 168 | * MySQL (or related) Database Service 169 | * Qt Creator is fine (not mandatory) 170 | * Qt Base Modules And Frameworks 171 | * A C++ Compiler (Windows -> MinGW or Visual C++, Linux -> GCC is fine) 172 | 173 | ## About 174 | 175 | ProductManagementTool was created to serve three purposes: 176 | 177 | **ProductManagementTool is an automation tool that controls some Product operations using with Database** 178 | 179 | 1. To act as a guide to learn Qt with enhanced and rich content using `C++`. 180 | 181 | 2. To act as a guide to exemplary and educational purpose. 182 | 183 | 3. To create your own Qt application. 184 | 185 | ## Collaborators 186 | 187 | **Project Manager** - Furkan Türkal (GitHub: **[dentrax](https://github.com/dentrax)**) 188 | 189 | ## Branches 190 | 191 | We publish source for the **[ProductManagementTool]** in single rolling branch: 192 | 193 | The **[master branch](https://github.com/dentrax/ProductManagementTool/tree/master)** is extensively tested by our QA team and makes a great starting point for learning the algorithms. Also tracks [live changes](https://github.com/dentrax/ProductManagementTool/commits/master) by our team. 194 | 195 | ## Copyright & Licensing 196 | 197 | The base project code is copyrighted by Furkan 'Dentrax' Türkal and is covered by single licence. 198 | 199 | All program code (i.e. .h, .cpp, .ui) is licensed under GNU v3 License unless otherwise specified. Please see the **[LICENSE.md](https://github.com/Dentrax/ProductManagementTool/blob/master/LICENSE)** file for more information. 200 | 201 | **References** 202 | 203 | While this repository is being prepared, it may have been quoted from some sources. (i.e Official Wiki & Documentations) 204 | If there is an unspecified source, please contact me. 205 | 206 | ## Contributing 207 | 208 | Please check the [CONTRIBUTING.md](CONTRIBUTING.md) file for contribution instructions and naming guidelines. 209 | 210 | ## Contact 211 | 212 | ProductManagementTool was created by Furkan 'Dentrax' Türkal 213 | 214 | * 215 | 216 | You can contact by URL: 217 | **[CONTACT](https://github.com/dentrax)** 218 | 219 | Best Regards 220 | -------------------------------------------------------------------------------- /src/frmRegister.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | frmRegister 4 | 5 | 6 | 7 | 0 8 | 0 9 | 410 10 | 430 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Register 21 | 22 | 23 | 24 | 25 | 10 26 | 20 27 | 392 28 | 401 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Address: 42 | 43 | 44 | 45 | 46 | 47 | 48 | Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData 49 | 50 | 51 | QLineEdit::Password 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Mail: 62 | 63 | 64 | 65 | 66 | 67 | 68 | Name: 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::ImhEmailCharactersOnly 79 | 80 | 81 | 82 | 83 | 84 | 85 | Surname: 86 | 87 | 88 | 89 | 90 | 91 | 92 | Phone: 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | Qt::ImhPreferNumbers 103 | 104 | 105 | 106 | 107 | 108 | 109 | Qt::ImhLatinOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhPreferLowercase 110 | 111 | 112 | 113 | 114 | 115 | 116 | Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData 117 | 118 | 119 | QLineEdit::Password 120 | 121 | 122 | 123 | 124 | 125 | 126 | Username: 127 | 128 | 129 | 130 | 131 | 132 | 133 | Password: 134 | 135 | 136 | 137 | 138 | 139 | 140 | Password: 141 | 142 | 143 | 144 | 145 | 146 | 147 | I have read the terms of use; I accept, declare and undertake. 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Qt::Vertical 157 | 158 | 159 | 160 | 20 161 | 80 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 5 170 | 171 | 172 | QLayout::SetDefaultConstraint 173 | 174 | 175 | 176 | 177 | Register 178 | 179 | 180 | 181 | 182 | 183 | 184 | Cancel 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | txtName 199 | txtSurname 200 | txtUsername 201 | txtPassword 202 | txtPassword2 203 | txtMail 204 | txtPhoneNumber 205 | txtAddress 206 | btnRegister 207 | btnCancel 208 | 209 | 210 | 211 | 212 | btnCancel 213 | clicked() 214 | frmRegister 215 | close() 216 | 217 | 218 | 298 219 | 407 220 | 221 | 222 | 390 223 | 402 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /src/frmProduct.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "frmProduct.h" 9 | #include "ui_frmProduct.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "frmMain.h" 21 | #include "dbcontroller.h" 22 | 23 | frmProduct::frmProduct(QWidget *parent) : QDialog(parent), ui(new Ui::frmProduct) { 24 | ui->setupUi(this); 25 | 26 | this->setFixedSize(this->maximumSize()); 27 | setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 28 | 29 | LoadProductsToComboBox(); 30 | 31 | ui->dteAdd->setDateTime(QDateTime::currentDateTime()); 32 | ui->dteUpdate->setDateTime(QDateTime::currentDateTime()); 33 | 34 | this->Clear(); 35 | 36 | } 37 | 38 | frmProduct::~frmProduct() 39 | { 40 | delete ui; 41 | } 42 | 43 | 44 | void frmProduct::Clear(){ 45 | ui->txtBarcode->clear(); 46 | ui->txtName->clear(); 47 | ui->txtDescription->clear(); 48 | ui->sbQuantity->clear(); 49 | ui->sbPurchasePrice->clear(); 50 | ui->sbSalePrice->clear(); 51 | ui->cbReadonly->setChecked(false); 52 | } 53 | 54 | bool frmProduct::CheckInputs(){ 55 | bool flag = true; 56 | 57 | if (ui->txtBarcode->text().trimmed().isEmpty()) { 58 | QMessageBox::warning(this, "Ürün", "Barkod numarası boş bırakılamaz!"); 59 | flag = false; 60 | } else if (ui->txtBarcode->text().trimmed().length() != 11) { 61 | QMessageBox::warning(this, "Ürün", "Barkod numarası 11 haneli olmalıdır!"); 62 | flag = false; 63 | } else if (ui->txtName->text().trimmed().isEmpty()) { 64 | QMessageBox::warning(this, "Ürün", "Ürün ismi boş bırakılamaz!"); 65 | flag = false; 66 | } else if (ui->txtDescription->toPlainText().trimmed().isEmpty()) { 67 | QMessageBox::warning(this, "Ürün", "Ürün açıklaması boş bırakılamaz!"); 68 | flag = false; 69 | } else if (ui->sbQuantity->value() <= 0.0) { 70 | QMessageBox::warning(this, "Ürün", "Ürün miktarını doğru şekilde giriniz!"); 71 | flag = false; 72 | } else if (ui->sbPurchasePrice->value() <= 0.0) { 73 | QMessageBox::warning(this, "Ürün", "Ürün satın alma fiyatını doğru şekilde giriniz!"); 74 | flag = false; 75 | } else if (ui->sbSalePrice->value() <= 0.0) { 76 | QMessageBox::warning(this, "Ürün", "Ürün satış fiyatını doğru şekilde giriniz!"); 77 | flag = false; 78 | } 79 | 80 | return flag; 81 | } 82 | 83 | void frmProduct::on_btnAdd_clicked() 84 | { 85 | QString barcode = ui->txtBarcode->text().trimmed(); 86 | QString name = ui->txtName->text().trimmed(); 87 | QString description = ui->txtDescription->toPlainText().trimmed(); 88 | 89 | if(this->CheckInputs()){ 90 | if(DBController::instance()->IsOpen()){ 91 | 92 | QSqlQuery query; 93 | 94 | query.prepare( 95 | "INSERT INTO " 96 | "product " 97 | "(barcode, name, description, quantity, purchasePrice, salePrice, dateAdd, dateUpdate) VALUES " 98 | "(:barcode, :name, :description, :quantity, :purchasePrice, :salePrice, NOW(), NOW())" 99 | ); 100 | 101 | query.bindValue(":barcode", barcode); 102 | query.bindValue(":name", name); 103 | query.bindValue(":description", description); 104 | 105 | query.bindValue(":quantity", ui->sbQuantity->value()); 106 | query.bindValue(":purchasePrice", ui->sbPurchasePrice->value()); 107 | query.bindValue(":salePrice", ui->sbSalePrice->value()); 108 | 109 | if(query.exec()){ 110 | if(query.isActive()){ 111 | this->Clear(); 112 | this->Refresh(); 113 | ui->cbID->addItem(barcode); 114 | QMessageBox::information(this, "Ürün", "Ürün başarıyla eklendi!"); 115 | qDebug() << "Database query OK."; 116 | return; 117 | } 118 | } else { 119 | QMessageBox::warning(this, "Ürün", "Ürün eklenirken bir hata oluştu!"); 120 | qDebug() << query.lastError(); 121 | return; 122 | } 123 | } else { 124 | QMessageBox::warning(this, "Ürün", "Veritabanı bağlantısı kapalı!"); 125 | qDebug() << "Database connection closed."; 126 | return; 127 | } 128 | } 129 | } 130 | 131 | void frmProduct::on_btnUpdate_clicked() 132 | { 133 | QString barcode = ui->txtBarcode->text().trimmed(); 134 | QString name = ui->txtName->text().trimmed(); 135 | QString description = ui->txtDescription->toPlainText().trimmed(); 136 | 137 | if(QString::compare(barcode, ui->cbID->currentText(), Qt::CaseSensitive) != 0){ 138 | QMessageBox::warning(this, "Ürün", "Güncellenmek istenen ürünün barkodu değiştirilemez!"); 139 | ui->txtBarcode->setText(ui->cbID->currentText()); 140 | return; 141 | } 142 | 143 | if(this->CheckInputs()){ 144 | QMessageBox::StandardButton reply = QMessageBox::question(this, "Ürün", "Ürünü güncellemek istediğinizden emin misiniz?", QMessageBox::Yes|QMessageBox::No); 145 | 146 | if (reply == QMessageBox::No) { 147 | return; 148 | } else if (reply == QMessageBox::Yes){ 149 | if(DBController::instance()->IsOpen()){ 150 | 151 | QSqlQuery query; 152 | 153 | query.prepare( 154 | "UPDATE " 155 | "product " 156 | "SET name = :name, description = :description , quantity = :quantity, purchasePrice = :purchasePrice, salePrice = :salePrice, dateUpdate = NOW() " 157 | "WHERE barcode = :barcode" 158 | ); 159 | 160 | query.bindValue(":barcode", ui->cbID->currentText()); 161 | query.bindValue(":name", name); 162 | query.bindValue(":description", description); 163 | query.bindValue(":quantity", ui->sbQuantity->value()); 164 | query.bindValue(":purchasePrice", ui->sbPurchasePrice->value()); 165 | query.bindValue(":salePrice", ui->sbSalePrice->value()); 166 | 167 | if(query.exec()){ 168 | if(query.isActive()){ 169 | if(query.numRowsAffected() <= 0){ 170 | QMessageBox::warning(this, "Ürün", "İşlem sonucu boş (0) döndü!"); 171 | qDebug() << query.lastError(); 172 | return; 173 | } 174 | this->Refresh(); 175 | this->LoadProduct(ui->cbID->currentText()); 176 | QMessageBox::information(this, "Ürün", "Ürün başarıyla güncellendi!"); 177 | qDebug() << "Database query OK."; 178 | return; 179 | } 180 | } else { 181 | QMessageBox::warning(this, "Ürün", "Ürün güncellenirken bir hata oluştu!"); 182 | qDebug() << query.lastError(); 183 | return; 184 | } 185 | } else { 186 | QMessageBox::warning(this, "Ürün", "Veritabanı bağlantısı kapalı!"); 187 | qDebug() << "Database connection closed."; 188 | return; 189 | } 190 | } 191 | } 192 | } 193 | 194 | void frmProduct::on_btnDelete_clicked() 195 | { 196 | QMessageBox::StandardButton reply = QMessageBox::question(this, "Ürün", "Ürünü silmek istediğinizden emin misiniz?", QMessageBox::Yes|QMessageBox::No); 197 | 198 | if (reply == QMessageBox::No) { 199 | return; 200 | } else if (reply == QMessageBox::Yes){ 201 | if(DBController::instance()->IsOpen()){ 202 | 203 | QSqlQuery query; 204 | 205 | query.prepare( 206 | "DELETE FROM " 207 | "product " 208 | "WHERE " 209 | "barcode = :barcode" 210 | ); 211 | 212 | query.bindValue(":barcode", ui->cbID->currentText()); 213 | 214 | if(query.exec()){ 215 | if(query.isActive()){ 216 | if(query.numRowsAffected() <= 0){ 217 | QMessageBox::warning(this, "Ürün", "Ürün barkod hatası!"); 218 | qDebug() << query.lastError(); 219 | return; 220 | } 221 | this->Clear(); 222 | this->Refresh(); 223 | QMessageBox::information(this, "Ürün", "Ürün başarıyla silindi!"); 224 | qDebug() << "Database query OK."; 225 | qDebug() << "Delete Product: " << ui->cbID->currentText(); 226 | ui->cbID->removeItem(ui->cbID->currentIndex()); 227 | return; 228 | } 229 | } else { 230 | QMessageBox::warning(this, "Ürün", "Ürün silinirken bir hata oluştu!"); 231 | qDebug() << query.lastError(); 232 | return; 233 | } 234 | } else { 235 | QMessageBox::warning(this, "Ürün", "Veritabanı bağlantısı kapalı!"); 236 | qDebug() << "Database connection closed."; 237 | return; 238 | } 239 | } 240 | } 241 | 242 | void frmProduct::LoadProductsToComboBox(){ 243 | 244 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 245 | 246 | QSqlQuery query; 247 | query.exec("SELECT * FROM Product ORDER BY dateAdd"); 248 | 249 | while (query.next()) { 250 | if(query.isActive()){ 251 | int id = query.value(0).toInt(); 252 | QString barcode = query.value(1).toString(); 253 | 254 | 255 | ui->cbID->addItem(barcode); 256 | } 257 | } 258 | } 259 | 260 | void frmProduct::LoadProduct(const int index){ 261 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 262 | 263 | QSqlQuery query; 264 | 265 | query.prepare( 266 | "SELECT * FROM " 267 | "product " 268 | "ORDER BY " 269 | "ID " 270 | "LIMIT " 271 | ":index, 1" 272 | ); 273 | 274 | query.bindValue(":index", index); 275 | 276 | if (query.exec()){ 277 | while (query.next()) { 278 | if(query.isActive()){ 279 | ui->cbReadonly->setChecked(true); 280 | ui->cbID->setCurrentIndex(index); 281 | ui->txtBarcode->setText(query.value(1).toString()); 282 | ui->txtName->setText(query.value(2).toString()); 283 | ui->txtDescription->setText(query.value(3).toString()); 284 | ui->sbQuantity->setValue(query.value(4).toInt()); 285 | ui->sbPurchasePrice->setValue(query.value(5).toDouble()); 286 | ui->sbSalePrice->setValue(query.value(6).toDouble()); 287 | ui->dteAdd->setDateTime(query.value(7).toDateTime()); 288 | ui->dteUpdate->setDateTime(query.value(8).toDateTime()); 289 | qDebug() << "Load Product Index: " << index; 290 | } 291 | } 292 | } else { 293 | QMessageBox::warning(this, "Ürün", "Ürün getirilirken bir hata oluştu!"); 294 | qDebug() << query.lastError(); 295 | return; 296 | } 297 | } 298 | 299 | void frmProduct::LoadProduct(const QString barcode){ 300 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 301 | 302 | QSqlQuery query; 303 | 304 | query.prepare( 305 | "SELECT * FROM " 306 | "product " 307 | "WHERE " 308 | "barcode = :barcode" 309 | ); 310 | 311 | query.bindValue(":barcode", barcode); 312 | 313 | if (query.exec()){ 314 | while (query.next()) { 315 | if(query.isActive()){ 316 | ui->txtBarcode->setText(query.value(1).toString()); 317 | ui->txtName->setText(query.value(2).toString()); 318 | ui->txtDescription->setText(query.value(3).toString()); 319 | ui->sbQuantity->setValue(query.value(4).toInt()); 320 | ui->sbPurchasePrice->setValue(query.value(5).toDouble()); 321 | ui->sbSalePrice->setValue(query.value(6).toDouble()); 322 | ui->dteAdd->setDateTime(query.value(7).toDateTime()); 323 | ui->dteUpdate->setDateTime(query.value(8).toDateTime()); 324 | qDebug() << "Load Product: " << barcode; 325 | } 326 | } 327 | } else { 328 | QMessageBox::warning(this, "Ürün", "Ürün getirilirken bir hata oluştu!"); 329 | qDebug() << query.lastError(); 330 | return; 331 | } 332 | } 333 | 334 | void frmProduct::on_cbID_activated(int index) 335 | { 336 | LoadProduct(ui->cbID->currentText()); 337 | } 338 | 339 | void frmProduct::on_cbReadonly_stateChanged(int arg1) 340 | { 341 | ui->txtBarcode->setReadOnly(m_isReadonly); 342 | ui->txtName->setReadOnly(m_isReadonly); 343 | ui->txtDescription->setReadOnly(m_isReadonly); 344 | ui->sbQuantity->setReadOnly(m_isReadonly); 345 | ui->sbPurchasePrice->setReadOnly(m_isReadonly); 346 | ui->sbSalePrice->setReadOnly(m_isReadonly); 347 | 348 | m_isReadonly = !m_isReadonly; 349 | } 350 | -------------------------------------------------------------------------------- /src/frmMain.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | frmMain 4 | 5 | 6 | 7 | 0 8 | 0 9 | 712 10 | 496 11 | 12 | 13 | 14 | Product Management Tool 15 | 16 | 17 | 0.000000000000000 18 | 19 | 20 | 21 | 22 | 23 | 20 24 | 70 25 | 681 26 | 381 27 | 28 | 29 | 30 | 0 31 | 32 | 33 | Qt::ElideNone 34 | 35 | 36 | true 37 | 38 | 39 | true 40 | 41 | 42 | false 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Product List 53 | 54 | 55 | 56 | 57 | 10 58 | 10 59 | 661 60 | 311 61 | 62 | 63 | 64 | 65 | 0 66 | 0 67 | 68 | 69 | 70 | 71 | 72 | 73 | 510 74 | 330 75 | 75 76 | 23 77 | 78 | 79 | 80 | Refresh 81 | 82 | 83 | 84 | 85 | 86 | 404 87 | 330 88 | 101 89 | 23 90 | 91 | 92 | 93 | Product Operations 94 | 95 | 96 | 97 | 98 | 99 | 10 100 | 330 101 | 471 102 | 16 103 | 104 | 105 | 106 | 107 | 8 108 | 75 109 | true 110 | 111 | 112 | 113 | <html><head/><body><p>You can single or double click on any product that listed above.</p></body></html> 114 | 115 | 116 | 117 | 118 | 119 | 590 120 | 330 121 | 75 122 | 23 123 | 124 | 125 | 126 | Clear 127 | 128 | 129 | 130 | 131 | 132 | Search 133 | 134 | 135 | 136 | 137 | 10 138 | 0 139 | 81 140 | 16 141 | 142 | 143 | 144 | Search By: 145 | 146 | 147 | 148 | 149 | 150 | 10 151 | 20 152 | 651 153 | 51 154 | 155 | 156 | 157 | Name 158 | 159 | 160 | 161 | 162 | 10 163 | 20 164 | 101 165 | 17 166 | 167 | 168 | 169 | By Name 170 | 171 | 172 | 173 | 174 | 175 | 200 176 | 20 177 | 113 178 | 20 179 | 180 | 181 | 182 | 183 | 184 | 185 | 100 186 | 20 187 | 51 188 | 16 189 | 190 | 191 | 192 | Name: 193 | 194 | 195 | 196 | 197 | 198 | 320 199 | 20 200 | 121 201 | 22 202 | 203 | 204 | 205 | EXACTLY 206 | 207 | 208 | 209 | EXACTLY 210 | 211 | 212 | 213 | 214 | STARTS WITH 215 | 216 | 217 | 218 | 219 | ENDS WITH 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 10 228 | 70 229 | 651 230 | 81 231 | 232 | 233 | 234 | Date 235 | 236 | 237 | 238 | 239 | 10 240 | 20 241 | 91 242 | 17 243 | 244 | 245 | 246 | By Date 247 | 248 | 249 | 250 | 251 | 252 | 200 253 | 20 254 | 194 255 | 22 256 | 257 | 258 | 259 | 260 | 261 | 262 | 100 263 | 20 264 | 81 265 | 17 266 | 267 | 268 | 269 | Date Add 270 | 271 | 272 | 273 | 274 | 275 | 100 276 | 50 277 | 81 278 | 17 279 | 280 | 281 | 282 | Date Update 283 | 284 | 285 | 286 | 287 | 288 | 400 289 | 20 290 | 47 291 | 13 292 | 293 | 294 | 295 | between 296 | 297 | 298 | 299 | 300 | 301 | 400 302 | 50 303 | 47 304 | 13 305 | 306 | 307 | 308 | between 309 | 310 | 311 | 312 | 313 | 314 | 450 315 | 20 316 | 194 317 | 22 318 | 319 | 320 | 321 | 322 | 323 | 324 | 200 325 | 50 326 | 194 327 | 22 328 | 329 | 330 | 331 | 332 | 333 | 334 | 450 335 | 50 336 | 194 337 | 22 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 10 346 | 150 347 | 651 348 | 51 349 | 350 | 351 | 352 | Quantity 353 | 354 | 355 | 356 | 357 | 10 358 | 20 359 | 101 360 | 17 361 | 362 | 363 | 364 | By Quantity 365 | 366 | 367 | 368 | 369 | 370 | 320 371 | 20 372 | 121 373 | 22 374 | 375 | 376 | 377 | 378 | LOWER 379 | 380 | 381 | 382 | 383 | HIGHER 384 | 385 | 386 | 387 | 388 | 389 | 390 | 200 391 | 20 392 | 81 393 | 22 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 90 402 | 290 403 | 75 404 | 23 405 | 406 | 407 | 408 | Search 409 | 410 | 411 | 412 | 413 | 414 | 10 415 | 290 416 | 75 417 | 23 418 | 419 | 420 | 421 | Reset 422 | 423 | 424 | 425 | 426 | 427 | 10 428 | 200 429 | 651 430 | 81 431 | 432 | 433 | 434 | Price 435 | 436 | 437 | 438 | 439 | 10 440 | 20 441 | 91 442 | 17 443 | 444 | 445 | 446 | By Price 447 | 448 | 449 | 450 | 451 | 452 | 100 453 | 20 454 | 101 455 | 17 456 | 457 | 458 | 459 | Purchase Price: 460 | 461 | 462 | 463 | 464 | 465 | 200 466 | 20 467 | 81 468 | 22 469 | 470 | 471 | 472 | 473 | 474 | 475 | 320 476 | 20 477 | 121 478 | 22 479 | 480 | 481 | 482 | 483 | LOWER 484 | 485 | 486 | 487 | 488 | HIGHER 489 | 490 | 491 | 492 | 493 | 494 | 495 | 200 496 | 50 497 | 81 498 | 22 499 | 500 | 501 | 502 | 503 | 504 | 505 | 100 506 | 50 507 | 101 508 | 17 509 | 510 | 511 | 512 | Sale Price: 513 | 514 | 515 | 516 | 517 | 518 | 320 519 | 50 520 | 121 521 | 22 522 | 523 | 524 | 525 | 526 | LOWER 527 | 528 | 529 | 530 | 531 | HIGHER 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 80 542 | 10 543 | 531 544 | 31 545 | 546 | 547 | 548 | 549 | Cambria Math 550 | 25 551 | 75 552 | true 553 | false 554 | false 555 | true 556 | 557 | 558 | 559 | PRODUCT MANAGEMENT TOOL 560 | 561 | 562 | false 563 | 564 | 565 | Qt::AlignCenter 566 | 567 | 568 | 569 | 570 | 571 | 20 572 | 50 573 | 261 574 | 16 575 | 576 | 577 | 578 | Welcome, NULL 579 | 580 | 581 | 582 | 583 | 584 | 585 | 0 586 | 0 587 | 712 588 | 21 589 | 590 | 591 | 592 | 593 | File 594 | 595 | 596 | 597 | 598 | 599 | Help 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | About 610 | 611 | 612 | 613 | 614 | Exit 615 | 616 | 617 | 618 | 619 | 620 | 621 | -------------------------------------------------------------------------------- /src/frmMain.cpp: -------------------------------------------------------------------------------- 1 | // ==================================================== 2 | // ProductManagementTool Copyright(C) 2018 Furkan Türkal 3 | // This program comes with ABSOLUTELY NO WARRANTY; This is free software, 4 | // and you are welcome to redistribute it under certain conditions; See 5 | // file LICENSE, which is part of this source code package, for details. 6 | // ==================================================== 7 | 8 | #include "frmMain.h" 9 | #include "ui_frmMain.h" 10 | #include "QSqlQueryModel" 11 | #include "frmProduct.h" 12 | #include "frmAbout.h" 13 | #include "frmLogin.h" 14 | #include 15 | #include "dbcontroller.h" 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | frmMain::frmMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::frmMain){ 31 | this->setVisible(false); 32 | this->hide(); 33 | 34 | ui->setupUi(this); 35 | window()->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, window()->size(), qApp->desktop()->availableGeometry())); 36 | this->statusBar()->setSizeGripEnabled(false); 37 | this->setFixedSize(this->maximumSize()); 38 | setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 39 | 40 | ui->dteSearchByDateAddMin->setDateTime(QDateTime::currentDateTime()); 41 | ui->dteSearchByDateAddMax->setDateTime(QDateTime::currentDateTime()); 42 | 43 | ui->dteSearchByDateUpdateMin->setDateTime(QDateTime::currentDateTime()); 44 | ui->dteSearchByDateUpdateMax->setDateTime(QDateTime::currentDateTime()); 45 | 46 | ui->tblProducts->setEditTriggers(QAbstractItemView::NoEditTriggers); 47 | ui->tblProducts->setSelectionBehavior(QAbstractItemView::SelectRows); 48 | ui->tblProducts->setSelectionMode(QAbstractItemView::SingleSelection); 49 | ui->tblProducts->resizeColumnsToContents(); 50 | ui->tblProducts->resizeRowsToContents(); 51 | ui->tblProducts->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); 52 | ui->tblProducts->horizontalHeader()->setResizeContentsPrecision(QHeaderView::Stretch); 53 | 54 | ui->txtSearchByName->setEnabled(false); 55 | ui->cbSearchByNamePattern->setEnabled(false); 56 | ui->cbSearchByDateAdd->setEnabled(false); 57 | ui->cbSearchByDateUpdate->setEnabled(false); 58 | ui->dteSearchByDateAddMin->setEnabled(false); 59 | ui->dteSearchByDateAddMax->setEnabled(false); 60 | ui->dteSearchByDateUpdateMin->setEnabled(false); 61 | ui->dteSearchByDateUpdateMax->setEnabled(false); 62 | ui->sbSearchByQuantity->setEnabled(false); 63 | ui->cbSearchByQuantityPattern->setEnabled(false); 64 | ui->cbSearchByPricePurchase->setEnabled(false); 65 | ui->cbSearchByPriceSale->setEnabled(false); 66 | ui->dsbSearchByPricePurchase->setEnabled(false); 67 | ui->cbSearchByPricePurchasePattern->setEnabled(false); 68 | ui->dsbSearchByPriceSale->setEnabled(false); 69 | ui->cbSearchByPriceSalePattern->setEnabled(false); 70 | 71 | 72 | DBController::instance()->SetupDB(); 73 | 74 | if(DBController::instance()->Connect()){ 75 | QTextStream(stdout) << "Connect OK!"; 76 | } else { 77 | QTextStream(stdout) << "Connect Fail!"; 78 | } 79 | 80 | 81 | m_frmProduct = new frmProduct(this); 82 | m_frmLogin = new frmLogin(this); 83 | 84 | bool signalAbout = connect(ui->actAbout, SIGNAL(triggered()), this, SLOT(showMenuAbout())); 85 | Q_ASSERT(signalAbout); 86 | 87 | bool signalQuit = connect(ui->actQuit, SIGNAL(triggered()), this, SLOT(quitApp())); 88 | Q_ASSERT(signalAbout); 89 | 90 | bool signalOK = connect(m_frmProduct, SIGNAL(Refresh()), this, SLOT(on_btnRefresh_clicked())); 91 | Q_ASSERT(signalOK); 92 | 93 | bool signalAccount = connect(m_frmLogin, SIGNAL(LoginOK(QString)), this, SLOT(loginOKWith(QString))); 94 | Q_ASSERT(signalAccount); 95 | 96 | m_frmLogin->show(); 97 | } 98 | 99 | frmMain::~frmMain() 100 | { 101 | delete ui; 102 | } 103 | 104 | void frmMain::closeEvent (QCloseEvent *event) 105 | { 106 | QMessageBox::StandardButton mboxSelect = QMessageBox::question( this, "Ürün Takip Yazılımı", "Çıkmak istediğinizden emin misiniz?", QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes); 107 | 108 | if (mboxSelect != QMessageBox::Yes) { 109 | event->ignore(); 110 | } else { 111 | event->accept(); 112 | quitApp(); 113 | } 114 | } 115 | 116 | void frmMain::quitApp(){ 117 | try { 118 | QMessageBox::StandardButton mboxSelect = QMessageBox::question( this, "Ürün Takip Yazılımı", "Çıkmak istediğinizden emin misiniz?", QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes); 119 | 120 | if (mboxSelect != QMessageBox::Yes) { 121 | return; 122 | } else { 123 | if(DBController::instance()->IsOpen()){ 124 | DBController::instance()->Disconnect(); 125 | } 126 | QApplication::quit(); 127 | } 128 | } catch (...) { 129 | qDebug() << "Hata"; 130 | QApplication::exit(1); 131 | } 132 | } 133 | 134 | void frmMain::showMenuAbout() 135 | { 136 | frmAbout * frm = new frmAbout(); 137 | frm->setModal(true); 138 | frm->show(); 139 | 140 | qDebug() << "Show Form About"; 141 | } 142 | 143 | void frmMain::loginOKWith(QString name){ 144 | m_frmLogin->hide(); 145 | this->show(); 146 | this->setVisible(true); 147 | this->setWindowOpacity(1); 148 | 149 | if(DBController::instance()->IsOpen()){ 150 | ui->statusbar->showMessage("Successully connected to MySQL database.", 1000); 151 | QTextStream(stdout) << "Connect OK!"; 152 | 153 | LoadProducts(); 154 | } else{ 155 | QMessageBox::critical(this, "ERROR", DBController::instance()->GetError()); 156 | QTextStream(stdout) << "Connect Fail!"; 157 | } 158 | 159 | ui->lblAccountInfo->setText("Welcome, " + name); 160 | } 161 | 162 | void frmMain::LoadProducts(){ 163 | qDebug() << "LoadProducts CALL"; 164 | 165 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 166 | 167 | QSqlQuery query; 168 | 169 | query.prepare( 170 | "SELECT * FROM " 171 | "product" 172 | ); 173 | 174 | if (query.exec()){ 175 | if(query.isActive()){ 176 | qDebug() << "LoadProducts OK"; 177 | queryModel->setQuery(query); 178 | 179 | queryModel->setHeaderData(0, Qt::Horizontal, "ID"); 180 | queryModel->setHeaderData(1, Qt::Horizontal, "Barcode"); 181 | queryModel->setHeaderData(2, Qt::Horizontal, "Name"); 182 | queryModel->setHeaderData(3, Qt::Horizontal, "Description"); 183 | queryModel->setHeaderData(4, Qt::Horizontal, "Quantity"); 184 | queryModel->setHeaderData(5, Qt::Horizontal, "Purchase Price"); 185 | queryModel->setHeaderData(6, Qt::Horizontal, "Sale Price"); 186 | queryModel->setHeaderData(7, Qt::Horizontal, "Add Date"); 187 | queryModel->setHeaderData(8, Qt::Horizontal, "Update Date"); 188 | 189 | ui->tblProducts->setModel(queryModel); 190 | ui->statusbar->showMessage("LoadProducts() success: " + queryModel->rowCount()); 191 | } else { 192 | QMessageBox::critical(this, "ERROR", "Query aktif değil!"); 193 | qDebug() << query.lastError(); 194 | return; 195 | } 196 | } else { 197 | QMessageBox::warning(this, "Ürün", "Ürün getirilirken bir hata oluştu!"); 198 | qDebug() << query.lastError(); 199 | return; 200 | } 201 | 202 | 203 | 204 | } 205 | 206 | void frmMain::on_btnRefresh_clicked() 207 | { 208 | this->LoadProducts(); 209 | } 210 | 211 | void frmMain::on_btnProductOperations_clicked() 212 | { 213 | m_frmProduct->setModal(true); 214 | m_frmProduct->show(); 215 | m_frmProduct->Clear(); 216 | } 217 | 218 | void frmMain::on_tblProducts_activated(const QModelIndex &index) 219 | { 220 | m_frmProduct->setModal(true); 221 | m_frmProduct->show(); 222 | m_frmProduct->LoadProduct(index.row()); 223 | } 224 | 225 | void frmMain::on_tblProducts_pressed(const QModelIndex &index) 226 | { 227 | LoadProductInfoToLabel(index); 228 | } 229 | 230 | void frmMain::LoadProductInfoToLabel(const QModelIndex &index){ 231 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 232 | 233 | QSqlQuery query; 234 | 235 | query.prepare( 236 | "SELECT * FROM " 237 | "product " 238 | "WHERE " 239 | "id = :id AND barcode = :barcode" 240 | ); 241 | 242 | query.bindValue(":id", index.sibling(index.row(), 0).data().toInt()); 243 | query.bindValue(":barcode", index.sibling(index.row(), 1).data().toString()); 244 | 245 | if (query.exec()){ 246 | while (query.next()) { 247 | if(query.isActive()){ 248 | 249 | ui->lblProductInfo->setText("Barcode: " + query.value(1).toString() + " - " + index.model()->headerData(index.column(), Qt::Horizontal).toString() + ": " + index.sibling(index.row(), index.column()).data().toString()); 250 | 251 | qDebug() << "Load Product Info: " << query.executedQuery(); 252 | } 253 | } 254 | } else { 255 | QMessageBox::warning(this, "Ürün", "Ürün getirilirken bir hata oluştu!"); 256 | qDebug() << query.lastError(); 257 | return; 258 | } 259 | } 260 | 261 | 262 | void frmMain::on_btnSearch_clicked() 263 | { 264 | QString queryString = "SELECT * FROM product "; 265 | QString queryStringWhereConcatenator = "WHERE "; 266 | 267 | if(ui->cbSearchByName->checkState()){ 268 | QString productName = ui->txtSearchByName->text().trimmed(); 269 | if(!productName.isEmpty() && productName.length() > 0){ 270 | queryString += queryStringWhereConcatenator; 271 | if(ui->cbSearchByNamePattern->currentIndex() == 0){ //Exactly 272 | queryString += "name = '" + productName + "' "; 273 | } else if (ui->cbSearchByNamePattern->currentIndex() == 1){ //Stars With 274 | queryString += "name like '" + productName + "%' "; 275 | } else if (ui->cbSearchByNamePattern->currentIndex() == 2){ //Ends With 276 | queryString += "name like '%" + productName + "' "; 277 | } 278 | queryStringWhereConcatenator = "AND "; 279 | } else { 280 | QMessageBox::warning(this, "Search", "SearchByName option selected but text is null or empty!"); 281 | return; 282 | } 283 | } 284 | 285 | if(ui->cbSearchByDate->checkState()){ 286 | QString time_format = "yyyy-MM-dd HH:mm:ss"; 287 | 288 | if(ui->cbSearchByDateAdd->checkState()){ 289 | QDateTimeEdit* min = ui->dteSearchByDateAddMin; 290 | QDateTimeEdit* max = ui->dteSearchByDateAddMax; 291 | 292 | QString smin = min->dateTime().toString(time_format); 293 | QString smax = max->dateTime().toString(time_format); 294 | 295 | queryString += queryStringWhereConcatenator; 296 | queryString += "dateAdd BETWEEN = " + smin + " AND " + smax + " "; 297 | queryStringWhereConcatenator = "AND "; 298 | } 299 | if(ui->cbSearchByDateUpdate->checkState()){ 300 | QDateTimeEdit* min = ui->dteSearchByDateUpdateMin; 301 | QDateTimeEdit* max = ui->dteSearchByDateUpdateMax; 302 | 303 | QString smin = min->dateTime().toString(time_format); 304 | QString smax = max->dateTime().toString(time_format); 305 | 306 | queryString += queryStringWhereConcatenator; 307 | queryString += "dateUpdate BETWEEN '" + smin + "' AND '" + smax + "' "; 308 | queryStringWhereConcatenator = "AND "; 309 | } 310 | } 311 | 312 | if(ui->cbSearchByQuantity->checkState()){ 313 | if(ui->sbSearchByQuantity->value() > 0){ 314 | queryString += queryStringWhereConcatenator; 315 | if(ui->cbSearchByQuantityPattern->currentIndex() == 0){ //LOWER 316 | queryString += "quantity <= " + QString::number(ui->sbSearchByQuantity->value()) + " "; 317 | }else if(ui->cbSearchByQuantityPattern->currentIndex() == 1){ //HIGHER 318 | queryString += "quantity >= " + QString::number(ui->sbSearchByQuantity->value()) + " "; 319 | } 320 | queryStringWhereConcatenator = "AND "; 321 | }else{ 322 | QMessageBox::warning(this, "Search", "SearchByQuantity option selected but value must be higher than 0!"); 323 | return; 324 | } 325 | 326 | } 327 | 328 | if(ui->cbSearchByPrice->checkState()){ 329 | if(ui->cbSearchByPricePurchase->checkState()){ 330 | if(ui->dsbSearchByPricePurchase->value() > 0.0){ 331 | queryString += queryStringWhereConcatenator; 332 | if(ui->cbSearchByPricePurchasePattern->currentIndex() == 0){ //LOWER 333 | queryString += "purchasePrice <= " + QString::number(ui->dsbSearchByPricePurchase->value()) + " "; 334 | }else if(ui->cbSearchByPricePurchasePattern->currentIndex() == 1){ //HIGHER 335 | queryString += "purchasePrice >= " + QString::number(ui->dsbSearchByPricePurchase->value()) + " "; 336 | } 337 | queryStringWhereConcatenator = "AND "; 338 | }else{ 339 | QMessageBox::warning(this, "Search", "SearchByPricePurchase option selected but value must be higher than 0.0!"); 340 | return; 341 | } 342 | 343 | } 344 | if(ui->cbSearchByPriceSale->checkState()){ 345 | if(ui->dsbSearchByPriceSale->value() > 0.0){ 346 | queryString += queryStringWhereConcatenator; 347 | if(ui->cbSearchByPriceSalePattern->currentIndex() == 0){ //LOWER 348 | queryString += "salePrice <= " + QString::number(ui->dsbSearchByPriceSale->value()) + " "; 349 | }else if(ui->cbSearchByPriceSalePattern->currentIndex() == 1){ //HIGHER 350 | queryString += "salePrice >= " + QString::number(ui->dsbSearchByPriceSale->value()) + " "; 351 | } 352 | queryStringWhereConcatenator = "AND "; 353 | }else{ 354 | QMessageBox::warning(this, "Search", "SearchByPriceSale option selected but value must be higher than 0.0!"); 355 | return; 356 | } 357 | } 358 | } 359 | 360 | qDebug() << "Search Query: " << queryString; 361 | 362 | QSqlQuery query; 363 | query.prepare(queryString); 364 | 365 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 366 | 367 | if (query.exec()){ 368 | if(query.isActive()){ 369 | qDebug() << "Search OK"; 370 | queryModel->setQuery(query); 371 | 372 | queryModel->setHeaderData(0, Qt::Horizontal, "ID"); 373 | queryModel->setHeaderData(1, Qt::Horizontal, "Barkod"); 374 | queryModel->setHeaderData(2, Qt::Horizontal, "Ürün"); 375 | queryModel->setHeaderData(3, Qt::Horizontal, "Açıklama"); 376 | queryModel->setHeaderData(4, Qt::Horizontal, "Adet"); 377 | queryModel->setHeaderData(5, Qt::Horizontal, "Alış Fiyatı"); 378 | queryModel->setHeaderData(6, Qt::Horizontal, "Satış Fiyatı"); 379 | queryModel->setHeaderData(7, Qt::Horizontal, "Eklenme Tarihi"); 380 | queryModel->setHeaderData(8, Qt::Horizontal, "Güncelleme Tarihi"); 381 | 382 | ui->tblProducts->setModel(queryModel); 383 | 384 | ui->twMain->setCurrentIndex(0); 385 | 386 | ui->statusbar->showMessage("Search() success: " + queryModel->rowCount()); 387 | } else { 388 | QMessageBox::critical(this, "ERROR", "Query aktif değil!"); 389 | qDebug() << query.lastError(); 390 | return; 391 | } 392 | } else { 393 | QMessageBox::critical(this, "ERROR", "Query exec error!"); 394 | qDebug() << query.lastError(); 395 | return; 396 | } 397 | } 398 | 399 | 400 | void frmMain::on_btnSearchReset_clicked() 401 | { 402 | ui->cbSearchByName->setChecked(false); 403 | ui->cbSearchByDate->setChecked(false); 404 | ui->cbSearchByDateAdd->setChecked(false); 405 | ui->cbSearchByDateUpdate->setChecked(false); 406 | ui->cbSearchByQuantity->setChecked(false); 407 | ui->cbSearchByPrice->setChecked(false); 408 | ui->cbSearchByPricePurchase->setChecked(false); 409 | ui->cbSearchByPriceSale->setChecked(false); 410 | 411 | ui->txtSearchByName->clear(); 412 | ui->cbSearchByNamePattern->setCurrentIndex(0); 413 | 414 | ui->dteSearchByDateAddMin->setDateTime(QDateTime::currentDateTime()); 415 | ui->dteSearchByDateAddMax->setDateTime(QDateTime::currentDateTime()); 416 | 417 | ui->dteSearchByDateUpdateMin->setDateTime(QDateTime::currentDateTime()); 418 | ui->dteSearchByDateUpdateMax->setDateTime(QDateTime::currentDateTime()); 419 | 420 | ui->sbSearchByQuantity->setValue(0); 421 | ui->cbSearchByQuantityPattern->setCurrentIndex(0); 422 | 423 | ui->dsbSearchByPricePurchase->setValue(0.0); 424 | ui->cbSearchByPricePurchasePattern->setCurrentIndex(0); 425 | 426 | ui->dsbSearchByPriceSale->setValue(0.0); 427 | ui->cbSearchByPriceSalePattern->setCurrentIndex(0); 428 | } 429 | 430 | void frmMain::on_btnClear_clicked() 431 | { 432 | QSqlQueryModel * queryModel = new QSqlQueryModel(); 433 | queryModel->setHeaderData(0, Qt::Horizontal, "ID"); 434 | queryModel->setHeaderData(1, Qt::Horizontal, "Barkod"); 435 | queryModel->setHeaderData(2, Qt::Horizontal, "Ürün"); 436 | queryModel->setHeaderData(3, Qt::Horizontal, "Açıklama"); 437 | queryModel->setHeaderData(4, Qt::Horizontal, "Adet"); 438 | queryModel->setHeaderData(5, Qt::Horizontal, "Alış Fiyatı"); 439 | queryModel->setHeaderData(6, Qt::Horizontal, "Satış Fiyatı"); 440 | queryModel->setHeaderData(7, Qt::Horizontal, "Eklenme Tarihi"); 441 | queryModel->setHeaderData(8, Qt::Horizontal, "Güncelleme Tarihi"); 442 | ui->tblProducts->setModel(queryModel); 443 | 444 | } 445 | 446 | void frmMain::on_cbSearchByName_stateChanged(int arg1) 447 | { 448 | ui->txtSearchByName->setEnabled(arg1); 449 | ui->cbSearchByNamePattern->setEnabled(arg1); 450 | } 451 | 452 | void frmMain::on_cbSearchByDate_stateChanged(int arg1) 453 | { 454 | ui->cbSearchByDateAdd->setEnabled(arg1); 455 | ui->cbSearchByDateUpdate->setEnabled(arg1); 456 | if(!arg1){ 457 | ui->dteSearchByDateAddMin->setEnabled(arg1); 458 | ui->dteSearchByDateAddMax->setEnabled(arg1); 459 | 460 | ui->dteSearchByDateUpdateMin->setEnabled(arg1); 461 | ui->dteSearchByDateUpdateMax->setEnabled(arg1); 462 | }else{ 463 | ui->dteSearchByDateAddMin->setEnabled(ui->cbSearchByDateAdd->checkState()); 464 | ui->dteSearchByDateAddMax->setEnabled(ui->cbSearchByDateAdd->checkState()); 465 | 466 | ui->dteSearchByDateUpdateMin->setEnabled(ui->cbSearchByDateUpdate->checkState()); 467 | ui->dteSearchByDateUpdateMax->setEnabled(ui->cbSearchByDateUpdate->checkState()); 468 | } 469 | } 470 | 471 | void frmMain::on_cbSearchByDateAdd_stateChanged(int arg1) 472 | { 473 | ui->dteSearchByDateAddMin->setEnabled(arg1); 474 | ui->dteSearchByDateAddMax->setEnabled(arg1); 475 | } 476 | 477 | void frmMain::on_cbSearchByDateUpdate_stateChanged(int arg1) 478 | { 479 | ui->dteSearchByDateUpdateMin->setEnabled(arg1); 480 | ui->dteSearchByDateUpdateMax->setEnabled(arg1); 481 | } 482 | 483 | void frmMain::on_cbSearchByQuantity_stateChanged(int arg1) 484 | { 485 | ui->sbSearchByQuantity->setEnabled(arg1); 486 | ui->cbSearchByQuantityPattern->setEnabled(arg1); 487 | } 488 | 489 | void frmMain::on_cbSearchByPrice_stateChanged(int arg1) 490 | { 491 | ui->cbSearchByPricePurchase->setEnabled(arg1); 492 | ui->cbSearchByPriceSale->setEnabled(arg1); 493 | if(!arg1){ 494 | ui->dsbSearchByPricePurchase->setEnabled(arg1); 495 | ui->cbSearchByPricePurchasePattern->setEnabled(arg1); 496 | 497 | ui->dsbSearchByPriceSale->setEnabled(arg1); 498 | ui->cbSearchByPriceSalePattern->setEnabled(arg1); 499 | }else{ 500 | ui->dsbSearchByPricePurchase->setEnabled(ui->cbSearchByPricePurchase->checkState()); 501 | ui->cbSearchByPricePurchasePattern->setEnabled(ui->cbSearchByPricePurchase->checkState()); 502 | 503 | ui->dsbSearchByPriceSale->setEnabled(ui->cbSearchByPriceSale->checkState()); 504 | ui->cbSearchByPriceSalePattern->setEnabled(ui->cbSearchByPriceSale->checkState()); 505 | } 506 | } 507 | 508 | void frmMain::on_cbSearchByPricePurchase_stateChanged(int arg1) 509 | { 510 | ui->dsbSearchByPricePurchase->setEnabled(arg1); 511 | ui->cbSearchByPricePurchasePattern->setEnabled(arg1); 512 | } 513 | 514 | void frmMain::on_cbSearchByPriceSale_stateChanged(int arg1) 515 | { 516 | ui->dsbSearchByPriceSale->setEnabled(arg1); 517 | ui->cbSearchByPriceSalePattern->setEnabled(arg1); 518 | } 519 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------