2016-03-23 02:08:16 +01:00
|
|
|
#include "SavegameDialog.h"
|
|
|
|
#include "ui_SavegameDialog.h"
|
2016-04-02 21:09:07 +02:00
|
|
|
#include "SavegameCopy.h"
|
2017-05-01 05:05:55 +02:00
|
|
|
#include "AppEnv.h"
|
2016-03-23 02:08:16 +01:00
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
SavegameDialog::SavegameDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::SavegameDialog)
|
|
|
|
{
|
2017-03-01 15:19:40 +01:00
|
|
|
// Set Window Flags
|
|
|
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
|
|
// Setup User Interface
|
2016-03-23 02:08:16 +01:00
|
|
|
ui->setupUi(this);
|
|
|
|
savegameLabStr = ui->labSavegameText->text();
|
2017-02-11 04:21:55 +01:00
|
|
|
|
|
|
|
if (QIcon::hasThemeIcon("dialog-close"))
|
|
|
|
{
|
|
|
|
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
|
|
|
}
|
2017-05-01 05:05:55 +02:00
|
|
|
|
|
|
|
// DPI calculation
|
|
|
|
qreal screenRatio = AppEnv::screenRatio();
|
|
|
|
resize(400 * screenRatio, 105 * screenRatio);
|
2016-03-23 02:08:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SavegameDialog::~SavegameDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2016-04-02 21:09:07 +02:00
|
|
|
void SavegameDialog::setSavegameData(SavegameData *savegame, QString savegamePath, bool readOk)
|
2016-03-23 02:08:16 +01:00
|
|
|
{
|
|
|
|
// Showing error if reading error
|
|
|
|
if (!readOk)
|
|
|
|
{
|
|
|
|
QMessageBox::warning(this,tr("Savegame Viewer"),tr("Failed at %1").arg(savegame->getLastStep()));
|
|
|
|
return;
|
|
|
|
}
|
2016-04-02 21:09:07 +02:00
|
|
|
sgdPath = savegamePath;
|
2016-03-23 02:08:16 +01:00
|
|
|
ui->labSavegameText->setText(savegameLabStr.arg(savegame->getSavegameStr()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void SavegameDialog::on_cmdClose_clicked()
|
|
|
|
{
|
|
|
|
this->close();
|
|
|
|
}
|
2016-04-02 21:09:07 +02:00
|
|
|
|
|
|
|
void SavegameDialog::on_cmdCopy_clicked()
|
|
|
|
{
|
2016-04-03 10:17:01 +02:00
|
|
|
SavegameCopy::copySavegame(this, sgdPath);
|
2016-04-02 21:09:07 +02:00
|
|
|
}
|