Compare commits

..

No commits in common. "master" and "v0.2" have entirely different histories.
master ... v0.2

33 changed files with 708 additions and 2379 deletions

8
.gitignore vendored
View File

@ -1,8 +0,0 @@
RepRaptor
Makefile
*.user
*.o
ui_*.h
moc_*
qrc_*
*~

View File

@ -1,26 +0,0 @@
language: cpp
compiler: gcc
sudo: require
dist: trusty
before_install:
- sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
- sudo apt-get update -qq
install:
- sudo apt-get -y install qt58base qt58serialport qt58tools
- source /opt/qt58/bin/qt58-env.sh
script:
- qmake PREFIX=/usr
- make -j4
- sudo make INSTALL_ROOT=appdir install ; sudo chown -R $USER appdir ; find appdir/
after_success:
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
- chmod a+x linuxdeployqt*.AppImage
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage
- find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
- curl --upload-file ./RepRaptor*.AppImage https://transfer.sh/RepRaptor-git.$(git rev-parse --short HEAD)-x86_64.AppImage

View File

@ -1,24 +1,16 @@
![RepRaptor logo](http://reprap.org/mediawiki/images/b/b0/RepRaptor_logo2.png) ![RepRaptor logo](http://reprap.org/mediawiki/images/b/b0/RepRaptor_logo2.png)
# RepRaptor [![Build Status](https://travis-ci.org/NeoTheFox/RepRaptor.svg?branch=master)](https://travis-ci.org/NeoTheFox/RepRaptor) # RepRaptor
A Qt RepRap gcode sender/host controller aimed to be fast and minimalistic. A Qt RepRap gcode sender/host controller aimed to be fast and minimalistic.
Right now the project is in early stage. This means some features are still absent, but it is already usable. Right now the project is in early stage.
## Screenshots ## Screenshots
![Screenshot](http://reprap.org/mediawiki/images/6/6c/RepRaptor-v0.2.png) ![RepRaptor printing a file](http://reprap.org/mediawiki/images/2/2d/RepRaptor_screenshot0.png)
## Install via PPA ## Building on Ubuntu 14.04.2
Since 0.3 release PPA is available for Ubuntu 14.04 and Linux Mint 17 (and later).
```
sudo add-apt-repository ppa:soniczerops/repraptor-dev
sudo apt-get update
sudo apt-get install repraptor
```
## Building on Ubuntu 14.04
``` ```
sudo apt-get install qt5-default libqt5serialport libqt5serialport5-dev git build-essential libudev-dev sudo apt-get install libqt5serialport5-dev git build-essential
git clone https://github.com/NeoTheFox/RepRaptor && cd RepRaptor git clone https://github.com/NeoTheFox/RepRaptor && cd RepRaptor
@ -26,15 +18,10 @@ qmake RepRaptor.pro
make make
``` ```
And if you want to install system-wide
```
sudo make install
```
## Links ## Links
- [Binary release downloads (Windows, Linux)](https://github.com/NeoTheFox/RepRaptor/releases) - [Binary release downloads](https://github.com/NeoTheFox/RepRaptor/releases)
- [RepRap wiki](http://reprap.org/wiki/RepRaptor) - [RepRap wiki](http://reprap.org/wiki/RepRaptor)
- [AUR](https://aur.archlinux.org/packages/repraptor-git/) - [Windows dev builds](http://reprap.org/wiki/File:RepRaptor-000-windows.zip)
[![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.svg)](https://gratipay.com/NeoTheFox/) [![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.svg)](https://gratipay.com/NeoTheFox/)

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Name=RepRaptor
Comment=A Qt RepRap gcode sender/host controller aimed to be fast and minimalistic.
Exec=RepRaptor
Icon=repraptor
Terminal=false
Type=Application
Categories=Utility;Application;

View File

@ -5,7 +5,7 @@
# #
#------------------------------------------------- #-------------------------------------------------
QT += core gui serialport QT += core gui serialport concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@ -13,28 +13,6 @@ TARGET = RepRaptor
TEMPLATE = app TEMPLATE = app
CONFIG += static CONFIG += static
unix {
#VARIABLES
isEmpty(PREFIX) {
PREFIX = /usr
}
BINDIR = $$PREFIX/bin
DATADIR =$$PREFIX/share
DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
#MAKE INSTALL
INSTALLS += target desktop icon
target.path =$$BINDIR
desktop.path = $$DATADIR/applications
desktop.files += $${TARGET}.desktop
icon.path = $$DATADIR/icons
icon.files += icons/repraptor.png
}
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp \ mainwindow.cpp \
@ -42,34 +20,24 @@ SOURCES += main.cpp\
aboutwindow.cpp \ aboutwindow.cpp \
errorwindow.cpp \ errorwindow.cpp \
erroricon.cpp \ erroricon.cpp \
sdwindow.cpp \ sdwindow.cpp
eepromwindow.cpp \
parser.cpp \
sender.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
settingswindow.h \ settingswindow.h \
aboutwindow.h \ aboutwindow.h \
errorwindow.h \ errorwindow.h \
erroricon.h \ erroricon.h \
sdwindow.h \ sdwindow.h
repraptor.h \
eepromwindow.h \
parser.h \
sender.h
FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
settingswindow.ui \ settingswindow.ui \
aboutwindow.ui \ aboutwindow.ui \
errorwindow.ui \ errorwindow.ui \
sdwindow.ui \ sdwindow.ui
eepromwindow.ui
RESOURCES += \ RESOURCES += \
graphics.qrc graphics.qrc
DISTFILES += \ DISTFILES += \
LICENCE \ LICENCE \
README.md \ README.md
RepRaptor.desktop \
.travis.yml

View File

@ -6,11 +6,6 @@ AboutWindow::AboutWindow(QWidget *parent) :
ui(new Ui::AboutWindow) ui(new Ui::AboutWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
QString info;
info += "RepRaptor v" + qApp->applicationVersion() + ", ";
info += "built with Qt " + QString(QT_VERSION_STR) + " on ";
info += QString(__DATE__) + ", " + QString(__TIME__);
ui->versionLabel->setText(info);
} }
AboutWindow::~AboutWindow() AboutWindow::~AboutWindow()

View File

@ -3,8 +3,6 @@
#include <QDialog> #include <QDialog>
#include "repraptor.h"
namespace Ui { namespace Ui {
class AboutWindow; class AboutWindow;
} }

View File

@ -6,16 +6,10 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>359</width> <width>424</width>
<height>363</height> <height>308</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>About RepRaptor</string> <string>About RepRaptor</string>
</property> </property>
@ -24,7 +18,7 @@
<normaloff>:/icons/about.png</normaloff>:/icons/about.png</iconset> <normaloff>:/icons/about.png</normaloff>:/icons/about.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="3" column="0"> <item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -34,7 +28,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="0">
<widget class="QTextBrowser" name="textBrowser"> <widget class="QTextBrowser" name="textBrowser">
<property name="acceptDrops"> <property name="acceptDrops">
<bool>false</bool> <bool>false</bool>
@ -45,8 +39,8 @@
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/icons/logo.png&quot; /&gt;&lt;/p&gt; &lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/icons/logo.png&quot; /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt; RepRaptor&lt;/span&gt; is free and open source software for controlling RepRap and similar machines. This software is distributed by terms of &lt;a href=&quot;https://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;GPL v2 licence.&lt;/span&gt;&lt;/a&gt; Some graphical images (Fugue Icons) are distributed by terms of &lt;a href=&quot;https://creativecommons.org/licenses/by/3.0/deed.ru&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Creative Commons 3 licence&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt; RepRaptor&lt;/span&gt; is a free and open source software for controlling RepRap and similar mashines. This software is distributed by terms of &lt;a href=&quot;https://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;GPL v2 licence.&lt;/span&gt;&lt;/a&gt; Some graphical images (Fugue Icons) are distributed by terms of &lt;a href=&quot;https://creativecommons.org/licenses/by/3.0/deed.ru&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Creative Commons 3 licence&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; RepRaptor's main goal is to be as simple as possible and fast, yet functional. This software is being developed as a primary host software for &lt;span style=&quot; font-weight:600;&quot;&gt;MGTU MIREA&lt;/span&gt; university's 3D printing laboratory by&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; RepRaptor's main goal is to be as simple as possible and fast, yet functional. This software is being developed as a primary host software for &lt;span style=&quot; font-weight:600;&quot;&gt;MGTU MIREA&lt;/span&gt; university's 3D printing labratory by&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;mailto:repraptor-dev@repraptor.33mail.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Nickolay (aka &amp;quot;NeoTheFox&amp;quot;) Mardanov.&lt;/span&gt;&lt;/a&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;mailto:repraptor-dev@repraptor.33mail.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Nickolay (aka &amp;quot;NeoTheFox&amp;quot;) Mardanov.&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/NeoTheFox/RepRaptor&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/NeoTheFox/RepRaptor&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
@ -62,13 +56,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>Build info</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>

View File

@ -1,139 +0,0 @@
#include "eepromwindow.h"
#include "ui_eepromwindow.h"
EEPROMWindow::EEPROMWindow(QStringList eepromLines, QWidget *parent) :
QDialog(parent),
ui(new Ui::EEPROMWindow)
{
ui->setupUi(this);
QSettings settings;
firmware = settings.value("printer/firmware").toInt();
QLayout *layout = new QVBoxLayout();
if(firmware == Repetier)
{
int j = 0;
foreach (QString str, eepromLines)
{
str.remove("EPR:"); // Clear the unneeded part
repetierEEPROMline currentLine; //Storage for EEPROM values
QStringList tmp = str.split(' ');
currentLine.T = tmp.at(0).toInt();
currentLine.P = tmp.at(1).toInt();
currentLine.S = tmp.at(2);
lines.append(currentLine);
QString msg;
for(int i = 3; i < tmp.size(); i++) msg+=(tmp.at(i) + " "); //Rejoin the rest
QLayout *line = new QGridLayout();
QLabel *label = new QLabel(msg, this);
QLineEdit *edit = new QLineEdit(currentLine.S,this);
QFrame* hline = new QFrame();
hline->setFrameShape(QFrame::HLine);
hline->setFrameShadow(QFrame::Sunken);
line->addWidget(hline);
edit->setObjectName("e"+QString::number(j)); //Name the LineEdit, so when it emits signal we know where it came from
QRegExpValidator *doublevalidator = new QRegExpValidator(
QRegExp("^\\-?\\d+\\.?\\d+(e\\-?\\d+)?$",
Qt::CaseInsensitive), this);
doublevalidator->setLocale(QLocale::English);
switch(currentLine.T) // set right validator for the line
{
case 0:
edit->setValidator(new QIntValidator(-128, 255, this));
case 1:
case 2:
edit->setValidator(new QIntValidator(this));
break;
case 3:
edit->setValidator(doublevalidator);
break;
default:
break;
}
connect(edit, &QLineEdit::textChanged, this, &EEPROMWindow::lineChanged);
line->addWidget(label);
line->addWidget(edit);
line->setMargin(2);
layout->addItem(line);
j++; // increase counter
}
for(int i = 0; i < lines.size(); i++) changed.append(false);
ui->eepromWidgets->setLayout(layout);
}
else if(firmware == Marlin)
{
}
}
EEPROMWindow::~EEPROMWindow()
{
delete ui;
}
void EEPROMWindow::lineChanged(QString s)
{
if(firmware == Repetier)
{
int num = sender()->objectName().remove(0, 1).toInt();
lines[num].S = s;
changed[num] = true;
}
else if(firmware == Marlin)
{
}
}
void EEPROMWindow::on_buttonBox_accepted()
{
QStringList gcode;
if(firmware == Repetier)
{
for(int i=0; i < changed.size(); i++)
{
if(changed.at(i))
{
QString command;
command+=QString("M206");
command+=QString("T");
command+=QString::number(lines.at(i).T);
command+=QString("P");
command+=QString::number(lines.at(i).P);
if(lines.at(i).T == 3) command+=QString("X");
else command+=QString("S");
command+=lines.at(i).S;
gcode.append(command);
}
}
}
else if(firmware == Marlin)
{
}
emit changesComplete(gcode);
}

View File

@ -1,37 +0,0 @@
#ifndef EEPROMWINDOW_H
#define EEPROMWINDOW_H
#include <QDialog>
#include <QtWidgets>
#include "repraptor.h"
using namespace RepRaptor;
namespace Ui {
class EEPROMWindow;
}
class EEPROMWindow : public QDialog
{
Q_OBJECT
public:
explicit EEPROMWindow(QStringList eepromLines, QWidget *parent = 0);
~EEPROMWindow();
private:
Ui::EEPROMWindow *ui;
QVector <repetierEEPROMline> lines;
QVector <bool> changed;
int firmware;
signals:
void changesComplete(QStringList changed);
private slots:
void on_buttonBox_accepted();
void lineChanged(QString s);
};
#endif // EEPROMWINDOW_H

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EEPROMWindow</class>
<widget class="QDialog" name="EEPROMWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>EEPROM Editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="eepromWidgets">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>267</width>
<height>251</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>EEPROMWindow</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>227</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>EEPROMWindow</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>277</x>
<y>288</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -4,18 +4,16 @@ ErrorIcon::ErrorIcon(QWidget *parent) : QWidget(parent)
{ {
framenum = 0; framenum = 0;
frame = ":icons/error_a.png"; frame = ":icons/error_a.png";
animation = new QTimer(this); animation.setInterval(300);
animation->setInterval(300); animation.start();
animation->start();
connect(animation, &QTimer::timeout, this, &ErrorIcon::changeFrame); connect(&animation, SIGNAL(timeout()), this, SLOT(changeFrame()));
} }
void ErrorIcon::paintEvent(QPaintEvent *) void ErrorIcon::paintEvent(QPaintEvent *pe)
{ {
QPainter painter(this); QPainter painter(this);
QPixmap pframe(frame); painter.drawPixmap(0,0,128,87,QPixmap(frame));
painter.drawPixmap(0,0,pframe.width(),pframe.height(),pframe);
} }
void ErrorIcon::changeFrame() void ErrorIcon::changeFrame()
@ -35,6 +33,6 @@ void ErrorIcon::changeFrame()
ErrorIcon::~ErrorIcon() ErrorIcon::~ErrorIcon()
{ {
animation->stop();
} }

View File

@ -11,12 +11,12 @@ class ErrorIcon : public QWidget
public: public:
explicit ErrorIcon(QWidget *parent = 0); explicit ErrorIcon(QWidget *parent = 0);
~ErrorIcon(); ~ErrorIcon();
QTimer *animation; QTimer animation;
QString frame; QString frame;
int framenum; int framenum;
protected: protected:
virtual void paintEvent(QPaintEvent *); virtual void paintEvent(QPaintEvent *pe);
signals: signals:

View File

@ -1,29 +1,11 @@
#include "errorwindow.h" #include "errorwindow.h"
#include "ui_errorwindow.h" #include "ui_errorwindow.h"
using namespace RepRaptor; ErrorWindow::ErrorWindow(QWidget *parent, QString errorText) :
ErrorWindow::ErrorWindow(QWidget *parent, QString errorText, int errType):
QDialog(parent), QDialog(parent),
ui(new Ui::ErrorWindow) ui(new Ui::ErrorWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
switch(errType)
{
case SerialPortError:
ui->label->setText(tr("Serial port error:"));
break;
case OpenFileError:
ui->label->setText(tr("File open error:"));
break;
case HardwareFailure:
ui->label->setText(tr("Hardware failure:"));
break;
default:
ui->label->setText(tr("Unknown error type:"));
break;
}
ui->errorlabel->setText(errorText); ui->errorlabel->setText(errorText);
} }

View File

@ -4,7 +4,6 @@
#include <QDialog> #include <QDialog>
#include "erroricon.h" #include "erroricon.h"
#include "repraptor.h"
namespace Ui { namespace Ui {
class ErrorWindow; class ErrorWindow;
@ -15,7 +14,7 @@ class ErrorWindow : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit ErrorWindow(QWidget *parent = 0, QString errorText = "Unknown error", int errType = 0); explicit ErrorWindow(QWidget *parent = 0, QString errorText = "Unknown error");
~ErrorWindow(); ~ErrorWindow();
private: private:

View File

@ -1,6 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>icons/repraptor.png</file> <file>icons/icon.png</file>
<file>icons/logo.png</file> <file>icons/logo.png</file>
<file>icons/error_a.png</file> <file>icons/error_a.png</file>
<file>icons/error_b.png</file> <file>icons/error_b.png</file>
@ -9,6 +9,5 @@
<file>icons/settings.png</file> <file>icons/settings.png</file>
<file>icons/about.png</file> <file>icons/about.png</file>
<file>icons/exit.png</file> <file>icons/exit.png</file>
<file>icons/eeprom.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,16 +1,13 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "repraptor.h"
#include <QApplication> #include <QApplication>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
//Set some props in order to fetch and save QSettings
QCoreApplication::setOrganizationName("NeoTheFox"); QCoreApplication::setOrganizationName("NeoTheFox");
QCoreApplication::setOrganizationDomain("https://github.com/NeoTheFox"); QCoreApplication::setOrganizationDomain("https://github.com/NeoTheFox");
QCoreApplication::setApplicationName("RepRaptor"); QCoreApplication::setApplicationName("RepRaptor");
QCoreApplication::setApplicationVersion(REPRAPTOR_VERSION);
MainWindow w; MainWindow w;
w.show(); w.show();

File diff suppressed because it is too large Load Diff

View File

@ -3,32 +3,31 @@
#include <QMainWindow> #include <QMainWindow>
#include <QFileDialog> #include <QFileDialog>
#include <QSystemTrayIcon>
#include <QtSerialPort/QtSerialPort> #include <QtSerialPort/QtSerialPort>
#include <QFile> #include <QFile>
#include <QThread> #include <QFuture>
#include <QVector> #include <QVector>
#include <QTextStream> #include <QTextStream>
#include <QtConcurrent/QtConcurrent>
#include <QSettings> #include <QSettings>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QRegExp> #include <QMessageBox>
#include <QMap>
#include "settingswindow.h" #include "settingswindow.h"
#include "aboutwindow.h" #include "aboutwindow.h"
#include "errorwindow.h" #include "errorwindow.h"
#include "sdwindow.h" #include "sdwindow.h"
#include "repraptor.h"
#include "eepromwindow.h"
#include "parser.h"
#include "sender.h"
using namespace RepRaptor;
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
} }
typedef struct
{
double e, b;
} TemperatureReadings;
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
@ -37,81 +36,58 @@ public:
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = 0);
~MainWindow(); ~MainWindow();
Parser *parserWorker;
Sender *senderWorker;
QThread *parserThread;
QThread *senderThread;
protected:
QMap <QString, QString> macros;
QFile gfile; QFile gfile;
QVector<QString> gcode; QVector<QString> gcode;
QQueue <QString> userCommands; QTimer sendTimer;
QTimer *progressSDTimer; QTimer progressSDTimer;
QTimer *statusTimer; QTimer statusTimer;
QSystemTrayIcon *trayIcon; QTimer tempWarning;
QMenu *recentMenu; QElapsedTimer sinceLastTemp;
QMenu *trayIconMenu;
QElapsedTimer *sinceLastTemp;
QElapsedTimer *sinceLastSDStatus;
QSettings settings; QSettings settings;
QStringList recentFiles; QStringList recentFiles;
QStringList EEPROMSettings; QStringList sdFiles;
QStringList userHistory; QFutureWatcher<TemperatureReadings> statusWatcher;
QSerialPortInfo printerinfo; QFutureWatcher<double> sdWatcher;
QTextCursor terminalCursor;
void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *target, QEvent *event);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QString lastDir; void parseFile(QFile &file);
bool opened; QSerialPort printer;
QSerialPortInfo printerinfo;
bool firstrun; bool firstrun;
bool autolock;
bool printing;
bool sending; bool sending;
bool paused; bool paused;
bool checkingTemperature; bool checkingTemperature;
bool injectingCommand;
bool readingFiles;
bool sdprinting; bool sdprinting;
bool echo; bool echo;
bool chekingSDStatus; int currentLine;
bool trayIconEnabled; int readyRecieve;
bool supressWait; double sdBytes;
int firmware; QString userCommand;
int feedrate;
int extruderFeedrate;
int userHistoryPos;
unsigned long int sdBytes;
private slots: private slots:
void open(); void open();
void serialconnect(); void serialconnect();
void serialupdate(); void serialupdate();
void updatesettings(); bool sendLine(QString line);
void readSerial(QByteArray data);
void readSerial();
void printMsg(QString text); void printMsg(QString text);
void printMsg(const char* text);
void sendNext();
void checkStatus(); void checkStatus();
void updateRecent(); void updateRecent();
void initSDprinting(QStringList sdFiles); void injectCommand(QString command);
void updateStatus();
void initSDprinting();
void selectSDfile(QString file); void selectSDfile(QString file);
void checkSDStatus(); void checkSDStatus();
void updateSDStatus(SDProgress p); void updateSDStatus();
void requestEEPROMSettings(); TemperatureReadings parseStatus(QByteArray data);
void openEEPROMeditor(); double parseSDStatus(QByteArray data);
void sendEEPROMsettings(QStringList changes);
void updateTemperature(TemperatureReadings r);
void EEPROMSettingReceived(QString esetting);
void receivedError();
void receivedSDDone();
void receivedNotSDPrinting();
void parseFile(QString filename);
void recentClicked();
void updateFileProgress(FileProgress);
void baudrateSetFailed(int b);
void trayIconClicked(QSystemTrayIcon::ActivationReason reason);
void xplus(); void xplus();
void yplus(); void yplus();
@ -154,22 +130,9 @@ private slots:
void on_actionAbout_triggered(); void on_actionAbout_triggered();
void serialError(QSerialPort::SerialPortError error); void serialError(QSerialPort::SerialPortError error);
void on_actionPrint_from_SD_triggered(); void on_actionPrint_from_SD_triggered();
void on_actionSet_SD_printing_mode_triggered();
void on_actionEEPROM_editor_triggered();
signals: signals:
void sdReady(); void sdReady();
void startedReadingEEPROM();
void openPort(QSerialPortInfo i);
void closePort();
void startPrinting();
void stopPrinting();
void pause(bool p);
void setBaudrate(int b);
void setFile(QVector <QString> f);
void injectCommand(QString command);
void flushInjectionBuffer();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>791</width> <width>761</width>
<height>514</height> <height>456</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -21,28 +21,23 @@
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="graphics.qrc"> <iconset resource="graphics.qrc">
<normaloff>:/icons/repraptor.png</normaloff>:/icons/repraptor.png</iconset> <normaloff>:/icons/icon.png</normaloff>:/icons/icon.png</iconset>
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="serialGroup"> <widget class="QGroupBox" name="serialGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="title"> <property name="title">
<string>Serial</string> <string>Serial</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <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"> <item row="0" column="1">
<widget class="QComboBox" name="serialBox"> <widget class="QComboBox" name="serialBox">
<property name="maximumSize"> <property name="maximumSize">
@ -51,23 +46,6 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="baudbox">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="portsBtn">
<property name="text">
<string>Ports</string>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
@ -77,6 +55,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QComboBox" name="baudbox"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -97,12 +78,6 @@
<property name="title"> <property name="title">
<string>Control</string> <string>Control</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -148,19 +123,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="1">
<widget class="QPushButton" name="ezerobtn"> <widget class="QPushButton" name="centerbtn">
<property name="toolTip">
<string>this is tool tip e0</string>
</property>
<property name="statusTip">
<string>this is status e0</string>
</property>
<property name="whatsThis">
<string>this is e0</string>
</property>
<property name="text"> <property name="text">
<string>E0</string> <string>C</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -171,18 +137,15 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="4">
<widget class="QPushButton" name="centerbtn"> <widget class="QPushButton" name="ezerobtn">
<property name="text"> <property name="text">
<string>C</string> <string>E0</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="6"> <item row="1" column="6">
<widget class="QPushButton" name="homeybtn"> <widget class="QPushButton" name="homeybtn">
<property name="whatsThis">
<string/>
</property>
<property name="text"> <property name="text">
<string>H Y</string> <string>H Y</string>
</property> </property>
@ -209,13 +172,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3" colspan="4">
<widget class="QPushButton" name="releasebtn">
<property name="text">
<string>Motors off</string>
</property>
</widget>
</item>
<item row="2" column="6"> <item row="2" column="6">
<widget class="QPushButton" name="homezbtn"> <widget class="QPushButton" name="homezbtn">
<property name="text"> <property name="text">
@ -225,33 +181,27 @@
</item> </item>
<item row="6" column="2" colspan="2"> <item row="6" column="2" colspan="2">
<widget class="QSpinBox" name="etmpspin"> <widget class="QSpinBox" name="etmpspin">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="maximum"> <property name="maximum">
<number>500</number> <number>500</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="6">
<widget class="QPushButton" name="etmpoff">
<property name="text">
<string>Off</string>
</property>
</widget>
</item>
<item row="6" column="4"> <item row="6" column="4">
<widget class="QPushButton" name="etmpset"> <widget class="QPushButton" name="etmpset">
<property name="text"> <property name="text">
<string>Set</string> <string>SET</string>
</property>
</widget>
</item>
<item row="6" column="6">
<widget class="QPushButton" name="etmpoff">
<property name="text">
<string>OFF</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="2" colspan="2"> <item row="7" column="2" colspan="2">
<widget class="QSpinBox" name="btmpspin"> <widget class="QSpinBox" name="btmpspin">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="maximum"> <property name="maximum">
<number>500</number> <number>500</number>
</property> </property>
@ -260,14 +210,14 @@
<item row="7" column="4"> <item row="7" column="4">
<widget class="QPushButton" name="btmpset"> <widget class="QPushButton" name="btmpset">
<property name="text"> <property name="text">
<string>Set</string> <string>SET</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="6"> <item row="7" column="6">
<widget class="QPushButton" name="btmpoff"> <widget class="QPushButton" name="btmpoff">
<property name="text"> <property name="text">
<string>Off</string> <string>OFF</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -276,12 +226,6 @@
<property name="text"> <property name="text">
<string>100</string> <string>100</string>
</property> </property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="clearButtonEnabled"> <property name="clearButtonEnabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -306,26 +250,15 @@
<item row="8" column="5" colspan="2"> <item row="8" column="5" colspan="2">
<widget class="QPushButton" name="speedsetbtn"> <widget class="QPushButton" name="speedsetbtn">
<property name="text"> <property name="text">
<string>Set</string> <string>SET</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="2"> <item row="9" column="2">
<widget class="QLineEdit" name="flowedit"> <widget class="QLineEdit" name="flowedit">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text"> <property name="text">
<string>100</string> <string>100</string>
</property> </property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="clearButtonEnabled"> <property name="clearButtonEnabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -350,35 +283,35 @@
<item row="9" column="5" colspan="2"> <item row="9" column="5" colspan="2">
<widget class="QPushButton" name="flowbutton"> <widget class="QPushButton" name="flowbutton">
<property name="text"> <property name="text">
<string>Set</string> <string>SET</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="2" colspan="2"> <item row="10" column="2" colspan="2">
<widget class="QPushButton" name="fanonbtn"> <widget class="QPushButton" name="fanonbtn">
<property name="text"> <property name="text">
<string>Fan On</string> <string>FAN ON</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="4" colspan="3"> <item row="10" column="4" colspan="3">
<widget class="QPushButton" name="fanoffbtn"> <widget class="QPushButton" name="fanoffbtn">
<property name="text"> <property name="text">
<string>Fan Off</string> <string>FAN OFF</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="2" colspan="2"> <item row="11" column="2" colspan="2">
<widget class="QPushButton" name="atxonbtn"> <widget class="QPushButton" name="atxonbtn">
<property name="text"> <property name="text">
<string>ATX On</string> <string>ATX ON</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="4" colspan="3"> <item row="11" column="4" colspan="3">
<widget class="QPushButton" name="atxoffbtn"> <widget class="QPushButton" name="atxoffbtn">
<property name="text"> <property name="text">
<string>ATX Off</string> <string>ATX OFF</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -389,16 +322,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3" colspan="2"> <item row="3" column="3" colspan="4">
<widget class="QLabel" name="label"> <widget class="QPushButton" name="releasebtn">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text"> <property name="text">
<string>E Step</string> <string>Release</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -434,6 +361,32 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3" colspan="2">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text">
<string>E Step</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
@ -444,7 +397,7 @@
<item row="7" column="0" colspan="2"> <item row="7" column="0" colspan="2">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Bed tmp</string> <string>B tmp</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -897,19 +850,6 @@ STOP</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text">
<string>Step Increment</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -921,23 +861,10 @@ STOP</string>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>190</width>
<height>0</height>
</size>
</property>
<property name="title"> <property name="title">
<string>Console</string> <string>Console</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0">
<widget class="QPushButton" name="sendbtn">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTextBrowser" name="terminal"> <widget class="QTextBrowser" name="terminal">
<property name="acceptDrops"> <property name="acceptDrops">
@ -958,23 +885,18 @@ STOP</string>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLineEdit" name="sendtext"/> <widget class="QLineEdit" name="sendtext"/>
</item> </item>
<item row="3" column="0">
<widget class="QPushButton" name="sendbtn">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="fileBox"> <widget class="QGroupBox" name="fileBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="title"> <property name="title">
<string>File</string> <string>File</string>
</property> </property>
@ -1043,20 +965,8 @@ STOP</string>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="statusGroup"> <widget class="QGroupBox" name="statusGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="title"> <property name="title">
<string>Temperature</string> <string>Status</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0"> <item row="0" column="0">
@ -1089,12 +999,6 @@ STOP</string>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QLabel" name="tempLine"> <widget class="QLabel" name="tempLine">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -1129,7 +1033,7 @@ STOP</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>791</width> <width>761</width>
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
@ -1138,6 +1042,8 @@ STOP</string>
<string>File</string> <string>File</string>
</property> </property>
<addaction name="actionOpen"/> <addaction name="actionOpen"/>
<addaction name="actionRecent"/>
<addaction name="separator"/>
<addaction name="actionSettings"/> <addaction name="actionSettings"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
@ -1157,9 +1063,6 @@ STOP</string>
<string>Tools</string> <string>Tools</string>
</property> </property>
<addaction name="actionPrint_from_SD"/> <addaction name="actionPrint_from_SD"/>
<addaction name="actionSet_SD_printing_mode"/>
<addaction name="separator"/>
<addaction name="actionEEPROM_editor"/>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuTools"/> <addaction name="menuTools"/>
@ -1210,9 +1113,6 @@ STOP</string>
<addaction name="actionSettings"/> <addaction name="actionSettings"/>
</widget> </widget>
<action name="actionOpen"> <action name="actionOpen">
<property name="checkable">
<bool>false</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="graphics.qrc"> <iconset resource="graphics.qrc">
<normaloff>:/icons/g.png</normaloff>:/icons/g.png</iconset> <normaloff>:/icons/g.png</normaloff>:/icons/g.png</iconset>
@ -1220,13 +1120,18 @@ STOP</string>
<property name="text"> <property name="text">
<string>Open...</string> <string>Open...</string>
</property> </property>
<property name="iconText">
<string>Open File</string>
</property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+O</string> <string>Ctrl+O</string>
</property> </property>
</action> </action>
<action name="actionRecent">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Recent</string>
</property>
</action>
<action name="actionExit"> <action name="actionExit">
<property name="icon"> <property name="icon">
<iconset resource="graphics.qrc"> <iconset resource="graphics.qrc">
@ -1277,26 +1182,6 @@ STOP</string>
<string>About Qt</string> <string>About Qt</string>
</property> </property>
</action> </action>
<action name="actionSet_SD_printing_mode">
<property name="text">
<string>Set SD printing mode</string>
</property>
</action>
<action name="actionEEPROM_editor">
<property name="enabled">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="graphics.qrc">
<normaloff>:/icons/eeprom.png</normaloff>:/icons/eeprom.png</iconset>
</property>
<property name="text">
<string>EEPROM editor</string>
</property>
<property name="toolTip">
<string>To use EEPROM editor you need to set firmware in settings</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
@ -1326,8 +1211,8 @@ STOP</string>
<slot>serialupdate()</slot> <slot>serialupdate()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>100</x> <x>82</x>
<y>110</y> <y>84</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>247</x> <x>247</x>
@ -1358,8 +1243,8 @@ STOP</string>
<slot>serialconnect()</slot> <slot>serialconnect()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>100</x> <x>82</x>
<y>142</y> <y>116</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>247</x> <x>247</x>
@ -1374,8 +1259,8 @@ STOP</string>
<slot>xhome()</slot> <slot>xhome()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>454</x> <x>455</x>
<y>108</y> <y>81</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>383</x>
@ -1391,7 +1276,7 @@ STOP</string>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>739</x> <x>739</x>
<y>376</y> <y>331</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>654</x> <x>654</x>
@ -1406,8 +1291,8 @@ STOP</string>
<slot>xplus()</slot> <slot>xplus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>329</x> <x>323</x>
<y>138</y> <y>110</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>383</x>
@ -1423,11 +1308,11 @@ STOP</string>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>739</x> <x>739</x>
<y>405</y> <y>360</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>739</x> <x>739</x>
<y>434</y> <y>389</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -1438,8 +1323,8 @@ STOP</string>
<slot>yminus()</slot> <slot>yminus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>289</x> <x>285</x>
<y>168</y> <y>139</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>383</x>
@ -1454,8 +1339,8 @@ STOP</string>
<slot>yplus()</slot> <slot>yplus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>289</x> <x>285</x>
<y>108</y> <y>81</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>383</x>
@ -1470,8 +1355,8 @@ STOP</string>
<slot>xminus()</slot> <slot>xminus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>250</x> <x>248</x>
<y>138</y> <y>110</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>189</x> <x>189</x>
@ -1486,8 +1371,8 @@ STOP</string>
<slot>zplus()</slot> <slot>zplus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>368</x> <x>367</x>
<y>108</y> <y>81</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>356</x> <x>356</x>
@ -1502,8 +1387,8 @@ STOP</string>
<slot>zminus()</slot> <slot>zminus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>368</x> <x>367</x>
<y>168</y> <y>139</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>209</x> <x>209</x>
@ -1518,8 +1403,8 @@ STOP</string>
<slot>ezero()</slot> <slot>ezero()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>408</x> <x>411</x>
<y>138</y> <y>110</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>220</x> <x>220</x>
@ -1534,8 +1419,8 @@ STOP</string>
<slot>zhome()</slot> <slot>zhome()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>454</x> <x>455</x>
<y>168</y> <y>139</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>209</x> <x>209</x>
@ -1550,8 +1435,8 @@ STOP</string>
<slot>yhome()</slot> <slot>yhome()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>454</x> <x>455</x>
<y>138</y> <y>110</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>383</x>
@ -1566,8 +1451,8 @@ STOP</string>
<slot>eplus()</slot> <slot>eplus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>408</x> <x>411</x>
<y>108</y> <y>81</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>397</x> <x>397</x>
@ -1582,8 +1467,8 @@ STOP</string>
<slot>eminus()</slot> <slot>eminus()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>408</x> <x>411</x>
<y>168</y> <y>139</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>475</x> <x>475</x>
@ -1598,8 +1483,8 @@ STOP</string>
<slot>bedcenter()</slot> <slot>bedcenter()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>289</x> <x>285</x>
<y>138</y> <y>110</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>321</x> <x>321</x>
@ -1614,8 +1499,8 @@ STOP</string>
<slot>homeall()</slot> <slot>homeall()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>329</x> <x>257</x>
<y>198</y> <y>165</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>200</x> <x>200</x>
@ -1623,54 +1508,6 @@ STOP</string>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>sendtext</sender>
<signal>returnPressed()</signal>
<receiver>sendtext</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>558</x>
<y>394</y>
</hint>
<hint type="destinationlabel">
<x>494</x>
<y>397</y>
</hint>
</hints>
</connection>
<connection>
<sender>speededit</sender>
<signal>returnPressed()</signal>
<receiver>speedsetbtn</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>315</x>
<y>339</y>
</hint>
<hint type="destinationlabel">
<x>446</x>
<y>340</y>
</hint>
</hints>
</connection>
<connection>
<sender>flowedit</sender>
<signal>returnPressed()</signal>
<receiver>flowbutton</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>368</y>
</hint>
<hint type="destinationlabel">
<x>421</x>
<y>371</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>open()</slot> <slot>open()</slot>
@ -1690,6 +1527,5 @@ STOP</string>
<slot>ezero()</slot> <slot>ezero()</slot>
<slot>yhome()</slot> <slot>yhome()</slot>
<slot>bedcenter()</slot> <slot>bedcenter()</slot>
<slot>requestEEPROMSettings()</slot>
</slots> </slots>
</ui> </ui>

View File

@ -1,123 +0,0 @@
#include "parser.h"
Parser::Parser(QObject *parent):
QObject(parent)
{
//Init regexp
temperatureRegxp.setCaseSensitivity(Qt::CaseInsensitive);
temperatureRegxp.setPatternSyntax(QRegExp::RegExp);
temperatureRegxp.setPattern("\\d+\\.\\d+"); // Find float in string
//Init values
readingFiles = false;
readingEEPROM = false;
EEPROMReadingStarted = false;
//Load settings
QSettings settings;
firmware = settings.value("printer/firmware").toInt();
}
Parser::~Parser()
{
}
void Parser::parse(QByteArray data)
{
if(!data.isEmpty()) //Dont need to process empty strings
{
if(readingFiles) //SD files list reading mode
{
if(!data.contains("End file list")) SDFilesList.append(data.remove(data.size()-2, 2));
else
{
readingFiles = false;
emit receivedSDFilesList(SDFilesList);
}
return;
}
if(readingEEPROM) // EEPROM reading mode
{
if(firmware == Repetier)
{
if(data.startsWith("EPR"))
{
emit receivedEEPROMLine(QString(data));
EEPROMReadingStarted = true;
}
else if(EEPROMReadingStarted)
{
readingEEPROM = false;
EEPROMReadingStarted = false;
emit recievingEEPROMDone();
}
return;
}
}
/*
if(data.startsWith("ok"))
{
QStringList tmp = QString(data).split(' ');
if(tmp.size() > 1)
emit receivedOkNum(tmp.at(1).toInt());
else emit receivedOkNum(0);
}
*/
else if(data.contains("T:"))
{
TemperatureReadings r;
if(temperatureRegxp.indexIn(QString(data)) != -1)
r.e = temperatureRegxp.cap(0).toDouble();
else r.e = 0;
if(temperatureRegxp.indexIn(QString(data), temperatureRegxp.matchedLength()) != -1)
r.b = temperatureRegxp.cap(0).toDouble();
else r.b = 0;
r.raw = QString(data);
emit receivedTemperature(r);
}
//else if(data.startsWith("wait")) emit receivedOkWait();
else if(data.startsWith("rs") || data.toLower().startsWith("resend"))
emit receivedResend(data.split(':').at(1).toInt());
else if(data.startsWith("!!")) emit receivedError();
else if(data.startsWith("Done")) emit receivedSDDone();
else if(data.startsWith("start")) emit receivedStart();
else if(data.startsWith("SD pr"))
{
SDProgress p;
QRegExp rxp("\\d+/\\d+");
QStringList tmp;
if(rxp.indexIn(data) != -1)
{
tmp = rxp.cap(0).split('/');
p.progress = tmp.at(0).toLong();
p.total = tmp.at(1).toLong();
}
else return;
emit receivedSDUpdate(p);
}
else if(data.startsWith("Not SD ")) emit receivedNotSDPrinting();
else if(data.contains("Begin file list"))
{
SDFilesList.clear();
readingFiles = true; //start reading files from SD
}
//else if(data.contains("REPETIER")) emit receivedFirmware(Repetier);
//else if(data.contains("MARLIN")) emit receivedFirmware(Marlin);
}
}
void Parser::setEEPROMReadingMode()
{
readingEEPROM = true;
}

View File

@ -1,48 +0,0 @@
#ifndef PARSETHREAD_H
#define PARSETHREAD_H
#include <QThread>
#include <QSettings>
#include "repraptor.h"
using namespace RepRaptor;
class Parser : public QObject
{
Q_OBJECT
public:
explicit Parser(QObject *parent = 0);
~Parser();
protected:
QByteArray data;
QStringList SDFilesList;
QRegExp temperatureRegxp;
int firmware;
bool readingFiles;
bool readingEEPROM;
bool EEPROMReadingStarted;
signals:
void receivedTemperature(TemperatureReadings);
void receivedSDUpdate(SDProgress);
void receivedNotSDPrinting();
void receivedEEPROMLine(QString);
void recievingEEPROMDone();
void receivedSDFilesList(QStringList);
void receivedOkWait();
void receivedOkNum(int);
void receivedStart();
void receivedResend(int);
void receivedError();
void receivedFirmware(int);
void receivedSDDone();
public slots:
void parse(QByteArray data);
void setEEPROMReadingMode();
};
#endif // PARSETHREAD_H

View File

@ -1,52 +0,0 @@
/////////////////////////////////////////////////
//This file contains RepRaptor - specific stuff//
/////////////////////////////////////////////////
#ifndef REPRAPTOR_H
#define REPRAPTOR_H
#ifndef REPRAPTOR_VERSION
#define REPRAPTOR_VERSION "0.3.9"
#endif
namespace RepRaptor
{
typedef struct
{
double e, b;
QString raw;
} TemperatureReadings;
enum Firmware
{
Marlin,
Repetier,
OtherFirmware
};
enum ErrorType
{
SerialPortError,
OpenFileError,
HardwareFailure
};
typedef struct
{
int T, P;
QString S;
} repetierEEPROMline;
typedef struct
{
unsigned long int progress, total;
} SDProgress;
typedef struct
{
unsigned int T, P;
} FileProgress;
}
#endif // REPRAPTOR_H

View File

@ -7,13 +7,7 @@ SDWindow::SDWindow(QStringList files, QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->fileslist->setSelectionMode(QListView::SingleSelection); ui->fileslist->addItems(files);
if(!files.isEmpty())
{
ui->fileslist->addItems(files);
ui->fileslist->setCurrentItem(ui->fileslist->itemAt(0,0));
}
} }
SDWindow::~SDWindow() SDWindow::~SDWindow()
@ -23,11 +17,11 @@ SDWindow::~SDWindow()
void SDWindow::on_buttonBox_accepted() void SDWindow::on_buttonBox_accepted()
{ {
if(ui->fileslist->count() > 0) emit fileSelected(ui->fileslist->currentItem()->text()); emit fileSelected(ui->fileslist->currentItem()->text());
} }
void SDWindow::on_fileslist_doubleClicked(const QModelIndex &) void SDWindow::on_fileslist_doubleClicked(const QModelIndex &index)
{ {
if(ui->fileslist->count() > 0) emit fileSelected(ui->fileslist->currentItem()->text()); emit fileSelected(ui->fileslist->currentItem()->text());
this->close(); this->close();
} }

View File

@ -21,7 +21,7 @@ signals:
private slots: private slots:
void on_buttonBox_accepted(); void on_buttonBox_accepted();
void on_fileslist_doubleClicked(const QModelIndex &); void on_fileslist_doubleClicked(const QModelIndex &index);
private: private:
Ui::SDWindow *ui; Ui::SDWindow *ui;

View File

@ -6,16 +6,10 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>274</width> <width>249</width>
<height>302</height> <height>246</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Print from SD</string> <string>Print from SD</string>
</property> </property>
@ -27,7 +21,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Select file:</string> <string>Print file:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -46,14 +40,8 @@
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QListWidget" name="fileslist"> <widget class="QListWidget" name="fileslist">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoScroll"> <property name="autoScroll">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -1,224 +0,0 @@
#include "sender.h"
Sender::Sender(QObject *parent) : QObject(parent)
{
//Initial values
currentLine=0;
totalLineNum=0;
baudrate=115200;
resendNum = 0;
resending = false;
sendingChecksum=false;
paused=false;
sending=false;
readyReceive = false;
printer = new QSerialPort(this);
sendTimer = new QTimer(this);
//Fetch settings
QSettings settings(this);
sendTimer->setInterval(settings.value("core/senderinterval", 2).toInt());
sendingChecksum = settings.value("core/checksums", 0).toBool();
dtr = settings.value("core/dtr", 1).toBool();
flowcontrol = settings.value("core/flowcontrol", 0).toInt();
sendTimer->start();
connect(printer, SIGNAL(error(QSerialPort::SerialPortError)), this, SLOT(receivedError(QSerialPort::SerialPortError)));
connect(printer, &QSerialPort::readyRead, this, &Sender::receivedData);
connect(sendTimer, &QTimer::timeout, this, &Sender::sendNext);
}
Sender::~Sender()
{
closePort();
sendTimer->stop();
}
//Mainloop of sending
void Sender::sendNext()
{
if(printer->isWritable() && readyReceive)
{
//Checksums
if(sendingChecksum && resending)
{
if(resendNum < sentCommands.size())
{
sendLine(sentCommands.at(resendNum));
resendNum++;
}
else if(resendNum == sentCommands.size())
{
resending = false;
resendNum = 0;
}
else if(resendNum > sentCommands.size())
{
sendLine("M110 N0");
totalLineNum = 0;
resendNum = 0;
sentCommands.clear();
}
return;
}
if(!userCommands.isEmpty()) //Inject user command
{
sendLine(userCommands.dequeue());
readyReceive = false;
return;
}
else if(sending && !paused) //Send line of gcode
{
FileProgress p;
if(currentLine >= gcode.size()) //check if we are at the end of array
{
sending = false;
currentLine = 0;
if(sendingChecksum) sendLine("M110 N0");
p.P = gcode.size();
p.T = gcode.size();
emit reportProgress(p);
return;
}
sendLine(gcode.at(currentLine));
currentLine++;
readyReceive=false;
p.P = currentLine;
p.T = gcode.size();
emit reportProgress(p);
}
}
}
bool Sender::sendLine(QString line)
{
sentCommands.clear();
if(printer->isOpen())
{
if(sendingChecksum)
{
if(line.contains("M110")) totalLineNum = 0;
sentCommands.append(line);
//Checksum algorithm from RepRap wiki
line = "N"+QString::number(totalLineNum)+line+"*";
int cs = 0;
for(int i = 0; line.at(i) != '*'; i++) cs = cs ^ line.at(i).toLatin1();
cs &= 0xff;
line += QString::number(cs);
totalLineNum++;
}
if(printer->write(line.toUtf8()+'\n')) return true;
else return false;
}
else return false;
}
void Sender::openPort(QSerialPortInfo i)
{
printer->setPort(i);
if(!printer->isOpen() && printer->open(QIODevice::ReadWrite))
{
//Moved here to be compatible with Qt 5.2.1
printer->setDataTerminalReady(dtr);
if(!printer->setBaudRate(baudrate))
emit baudrateSetFailed(baudrate);
printer->setFlowControl(static_cast<QSerialPort::FlowControl>(flowcontrol));
}
readyReceive = true;
}
void Sender::closePort()
{
if(printer->isOpen()) printer->close();
}
void Sender::startPrinting()
{
currentLine = 0;
paused = false;
sending = true;
}
void Sender::stopPrinting()
{
currentLine = 0;
paused = false;
sending = false;
}
void Sender::pause(bool p)
{
paused = p;
}
void Sender::setBaudrate(int b)
{
baudrate = b;
}
void Sender::setFile(QVector <QString> f)
{
gcode = f;
}
void Sender::injectCommand(QString command)
{
if(!userCommands.contains(command)) userCommands.enqueue(command);
}
void Sender::receivedOkWait()
{
readyReceive = true;
}
void Sender::receivedOkNum(int)
{
readyReceive = true;
}
void Sender::receivedStart()
{
readyReceive = true;
}
void Sender::flushInjectionBuffer()
{
userCommands.clear();
}
void Sender::receivedResend(int r)
{
if(sendingChecksum)
{
resending = true;
resendNum = r;
}
else currentLine--;
}
void Sender::receivedData()
{
if(printer->canReadLine())
{
QByteArray data = printer->readLine();
if(data == "") return;
emit dataReceived(data);
//Yeah, yeah, I know. This class is called "Sender", but checking this here is faster.
if(data.startsWith("ok") || data.startsWith("wait")) readyReceive=true;
}
}
void Sender::receivedError(QSerialPort::SerialPortError error)
{
if(error > 0)
{
closePort();
emit errorReceived(error);
}
}

View File

@ -1,71 +0,0 @@
#ifndef SENDER_H
#define SENDER_H
#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QQueue>
#include <QTimer>
#include <QSettings>
#include <QVector>
#include "repraptor.h"
using namespace RepRaptor;
class Sender : public QObject
{
Q_OBJECT
public:
explicit Sender(QObject *parent = 0);
~Sender();
protected:
QSerialPort *printer;
QTimer *sendTimer;
long int currentLine;
long int totalLineNum;
long int resendNum;
long int baudrate;
long int flowcontrol;
bool paused;
bool sending;
bool dtr;
bool readyReceive;
bool sendingChecksum;
bool resending;
QQueue <QString> userCommands;
QStringList sentCommands;
QVector <QString> gcode;
bool sendLine(QString s);
signals:
void errorReceived(QSerialPort::SerialPortError error);
void dataReceived(QByteArray data);
void reportProgress(FileProgress p);
void baudrateSetFailed(int b);
public slots:
void openPort(QSerialPortInfo i);
void closePort();
void startPrinting();
void stopPrinting();
void pause(bool p);
void setBaudrate(int b);
void setFile(QVector <QString> f);
void injectCommand(QString);
void flushInjectionBuffer();
void receivedOkWait();
void receivedOkNum(int);
void receivedStart();
void receivedResend(int r);
void sendNext();
void receivedData();
void receivedError(QSerialPort::SerialPortError error);
};
#endif // SENDER_H

View File

@ -6,39 +6,21 @@ SettingsWindow::SettingsWindow(QWidget *parent) :
ui(new Ui::SettingsWindow) ui(new Ui::SettingsWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->flowcontrolbox->addItem(tr("No control"));
ui->flowcontrolbox->addItem(tr("Hardware control"));
ui->flowcontrolbox->addItem(tr("Software control"));
//bool firstrun = !settings.value("core/firstrun").toBool(); //firstrun is inverted! if(!settings.value("core/firstrun").toBool()) ui->senderbox->setValue(4);
else ui->senderbox->setValue(settings.value("core/senderinterval").toFloat());
settings.setParent(this); if(!settings.value("core/firstrun").toBool()) ui->echobox->setChecked(false);
ui->flowcontrolbox->setCurrentIndex(settings.value("core/flowcontrol", 0).toInt()); else ui->echobox->setChecked(settings.value("core/echo").toBool());
ui->senderbox->setValue(settings.value("core/senderinterval", 2).toInt());
ui->traybox->setChecked(settings.value("core/trayiconenabled", 1).toBool());
ui->statusbox->setValue(settings.value("core/statusinterval", 2000).toInt());
ui->bedxbox->setValue(settings.value("printer/bedx", 200).toInt());
ui->bedybox->setValue(settings.value("printer/bedy", 200).toInt());
ui->feedrateBox->setValue(settings.value("printer/feedrate", 1500).toInt());
ui->extruderFeedrateBox->setValue(settings.value("printer/extruderfeedrate", 200).toInt());
ui->lockbox->setChecked(settings.value("core/lockcontrols", 0).toBool());
ui->checksumbox->setChecked(settings.value("core/checksums", 0).toBool());
ui->sdbox->setChecked(settings.value("core/checksdstatus", 1).toBool());
ui->dtrbox->setChecked(settings.value("core/dtr", 1).toBool());
ui->supresswaitbox->setChecked(settings.value("user/supresswait").toBool());
ui->bufferbox->setValue(settings.value("core/logbuffersize", 1000).toInt());
ui->firmwarecombo->addItem("Marlin"); //0 if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt());
ui->firmwarecombo->addItem("Repetier"); //1 else ui->statusbox->setValue(1500);
ui->firmwarecombo->addItem("Other"); //2
ui->firmwarecombo->setCurrentIndex(settings.value("printer/firmware", OtherFirmware).toInt()); if(settings.value("printer/bedx").toInt()) ui->bedxbox->setValue(settings.value("printer/bedx").toInt());
else ui->bedxbox->setValue(200);
#ifdef QT_DEBUG if(settings.value("printer/bedy").toInt()) ui->bedybox->setValue(settings.value("printer/bedy").toInt());
ui->checksumbox->setEnabled(true); else ui->bedybox->setValue(200);
#else
ui->checksumbox->setDisabled(true);
#endif
} }
@ -49,21 +31,9 @@ SettingsWindow::~SettingsWindow()
void SettingsWindow::on_buttonBox_accepted() void SettingsWindow::on_buttonBox_accepted()
{ {
settings.setValue("core/flowcontrol", ui->flowcontrolbox->currentIndex());
settings.setValue("core/trayiconenabled", ui->traybox->isChecked());
settings.setValue("core/senderinterval", ui->senderbox->value()); settings.setValue("core/senderinterval", ui->senderbox->value());
settings.setValue("core/statusinterval", ui->statusbox->value()); settings.setValue("core/statusinterval", ui->statusbox->value());
settings.setValue("printer/bedy", ui->bedybox->value()); settings.setValue("printer/bedy", ui->bedybox->value());
settings.setValue("printer/bedx", ui->bedxbox->value()); settings.setValue("printer/bedx", ui->bedxbox->value());
settings.setValue("printer/feedrate", ui->feedrateBox->value()); settings.setValue("core/echo", ui->echobox->isChecked());
settings.setValue("printer/extruderfeedrate", ui->extruderFeedrateBox->value());
settings.setValue("core/lockcontrols", ui->lockbox->isChecked());
settings.setValue("core/checksums", ui->checksumbox->isChecked());
settings.setValue("core/checksdstatus", ui->sdbox->isChecked());
settings.setValue("core/dtr", ui->dtrbox->isChecked());
settings.setValue("printer/firmware", ui->firmwarecombo->currentIndex());
settings.setValue("user/supresswait", ui->supresswaitbox->isChecked());
settings.setValue("core/logbuffersize", ui->bufferbox->value());
emit updatesettings();
} }

View File

@ -3,9 +3,6 @@
#include <QDialog> #include <QDialog>
#include <QSettings> #include <QSettings>
#include "repraptor.h"
using namespace RepRaptor;
namespace Ui { namespace Ui {
class SettingsWindow; class SettingsWindow;
@ -27,10 +24,6 @@ private slots:
private: private:
Ui::SettingsWindow *ui; Ui::SettingsWindow *ui;
signals:
void updatesettings();
}; };
#endif // SETTINGSWINDOW_H #endif // SETTINGSWINDOW_H

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>603</width> <width>253</width>
<height>491</height> <height>242</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -19,321 +19,134 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QGroupBox" name="internalGroup">
<property name="minimumSize"> <property name="title">
<size> <string>Internal</string>
<width>200</width>
<height>400</height>
</size>
</property> </property>
<property name="currentIndex"> <layout class="QGridLayout" name="gridLayout">
<number>0</number> <item row="0" column="0">
</property> <widget class="QLabel" name="label">
<widget class="QWidget" name="tab_general"> <property name="text">
<attribute name="title"> <string>Sender</string>
<string>General</string> </property>
</attribute> </widget>
<layout class="QFormLayout" name="formLayout"> </item>
<item row="0" column="0"> <item row="0" column="1">
<widget class="QGroupBox" name="internalGroup"> <widget class="QDoubleSpinBox" name="senderbox">
<property name="title"> <property name="toolTip">
<string>Internal</string> <string>A good default is 2, lower = fater, higher = less CPU load. 0 would execute as soon as possible.</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <property name="toolTipDuration">
<item row="1" column="1"> <number>-1</number>
<widget class="QDoubleSpinBox" name="senderbox"> </property>
<property name="toolTip"> <property name="locale">
<string>A good default is 2, lower = fater, higher = less CPU load. 0 would execute as soon as possible.</string> <locale language="English" country="UnitedStates"/>
</property> </property>
<property name="toolTipDuration"> <property name="minimum">
<number>-1</number> <double>0.000000000000000</double>
</property> </property>
<property name="locale"> <property name="maximum">
<locale language="English" country="UnitedStates"/> <double>999.990000000000009</double>
</property> </property>
<property name="minimum"> <property name="singleStep">
<double>0.000000000000000</double> <double>0.100000000000000</double>
</property> </property>
<property name="maximum"> </widget>
<double>999.990000000000009</double> </item>
</property> <item row="0" column="2">
<property name="singleStep"> <widget class="QLabel" name="label_3">
<double>1.000000000000000</double> <property name="text">
</property> <string>ms</string>
<property name="value"> </property>
<double>2.000000000000000</double> </widget>
</property> </item>
</widget> <item row="1" column="0">
</item> <widget class="QLabel" name="label_2">
<item row="2" column="1"> <property name="text">
<widget class="QSpinBox" name="statusbox"> <string>Status</string>
<property name="toolTip"> </property>
<string>A good default is 5000. More = less interruptions, less = better temperature monitoring</string> </widget>
</property> </item>
<property name="toolTipDuration"> <item row="1" column="1">
<number>-1</number> <widget class="QSpinBox" name="statusbox">
</property> <property name="toolTip">
<property name="minimum"> <string>A good default is 5000. More = less interruptions, less = better temperature monitoring</string>
<number>1500</number> </property>
</property> <property name="toolTipDuration">
<property name="maximum"> <number>-1</number>
<number>99999</number> </property>
</property> <property name="minimum">
</widget> <number>500</number>
</item> </property>
<item row="2" column="0"> <property name="maximum">
<widget class="QLabel" name="label_2"> <number>99999</number>
<property name="text"> </property>
<string>Status</string> </widget>
</property> </item>
</widget> <item row="1" column="2">
</item> <widget class="QLabel" name="label_4">
<item row="10" column="0"> <property name="text">
<widget class="QCheckBox" name="checksumbox"> <string>ms</string>
<property name="enabled"> </property>
<bool>true</bool> </widget>
</property> </item>
<property name="text"> <item row="2" column="0" colspan="3">
<string>Checksums</string> <widget class="QCheckBox" name="echobox">
</property> <property name="toolTip">
</widget> <string>Show every sent command in console</string>
</item> </property>
<item row="9" column="0" colspan="3"> <property name="text">
<widget class="QCheckBox" name="sdbox"> <string>Echo commands</string>
<property name="text"> </property>
<string>Check SD printing status</string> </widget>
</property> </item>
</widget> </layout>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>This settings are applied after restart</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Flow control</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="dtrbox">
<property name="text">
<string>DTR</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
<item row="1" 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">
<property name="text">
<string>Sender</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QComboBox" name="flowcontrolbox">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QCheckBox" name="lockbox">
<property name="text">
<string>Lock controls when printing</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="traybox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Show tray icon</string>
</property>
<property name="text">
<string>Tray icon</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<widget class="QCheckBox" name="supresswaitbox">
<property name="text">
<string>Supress &quot;wait&quot; responce</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Log buffer</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="bufferbox">
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_network">
<attribute name="title">
<string>Network</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_hardware">
<attribute name="title">
<string>Hardware</string>
</attribute>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>249</width>
<height>171</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Printer</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QSpinBox" name="bedxbox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="bedybox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Bed size</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Firmware</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="firmwarecombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Feedrate</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QSpinBox" name="feedrateBox">
<property name="toolTip">
<string>Speed of axis movements (only affect buttons)</string>
</property>
<property name="maximum">
<number>99999</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Extruder
feedrate</string>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="extruderFeedrateBox">
<property name="toolTip">
<string>Extruder speed (only affect buttons)</string>
</property>
<property name="maximum">
<number>99999</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Printer</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="bedxbox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Bed size</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="bedybox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -341,9 +154,6 @@ feedrate</string>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -359,8 +169,8 @@ feedrate</string>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>243</x> <x>248</x>
<y>376</y> <y>254</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>157</x> <x>157</x>
@ -375,11 +185,11 @@ feedrate</string>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>243</x> <x>316</x>
<y>376</y> <y>260</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>252</x> <x>286</x>
<y>274</y> <y>274</y>
</hint> </hint>
</hints> </hints>