diff --git a/Resources.qrc b/Resources.qrc index bfa814e..837b27b 100644 --- a/Resources.qrc +++ b/Resources.qrc @@ -1,5 +1,5 @@ - assets/favIcon-196x196.png + assets/embToolsLogo.png diff --git a/about.ui b/about.ui index db0d228..646fa67 100644 --- a/about.ui +++ b/about.ui @@ -6,45 +6,116 @@ 0 0 - 400 + 489 300 Dialog - - - - 120 - 110 - 111 - 81 - - - - - - - :/assets/favIcon-196x196.png - - - true - - - - - - 90 - 60 - 201 - 41 - - - - embTools by wwderw 2020 - - + + + + + 0 + + + + Author + + + + + 110 + 0 + 221 + 141 + + + + + + + :/assets/embToolsLogo.png + + + true + + + + + + 110 + 180 + 249 + 28 + + + + + 14 + + + + 2020 Evan "wwderw" West + + + + + + 3rd Party Libraries + + + + + 30 + 10 + 381 + 20 + + + + + 15 + + + + 3rd Party Libraries used by embTools + + + + + + 40 + 50 + 391 + 20 + + + + embTools is created on the following free software libraries + + + Qt::AlignCenter + + + + + + 20 + 90 + 81 + 20 + + + + *Qt LGPLv3 + + + + + + diff --git a/database.cpp b/database.cpp index 3be07e5..0ba5e04 100644 --- a/database.cpp +++ b/database.cpp @@ -9,13 +9,15 @@ #include #include #include +#include + database::database(QWidget *parent) : QDialog(parent), ui(new Ui::database) { ui->setupUi(this); //Setup Window Titles - setWindowTitle("embTools - Client Database"); + setWindowTitle("embTools - Client/Vendor Database"); @@ -28,36 +30,10 @@ database::~database() delete ui; } -void database::on_client_clicked() -{ - - - - QSqlQueryModel * model = new QSqlQueryModel(); - connOpen(); - - QSqlQuery query; - query.prepare("SELECT * FROM Client"); - - query.exec(); - model->setQuery(query); - - //Override the 256 default row limit - - while (model->canFetchMore()) - model->fetchMore(); - - - ui-> display ->setModel(model); - - qDebug()<< (model->rowCount()); - connClose(); -} - - void database::on_addClient_clicked() { + if (ui->clientVendor->currentIndex() == 0){ QSqlQueryModel * model = new QSqlQueryModel(); connOpen(); QSqlQuery query; @@ -87,12 +63,46 @@ void database::on_addClient_clicked() ui->busName->clear(); ui->website->clear(); - on_client_clicked(); + + }else{ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + QSqlQuery query; + + QString name, email, phone, mobile, address, billing, busName, website; + name=ui->name->text(); + email=ui->email->text(); + phone=ui->phone->text(); + mobile=ui->mobile->text(); + address=ui->address->text(); + billing=ui->billing->text(); + busName=ui->busName->text(); + website=ui->website->text(); + + query.prepare("INSERT INTO Vendor (Name, Email, Phone, Mobile, Address, BillingAddress, BusinessName, Website) VALUES ('"+name+"', '"+email+"', '"+phone+"', '"+mobile+"', '"+address+"', '"+billing+"', '"+busName+"', '"+website+"')"); + query.exec(); + connClose(); + + + //Clear Entry Fields + ui->name->clear(); + ui->email->clear(); + ui->phone->clear(); + ui->mobile->clear(); + ui->address->clear(); + ui->billing->clear(); + ui->busName->clear(); + ui->website->clear(); + } + + } void database::on_delete_2_clicked() { + + if(ui->clientVendor->currentIndex() == 0){ QSqlQueryModel * model = new QSqlQueryModel(); connOpen(); QSqlQuery query; @@ -115,12 +125,37 @@ void database::on_delete_2_clicked() ui->billing->clear(); ui->busName->clear(); ui->website->clear(); + }else{ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + QSqlQuery query; + + QString name; + name=ui->name->text(); + + + query.prepare("DELETE FROM Vendor where Name == '"+name+"'"); + query.exec(); + connClose(); + + + //Clear Entry Fields + ui->name->clear(); + ui->email->clear(); + ui->phone->clear(); + ui->mobile->clear(); + ui->address->clear(); + ui->billing->clear(); + ui->busName->clear(); + ui->website->clear(); + } + - on_client_clicked(); } void database::on_update_clicked() { + if(ui->clientVendor->currentIndex() == 0){ QSqlQueryModel * model = new QSqlQueryModel(); connOpen(); QSqlQuery query; @@ -150,11 +185,43 @@ void database::on_update_clicked() ui->busName->clear(); ui->website->clear(); - on_client_clicked(); + }else{ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + QSqlQuery query; + + QString name, email, phone, mobile, address, billing, busName, website; + name=ui->name->text(); + email=ui->email->text(); + phone=ui->phone->text(); + mobile=ui->mobile->text(); + address=ui->address->text(); + billing=ui->billing->text(); + busName=ui->busName->text(); + website=ui->website->text(); + + query.prepare("UPDATE Vendor set Name='"+name+"', Email='"+email+"', Phone='"+phone+"', Mobile='"+mobile+"', Address='"+address+"', BillingAddress='"+billing+"', BusinessName='"+busName+"', Website='"+website+"' where Name='"+name+"'"); + query.exec(); + connClose(); + + + //Clear Entry Fields + ui->name->clear(); + ui->email->clear(); + ui->phone->clear(); + ui->mobile->clear(); + ui->address->clear(); + ui->billing->clear(); + ui->busName->clear(); + ui->website->clear(); + } + + } void database::on_sortName_clicked() { + if(ui->clientVendor->currentIndex() == 0){ QSqlQueryModel * model = new QSqlQueryModel(); connOpen(); QSqlQuery query; @@ -173,10 +240,31 @@ void database::on_sortName_clicked() ui-> display ->setModel(model); connClose(); + }else{ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + QSqlQuery query; + + query.prepare("SELECT * FROM Vendor ORDER BY 1 ASC"); + query.exec(); + + model->setQuery(query); + + //Override the 256 default row limit + + while (model->canFetchMore()) + model->fetchMore(); + + + ui-> display ->setModel(model); + connClose(); + } + } void database::on_sortBus_clicked() { + if (ui->clientVendor->currentIndex() == 0){ QSqlQueryModel * model = new QSqlQueryModel(); connOpen(); QSqlQuery query; @@ -194,4 +282,158 @@ void database::on_sortBus_clicked() ui-> display ->setModel(model); connClose(); + + }else{ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + QSqlQuery query; + + query.prepare("SELECT * FROM Vendor ORDER BY 7 ASC"); + query.exec(); + + model->setQuery(query); + + //Override the 256 default row limit + + while (model->canFetchMore()) + model->fetchMore(); + + + ui-> display ->setModel(model); + connClose(); + } +} + + + +void database::on_clientVendor_activated(const QString &arg1) +{ + if (ui->clientVendor->currentIndex() == 0){ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + + QSqlQuery query; + query.prepare("SELECT * FROM Client"); + + query.exec(); + model->setQuery(query); + + //Override the 256 default row limit + + while (model->canFetchMore()) + model->fetchMore(); + + + ui-> display ->setModel(model); + + qDebug()<< (model->rowCount()); + connClose(); + }else{ + QSqlQueryModel * model = new QSqlQueryModel(); + connOpen(); + + QSqlQuery query; + query.prepare("SELECT * FROM Vendor"); + + query.exec(); + model->setQuery(query); + + //Override the 256 default row limit + + while (model->canFetchMore()) + model->fetchMore(); + + + ui-> display ->setModel(model); + + qDebug()<< (model->rowCount()); + connClose(); + } +} + +void database::on_export_2_clicked() +{ + if(ui->clientVendor->currentIndex() == 0){ + connOpen(); + QSqlQueryModel * model = new QSqlQueryModel(); + QSqlQuery query; + QString series; + + + query.prepare("SELECT * FROM Client ORDER BY 2 ASC"); + + query.exec(); + model->setQuery(query); + + //Override the 256 default row limit + + while (model->canFetchMore()) + model->fetchMore(); + + ui-> display ->setModel(model); + connClose(); + + //Collect Data for Exporting + QString seriesData; + int rows = model -> rowCount(); + int cols = model-> columnCount(); + + for (int i = 0; idata(model->index(i,j)).toString(); + seriesData += ", "; + + } + seriesData += "\n" ; + } + + QFile csv("Clients.csv"); + if(csv.open(QIODevice::WriteOnly)){ + QTextStream output(&csv); + output<setQuery(query); + + //Override the 256 default row limit + + while (model->canFetchMore()) + model->fetchMore(); + + ui-> display ->setModel(model); + connClose(); + + //Collect Data for Exporting + QString seriesData; + int rows = model -> rowCount(); + int cols = model-> columnCount(); + + for (int i = 0; idata(model->index(i,j)).toString(); + seriesData += ", "; + + } + seriesData += "\n" ; + } + + QFile csv("Vendors.csv"); + if(csv.open(QIODevice::WriteOnly)){ + QTextStream output(&csv); + output< - - - - - - Client - - - - - + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + false + + + true + + + true + + + true + + + false + + + 150 + + + false + + + true + + + true + + + false + + + false + + + false + + + false + + + false + + + + Qt::Horizontal @@ -60,7 +113,7 @@ - + Qt::Horizontal @@ -179,21 +232,28 @@ - Add Client + Add Entry - Delete Client + Delete Entry - Update Client + Update Entry + + + + + + + Export @@ -215,7 +275,7 @@ - + @@ -272,65 +332,21 @@ - - - - - 0 - 0 - - - - - 0 - 0 - - - - QAbstractScrollArea::AdjustIgnored - - - false - - - true - - - true + + + + 0 - - true - - - false - - - 150 - - - false - - - true - - - true - - - false - - - false - - - false - - - false - - - false - + + + Client + + + + + Vendor + + diff --git a/embTools.pro b/embTools.pro index d28b7d8..5f04e81 100644 --- a/embTools.pro +++ b/embTools.pro @@ -26,7 +26,7 @@ SOURCES += \ quotesheet.cpp \ stitchplayer.cpp \ unitconversion.cpp \ - vendordatabase.cpp + HEADERS += \ about.h \ @@ -35,7 +35,7 @@ HEADERS += \ quotesheet.h \ stitchplayer.h \ unitconversion.h \ - vendordatabase.h + FORMS += \ about.ui \ @@ -44,7 +44,7 @@ FORMS += \ quotesheet.ui \ stitchplayer.ui \ unitconversion.ui \ - vendordatabase.ui + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin @@ -54,3 +54,5 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin RESOURCES += \ Resources.qrc +DISTFILES += + diff --git a/main.cpp b/main.cpp index 5b06146..9fd9ff2 100644 --- a/main.cpp +++ b/main.cpp @@ -8,7 +8,7 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; - splash->setPixmap(QPixmap("assets/favIcon-196x196.png")); + splash->setPixmap(QPixmap("assets/embToolsLogo.png")); splash->show(); MainWindow w; diff --git a/mainwindow.cpp b/mainwindow.cpp index 8db70b6..58eaee8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -87,11 +87,7 @@ void MainWindow::on_actionDatabase_triggered() Database->show(); } -void MainWindow::on_actionVender_Database_triggered() -{ - VendorDatabase = new vendorDatabase(this); - VendorDatabase->show(); -} + void MainWindow::on_actionQuote_Sheet_triggered() { diff --git a/mainwindow.h b/mainwindow.h index f629179..4a7606c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -3,7 +3,6 @@ #include "stitchplayer.h" #include "unitconversion.h" #include "database.h" -#include "vendordatabase.h" #include "quotesheet.h" #include "about.h" #include @@ -39,8 +38,6 @@ private slots: void on_actionDatabase_triggered(); - void on_actionVender_Database_triggered(); - void on_actionQuote_Sheet_triggered(); void on_actionAbout_triggered(); @@ -70,7 +67,6 @@ private slots: stitchPlayer *StitchPlayer; unitConversion *UnitConversion; database *Database; - vendorDatabase *VendorDatabase; quoteSheet *QuoteSheet; about *About; diff --git a/mainwindow.ui b/mainwindow.ui index b3c77e0..9703ed4 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -14,8 +14,8 @@ MainWindow - - assets/favIcon-196x196.pngassets/favIcon-196x196.png + + :/assets/embToolsLogo.png:/assets/embToolsLogo.png @@ -374,7 +374,7 @@ 0 0 1096 - 25 + 32 @@ -385,7 +385,6 @@ - @@ -486,12 +485,7 @@ - Client Database - - - - - Vender Database + Client/Vendor Database @@ -543,6 +537,8 @@ - + + + diff --git a/quotesheet.cpp b/quotesheet.cpp index 6f1745a..a5be63b 100644 --- a/quotesheet.cpp +++ b/quotesheet.cpp @@ -78,9 +78,9 @@ void quoteSheet::on_getQuote_clicked() quote = setup + markup + (digitizing - discount); + QString finalQuote = QString::number(quote); - - ui->quoteDisplay->display(quote); + ui->quoteDisplay->setText("$"+finalQuote); diff --git a/quotesheet.ui b/quotesheet.ui index 364fa19..301d295 100644 --- a/quotesheet.ui +++ b/quotesheet.ui @@ -32,9 +32,9 @@ 0 - -385 - 1110 - 1085 + -448 + 1108 + 1152 @@ -534,468 +534,14 @@ - - - - 16777215 - 16777208 - - - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 241 - 241 - - - - - - - 255 - 255 - 255 - - - - - - - 248 - 248 - 248 - - - - - - - 120 - 120 - 120 - - - - - - - 161 - 161 - 161 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 241 - 241 - 241 - - - - - - - 0 - 0 - 0 - - - - - - - 248 - 248 - 248 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 241 - 241 - - - - - - - 255 - 255 - 255 - - - - - - - 248 - 248 - 248 - - - - - - - 120 - 120 - 120 - - - - - - - 161 - 161 - 161 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 241 - 241 - 241 - - - - - - - 0 - 0 - 0 - - - - - - - 248 - 248 - 248 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - - - 120 - 120 - 120 - - - - - - - 241 - 241 - 241 - - - - - - - 255 - 255 - 255 - - - - - - - 248 - 248 - 248 - - - - - - - 120 - 120 - 120 - - - - - - - 161 - 161 - 161 - - - - - - - 120 - 120 - 120 - - - - - - - 255 - 255 - 255 - - - - - - - 120 - 120 - 120 - - - - - - - 241 - 241 - 241 - - - - - - - 241 - 241 - 241 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 241 - 241 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - + - 25 + 14 - - 1 - - - true - - - 12 + + Final Quote