open error msg added

This commit is contained in:
Rafael 2016-03-21 22:14:32 +01:00
parent b06830c033
commit 93f023b89e
3 changed files with 27 additions and 19 deletions

View file

@ -20,6 +20,7 @@
#include "ui_PictureDialog.h" #include "ui_PictureDialog.h"
#include <QJsonDocument> #include <QJsonDocument>
#include <QMessageBox>
#include <QJsonObject> #include <QJsonObject>
#include <QVariantMap> #include <QVariantMap>
#include <QJsonArray> #include <QJsonArray>
@ -39,8 +40,10 @@ PictureDialog::~PictureDialog()
delete ui; delete ui;
} }
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture) void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
{ {
if (readOk)
{
QString locX = QString::number(picture->getLocationX()); QString locX = QString::number(picture->getLocationX());
QString locY = QString::number(picture->getLocationY()); QString locY = QString::number(picture->getLocationY());
QString locZ = QString::number(picture->getLocationZ()); QString locZ = QString::number(picture->getLocationZ());
@ -58,6 +61,11 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
this->setWindowTitle(windowTitleStr.arg(picture->getPictureStr())); this->setWindowTitle(windowTitleStr.arg(picture->getPictureStr()));
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID)); ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID));
ui->labPicture->setPixmap(picture->getPixmap()); ui->labPicture->setPixmap(picture->getPixmap());
}
else
{
QMessageBox::warning(this,tr("Snapmatic Picture Viewer"),tr("Failed at %1").arg(picture->getLastStep()));
}
} }
void PictureDialog::on_cmdClose_clicked() void PictureDialog::on_cmdClose_clicked()

View file

@ -31,7 +31,7 @@ class PictureDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit PictureDialog(QWidget *parent = 0); explicit PictureDialog(QWidget *parent = 0);
void setSnapmaticPicture(SnapmaticPicture *picture); void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
~PictureDialog(); ~PictureDialog();
private slots: private slots:

View file

@ -46,9 +46,9 @@ int main(int argc, char *argv[])
{ {
PictureDialog picDialog; PictureDialog picDialog;
SnapmaticPicture picture; SnapmaticPicture picture;
picture.readingPictureFromFile(arg1); bool readOk = picture.readingPictureFromFile(arg1);
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::WindowContextHelpButtonHint); picDialog.setWindowFlags(picDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
picDialog.setSnapmaticPicture(&picture); picDialog.setSnapmaticPicture(&picture, readOk);
picDialog.show(); picDialog.show();
return a.exec(); return a.exec();