Example #1
0
pFace::pFace(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::pFace)
{
    ui->setupUi(this);

    QObject::connect(ui->LoadButton,SIGNAL(clicked()),this,SLOT(readScript()));
    QObject::connect(ui->RunButton,SIGNAL(clicked()),this,SLOT(tmpRunner()));
    //QObject::connect(ui->RunButton,SIGNAL(clicked()),this,SLOT(parseCommands()));
    QObject::connect(ui->ConnectButton,SIGNAL(clicked()),this,SLOT(connect2Port()));
    QObject::connect(ui->DisconnectButton,SIGNAL(clicked()),this,SLOT(closePort()));
    QObject::connect(ui->scanButton,SIGNAL(clicked()),this,SLOT(scanPorts()));

    QObject::connect(ui->homeX,SIGNAL(clicked()),this,SLOT(homeX()));
    QObject::connect(ui->homeY,SIGNAL(clicked()),this,SLOT(homeY()));
    QObject::connect(ui->homeZ,SIGNAL(clicked()),this,SLOT(homeZ()));
    QObject::connect(ui->homeAll,SIGNAL(clicked()),this,SLOT(homeAll()));

    scanPorts();
}
Example #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //about window
    this->aboutWindow = new AboutWindow();
    this->aboutWindow->hide();
    this->aboutWindow->move(this->geometry().center()-this->aboutWindow->geometry().center());
    //calibrate Dialog
    this->calibrateDialog = new CalibrateDialog();
    this->calibrateDialog->hide();
    this->calibrateDialog->move(this->geometry().center()-this->calibrateDialog->geometry().center());
    //option Dialog
    this->optionDialog = new OptionDialog();
    this->optionDialog->hide();
    this->optionDialog->move(this->geometry().center()-this->optionDialog->geometry().center());
    //slice dialog
    this->sliceDialog = new SliceDialog(ui->glWidget, this);
    this->sliceDialog->hide();
    this->sliceDialog->move(this->geometry().center()-this->sliceDialog->geometry().center());
    //macros window
    this->macrosWindow = new MacrosWindow();
    this->macrosWindow->hide();
    this->macrosWindow->move(this->geometry().center()-this->macrosWindow->geometry().center());
    connect(this->macrosWindow, SIGNAL(buttonAdded(MacroButton*)), this, SLOT(addMacroBtn(MacroButton*)));
    connect(this->macrosWindow, SIGNAL(buttonRemoved(MacroButton*)), this, SLOT(removeMacroBtn(MacroButton*)));
    //sd card window
    this->sdCardWindow = new SDCardWindow();
    this->sdCardWindow->hide();
    this->sdCardWindow->move(this->geometry().center()-this->sdCardWindow->geometry().center());
    connect(this->sdCardWindow, SIGNAL(sdFile_selected(QString)), this, SLOT(sdFile_selected(QString)));
    connect(this->optionDialog, SIGNAL(slicerPathChanged(QString)), this->sliceDialog, SLOT(updateSlicerPath(QString)));
    connect(this->optionDialog, SIGNAL(outputPathChanged(QString)), this->sliceDialog, SLOT(updateOutputPath(QString)));
    connect(this->optionDialog, SIGNAL(newSize(QVector3D)), this, SLOT(updatadeSize(QVector3D)));
    connect(this->optionDialog, SIGNAL(newList(QList<Material*>*)), this->sliceDialog, SLOT(setMaterialList(QList<Material*>*)));
    connect(this->sliceDialog, SIGNAL(fileSliced(QString)), this, SLOT(loadFile(QString)));
    //set version number
    this->setWindowTitle("YARRH v"+QString::number(VERSION_MAJOR)+"."+QString::number(VERSION_MINOR)+"."+QString::number(VERSION_REVISION));
    this->aboutWindow->setVersion(VERSION_MAJOR,VERSION_MINOR,VERSION_REVISION);
    //setting up printer and its thread
    this->printerObj = new Printer();
    QThread *qthread = new QThread();

    //connecting ui to printer
    connect(printerObj, SIGNAL(write_to_console(QString)), ui->inConsole, SLOT(appendPlainText(QString)), Qt::QueuedConnection);
    connect(this->macrosWindow, SIGNAL(writeToPrinter(QString)), printerObj, SLOT(send_now(QString)),Qt::QueuedConnection);
    connect(ui->fanSpinBox, SIGNAL(valueChanged(int)), printerObj, SLOT(setFan(int)), Qt::QueuedConnection);
    ui->fanSpinBox->blockSignals(true);
    connect(this->printerObj, SIGNAL(SDFileList(QStringList)), this->sdCardWindow, SLOT(updateFileList(QStringList)));
    connect(this->printerObj, SIGNAL(uploadProgress(int,int)), this->sdCardWindow, SLOT(updateProgress(int,int)));
    this->sdCardWindow->setPrinter(this->printerObj);
    //connecting move btns
    connect(ui->homeX, SIGNAL(clicked()), printerObj, SLOT(homeX()), Qt::QueuedConnection);
    connect(ui->homeY, SIGNAL(clicked()), printerObj, SLOT(homeY()), Qt::QueuedConnection);
    connect(ui->homeAll, SIGNAL(clicked()), printerObj, SLOT(homeAll()), Qt::QueuedConnection);
    //connect monit temp checkbox
    connect(ui->graphGroupBox, SIGNAL(toggled(bool)), printerObj, SLOT(setMonitorTemperature(bool)),Qt::QueuedConnection);
    //connect printer to temp widget
    connect(printerObj, SIGNAL(currentTemp(double,double,double)), this, SLOT(drawTemp(double,double,double)));
    connect(printerObj, SIGNAL(progress(int,int)), this, SLOT(updateProgress(int,int)));
    connect(printerObj, SIGNAL(connected(bool)), this, SLOT(printerConnected(bool)));
    //setting ui temp from gcode
    connect(printerObj, SIGNAL(settingTemp1(double)), this, SLOT(setTemp1FromGcode(double)));
    connect(printerObj, SIGNAL(settingTemp3(double)), this, SLOT(setTemp3FromGcode(double)));
    //updating head position in ui
    connect(printerObj, SIGNAL(currentPosition(QVector3D)), this, SLOT(updateHeadPosition(QVector3D)));
    //print finished signal
    connect(printerObj, SIGNAL(printFinished(bool)), this, SLOT(printFinished(bool)));
    //connect calibration dialog to printer
    connect(calibrateDialog, SIGNAL(writeToPrinter(QString)), printerObj, SLOT(send_now(QString)),Qt::QueuedConnection);
    //connect z slider
    connect(ui->zSlider, SIGNAL(valueChanged(int)), this, SLOT(moveZ(int)));
    connect(ui->zSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateZ(int)));
    //connect action load
    connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadFile()));

    printerObj->moveToThread(qthread);
    qthread->start(QThread::HighestPriority);


    this->portEnum = new QextSerialEnumerator(this);
    this->portEnum->setUpNotifications();
    QList<QextPortInfo> ports = this->portEnum->getPorts();
    //finding avalible ports
    foreach (QextPortInfo info, ports) {
        ui->portCombo->addItem(info.portName);
    }