Skip to content

Commit

Permalink
Show connection/disconnect/upload messages in status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed Jan 16, 2019
1 parent 44f2751 commit dd4b320
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -33,6 +33,7 @@
- Fixed Windows OpenGL problems.
- Dropped support for Qt4.
- Change from XML to JSON project file format and .camotics extension.
- Show 3D view of machine.

## v1.1.1:
- Fixed bug preventing ``camsim`` from writing STL data.
Expand Down
1 change: 0 additions & 1 deletion src/camotics/qt/BBCtrlAPI.cpp
Expand Up @@ -118,7 +118,6 @@ void BBCtrlAPI::uploadGCode(const char *data, unsigned length) {

QNetworkReply *reply = netManager->put(request, multiPart);
multiPart->setParent(reply); // delete the multiPart with the reply
// here connect signals etc.
}


Expand Down
16 changes: 15 additions & 1 deletion src/camotics/qt/QtWin.cpp
Expand Up @@ -583,8 +583,18 @@ void QtWin::paintGL() {
}


void QtWin::showMessage(const QString &msg, double timeout) {
ui->statusbar->showMessage(msg, timeout * 1000);
}


void QtWin::showMessage(const char *msg, double timeout) {
showMessage(QString::fromUtf8(msg), timeout);
}


void QtWin::showMessage(const string &msg, double timeout) {
ui->statusbar->showMessage(QString::fromUtf8(msg.c_str()), timeout * 1000);
showMessage(QString::fromUtf8(msg.c_str()), timeout);
}


Expand Down Expand Up @@ -669,6 +679,8 @@ void QtWin::uploadGCode() {

bbCtrlAPI->setFilename(filename.toUtf8().data());
bbCtrlAPI->uploadGCode(&gcode->front(), gcode->size());
showMessage(QString("Uploading ") + filename + QString(" to ") +
connectDialog.getAddress());
}


Expand Down Expand Up @@ -1806,12 +1818,14 @@ void QtWin::on_bbctrlDisconnect() {
void QtWin::on_bbctrlConnected() {
connectDialog.setNetworkStatus(bbCtrlAPI->getStatus());
if (connectDialog.isVisible()) connectDialog.accept();
showMessage(QString("Connected to ") + connectDialog.getAddress());
uploadGCode();
}


void QtWin::on_bbctrlDisconnected() {
connectDialog.setNetworkStatus(bbCtrlAPI->getStatus());
showMessage(QString("Disconnected from ") + connectDialog.getAddress());
}


Expand Down
2 changes: 2 additions & 0 deletions src/camotics/qt/QtWin.h
Expand Up @@ -166,6 +166,8 @@ namespace CAMotics {
void resizeGL(int w, int h);
void paintGL();

void showMessage(const QString &msg, double timeout = 30);
void showMessage(const char *msg, double timeout = 30);
void showMessage(const std::string &msg, double timeout = 30);
void message(const std::string &msg);
void warning(const std::string &msg);
Expand Down

0 comments on commit dd4b320

Please sign in to comment.