Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #6 from camrein/cleanup
Browse files Browse the repository at this point in the history
Cleaned certain parts of codes and added versioning of builds.
  • Loading branch information
camrein authored Aug 29, 2016
2 parents f7e0792 + b636885 commit a57cd36
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build:
pull: true
commands:
# Compilation
- EZ_VERSION=$CI_TAG
- if [ $$arch = 32 ]; then target=i686; fi
- if [ $$arch = 64 ]; then target=x86_64; fi
- pacman -S --needed --noconfirm --noprogressbar mingw-w64-${target}-pkg-config mingw-w64-${target}-qt5 zip
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then source /opt/qt55/bin/qt55-env.sh ; fi

script:
- EZ_VERSION=$TRAVIS_TAG
- qmake -v
- qmake -config release EzGraver.pro
- make
Expand Down
2 changes: 2 additions & 0 deletions EzGraverCli/EzGraverCli.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(../common.pri)

QT += core
QT += gui

Expand Down
11 changes: 8 additions & 3 deletions EzGraverCli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ std::ostream& operator<<(std::ostream& rhv, QString const& lhv) {
void showHelp() {
std::cout << "Usage: EzGraverCli <option> [arguments...]\n\n";
std::cout << "Available options:\n";
std::cout << " a <port> - Shows the available ports\n";
std::cout << " v - Prints the version information\n";
std::cout << " a - Shows the available ports\n";
std::cout << " h <port> - Moves the engraver to the home position\n";
std::cout << " s <port> - Starts the engraving process with the burn time 60\n";
std::cout << " p <port> - Pauses the engraver\n";
Expand Down Expand Up @@ -60,9 +61,13 @@ void handleArguments(QStringList const& arguments) {
}

auto argument = arguments[1][0].toLatin1();
if(argument == 'a') {
switch(argument) {
case 'a':
showAvailablePorts();
return;
case 'v':
std::cout << "EzGraver " << EZ_VERSION << '\n';
return;
}

if(arguments.size() < 3) {
Expand Down Expand Up @@ -103,7 +108,7 @@ void handleArguments(QStringList const& arguments) {
}
}

int main(int argc, char *argv[]) {
int main(int argc, char* argv[]) {
QCoreApplication app{argc, argv};

QStringList arguments{};
Expand Down
1 change: 1 addition & 0 deletions EzGraverLib/EzGraverLib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Project created by QtCreator 2016-08-22T09:05:45
#
#-------------------------------------------------
include(../common.pri)

QT += gui
QT += serialport
Expand Down
3 changes: 3 additions & 0 deletions EzGraverUi/EzGraverUi.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Project created by QtCreator 2016-08-22T09:16:50
#
#-------------------------------------------------
include(../common.pri)

QT += core
QT += gui
Expand Down Expand Up @@ -30,3 +31,5 @@ else:unix: LIBS += -L$$OUT_PWD/../EzGraverLib/ -lEzGraverLib

INCLUDEPATH += $$PWD/../EzGraverLib
DEPENDPATH += $$PWD/../EzGraverLib

DISTFILES +=
2 changes: 2 additions & 0 deletions EzGraverUi/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "mainwindow.h"
#include <QApplication>
#include <QString>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
w.setWindowTitle(QString{"EzGraver %1"}.arg(EZ_VERSION));

return a.exec();
}
5 changes: 3 additions & 2 deletions EzGraverUi/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdexcept>
#include <functional>

MainWindow::MainWindow(QWidget *parent)
MainWindow::MainWindow(QWidget* parent)
: QMainWindow{parent}, _ui{new Ui::MainWindow},
_portTimer{}, _ezGraver{}, _connected{false}, _imageLoaded{false} {
_ui->setupUi(this);
Expand All @@ -25,10 +25,11 @@ MainWindow::MainWindow(QWidget *parent)
}

MainWindow::~MainWindow() {
delete _ui;
}

void MainWindow::setupBindings() {
connect(_ui->burnTime, &QSlider::valueChanged, [this](const int& v) { _ui->burnTimeLabel->setText(QString::number(v)); });
connect(_ui->burnTime, &QSlider::valueChanged, [this](int const& v) { _ui->burnTimeLabel->setText(QString::number(v)); });

connect(this, &MainWindow::connectedChanged, _ui->ports, &QComboBox::setDisabled);
connect(this, &MainWindow::connectedChanged, _ui->connect, &QPushButton::setDisabled);
Expand Down
2 changes: 1 addition & 1 deletion EzGraverUi/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private slots:
void dropEvent(QDropEvent* event);

private:
std::shared_ptr<Ui::MainWindow> _ui;
Ui::MainWindow* _ui;
QTimer _portTimer;

std::shared_ptr<EzGraver> _ezGraver;
Expand Down
3 changes: 3 additions & 0 deletions EzGraverUi/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<height>512</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>No Image Loaded</string>
</property>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Beside the graphical user interface, EzGraver provides a pure command line inter
Usage: EzGraverCli <option> [arguments...]

Available options:
v - Prints the version information
a - Shows the available ports
h <port> - Moves the engraver to the home position
s <port> - Starts the engraving process with the burn time 60
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ install:
- set PATH=%PATH%;%QT_DIR%\bin

before_build:
- set EZ_VERSION=%APPVEYOR_REPO_TAG_NAME%
- cd EzGraverCli & qmake -config release -tp vc -spec win32-msvc2015 EzGraverCli.pro & cd ..
- cd EzGraverLib & qmake -config release -tp vc -spec win32-msvc2015 EzGraverLib.pro & cd ..
- cd EzGraverUi & qmake -config release -tp vc -spec win32-msvc2015 EzGraverUi.pro & cd ..
Expand Down
1 change: 1 addition & 0 deletions common.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DEFINES += EZ_VERSION=\\\"$$(EZ_VERSION)\\\"

0 comments on commit a57cd36

Please sign in to comment.