added savegame to ui

This commit is contained in:
Rafael 2016-03-26 09:22:47 +01:00
parent 5ac9276193
commit 4aa2fd844e
5 changed files with 151 additions and 33 deletions

View file

@ -68,5 +68,15 @@ void ProfileInterface::setupProfileInterface()
profileDir.setNameFilters(QStringList("SGTA*"));
QStringList SavegameFiles = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
qDebug() << SavegameFiles;
foreach(const QString &SavegameFile, SavegameFiles)
{
QString sgdPath = profileFolder + "/" + SavegameFile;
SavegameData *savegame = new SavegameData(sgdPath);
if (savegame->readingSavegame())
{
SavegameWidget *sgdWidget = new SavegameWidget(ui->saSavegameContent);
sgdWidget->setSavegameData(savegame, sgdPath);
ui->saSavegameContent->layout()->addWidget(sgdWidget);
}
}
}

View file

@ -18,51 +18,145 @@
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>9</number>
</property>
<item>
<widget class="QScrollArea" name="saSnapmatic">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<widget class="QLabel" name="labProfileContent">
<property name="text">
<string>Content of Profile %1</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="lineWidth">
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlContent">
<property name="leftMargin">
<number>0</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
<property name="topMargin">
<number>0</number>
</property>
<widget class="QWidget" name="saSnapmaticContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlSnapmaticContent">
<item>
<widget class="QLabel" name="labProfileContent">
<property name="text">
<string>Content of Profile %1</string>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="saSnapmatic">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="saSnapmaticContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>196</width>
<height>261</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlSnapmaticContent">
<property name="spacing">
<number>0</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<property name="leftMargin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="vsSnapmatic">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QScrollArea" name="saSavegame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="saSavegameContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>196</width>
<height>261</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlSavegameContent">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="vsSavegame">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

View file

@ -18,15 +18,25 @@
#include "SavegameWidget.h"
#include "ui_SavegameWidget.h"
#include "SavegameData.h"
SavegameWidget::SavegameWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SavegameWidget)
{
ui->setupUi(this);
sgdPath = "";
sgdata = 0;
}
SavegameWidget::~SavegameWidget()
{
delete ui;
}
void SavegameWidget::setSavegameData(SavegameData *savegame, QString savegamePath)
{
ui->labSavegameStr->setText(savegame->getSavegameStr());
sgdPath = savegamePath;
sgdata = savegame;
}

View file

@ -20,6 +20,7 @@
#define SAVEGAMEWIDGET_H
#include <QWidget>
#include "SavegameData.h"
namespace Ui {
class SavegameWidget;
@ -31,10 +32,13 @@ class SavegameWidget : public QWidget
public:
explicit SavegameWidget(QWidget *parent = 0);
void setSavegameData(SavegameData *savegame, QString savegamePath);
~SavegameWidget();
private:
Ui::SavegameWidget *ui;
SavegameData *sgdata;
QString sgdPath;
};
#endif // SAVEGAMEWIDGET_H

View file

@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Savegame Widget</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="hlSavegameContent">
<item>
<widget class="QLabel" name="labSavegameStr">
<property name="text">