Compare commits

..

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

24 changed files with 350 additions and 660 deletions

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,5 +1,5 @@
![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. This means some features are still absent, but it is already usable.

View File

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

View File

@ -71,5 +71,4 @@ RESOURCES += \
DISTFILES += \ DISTFILES += \
LICENCE \ LICENCE \
README.md \ README.md \
RepRaptor.desktop \ RepRaptor.desktop
.travis.yml

View File

@ -64,7 +64,7 @@ EEPROMWindow::EEPROMWindow(QStringList eepromLines, QWidget *parent) :
break; break;
} }
connect(edit, &QLineEdit::textChanged, this, &EEPROMWindow::lineChanged); connect(edit, SIGNAL(textChanged(QString)), this, SLOT(lineChanged(QString)));
line->addWidget(label); line->addWidget(label);
line->addWidget(edit); line->addWidget(edit);

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

@ -12,6 +12,9 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName("RepRaptor"); QCoreApplication::setApplicationName("RepRaptor");
QCoreApplication::setApplicationVersion(REPRAPTOR_VERSION); QCoreApplication::setApplicationVersion(REPRAPTOR_VERSION);
//Set the priority, so the OS would not mess up serial communication
QThread::currentThread()->setPriority(QThread::HighestPriority);
MainWindow w; MainWindow w;
w.show(); w.show();

View File

@ -7,10 +7,6 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
//Set parents
settings.setParent(this);
gfile.setParent(this);
//Setup the UI //Setup the UI
ui->fileBox->setDisabled(true); ui->fileBox->setDisabled(true);
ui->sendBtn->setDisabled(true); ui->sendBtn->setDisabled(true);
@ -29,18 +25,9 @@ MainWindow::MainWindow(QWidget *parent) :
ui->etmpspin->installEventFilter(this); ui->etmpspin->installEventFilter(this);
ui->btmpspin->installEventFilter(this); ui->btmpspin->installEventFilter(this);
recentMenu = new QMenu(this); recentMenu = new QMenu(this);
//Note about tray icon - possible bug with Qt 5.4
trayIcon = new QSystemTrayIcon(this);
trayIcon->setIcon(QIcon(":icons/repraptor.png"));
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(ui->actionOpen);
trayIconMenu->addAction(ui->actionExit);
trayIcon->setToolTip(tr("RepRaptor running in the background"));
trayIcon->setContextMenu(trayIconMenu);
recentMenu->setTitle("Recent files"); recentMenu->setTitle("Recent files");
ui->menuFile->insertMenu(ui->actionSettings, recentMenu); ui->menuFile->insertMenu(ui->actionSettings, recentMenu);
ui->menuFile->insertSeparator(ui->actionSettings); ui->menuFile->insertSeparator(ui->actionSettings);
terminalCursor = ui->terminal->textCursor();
//Init baudrate combobox //Init baudrate combobox
ui->baudbox->addItem(QString::number(4800)); ui->baudbox->addItem(QString::number(4800));
@ -80,10 +67,6 @@ MainWindow::MainWindow(QWidget *parent) :
ui->checktemp->setChecked(checkingTemperature); ui->checktemp->setChecked(checkingTemperature);
ui->etmpspin->setValue(settings.value("user/extrudertemp", 210).toInt()); ui->etmpspin->setValue(settings.value("user/extrudertemp", 210).toInt());
ui->btmpspin->setValue(settings.value("user/bedtemp", 60).toInt()); ui->btmpspin->setValue(settings.value("user/bedtemp", 60).toInt());
ui->stepspin->setValue(settings.value("user/step", 1).toInt());
ui->estepspin->setValue(settings.value("user/estep", 1).toInt());
ui->terminal->document()->setMaximumBlockCount(
settings.value("core/logbuffersize", 1000).toInt());
echo = settings.value("core/echo", 0).toBool(); echo = settings.value("core/echo", 0).toBool();
autolock = settings.value("core/lockcontrols", 0).toBool(); autolock = settings.value("core/lockcontrols", 0).toBool();
chekingSDStatus = settings.value("core/checksdstatus", 1).toBool(); chekingSDStatus = settings.value("core/checksdstatus", 1).toBool();
@ -91,9 +74,6 @@ MainWindow::MainWindow(QWidget *parent) :
statusTimer->setInterval(settings.value("core/statusinterval", 3000).toInt()); statusTimer->setInterval(settings.value("core/statusinterval", 3000).toInt());
feedrate = settings.value("feedrate", 1500).toInt(); feedrate = settings.value("feedrate", 1500).toInt();
extruderFeedrate = settings.value("extruderfeedrate", 200).toInt(); extruderFeedrate = settings.value("extruderfeedrate", 200).toInt();
trayIconEnabled = settings.value("core/trayiconenabled", 1).toBool();
supressWait = settings.value("user/supresswait", 0).toBool();
lastDir.append(settings.value("user/lastdir", "").toString());
int size = settings.beginReadArray("user/recentfiles"); int size = settings.beginReadArray("user/recentfiles");
for(int i = 0; i < size; ++i) for(int i = 0; i < size; ++i)
{ {
@ -108,7 +88,16 @@ MainWindow::MainWindow(QWidget *parent) :
sdprinting = false; sdprinting = false;
opened = false; opened = false;
sdBytes = 0; sdBytes = 0;
userHistoryPos = -1; userHistoryPos = 0;
userHistory.append("");
//Update serial ports
serialupdate();
//Internal signal-slots
connect(statusTimer, SIGNAL(timeout()), this, SLOT(checkStatus()));
connect(progressSDTimer, SIGNAL(timeout()), this, SLOT(checkSDStatus()));
connect(this, SIGNAL(eepromReady()), this, SLOT(openEEPROMeditor()));
//Register all the types //Register all the types
qRegisterMetaType<TemperatureReadings>("TemperatureReadings"); qRegisterMetaType<TemperatureReadings>("TemperatureReadings");
@ -118,14 +107,10 @@ MainWindow::MainWindow(QWidget *parent) :
qRegisterMetaType<FileProgress>("FileProgress"); qRegisterMetaType<FileProgress>("FileProgress");
qRegisterMetaType<QSerialPort::SerialPortError>("QSerialPort::SerialPortError"); qRegisterMetaType<QSerialPort::SerialPortError>("QSerialPort::SerialPortError");
//Internal signal-slots
connect(statusTimer, &QTimer::timeout, this, &MainWindow::checkStatus);
connect(progressSDTimer, &QTimer::timeout, this, &MainWindow::checkSDStatus);
connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconClicked);
//Parser thread signal-slots and init //Parser thread signal-slots and init
parserWorker->moveToThread(parserThread); parserWorker->moveToThread(parserThread);
connect(parserThread, &QThread::finished, parserWorker, &QObject::deleteLater); connect(parserThread, &QThread::finished, parserWorker, &QObject::deleteLater);
connect(this, &MainWindow::receivedData, parserWorker, &Parser::parse);
connect(this, &MainWindow::startedReadingEEPROM, parserWorker, &Parser::setEEPROMReadingMode); connect(this, &MainWindow::startedReadingEEPROM, parserWorker, &Parser::setEEPROMReadingMode);
connect(parserWorker, &Parser::receivedTemperature, this, &MainWindow::updateTemperature); connect(parserWorker, &Parser::receivedTemperature, this, &MainWindow::updateTemperature);
connect(parserWorker, &Parser::receivedSDFilesList, this, &MainWindow::initSDprinting); connect(parserWorker, &Parser::receivedSDFilesList, this, &MainWindow::initSDprinting);
@ -134,9 +119,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(parserWorker, &Parser::receivedError, this, &MainWindow::receivedError); connect(parserWorker, &Parser::receivedError, this, &MainWindow::receivedError);
connect(parserWorker, &Parser::receivedSDDone, this, &MainWindow::receivedSDDone); connect(parserWorker, &Parser::receivedSDDone, this, &MainWindow::receivedSDDone);
connect(parserWorker, &Parser::receivedSDUpdate, this, &MainWindow::updateSDStatus); connect(parserWorker, &Parser::receivedSDUpdate, this, &MainWindow::updateSDStatus);
connect(parserWorker, &Parser::receivedNotSDPrinting, this, &MainWindow::receivedNotSDPrinting);
parserThread->start(); parserThread->start();
parserThread->setPriority(QThread::HighestPriority);
//Sender thread signal-slots and init //Sender thread signal-slots and init
senderWorker->moveToThread(senderThread); senderWorker->moveToThread(senderThread);
@ -146,8 +129,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(parserWorker, &Parser::receivedResend, senderWorker, &Sender::receivedResend); connect(parserWorker, &Parser::receivedResend, senderWorker, &Sender::receivedResend);
connect(parserWorker, &Parser::receivedStart, senderWorker, &Sender::receivedStart); connect(parserWorker, &Parser::receivedStart, senderWorker, &Sender::receivedStart);
connect(senderWorker, &Sender::errorReceived, this, &MainWindow::serialError); connect(senderWorker, &Sender::errorReceived, this, &MainWindow::serialError);
connect(senderWorker, &Sender::dataReceived, parserWorker, &Parser::parse); connect(senderWorker, &Sender::dataReceived, parserWorker, &Parser::parse, Qt::QueuedConnection);
connect(senderWorker, &Sender::dataReceived, this, &MainWindow::readSerial); connect(senderWorker, &Sender::dataReceived, this, &MainWindow::readSerial, Qt::QueuedConnection);
connect(senderWorker, &Sender::reportProgress, this, &MainWindow::updateFileProgress); connect(senderWorker, &Sender::reportProgress, this, &MainWindow::updateFileProgress);
connect(senderWorker, &Sender::baudrateSetFailed, this, &MainWindow::baudrateSetFailed); connect(senderWorker, &Sender::baudrateSetFailed, this, &MainWindow::baudrateSetFailed);
connect(this, &MainWindow::setFile, senderWorker, &Sender::setFile); connect(this, &MainWindow::setFile, senderWorker, &Sender::setFile);
@ -160,7 +143,6 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, &MainWindow::injectCommand, senderWorker, &Sender::injectCommand); connect(this, &MainWindow::injectCommand, senderWorker, &Sender::injectCommand);
connect(this, &MainWindow::flushInjectionBuffer, senderWorker, &Sender::flushInjectionBuffer); connect(this, &MainWindow::flushInjectionBuffer, senderWorker, &Sender::flushInjectionBuffer);
senderThread->start(); senderThread->start();
senderThread->setPriority(QThread::TimeCriticalPriority);
//Timers init //Timers init
statusTimer->start(); statusTimer->start();
@ -169,15 +151,8 @@ MainWindow::MainWindow(QWidget *parent) :
sinceLastTemp->start(); sinceLastTemp->start();
sinceLastSDStatus->start(); sinceLastSDStatus->start();
//Update serial ports
serialupdate();
//Update recent files list //Update recent files list
updateRecent(); updateRecent();
//Update icon
if(trayIconEnabled) trayIcon->show();
else trayIcon->hide();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -188,9 +163,6 @@ MainWindow::~MainWindow()
settings.setValue("core/checktemperature", ui->checktemp->isChecked()); settings.setValue("core/checktemperature", ui->checktemp->isChecked());
settings.setValue("user/extrudertemp", ui->etmpspin->value()); settings.setValue("user/extrudertemp", ui->etmpspin->value());
settings.setValue("user/bedtemp", ui->btmpspin->value()); settings.setValue("user/bedtemp", ui->btmpspin->value());
settings.setValue("user/step", ui->stepspin->value());
settings.setValue("user/estep", ui->estepspin->value());
settings.setValue("user/lastdir", lastDir);
settings.beginWriteArray("user/recentfiles"); settings.beginWriteArray("user/recentfiles");
for(int i = 0; i < recentFiles.size(); ++i) for(int i = 0; i < recentFiles.size(); ++i)
{ {
@ -213,34 +185,13 @@ MainWindow::~MainWindow()
void MainWindow::open() void MainWindow::open()
{ {
if(this->isHidden()) this->show();
sdprinting = false; sdprinting = false;
QString filename; QString filename;
QDir home; QDir home;
if(lastDir == "")
{
filename = QFileDialog::getOpenFileName(this, filename = QFileDialog::getOpenFileName(this,
tr("Open GCODE"), "Open GCODE",
home.home().absolutePath(), home.home().absolutePath(),
"GCODE (*.g *.gco *.gcode *.nc)"); "GCODE (*.g *.gco *.gcode *.nc)");
}
else
{
filename = QFileDialog::getOpenFileName(this,
tr("Open GCODE"),
lastDir,
"GCODE (*.g *.gco *.gcode *.nc)");
}
if(filename.isEmpty() || filename.isNull()) return;
//Remember the last folder
lastDir.clear();
lastDir.append(filename);
int filenameChars = 0;
for(int i = filename.count()-1; filename.at(i) != QDir::separator(); i--)
{
filenameChars++; //Count how many characters are in the filename
}
lastDir.remove(lastDir.count()-filenameChars, filenameChars);//remove filename
gfile.setFileName(filename); gfile.setFileName(filename);
if(!recentFiles.contains(filename)) if(!recentFiles.contains(filename))
{ {
@ -272,13 +223,6 @@ void MainWindow::parseFile(QString filename)
ui->filename->setText(gfile.fileName().split(QDir::separator()).last()); ui->filename->setText(gfile.fileName().split(QDir::separator()).last());
ui->filelines->setText(QString::number(gcode.size()) + QString("/0 lines")); ui->filelines->setText(QString::number(gcode.size()) + QString("/0 lines"));
} }
else
{
ErrorWindow window(this, tr("Can't open file"), OpenFileError);
ui->filename->setText("");
ui->filelines->setText("");
window.exec();
}
} }
void MainWindow::serialupdate() void MainWindow::serialupdate()
@ -333,7 +277,7 @@ void MainWindow::serialconnect()
//Set the flag //Set the flag
opened = false; opened = false;
//Update UI //Update UI
ui->connectBtn->setText(tr("Connect")); ui->connectBtn->setText("Connect");
ui->sendBtn->setDisabled(true); ui->sendBtn->setDisabled(true);
ui->pauseBtn->setDisabled(true); ui->pauseBtn->setDisabled(true);
ui->progressBar->setValue(0); ui->progressBar->setValue(0);
@ -425,10 +369,10 @@ void MainWindow::homeall()
void MainWindow::on_sendbtn_clicked() void MainWindow::on_sendbtn_clicked()
{ {
QString command = ui->sendtext->text().toUpper(); QString command = ui->sendtext->text();
emit injectCommand(command); emit injectCommand(command);
userHistory.prepend(command); userHistory.append(command);
userHistoryPos = -1; userHistoryPos = 0;
} }
void MainWindow::on_fanonbtn_clicked() void MainWindow::on_fanonbtn_clicked()
@ -537,8 +481,8 @@ void MainWindow::on_sendBtn_clicked()
if(sending && !sdprinting) if(sending && !sdprinting)
{ {
sending = false; sending = false;
ui->sendBtn->setText(tr("Send")); ui->sendBtn->setText("Send");
ui->pauseBtn->setText(tr("Pause")); ui->pauseBtn->setText("Pause");
ui->pauseBtn->setDisabled(true); ui->pauseBtn->setDisabled(true);
if(autolock) ui->controlBox->setChecked(true); if(autolock) ui->controlBox->setChecked(true);
paused = false; paused = false;
@ -548,13 +492,11 @@ void MainWindow::on_sendBtn_clicked()
else if(!sending && !sdprinting) else if(!sending && !sdprinting)
{ {
sending=true; sending=true;
ui->sendBtn->setText(tr("Stop")); ui->sendBtn->setText("Stop");
ui->pauseBtn->setText(tr("Pause")); ui->pauseBtn->setText("Pause");
ui->pauseBtn->setEnabled(true); ui->pauseBtn->setEnabled(true);
if(autolock) ui->controlBox->setChecked(false); if(autolock) ui->controlBox->setChecked(false);
paused = false; paused = false;
emit flushInjectionBuffer();
emit pause(paused); emit pause(paused);
emit startPrinting(); emit startPrinting();
} }
@ -563,8 +505,8 @@ void MainWindow::on_sendBtn_clicked()
sending = false; sending = false;
emit injectCommand("M24"); emit injectCommand("M24");
emit injectCommand("M27"); emit injectCommand("M27");
ui->sendBtn->setText(tr("Start")); ui->sendBtn->setText("Start");
ui->pauseBtn->setText(tr("Pause")); ui->pauseBtn->setText("Pause");
ui->pauseBtn->setEnabled(true); ui->pauseBtn->setEnabled(true);
if(autolock) ui->controlBox->setChecked(true); if(autolock) ui->controlBox->setChecked(true);
paused = false; paused = false;
@ -581,14 +523,14 @@ void MainWindow::on_pauseBtn_clicked()
paused = false; paused = false;
emit pause(paused); emit pause(paused);
if(autolock) ui->controlBox->setChecked(false); if(autolock) ui->controlBox->setChecked(false);
ui->pauseBtn->setText(tr("Pause")); ui->pauseBtn->setText("Pause");
} }
else if(!paused && !sdprinting) else if(!paused && !sdprinting)
{ {
paused = true; paused = true;
emit pause(paused); emit pause(paused);
if(autolock) ui->controlBox->setChecked(true); if(autolock) ui->controlBox->setChecked(true);
ui->pauseBtn->setText(tr("Resume")); ui->pauseBtn->setText("Resume");
} }
else if(sdprinting) else if(sdprinting)
{ {
@ -605,8 +547,6 @@ void MainWindow::on_actionSettings_triggered()
{ {
SettingsWindow settingswindow(this); SettingsWindow settingswindow(this);
connect(&settingswindow, &SettingsWindow::updatesettings, this, &MainWindow::updatesettings);
settingswindow.exec(); settingswindow.exec();
} }
@ -632,16 +572,15 @@ void MainWindow::readSerial(QByteArray data)
void MainWindow::printMsg(QString text) void MainWindow::printMsg(QString text)
{ {
if(supressWait && text.startsWith("wait")) return;
//Get the cursor and set it to the end //Get the cursor and set it to the end
terminalCursor.movePosition(QTextCursor::End); QTextCursor cursor = ui->terminal->textCursor();
cursor.movePosition(QTextCursor::End);
//Paste the text //Paste the text
terminalCursor.insertText(text); cursor.insertText(text);
//Scroll to the bottom //Apply
ui->terminal->verticalScrollBar()->setValue( ui->terminal->setTextCursor(cursor);
ui->terminal->verticalScrollBar()->maximum());
} }
void MainWindow::checkStatus() void MainWindow::checkStatus()
@ -672,8 +611,9 @@ void MainWindow::updateRecent()
{ {
QAction *action = new QAction(this); QAction *action = new QAction(this);
action->setText(str); //Set filepath as a title action->setText(str); //Set filepath as a title
action->setObjectName(str); //Also set name to the path so we can get it later
recentMenu->addAction(action); //Add action to the menu recentMenu->addAction(action); //Add action to the menu
connect(action, &QAction::triggered, this, &MainWindow::recentClicked); connect(action, SIGNAL(triggered()), this, SLOT(recentClicked()));
} }
} }
} }
@ -700,7 +640,7 @@ void MainWindow::serialError(QSerialPort::SerialPortError error)
opened = false; opened = false;
//Update UI //Update UI
ui->connectBtn->setText(tr("Connect")); ui->connectBtn->setText("Connect");
ui->sendBtn->setDisabled(true); ui->sendBtn->setDisabled(true);
ui->pauseBtn->setDisabled(true); ui->pauseBtn->setDisabled(true);
ui->controlBox->setDisabled(true); ui->controlBox->setDisabled(true);
@ -717,42 +657,38 @@ void MainWindow::serialError(QSerialPort::SerialPortError error)
switch(error) switch(error)
{ {
case QSerialPort::DeviceNotFoundError: case QSerialPort::DeviceNotFoundError:
errorMsg = tr("Device not found"); errorMsg = "Device not found";
break; break;
case QSerialPort::PermissionError: case QSerialPort::PermissionError:
errorMsg = tr("Insufficient permissions\nAlready opened?"); errorMsg = "Insufficient permissions\nAlready opened?";
break; break;
case QSerialPort::OpenError: case QSerialPort::OpenError:
errorMsg = tr("Cant open port\nAlready opened?"); errorMsg = "Cant open port\nAlready opened?";
break; break;
case QSerialPort::TimeoutError: case QSerialPort::TimeoutError:
errorMsg = tr("Serial connection timed out"); errorMsg = "Serial connection timed out";
break; break;
//These errors are the same really //These errors are the same really
case QSerialPort::WriteError: case QSerialPort::WriteError:
case QSerialPort::ReadError: case QSerialPort::ReadError:
errorMsg = tr("I/O Error"); errorMsg = "I/O Error";
break; break;
case QSerialPort::ResourceError: case QSerialPort::ResourceError:
errorMsg = tr("Disconnected"); errorMsg = "Disconnected";
break;
case QSerialPort::UnsupportedOperationError:
errorMsg = tr("Operation not supported.\nUnsupported baudrate?");
break; break;
default: default:
errorMsg = tr("Unknown error\nSomething went wrong"); errorMsg = "Unknown error\nSomething went wrong";
break; break;
} }
//Spawn the error message //Spawn the error message
ErrorWindow errorwindow(this, errorMsg, SerialPortError); ErrorWindow errorwindow(this, errorMsg);
errorwindow.exec(); errorwindow.exec();
} }
@ -768,7 +704,7 @@ void MainWindow::initSDprinting(QStringList sdFiles)
{ {
SDWindow sdwindow(sdFiles, this); SDWindow sdwindow(sdFiles, this);
connect(&sdwindow, &SDWindow::fileSelected, this, &MainWindow::selectSDfile); connect(&sdwindow, SIGNAL(fileSelected(QString)), this, SLOT(selectSDfile(QString)));
sdwindow.exec(); sdwindow.exec();
} }
@ -783,12 +719,12 @@ void MainWindow::selectSDfile(QString file)
ui->filename->setText(filename); ui->filename->setText(filename);
if(chekingSDStatus) if(chekingSDStatus)
{ {
ui->filelines->setText(bytes + tr("/0 bytes")); ui->filelines->setText(bytes + QString("/0 bytes"));
ui->progressBar->setEnabled(true); ui->progressBar->setEnabled(true);
ui->progressBar->setValue(0); ui->progressBar->setValue(0);
} }
else ui->progressBar->setDisabled(true); else ui->progressBar->setDisabled(true);
ui->sendBtn->setText(tr("Start")); ui->sendBtn->setText("Start");
sdBytes = bytes.toDouble(); sdBytes = bytes.toDouble();
emit flushInjectionBuffer(); emit flushInjectionBuffer();
@ -802,7 +738,7 @@ void MainWindow::updateSDStatus(SDProgress p)
ui->filelines->setText(QString::number(p.progress) ui->filelines->setText(QString::number(p.progress)
+ QString("/") + QString("/")
+ QString::number(p.total) + QString::number(p.total)
+ QString(tr(" bytes"))); + QString(" bytes"));
if(p.progress != 0) ui->progressBar->setValue(((double)p.progress/p.total) * 100); if(p.progress != 0) ui->progressBar->setValue(((double)p.progress/p.total) * 100);
else ui->progressBar->setValue(0); else ui->progressBar->setValue(0);
if(p.total == p.progress) sdprinting = false; if(p.total == p.progress) sdprinting = false;
@ -816,13 +752,6 @@ void MainWindow::checkSDStatus()
emit injectCommand("M27"); emit injectCommand("M27");
} }
void MainWindow::receivedNotSDPrinting()
{
sdprinting = false;
ui->fileBox->setDisabled(true);
ui->filename->setText(tr("Filename: "));
}
void MainWindow::on_stepspin_valueChanged(const QString &arg1) void MainWindow::on_stepspin_valueChanged(const QString &arg1)
{ {
if(arg1.toFloat() < 1) ui->stepspin->setSingleStep(0.1); if(arg1.toFloat() < 1) ui->stepspin->setSingleStep(0.1);
@ -875,8 +804,8 @@ void MainWindow::openEEPROMeditor()
{ {
EEPROMWindow eepromwindow(EEPROMSettings, this); EEPROMWindow eepromwindow(EEPROMSettings, this);
eepromwindow.setWindowModality(Qt::NonModal); //Do not block the UI when EEPROM editor is shown eepromwindow.setWindowModality(Qt::NonModal); //Do not bloct the UI when EEPROM editor is shown
connect(&eepromwindow, &EEPROMWindow::changesComplete, this, &MainWindow::sendEEPROMsettings); connect(&eepromwindow, SIGNAL(changesComplete(QStringList)), this, SLOT(sendEEPROMsettings(QStringList)));
eepromwindow.exec(); eepromwindow.exec();
} }
@ -898,7 +827,7 @@ void MainWindow::EEPROMSettingReceived(QString esetting)
void MainWindow::receivedError() void MainWindow::receivedError()
{ {
//This should be raised if "!!" received //This should be raised if "!!" received
ErrorWindow errorwindow(this, tr("Hardware failure"), 2); ErrorWindow errorwindow(this,"Hardware failure");
errorwindow.exec(); errorwindow.exec();
} }
@ -906,9 +835,7 @@ void MainWindow::receivedSDDone()
{ {
sdprinting=false; sdprinting=false;
ui->progressBar->setValue(0); ui->progressBar->setValue(0);
if(trayIconEnabled && (this->isMinimized() || this->isHidden())) ui->filename->setText("");
trayIcon->showMessage(tr("Done"), tr("Finished printing"));
ui->filename->setText(tr("Filename:"));
ui->fileBox->setDisabled(true); ui->fileBox->setDisabled(true);
} }
@ -917,17 +844,15 @@ void MainWindow::updateFileProgress(FileProgress p)
//Check if file is at end //Check if file is at end
if(p.P >= p.T) if(p.P >= p.T)
{ {
ui->sendBtn->setText(tr("Send")); ui->sendBtn->setText("Send");
ui->pauseBtn->setDisabled(true); ui->pauseBtn->setDisabled(true);
if(trayIconEnabled && (this->isMinimized() || this->isHidden()))
trayIcon->showMessage(tr("Done"), tr("Finished printing"));
sending = false; sending = false;
paused = false; paused = false;
emit pause(paused); emit pause(paused);
} }
else else
{ {
ui->sendBtn->setText(tr("Stop")); ui->sendBtn->setText("Stop");
ui->pauseBtn->setEnabled(true); ui->pauseBtn->setEnabled(true);
sending = true; sending = true;
} }
@ -935,31 +860,18 @@ void MainWindow::updateFileProgress(FileProgress p)
ui->filelines->setText(QString::number(p.T) ui->filelines->setText(QString::number(p.T)
+ QString("/") + QString("/")
+ QString::number(p.P) + QString::number(p.P)
+ tr(" Lines")); + QString(" Lines"));
ui->progressBar->setValue(((float)p.P/p.T) * 100); ui->progressBar->setValue(((float)p.P/p.T) * 100);
} }
void MainWindow::baudrateSetFailed(int b) void MainWindow::baudrateSetFailed(int b)
{ {
ErrorWindow errorwindow(this, tr("Baudrate set failed:\n") + ErrorWindow errorwindow(this, QString("Baudrate set failed:\n" +
QString::number(b) + QString::number(b) +
tr(" baud"), SerialPortError); " baud"));
errorwindow.show(); errorwindow.show();
} }
void MainWindow::updatesettings()
{
echo = settings.value("core/echo", 0).toBool();
autolock = settings.value("core/lockcontrols", 0).toBool();
chekingSDStatus = settings.value("core/checksdstatus", 1).toBool();
firmware = settings.value("printer/firmware", OtherFirmware).toInt();
statusTimer->setInterval(settings.value("core/statusinterval", 3000).toInt());
feedrate = settings.value("feedrate", 1500).toInt();
extruderFeedrate = settings.value("extruderfeedrate", 200).toInt();
ui->terminal->document()->setMaximumBlockCount(
settings.value("core/logbuffersize", 1000).toInt());
}
//Needed for keypress handling //Needed for keypress handling
bool MainWindow::eventFilter(QObject *obj, QEvent *event) bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{ {
@ -972,7 +884,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
if (keyEvent->key() == Qt::Key_Up) //Scroll up with up arrow if (keyEvent->key() == Qt::Key_Up) //Scroll up with up arrow
{ {
if(++userHistoryPos < userHistory.size()) if(++userHistoryPos <= userHistory.size()-1)
ui->sendtext->setText(userHistory.at(userHistoryPos)); ui->sendtext->setText(userHistory.at(userHistoryPos));
else userHistoryPos--; else userHistoryPos--;
return true; return true;
@ -981,11 +893,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{ {
if(--userHistoryPos >= 0) if(--userHistoryPos >= 0)
ui->sendtext->setText(userHistory.at(userHistoryPos)); ui->sendtext->setText(userHistory.at(userHistoryPos));
else else userHistoryPos++;
{
userHistoryPos++;
ui->sendtext->clear();
}
return true; return true;
} }
} }
@ -1017,50 +925,10 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
return QMainWindow::eventFilter(obj, event); return QMainWindow::eventFilter(obj, event);
} }
void MainWindow::closeEvent(QCloseEvent *event)
{
//If connected to printer - show warning dialog
if(opened)
{
//Create dialog
QMessageBox dialog(this);
//Set it up - different text if just connected and if printing
if(sending) dialog.setText(tr("Printer is working!\nAre you shure you want to exit?"));
else dialog.setText(tr("Printer is connected!\nAre you shure you want tot exit?"));
dialog.setIcon(QMessageBox::Warning);
dialog.setWindowTitle(tr("Warning"));
//Save pointer to check what button was clicked
QPushButton *exitButton = dialog.addButton(tr("Exit"), QMessageBox::AcceptRole);
dialog.addButton(QMessageBox::Cancel);
//Show dialog
dialog.exec();
//Process responce
if(dialog.clickedButton() == exitButton) event->accept();
else event->ignore();
}
//Close immediately if not connected
else event->accept();
}
void MainWindow::trayIconClicked(QSystemTrayIcon::ActivationReason reason)
{
if(trayIconEnabled && reason == QSystemTrayIcon::Trigger)
{
if(this->isHidden()) this->show();
else this->hide();
}
else return;
}
void MainWindow::recentClicked() void MainWindow::recentClicked()
{ {
//Actually a dirty hack, but it is fast and simple //Actually a dirty hack, but it is fast and simple
//So this slot is not for anything to trigger, but //So this slot is not for anything to trigger, but
//recent files menu //recent files menu
QAction *action = qobject_cast<QAction*>(sender()); parseFile(sender()->objectName());
if(action) parseFile(action->text());
} }

View File

@ -3,7 +3,6 @@
#include <QMainWindow> #include <QMainWindow>
#include <QFileDialog> #include <QFileDialog>
#include <QSystemTrayIcon>
#include <QtSerialPort/QtSerialPort> #include <QtSerialPort/QtSerialPort>
#include <QFile> #include <QFile>
#include <QThread> #include <QThread>
@ -49,9 +48,7 @@ protected:
QQueue <QString> userCommands; QQueue <QString> userCommands;
QTimer *progressSDTimer; QTimer *progressSDTimer;
QTimer *statusTimer; QTimer *statusTimer;
QSystemTrayIcon *trayIcon;
QMenu *recentMenu; QMenu *recentMenu;
QMenu *trayIconMenu;
QElapsedTimer *sinceLastTemp; QElapsedTimer *sinceLastTemp;
QElapsedTimer *sinceLastSDStatus; QElapsedTimer *sinceLastSDStatus;
QSettings settings; QSettings settings;
@ -59,15 +56,12 @@ protected:
QStringList EEPROMSettings; QStringList EEPROMSettings;
QStringList userHistory; QStringList userHistory;
QSerialPortInfo printerinfo; QSerialPortInfo printerinfo;
QTextCursor terminalCursor;
void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *target, QEvent *event); bool eventFilter(QObject *target, QEvent *event);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QString lastDir;
bool opened; bool opened;
bool firstrun; bool firstrun;
bool autolock; bool autolock;
@ -78,8 +72,6 @@ private:
bool sdprinting; bool sdprinting;
bool echo; bool echo;
bool chekingSDStatus; bool chekingSDStatus;
bool trayIconEnabled;
bool supressWait;
int firmware; int firmware;
int feedrate; int feedrate;
int extruderFeedrate; int extruderFeedrate;
@ -90,7 +82,6 @@ private slots:
void open(); void open();
void serialconnect(); void serialconnect();
void serialupdate(); void serialupdate();
void updatesettings();
void readSerial(QByteArray data); void readSerial(QByteArray data);
void printMsg(QString text); void printMsg(QString text);
void checkStatus(); void checkStatus();
@ -106,12 +97,10 @@ private slots:
void EEPROMSettingReceived(QString esetting); void EEPROMSettingReceived(QString esetting);
void receivedError(); void receivedError();
void receivedSDDone(); void receivedSDDone();
void receivedNotSDPrinting();
void parseFile(QString filename); void parseFile(QString filename);
void recentClicked(); void recentClicked();
void updateFileProgress(FileProgress); void updateFileProgress(FileProgress);
void baudrateSetFailed(int b); void baudrateSetFailed(int b);
void trayIconClicked(QSystemTrayIcon::ActivationReason reason);
void xplus(); void xplus();
void yplus(); void yplus();
@ -159,6 +148,8 @@ private slots:
signals: signals:
void sdReady(); void sdReady();
void eepromReady();
void receivedData(QByteArray);
void startedReadingEEPROM(); void startedReadingEEPROM();
void openPort(QSerialPortInfo i); void openPort(QSerialPortInfo i);

View File

@ -51,17 +51,10 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="editable">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="baudbox"> <widget class="QComboBox" name="baudbox"/>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QPushButton" name="portsBtn"> <widget class="QPushButton" name="portsBtn">
@ -276,9 +269,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"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
@ -320,9 +310,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"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>

View File

@ -29,7 +29,7 @@ void Parser::parse(QByteArray data)
{ {
if(readingFiles) //SD files list reading mode if(readingFiles) //SD files list reading mode
{ {
if(!data.contains("End file list")) SDFilesList.append(data.remove(data.size()-2, 2)); if(!data.contains("End file list")) SDFilesList.append(data);
else else
{ {
readingFiles = false; readingFiles = false;
@ -105,7 +105,7 @@ void Parser::parse(QByteArray data)
emit receivedSDUpdate(p); emit receivedSDUpdate(p);
} }
else if(data.startsWith("Not SD ")) emit receivedNotSDPrinting(); else if(data.startsWith("Not SD "));
else if(data.contains("Begin file list")) else if(data.contains("Begin file list"))
{ {
SDFilesList.clear(); SDFilesList.clear();

View File

@ -28,7 +28,6 @@ protected:
signals: signals:
void receivedTemperature(TemperatureReadings); void receivedTemperature(TemperatureReadings);
void receivedSDUpdate(SDProgress); void receivedSDUpdate(SDProgress);
void receivedNotSDPrinting();
void receivedEEPROMLine(QString); void receivedEEPROMLine(QString);
void recievingEEPROMDone(); void recievingEEPROMDone();
void receivedSDFilesList(QStringList); void receivedSDFilesList(QStringList);

View File

@ -1,12 +1,8 @@
/////////////////////////////////////////////////
//This file contains RepRaptor - specific stuff//
/////////////////////////////////////////////////
#ifndef REPRAPTOR_H #ifndef REPRAPTOR_H
#define REPRAPTOR_H #define REPRAPTOR_H
#ifndef REPRAPTOR_VERSION #ifndef REPRAPTOR_VERSION
#define REPRAPTOR_VERSION "0.3.9" #define REPRAPTOR_VERSION "0.3.6"
#endif #endif
namespace RepRaptor namespace RepRaptor
@ -24,13 +20,6 @@ namespace RepRaptor
OtherFirmware OtherFirmware
}; };
enum ErrorType
{
SerialPortError,
OpenFileError,
HardwareFailure
};
typedef struct typedef struct
{ {
int T, P; int T, P;

View File

@ -7,13 +7,7 @@ SDWindow::SDWindow(QStringList files, QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->fileslist->setSelectionMode(QListView::SingleSelection);
if(!files.isEmpty())
{
ui->fileslist->addItems(files); 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

@ -16,7 +16,7 @@ Sender::Sender(QObject *parent) : QObject(parent)
sendTimer = new QTimer(this); sendTimer = new QTimer(this);
//Fetch settings //Fetch settings
QSettings settings(this); QSettings settings;
sendTimer->setInterval(settings.value("core/senderinterval", 2).toInt()); sendTimer->setInterval(settings.value("core/senderinterval", 2).toInt());
sendingChecksum = settings.value("core/checksums", 0).toBool(); sendingChecksum = settings.value("core/checksums", 0).toBool();
dtr = settings.value("core/dtr", 1).toBool(); dtr = settings.value("core/dtr", 1).toBool();
@ -40,7 +40,6 @@ void Sender::sendNext()
{ {
if(printer->isWritable() && readyReceive) if(printer->isWritable() && readyReceive)
{ {
//Checksums
if(sendingChecksum && resending) if(sendingChecksum && resending)
{ {
if(resendNum < sentCommands.size()) if(resendNum < sentCommands.size())

View File

@ -23,11 +23,11 @@ public:
protected: protected:
QSerialPort *printer; QSerialPort *printer;
QTimer *sendTimer; QTimer *sendTimer;
long int currentLine; unsigned int currentLine;
long int totalLineNum; unsigned int totalLineNum;
long int resendNum; unsigned int resendNum;
long int baudrate; unsigned int baudrate;
long int flowcontrol; int flowcontrol;
bool paused; bool paused;
bool sending; bool sending;
bool dtr; bool dtr;

View File

@ -6,16 +6,15 @@ 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("No control");
ui->flowcontrolbox->addItem(tr("Hardware control")); ui->flowcontrolbox->addItem("Hardware control");
ui->flowcontrolbox->addItem(tr("Software control")); ui->flowcontrolbox->addItem("Software control");
//bool firstrun = !settings.value("core/firstrun").toBool(); //firstrun is inverted! //bool firstrun = !settings.value("core/firstrun").toBool(); //firstrun is inverted!
settings.setParent(this);
ui->flowcontrolbox->setCurrentIndex(settings.value("core/flowcontrol", 0).toInt()); ui->flowcontrolbox->setCurrentIndex(settings.value("core/flowcontrol", 0).toInt());
ui->senderbox->setValue(settings.value("core/senderinterval", 2).toInt()); ui->senderbox->setValue(settings.value("core/senderinterval", 2).toInt());
ui->traybox->setChecked(settings.value("core/trayiconenabled", 1).toBool()); ui->echobox->setChecked(settings.value("core/echo", 0).toBool());
ui->statusbox->setValue(settings.value("core/statusinterval", 2000).toInt()); ui->statusbox->setValue(settings.value("core/statusinterval", 2000).toInt());
ui->bedxbox->setValue(settings.value("printer/bedx", 200).toInt()); ui->bedxbox->setValue(settings.value("printer/bedx", 200).toInt());
ui->bedybox->setValue(settings.value("printer/bedy", 200).toInt()); ui->bedybox->setValue(settings.value("printer/bedy", 200).toInt());
@ -25,8 +24,6 @@ SettingsWindow::SettingsWindow(QWidget *parent) :
ui->checksumbox->setChecked(settings.value("core/checksums", 0).toBool()); ui->checksumbox->setChecked(settings.value("core/checksums", 0).toBool());
ui->sdbox->setChecked(settings.value("core/checksdstatus", 1).toBool()); ui->sdbox->setChecked(settings.value("core/checksdstatus", 1).toBool());
ui->dtrbox->setChecked(settings.value("core/dtr", 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 ui->firmwarecombo->addItem("Marlin"); //0
ui->firmwarecombo->addItem("Repetier"); //1 ui->firmwarecombo->addItem("Repetier"); //1
@ -50,20 +47,16 @@ SettingsWindow::~SettingsWindow()
void SettingsWindow::on_buttonBox_accepted() void SettingsWindow::on_buttonBox_accepted()
{ {
settings.setValue("core/flowcontrol", ui->flowcontrolbox->currentIndex()); 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("printer/feedrate", ui->feedrateBox->value());
settings.setValue("printer/extruderfeedrate", ui->extruderFeedrateBox->value()); settings.setValue("printer/extruderfeedrate", ui->extruderFeedrateBox->value());
settings.setValue("core/echo", ui->echobox->isChecked());
settings.setValue("core/lockcontrols", ui->lockbox->isChecked()); settings.setValue("core/lockcontrols", ui->lockbox->isChecked());
settings.setValue("core/checksums", ui->checksumbox->isChecked()); settings.setValue("core/checksums", ui->checksumbox->isChecked());
settings.setValue("core/checksdstatus", ui->sdbox->isChecked()); settings.setValue("core/checksdstatus", ui->sdbox->isChecked());
settings.setValue("core/dtr", ui->dtrbox->isChecked()); settings.setValue("core/dtr", ui->dtrbox->isChecked());
settings.setValue("printer/firmware", ui->firmwarecombo->currentIndex()); 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

@ -27,10 +27,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>483</width>
<height>491</height> <height>341</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -18,28 +18,25 @@
<normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset> <normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="minimumSize">
<size>
<width>200</width>
<height>400</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_general">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="internalGroup"> <widget class="QGroupBox" name="internalGroup">
<property name="title"> <property name="title">
<string>Internal</string> <string>Internal</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="echobox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Show every sent command in console</string>
</property>
<property name="text">
<string>Echo commands</string>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QDoubleSpinBox" name="senderbox"> <widget class="QDoubleSpinBox" name="senderbox">
<property name="toolTip"> <property name="toolTip">
@ -65,6 +62,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QSpinBox" name="statusbox"> <widget class="QSpinBox" name="statusbox">
<property name="toolTip"> <property name="toolTip">
@ -81,14 +92,35 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="2">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Status</string> <string>ms</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="lockbox">
<property name="text">
<string>Lock controls when printing</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="7" column="0" colspan="3">
<widget class="QCheckBox" name="sdbox">
<property name="text">
<string>Check SD printing status</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="checksumbox"> <widget class="QCheckBox" name="checksumbox">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -98,13 +130,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" colspan="3">
<widget class="QCheckBox" name="sdbox">
<property name="text">
<string>Check SD printing status</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3"> <item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="minimumSize"> <property name="minimumSize">
@ -127,115 +152,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" 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"> <widget class="QCheckBox" name="dtrbox">
<property name="text"> <property name="text">
<string>DTR</string> <string>DTR</string>
</property> </property>
</widget> </widget>
</item> </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"> <item row="3" column="0">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Log buffer</string> <string>Flow control</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="bufferbox"> <widget class="QComboBox" name="flowcontrolbox"/>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> <item row="0" column="1">
</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"> <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"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -299,9 +237,6 @@
</item> </item>
<item row="2" column="1" colspan="2"> <item row="2" column="1" colspan="2">
<widget class="QSpinBox" name="feedrateBox"> <widget class="QSpinBox" name="feedrateBox">
<property name="toolTip">
<string>Speed of axis movements (only affect buttons)</string>
</property>
<property name="maximum"> <property name="maximum">
<number>99999</number> <number>99999</number>
</property> </property>
@ -320,9 +255,6 @@ feedrate</string>
</item> </item>
<item row="3" column="1" colspan="2"> <item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="extruderFeedrateBox"> <widget class="QSpinBox" name="extruderFeedrateBox">
<property name="toolTip">
<string>Extruder speed (only affect buttons)</string>
</property>
<property name="maximum"> <property name="maximum">
<number>99999</number> <number>99999</number>
</property> </property>
@ -330,10 +262,8 @@ feedrate</string>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>