Skip to content

Commit

Permalink
Bumped version;
Browse files Browse the repository at this point in the history
Removed Macros.h EXEC_SILENT temporary moved to functions.h
Various other cleanups
  • Loading branch information
konserw committed Aug 24, 2014
1 parent 6d6d92c commit b43729e
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 54 deletions.
3 changes: 1 addition & 2 deletions CustomerEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

#include "CustomerEdit.h"
#include "ui_CustomerEdit.h"

#include "functions.h"
#include <QSqlQuery>
#include <QString>
#include <QtSql>
#include "Macros.h"

CustomerEdit::~CustomerEdit()
{
Expand Down
4 changes: 3 additions & 1 deletion CustomerSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "CustomerSearch.h"
#include "Macros.h"

#include <QSqlTableModel>
#include <QSqlRecord>
#include <QtWidgets>
/*
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
Expand All @@ -29,6 +30,7 @@
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QTableView>
#include <QtWidgets/QVBoxLayout>
*/

CustomerSearch::CustomerSearch(QWidget *parent) :
QWidget(parent)
Expand Down
2 changes: 0 additions & 2 deletions CustomerSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "ui_CustomerSelection.h"

#include <QSqlQuery>
#include "Macros.h"


CustomerSelection::CustomerSelection(QWidget *parent) :
QDialog(parent),
Expand Down
2 changes: 1 addition & 1 deletion Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <QSettings>
#include "User.h"
#include "Database.h"
#include "Macros.h"
#include "functions.h"

void insert_klient(const QString& skrot, const QString& full, const QString& tytul, const QString& imie, const QString& nazwisko, const QString& adres)
{
Expand Down
1 change: 0 additions & 1 deletion Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,4 @@ void insert_klient(const QString &skrot, const QString &full, const QString &tyt
void insert_zapisane(const QString& nr_oferty, int id_klienta, const QString& data, int uid, const QString& zapytanie_data, const QString& zapytanie_nr, int dostawa, int termin, int platnosc, int oferta, const QString& uwagi);
void insert_combo(const QString& typ, const QString& sh, const QString& lo);

//QStringList getUsersList();
#endif // DATABASE_H
1 change: 0 additions & 1 deletion LoadDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "LoadDialog.h"
#include "ui_LoadDialog.h"
#include "Macros.h"
#include "OfferSearch.h"

#include <QSqlTableModel>
Expand Down
2 changes: 1 addition & 1 deletion LoginDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ LoginDialog::LoginDialog() :
QObject::connect(m_db, &Database::newUsers, this, &LoginDialog::updateUserList);
QObject::connect(m_db, &Database::changeStatus, ui->info, &QLabel::setText);
connect(this, &LoginDialog::userListRequested, m_db, &Database::getUsersList);
// m_db->setupInitialConnection();

emit(userListRequested());
}

Expand Down
4 changes: 2 additions & 2 deletions LoginDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class LoginDialog : public QDialog
Q_OBJECT

public:
explicit LoginDialog(); //konstruktor inicjalizujący elementy interface, user** służy do przekazania zwrotnego danych wybranego użytkownika
explicit LoginDialog();
~LoginDialog();

public slots:
void ok(); //slot obsługujący przycisk ok - sprawdza zgodność skrótu wpisanego hasła ze skrótem zapisanym w klasie user i tworzy połączenie z bazą MySQL (klasa QSqlDatabase)
void ok();
void updateUserList(const QStringList&);

signals:
Expand Down
24 changes: 0 additions & 24 deletions Macros.h

This file was deleted.

2 changes: 1 addition & 1 deletion MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "LoginDialog.h"
#include "LoadDialog.h"
#include "User.h"
#include "Macros.h"

#include "AddConditionDialog.h"
#include "SettingsDialog.h"

Expand Down
3 changes: 0 additions & 3 deletions MerchandiseListModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ class MerchandiseListModel : public QAbstractTableModel

public slots:
void clear();

void setKurs(double kurs);

///dodawanie towarów do tabeli (wywoływane przez sygnał z dialogu dodajTowar)
void changeItemCount(int id, double ile);

protected:
Expand Down
5 changes: 5 additions & 0 deletions MerchandiseNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ void MerchandiseNew::acc()
{
ui->pushButton_ok->setEnabled(false);

/**********************
* TODO
* Przenieść do klasy Database !!!
*/

QSqlQuery q;
q.exec(QString("INSERT INTO `merchandise` (`id`, `code`, `description`, `price`, `unit`) VALUES (NULL, '%1', '%2', '%3', '%4')")
.arg(ui->kod->text())
Expand Down
1 change: 0 additions & 1 deletion MerchandiseSearchModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,4 @@ void MerchandiseSearchModel::setFilter(const QString &filter)
QVariant MerchandiseSearchModel::d(const QModelIndex &index, int col) const
{
return sourceModel()->data(index.sibling(index.row(), col));
// return sourceModel()->data(sourceModel()->index(index.row(), col, index.parent()));
}
1 change: 0 additions & 1 deletion MerchendiseSelectionDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ void MerchendiseSelectionDelegate::setModelData(QWidget *editor, QAbstractItemMo
spinBox->interpretText();
double count = spinBox->value();
model->setData(index, count, Qt::EditRole);
// emit itemCountChanged(model->data(index, Qt::UserRole).toInt(), count);
}

void MerchendiseSelectionDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const
Expand Down
3 changes: 0 additions & 3 deletions MerchendiseSelectionDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class MerchendiseSelectionDelegate : public QItemDelegate
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;

void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;

signals:
// void itemCountChanged(int id, double count) const;
};

#endif // MERCHENDISESELECTIONDELEGATE_H
5 changes: 4 additions & 1 deletion User.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ User::~User()

void User::nrOfertyInkrement()
{
/********************
* Też do bazy ?
*/

_nrOferty++;

QString s = QString("UPDATE users SET nrOferty=%1 WHERE uid=%2").arg(_nrOferty).arg(_uid);
Expand All @@ -67,7 +71,6 @@ void User::nrOfertyInkrement()
_nrOferty--;
qCritical() << "Zapytanie mysql zkonczone niepowodzeniem!";
qDebug() << "\tError text: " << q.lastError().text();
// throw std::exception("Failed to execute query");
}
}

Expand Down
2 changes: 1 addition & 1 deletion User.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class QString;
class QSqlDatabase;
/*!
* \briefklasa przechowująca dane użytkownika
* \brief Klasa przechowująca dane użytkownika
*/
class User
{
Expand Down
20 changes: 20 additions & 0 deletions functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ class QString;
#include <QCoreApplication>
#include <QDir>

#include <QMessageBox>
#include <QDebug>
#include <QSqlError>
#include <QSqlDatabase>
#include <QTextStream>
#include <QSqlQuery>
#include <QFile>

#define EXEC_SILENT(s) \
do{ \
if(q.exec(s) == false) \
{ \
qDebug() << "Zapytanie mysql zkończone niepowodzeniem!"; \
qDebug() << "\tZapytanie mysql: " << s; \
qDebug() << "\tError text: " << q.lastError().text(); \
QMessageBox::warning(NULL, "error", "Wystąpił błąd połączenia z bazą danych. Sprawdź połączenie i spróbuj ponownie"); \
return; \
} \
}while(0)

/*!
* \brief filePath wyznacza bezwzględną ścieżka do pliku o nazwie jak plik wykonywalny z rozszerzeniem podanym jako parametr
* \param suffix Rozszerzenie pliku (podawać z kropką)
Expand Down
9 changes: 1 addition & 8 deletions kOferta.pro
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG += c++11

TEMPLATE = app

DEFINES += VER=2.44
DEFINES += VER=2.45

win32 {
RC_FILE = res/koferta.rc
Expand All @@ -40,12 +40,7 @@ win32 {

DEFINES += RELEASE
DEFINES += WIN32
# DEFINES += QT_NO_DEBUG_OUTPUT

#LIBS += -L"C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86" -lUser32 -lAdvAPI32
#LIBS += -L"C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64" -lUser32 -lAdvAPI32
#INCLUDEPATH += "C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/include"
#LIBS += -L"C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/lib" -llibmysql
LIBS += -L"C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib" -llibmysql
}

Expand All @@ -59,7 +54,6 @@ DEPENDPATH += . res
HEADERS += \
Database.h \
LoadDialog.h \
Macros.h \
MainWindow.h \
User.h \
functions.h \
Expand Down Expand Up @@ -138,5 +132,4 @@ TRANSLATIONS = \
OTHER_FILES += \
LICENSE.md \
README.md \
hosts \
res/koferta.rc

0 comments on commit b43729e

Please sign in to comment.