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 <QJsonDocument>
#include <QMessageBox>
#include <QJsonObject>
#include <QVariantMap>
#include <QJsonArray>
@ -39,7 +40,9 @@ PictureDialog::~PictureDialog()
delete ui;
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
{
if (readOk)
{
QString locX = QString::number(picture->getLocationX());
QString locY = QString::number(picture->getLocationY());
@ -59,6 +62,11 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID));
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()
{

View file

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

View file

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