initial commit

This commit is contained in:
NeoTheFox 2015-02-28 18:12:34 +03:00
commit 04a1d317be
10 changed files with 1745 additions and 0 deletions

26
Wizard.pro Normal file
View File

@ -0,0 +1,26 @@
#-------------------------------------------------
#
# Project created by QtCreator 2015-02-26T16:14:20
#
#-------------------------------------------------
QT += core gui serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Wizard
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
settingswindow.cpp
HEADERS += mainwindow.h \
settingswindow.h
FORMS += mainwindow.ui \
settingswindow.ui
RESOURCES += \
settings.qrc

16
main.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("NeoTheFox");
QCoreApplication::setOrganizationDomain("https://github.com/NeoTheFox");
QCoreApplication::setApplicationName("RepRaptor");
MainWindow w;
w.show();
return a.exec();
}

453
mainwindow.cpp Normal file
View File

@ -0,0 +1,453 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->fileBox->setDisabled(true);
ui->sendBtn->setDisabled(true);
ui->pauseBtn->setDisabled(true);
ui->progressBar->setValue(0);
ui->controlBox->setDisabled(true);
ui->consoleGroup->setDisabled(true);
ui->pauseBtn->setDisabled("true");
//ui->extruderlcd->setSegmentStyle();
ui->baudbox->addItem(QString::number(4800));
ui->baudbox->addItem(QString::number(9600));
ui->baudbox->addItem(QString::number(115200));
ui->baudbox->addItem(QString::number(128000));
ui->baudbox->addItem(QString::number(230400));
ui->baudbox->addItem(QString::number(250000));
ui->baudbox->addItem(QString::number(460800));
ui->baudbox->addItem(QString::number(500000));
ui->baudbox->setCurrentIndex(2);
ui->extruderlcd->setPalette(Qt::red);
ui->bedlcd->setPalette(Qt::red);
sending = false;
paused = false;
commandDone = false;
checkingTemperature = true;
currentLine = 0;
serialupdate();
connect(&printer, SIGNAL(readyRead()), this, SLOT(readSerial()));
connect(&statusTimer, SIGNAL(timeout()), this, SLOT(checkStatus()));
connect(&sendTimer, SIGNAL(timeout()), this, SLOT(sendNext()));
if(settings.value("core/statusinterval").toInt()) statusTimer.setInterval(settings.value("core/statusinterval").toInt());
else statusTimer.setInterval(3000);
statusTimer.start();
if(settings.value("core/senderinterval").toInt()) sendTimer.setInterval(settings.value("core/senderinterval").toInt());
else sendTimer.setInterval(50);
sendTimer.start();
}
MainWindow::~MainWindow()
{
if(gfile.isOpen()) gfile.close();
if(printer.isOpen()) printer.close();
settings.beginWriteArray("user/recentfiles");
for(int i = 0; i < recentFiles.size(); i++)
{
settings.setArrayIndex(i);
settings.setValue("user/recentfile", recentFiles.at(i));
}
settings.endArray();
delete ui;
}
void MainWindow::open()
{
QString filename;
filename = QFileDialog::getOpenFileName(this, tr("Open GCODE"), "/home/", tr("GCODE (*.g *.gcode *.nc)"));
gfile.setFileName(filename);
if(!recentFiles.contains(filename))
{
if(recentFiles.size() < 5)
{
recentFiles.append(filename);
}
else
{
recentFiles.push_front(filename);
}
}
parseFile(gfile);
}
void MainWindow::parseFile(QFile &file)
{
gcode.clear();
if (file.open(QIODevice::ReadOnly))
{
QTextStream in(&file);
while (!in.atEnd())
{
QString line = in.readLine();
if(!line.startsWith(";"))
{
gcode.append(line);
}
}
file.close();
ui->fileBox->setEnabled(true);
ui->filename->setText(file.fileName().split("/").last());
ui->filelines->setText(QString::number(gcode.size()) + QString("/0 lines"));
}
}
bool MainWindow::sendLine(QString line)
{
if(printer.isOpen())
{
if(printer.write(line.toUtf8()+'\n'))
{
printMsg(line);
return true;
}
else
{
return false;
}
}
else return false;
}
void MainWindow::serialupdate()
{
ui->serialBox->clear();
QList<QSerialPortInfo> list = QSerialPortInfo::availablePorts();
for(int i = 0; i < list.size(); i++)
{
ui->serialBox->addItem(list.at(i).portName());
}
}
void MainWindow::serialconnect()
{
if(!printer.isOpen())
{
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
{
if(info.portName() == ui->serialBox->currentText())
{
printerinfo = info;
break;
}
}
printer.setPort(printerinfo);
printer.setFlowControl(QSerialPort::HardwareControl);
switch(ui->baudbox->currentText().toInt())
{
case 4800:
printer.setBaudRate(QSerialPort::Baud4800);
break;
case 9600:
printer.setBaudRate(QSerialPort::Baud9600);
break;
case 115200:
printer.setBaudRate(QSerialPort::Baud115200);
break;
default:
printer.setBaudRate(QSerialPort::Baud115200);
break;
}
if(printer.open(QIODevice::ReadWrite))
{
ui->connectBtn->setText("Disconnect");
ui->sendBtn->setDisabled(false);
ui->pauseBtn->setDisabled(false);
ui->progressBar->setValue(0);
ui->controlBox->setDisabled(false);
ui->consoleGroup->setDisabled(false);
}
}
else if(printer.isOpen())
{
printer.close();
ui->connectBtn->setText("Connect");
ui->sendBtn->setDisabled(true);
ui->pauseBtn->setDisabled(true);
ui->progressBar->setValue(0);
ui->controlBox->setDisabled(true);
ui->consoleGroup->setDisabled(true);
}
}
//Buttons start
void MainWindow::xplus()
{
QString command = "G91\n G1 X" + ui->stepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::xminus()
{
QString command = "G91\n G1 X-" + ui->stepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::xhome()
{
sendLine("G28 X0");
}
void MainWindow::yplus()
{
QString command = "G91\n G1 Y" + ui->stepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::yminus()
{
QString command = "G91\n G1 Y-" + ui->stepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::yhome()
{
sendLine("G28 Y0");
}
void MainWindow::zplus()
{
QString command = "G91\n G1 Z" + ui->stepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::zminus()
{
QString command = "G91\n G1 Z-" + ui->stepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::zhome()
{
sendLine("G28 Z0");
}
void MainWindow::eplus()
{
QString command = "G91\n G1 E" + ui->estepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::eminus()
{
QString command = "G91\n G1 E-" + ui->estepspin->text() + "\n G90";
sendLine(command);
}
void MainWindow::ezero()
{
sendLine("G92 E0");
}
void MainWindow::homeall()
{
sendLine("G28");
}
void MainWindow::on_sendbtn_clicked()
{
sendLine(ui->sendtext->text());
}
void MainWindow::on_fanonbtn_clicked()
{
sendLine("M106");
}
void MainWindow::on_fanoffbtn_clicked()
{
sendLine("M107");
}
void MainWindow::on_atxonbtn_clicked()
{
sendLine("M80");
}
void MainWindow::on_atxoffbtn_clicked()
{
sendLine("M81");
}
void MainWindow::on_etmpset_clicked()
{
QString command = "M104 S" + ui->etmpspin->text();
sendLine(command);
}
void MainWindow::on_etmpoff_clicked()
{
sendLine("M104 S0");
}
void MainWindow::on_btmpset_clicked()
{
QString command = "M140 S" + ui->btmpspin->text();
sendLine(command);
}
void MainWindow::on_btmpoff_clicked()
{
sendLine("M140 S0");
}
//Buttons end
void MainWindow::readSerial()
{
if(printer.canReadLine())
{
QByteArray data = printer.readLine();
if(data.startsWith("T:"))
{
QString extmp = "";
QString btmp = "";
for(int i = 2; data.at(i) != '/'; i++)
{
extmp+=data.at(i);
}
for(int i = data.indexOf("B:")+2; data.at(i) != '/'; i++)
{
btmp+=data.at(i);
}
ui->extruderlcd->display(extmp.toDouble());
ui->bedlcd->display(btmp.toDouble());
}
else if(data.startsWith("ok") || data.startsWith("wait")) commandDone = true;
printMsg(QString(data));
}
}
void MainWindow::printMsg(const char* text)
{
QTextCursor cursor = ui->terminal->textCursor();
cursor.movePosition(QTextCursor::End);
//QTextBlockFormat bf;
//QTextCharFormat cf;
//cursor.insertBlock(bf, cf);
cursor.insertText(text);
cursor.insertText("\n");
ui->terminal->setTextCursor(cursor);
;
}
void MainWindow::printMsg(QString text)
{
QTextCursor cursor = ui->terminal->textCursor();
cursor.movePosition(QTextCursor::End);
//QTextBlockFormat bf;
//QTextCharFormat cf;
//cursor.insertBlock(bf, cf);
cursor.insertText(text);
cursor.insertText("\n");
ui->terminal->setTextCursor(cursor);
}
void MainWindow::on_sendBtn_clicked()
{
if(sending)
{
sending = false;
ui->sendBtn->setText("Send");
ui->pauseBtn->setDisabled("true");
}
else if(!sending)
{
sending=true;
ui->sendBtn->setText("Stop");
ui->pauseBtn->setEnabled("true");
}
ui->progressBar->setValue(0);
currentLine = 0;
}
void MainWindow::sendNext()
{
if(sending && !paused && printer.bytesToWrite() < 100 && commandDone)
{
if(currentLine >= gcode.size()) //check if we are at the end of array
{
sending = false;
currentLine = 0;
ui->sendBtn->setText("Send");
ui->pauseBtn->setDisabled("true");
return;
}
sendLine(gcode.at(currentLine));
currentLine++;
commandDone = false;
ui->filelines->setText(QString::number(gcode.size()) + QString("/") + QString::number(currentLine) + QString(" Lines"));
ui->progressBar->setValue(((float)currentLine/gcode.size()) * 100);
}
}
void MainWindow::on_pauseBtn_clicked()
{
if(paused)
{
paused = false;
ui->pauseBtn->setText("Pause");
}
else
{
paused = true;
ui->pauseBtn->setText("Resume");
}
}
void MainWindow::checkStatus()
{
if(checkingTemperature) sendLine("M105");
}
void MainWindow::on_checktemp_stateChanged(int arg1)
{
if(arg1) checkingTemperature = true;
else checkingTemperature = false;
}
void MainWindow::on_actionSettings_triggered()
{
SettingsWindow settingswindow(this);
settingswindow.exec();
}
void MainWindow::on_releasebtn_clicked()
{
sendLine("M84");
}

90
mainwindow.h Normal file
View File

@ -0,0 +1,90 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFileDialog>
#include <QtSerialPort/QtSerialPort>
#include <QFile>
#include <QFuture>
#include <QVector>
#include <QTextStream>
#include <QTimer>
#include <QSettings>
#include "settingswindow.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
QFile gfile;
QVector<QString> gcode;
QTimer sendTimer;
QTimer statusTimer;
QSettings settings;
QStringList recentFiles;
private:
Ui::MainWindow *ui;
void parseFile(QFile &file);
QSerialPort printer;
QSerialPortInfo printerinfo;
bool sending;
bool paused;
bool commandDone;
bool checkingTemperature;
int currentLine;
private slots:
void open();
void serialconnect();
void serialupdate();
bool sendLine(QString line);
void readSerial();
void printMsg(QString text);
void printMsg(const char* text);
void sendNext();
void checkStatus();
void xplus();
void yplus();
void zplus();
void eplus();
void xminus();
void yminus();
void zminus();
void eminus();
void xhome();
void yhome();
void zhome();
void ezero();
void homeall();
void on_sendbtn_clicked();
void on_fanonbtn_clicked();
void on_fanoffbtn_clicked();
void on_atxonbtn_clicked();
void on_atxoffbtn_clicked();
void on_etmpset_clicked();
void on_etmpoff_clicked();
void on_btmpset_clicked();
void on_btmpoff_clicked();
void on_sendBtn_clicked();
void on_pauseBtn_clicked();
void on_checktemp_stateChanged(int arg1);
void on_actionSettings_triggered();
void on_releasebtn_clicked();
};
#endif // MAINWINDOW_H

827
mainwindow.ui Normal file
View File

@ -0,0 +1,827 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>768</width>
<height>498</height>
</rect>
</property>
<property name="windowTitle">
<string>RepRaptor</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QGroupBox" name="serialGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>189</width>
<height>94</height>
</rect>
</property>
<property name="title">
<string>Serial</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="portsBtn">
<property name="text">
<string>Ports</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="serialBox"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="connectBtn">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="baudbox"/>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="fileBox">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>190</width>
<height>136</height>
</rect>
</property>
<property name="title">
<string>File</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="filename">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Filename: </string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="filelines">
<property name="text">
<string>Lines:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="sendBtn">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pauseBtn">
<property name="text">
<string>Pause</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="consoleGroup">
<property name="geometry">
<rect>
<x>480</x>
<y>10</y>
<width>280</width>
<height>371</height>
</rect>
</property>
<property name="title">
<string>Console</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTextBrowser" name="terminal">
<property name="acceptDrops">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="clearbtn">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="sendtext"/>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="sendbtn">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="controlBox">
<property name="geometry">
<rect>
<x>210</x>
<y>10</y>
<width>261</width>
<height>311</height>
</rect>
</property>
<property name="title">
<string>Control</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="8">
<widget class="QPushButton" name="homexbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>H X</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="xminusbtn">
<property name="text">
<string>X-</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="xplusbtn">
<property name="text">
<string>X+</string>
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="QPushButton" name="homeybtn">
<property name="text">
<string>H Y</string>
</property>
</widget>
</item>
<item row="2" column="8">
<widget class="QPushButton" name="homezbtn">
<property name="text">
<string>H Z</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QDoubleSpinBox" name="estepspin">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>150.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>E tmp</string>
</property>
</widget>
</item>
<item row="6" column="5" colspan="2">
<widget class="QPushButton" name="etmpset">
<property name="text">
<string>SET</string>
</property>
</widget>
</item>
<item row="6" column="7" colspan="2">
<widget class="QPushButton" name="etmpoff">
<property name="text">
<string>OFF</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>B tmp</string>
</property>
</widget>
</item>
<item row="7" column="5" colspan="2">
<widget class="QPushButton" name="btmpset">
<property name="text">
<string>SET</string>
</property>
</widget>
</item>
<item row="7" column="7" colspan="2">
<widget class="QPushButton" name="btmpoff">
<property name="text">
<string>OFF</string>
</property>
</widget>
</item>
<item row="8" column="2" colspan="3">
<widget class="QPushButton" name="fanonbtn">
<property name="text">
<string>FAN ON</string>
</property>
</widget>
</item>
<item row="8" column="6" colspan="3">
<widget class="QPushButton" name="fanoffbtn">
<property name="text">
<string>FAN OFF</string>
</property>
</widget>
</item>
<item row="9" column="2" colspan="3">
<widget class="QPushButton" name="atxonbtn">
<property name="text">
<string>ATX ON</string>
</property>
</widget>
</item>
<item row="9" column="6" colspan="3">
<widget class="QPushButton" name="atxoffbtn">
<property name="text">
<string>ATX OFF</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="eplusbtn">
<property name="text">
<string>E+</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="zplusbtn">
<property name="text">
<string>Z+</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QPushButton" name="ezerobtn">
<property name="text">
<string>E0</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="centerbtn">
<property name="text">
<string>C</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="yplusbtn">
<property name="text">
<string>Y+</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="yminusbtn">
<property name="text">
<string>Y-</string>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QPushButton" name="eminusbtn">
<property name="text">
<string>E-</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="zminusbtn">
<property name="text">
<string>Z-</string>
</property>
</widget>
</item>
<item row="6" column="2" colspan="3">
<widget class="QSpinBox" name="etmpspin">
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="7" column="2" colspan="3">
<widget class="QSpinBox" name="btmpspin">
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="5" column="4" colspan="5">
<widget class="QDoubleSpinBox" name="stepspin">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="4" colspan="4">
<widget class="QLabel" name="label">
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="text">
<string>E Step</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QPushButton" name="homeallbtn">
<property name="text">
<string>Home All</string>
</property>
</widget>
</item>
<item row="3" column="4" colspan="5">
<widget class="QPushButton" name="releasebtn">
<property name="text">
<string>Release</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="statusGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>270</y>
<width>166</width>
<height>121</height>
</rect>
</property>
<property name="title">
<string>Status</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Extruder</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLCDNumber" name="extruderlcd">
<property name="segmentStyle">
<enum>QLCDNumber::Outline</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Bed</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLCDNumber" name="bedlcd">
<property name="segmentStyle">
<enum>QLCDNumber::Outline</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checktemp">
<property name="text">
<string>Check temperature</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>768</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
<addaction name="actionRecent"/>
<addaction name="separator"/>
<addaction name="actionSettings"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open...</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionRecent">
<property name="text">
<string>Recent</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionSettings">
<property name="text">
<string>Settings</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections>
<connection>
<sender>actionOpen</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>open()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>247</x>
<y>217</y>
</hint>
</hints>
</connection>
<connection>
<sender>portsBtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>serialupdate()</slot>
<hints>
<hint type="sourcelabel">
<x>61</x>
<y>88</y>
</hint>
<hint type="destinationlabel">
<x>247</x>
<y>217</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionExit</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>247</x>
<y>217</y>
</hint>
</hints>
</connection>
<connection>
<sender>connectBtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>serialconnect()</slot>
<hints>
<hint type="sourcelabel">
<x>61</x>
<y>117</y>
</hint>
<hint type="destinationlabel">
<x>247</x>
<y>217</y>
</hint>
</hints>
</connection>
<connection>
<sender>homexbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>xhome()</slot>
<hints>
<hint type="sourcelabel">
<x>434</x>
<y>88</y>
</hint>
<hint type="destinationlabel">
<x>383</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>clearbtn</sender>
<signal>clicked()</signal>
<receiver>terminal</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>624</x>
<y>335</y>
</hint>
<hint type="destinationlabel">
<x>654</x>
<y>275</y>
</hint>
</hints>
</connection>
<connection>
<sender>xplusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>xplus()</slot>
<hints>
<hint type="sourcelabel">
<x>327</x>
<y>117</y>
</hint>
<hint type="destinationlabel">
<x>383</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>sendtext</sender>
<signal>returnPressed()</signal>
<receiver>sendbtn</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>540</x>
<y>369</y>
</hint>
<hint type="destinationlabel">
<x>548</x>
<y>397</y>
</hint>
</hints>
</connection>
<connection>
<sender>yminusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>yminus()</slot>
<hints>
<hint type="sourcelabel">
<x>292</x>
<y>146</y>
</hint>
<hint type="destinationlabel">
<x>383</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>yplusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>yplus()</slot>
<hints>
<hint type="sourcelabel">
<x>292</x>
<y>88</y>
</hint>
<hint type="destinationlabel">
<x>383</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>xminusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>xminus()</slot>
<hints>
<hint type="sourcelabel">
<x>256</x>
<y>120</y>
</hint>
<hint type="destinationlabel">
<x>189</x>
<y>43</y>
</hint>
</hints>
</connection>
<connection>
<sender>zplusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>zplus()</slot>
<hints>
<hint type="sourcelabel">
<x>359</x>
<y>82</y>
</hint>
<hint type="destinationlabel">
<x>356</x>
<y>-10</y>
</hint>
</hints>
</connection>
<connection>
<sender>zminusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>zminus()</slot>
<hints>
<hint type="sourcelabel">
<x>362</x>
<y>156</y>
</hint>
<hint type="destinationlabel">
<x>209</x>
<y>151</y>
</hint>
</hints>
</connection>
<connection>
<sender>ezerobtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>ezero()</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>123</y>
</hint>
<hint type="destinationlabel">
<x>220</x>
<y>117</y>
</hint>
</hints>
</connection>
<connection>
<sender>homezbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>zhome()</slot>
<hints>
<hint type="sourcelabel">
<x>438</x>
<y>144</y>
</hint>
<hint type="destinationlabel">
<x>209</x>
<y>199</y>
</hint>
</hints>
</connection>
<connection>
<sender>homeybtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>yhome()</slot>
<hints>
<hint type="sourcelabel">
<x>434</x>
<y>117</y>
</hint>
<hint type="destinationlabel">
<x>383</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>eplusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>eplus()</slot>
<hints>
<hint type="sourcelabel">
<x>397</x>
<y>93</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
<y>42</y>
</hint>
</hints>
</connection>
<connection>
<sender>eminusbtn</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>eminus()</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>142</y>
</hint>
<hint type="destinationlabel">
<x>475</x>
<y>173</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>open()</slot>
<slot>serialupdate()</slot>
<slot>serialconnect()</slot>
<slot>xhome()</slot>
<slot>homeall()</slot>
<slot>xplus()</slot>
<slot>xminus()</slot>
<slot>yplus()</slot>
<slot>yminus()</slot>
<slot>zplus()</slot>
<slot>zminus()</slot>
<slot>zhome()</slot>
<slot>eplus()</slot>
<slot>eminus()</slot>
<slot>ezero()</slot>
<slot>yhome()</slot>
</slots>
</ui>

1
settings.qrc Normal file
View File

@ -0,0 +1 @@
<RCC/>

151
settings.ui Normal file
View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QGroupBox" name="hardwaregroup">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>181</width>
<height>65</height>
</rect>
</property>
<property name="title">
<string>Hardware</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Bed Size</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="xsize">
<property name="text">
<string>200</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="ysize">
<property name="text">
<string>200</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="savebtn">
<property name="geometry">
<rect>
<x>220</x>
<y>270</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
<widget class="QPushButton" name="cancelbtn">
<property name="geometry">
<rect>
<x>310</x>
<y>270</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<widget class="QGroupBox" name="intervalgroup">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>181</width>
<height>96</height>
</rect>
</property>
<property name="title">
<string>Intervals</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Sender</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sendinterval">
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="statusinterval">
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>3000</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

27
settingswindow.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "settingswindow.h"
#include "ui_settingswindow.h"
SettingsWindow::SettingsWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingsWindow)
{
ui->setupUi(this);
if(settings.value("core/senderinterval").toInt()) ui->senderbox->setValue(settings.value("core/senderinterval").toInt());
else ui->senderbox->setValue(50);
if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt());
else ui->senderbox->setValue(3000);
}
SettingsWindow::~SettingsWindow()
{
delete ui;
}
void SettingsWindow::on_buttonBox_accepted()
{
settings.setValue("core/senderinterval", ui->senderbox->value());
settings.setValue("core/statusinterval", ui->statusbox->value());
}

29
settingswindow.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef SETTINGSWINDOW_H
#define SETTINGSWINDOW_H
#include <QDialog>
#include <QSettings>
namespace Ui {
class SettingsWindow;
}
class SettingsWindow : public QDialog
{
Q_OBJECT
public:
explicit SettingsWindow(QWidget *parent = 0);
QSettings settings;
~SettingsWindow();
private slots:
void on_buttonBox_accepted();
private:
Ui::SettingsWindow *ui;
};
#endif // SETTINGSWINDOW_H

125
settingswindow.ui Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsWindow</class>
<widget class="QDialog" name="SettingsWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>260</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QGroupBox" name="intervalsGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>144</width>
<height>96</height>
</rect>
</property>
<property name="title">
<string>Intervals</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Sender</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="senderbox">
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="statusbox">
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsWindow</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsWindow</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>