More error messages
This commit is contained in:
parent
9fff9d6743
commit
7e354a56d7
@ -1,11 +1,26 @@
|
||||
#include "errorwindow.h"
|
||||
#include "ui_errorwindow.h"
|
||||
|
||||
ErrorWindow::ErrorWindow(QWidget *parent, QString errorText) :
|
||||
using namespace RepRaptor;
|
||||
|
||||
ErrorWindow::ErrorWindow(QWidget *parent, QString errorText, int errType):
|
||||
QDialog(parent),
|
||||
ui(new Ui::ErrorWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
switch(errType)
|
||||
{
|
||||
case SerialPortError:
|
||||
ui->label->setText("Serial port error:");
|
||||
break;
|
||||
case OpenFileError:
|
||||
ui->label->setText("File open error:");
|
||||
break;
|
||||
default:
|
||||
ui->label->setText("Unknown error type:");
|
||||
break;
|
||||
}
|
||||
|
||||
ui->errorlabel->setText(errorText);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <QDialog>
|
||||
|
||||
#include "erroricon.h"
|
||||
#include "repraptor.h"
|
||||
|
||||
namespace Ui {
|
||||
class ErrorWindow;
|
||||
@ -14,7 +15,7 @@ class ErrorWindow : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ErrorWindow(QWidget *parent = 0, QString errorText = "Unknown error");
|
||||
explicit ErrorWindow(QWidget *parent = 0, QString errorText = "Unknown error", int errType = 0);
|
||||
~ErrorWindow();
|
||||
|
||||
private:
|
||||
|
||||
@ -222,6 +222,13 @@ void MainWindow::parseFile(QString filename)
|
||||
ui->filename->setText(gfile.fileName().split(QDir::separator()).last());
|
||||
ui->filelines->setText(QString::number(gcode.size()) + QString("/0 lines"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorWindow window(this, "Can't open file", OpenFileError);
|
||||
ui->filename->setText("");
|
||||
ui->filelines->setText("");
|
||||
window.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::serialupdate()
|
||||
@ -691,7 +698,7 @@ void MainWindow::serialError(QSerialPort::SerialPortError error)
|
||||
}
|
||||
|
||||
//Spawn the error message
|
||||
ErrorWindow errorwindow(this, errorMsg);
|
||||
ErrorWindow errorwindow(this, errorMsg, SerialPortError);
|
||||
errorwindow.exec();
|
||||
}
|
||||
|
||||
@ -871,7 +878,7 @@ void MainWindow::baudrateSetFailed(int b)
|
||||
{
|
||||
ErrorWindow errorwindow(this, QString("Baudrate set failed:\n" +
|
||||
QString::number(b) +
|
||||
" baud"));
|
||||
" baud"), SerialPortError);
|
||||
errorwindow.show();
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,12 @@ namespace RepRaptor
|
||||
OtherFirmware
|
||||
};
|
||||
|
||||
enum ErrorType
|
||||
{
|
||||
SerialPortError,
|
||||
OpenFileError
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int T, P;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user