void IpcClient::error(QAbstractSocket::SocketError error) { QString text; switch (error) { case 0: text = "connection refused"; break; case 1: text = "remote host closed"; break; default: text = QString("code=%1").arg(error); break; } errorMessage(QString("ipc connection error, %1").arg(text)); QTimer::singleShot(1000, this, SLOT(retryConnect())); }
msl::msl(QWidget *parent) : QWidget(parent), serialConnection("","","",""/*Manufacturer String*/,""/*Product String*/) { ui.setupUi(this); //Create QColorDialog this->colorDialog = new QColorDialog(this); this->colorDialog->setWindowFlags(Qt::Widget); //Remove buttons and dialog this->colorDialog->setOptions( QColorDialog::DontUseNativeDialog | QColorDialog::NoButtons); //SetColor this->colorDialog->setCurrentColor(QColor(Qt::black)); this->ui.LayoutForColorSelector->addWidget(colorDialog); //Connect the colorChanged signal connect(this->colorDialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(colorChanged(QColor))); //Hide the EEProm settings-box this->ui.groupBox_EEProm->hide(); //Disable the GUI as long as there is no connection to the serial this->setDisabled(1); //Connect the signals connect(&this->serialConnection, SIGNAL(serialAbortedConnect(int)), this, SLOT(serialConnectionAbort(int))); connect(&this->serialConnection, SIGNAL(waitingForRetry()), this, SLOT(serialWaitingForRetry())); connect(&this->serialConnection, SIGNAL(serialConnected()), this, SLOT(serialConnected())); connect(this, SIGNAL(retry()), &this->serialConnection, SLOT(retryConnect())); connect(this, SIGNAL(sendArray(QByteArray)),&this->serialConnection,SLOT(sendArray(QByteArray))); //Start serial connection thread serialConnection.start(); serialConnection.setStopBits(qUSBSerial::StopBits_2); //Connect to Microscope Light serialConnection.serialConnect(); }