Commit 34744f27 authored by Hugo Hörnquist's avatar Hugo Hörnquist

New serial should now be done.

parent 72634781
......@@ -2,11 +2,12 @@
all: kassa admin
# This doesn't clean bad_com build dir
# This doesn't clean serial build dir
clean:
-rm -rf build-{kassa,admin}
-rm stupan-{kassa,admin}
-rm libcom.so
make -C serial clean
install:
-mkdir -p /opt/stupan
......@@ -18,7 +19,7 @@ installicon:
cp icons/*.png /usr/share/pixmaps/
libcom.so:
make -C bad_com
make -C serial
kassa: libcom.so
-@mkdir build-kassa
......
......@@ -35,8 +35,7 @@ HEADERS += mainwindow.h \
FORMS += mainwindow.ui
unix|win32: LIBS += -L$$PWD/../serial/ -lcom
unix: CFLAGS += -I$$PWD/../
unix:!macx: LIBS += -L$$PWD/../serial/ -lcom
INCLUDEPATH += $$PWD/../serial
DEPENDPATH += $$PWD/../serial
......@@ -24,8 +24,6 @@
#include <QPainter>
#include "tableprinter.h"
#include <cstring>
#include "comboboxitemdelegate.h"
#include "validatordelegate.h"
#include "moneydelegate.h"
......@@ -34,7 +32,7 @@
#include "qintornullvalidator.h"
#include "cash_drawer.h"
#include "serial.h"
// TODO maybe make it somehow possible to remove product
// or have a button to delete all "dead" products
......@@ -77,8 +75,6 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
setbuf(stdout, NULL);
QString HOME = QString::fromLocal8Bit(getenv("HOME"));
QString port = "/dev/ttyACM0";
......
......@@ -20,7 +20,7 @@ HEADERS += widget.h \
FORMS += widget.ui
unix|win32: LIBS += -L$$PWD/../bad_com/ -lcom
unix:!macx: LIBS += -L$$PWD/../serial/ -lcom
INCLUDEPATH += $$PWD/../bad_com
DEPENDPATH += $$PWD/../bad_com
INCLUDEPATH += $$PWD/../serial
DEPENDPATH += $$PWD/../serial
......@@ -11,8 +11,6 @@
#include <QMessageBox>
#include <QFileInfo>
#include <cstring>
#include "utils.h"
#include "serial.h"
......@@ -31,11 +29,6 @@ Widget::Widget(QWidget *parent) :
{
ui->setupUi(this);
// makes stdout unbuffered
// might be needed for the till opener
// atlest when compiled on non windows it's needed for debug
setbuf(stdout, NULL);
QString HOME = QString::fromLocal8Bit(getenv("HOME"));
QString port = "/dev/ttyACM0";
......@@ -60,9 +53,7 @@ Widget::Widget(QWidget *parent) :
}
}
port_name = new char[port.length() + 1];
std::strcpy(port_name, port.toStdString().c_str());
port_setup(port_name, 9600);
port_fd = port_setup(port.toStdString().c_str(), B9600);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
......@@ -577,5 +568,5 @@ void Widget::update_sumChange_strings()
}
void Widget::open_till() {
port_write(port_name, '1');
port_write(port_fd, '1');
}
......@@ -59,7 +59,7 @@ private:
Ui::Widget *ui;
int amount_of_products_last_buy;
char* port_name;
int port_fd;
bool double_click_enabled;
QVariant lastDrainageId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment