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*")); profileDir.setNameFilters(QStringList("SGTA*"));
QStringList SavegameFiles = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort); 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> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>9</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>9</number>
</property> </property>
<item> <item>
<widget class="QScrollArea" name="saSnapmatic"> <widget class="QLabel" name="labProfileContent">
<property name="frameShape"> <property name="text">
<enum>QFrame::NoFrame</enum> <string>Content of Profile %1</string>
</property> </property>
<property name="frameShadow"> <property name="alignment">
<enum>QFrame::Plain</enum> <set>Qt::AlignCenter</set>
</property> </property>
<property name="lineWidth"> </widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlContent">
<property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="widgetResizable"> <property name="topMargin">
<bool>true</bool> <number>0</number>
</property> </property>
<widget class="QWidget" name="saSnapmaticContent"> <property name="rightMargin">
<property name="geometry"> <number>0</number>
<rect> </property>
<x>0</x> <property name="bottomMargin">
<y>0</y> <number>0</number>
<width>400</width> </property>
<height>300</height> <item>
</rect> <widget class="QScrollArea" name="saSnapmatic">
</property> <property name="frameShape">
<layout class="QVBoxLayout" name="vlSnapmaticContent"> <enum>QFrame::NoFrame</enum>
<item> </property>
<widget class="QLabel" name="labProfileContent"> <property name="frameShadow">
<property name="text"> <enum>QFrame::Plain</enum>
<string>Content of Profile %1</string> </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>
<property name="alignment"> <property name="leftMargin">
<set>Qt::AlignCenter</set> <number>0</number>
</property> </property>
</widget> <property name="topMargin">
</item> <number>0</number>
</layout> </property>
</widget> <property name="rightMargin">
</widget> <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> </item>
</layout> </layout>
</widget> </widget>

View file

@ -18,15 +18,25 @@
#include "SavegameWidget.h" #include "SavegameWidget.h"
#include "ui_SavegameWidget.h" #include "ui_SavegameWidget.h"
#include "SavegameData.h"
SavegameWidget::SavegameWidget(QWidget *parent) : SavegameWidget::SavegameWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::SavegameWidget) ui(new Ui::SavegameWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
sgdPath = "";
sgdata = 0;
} }
SavegameWidget::~SavegameWidget() SavegameWidget::~SavegameWidget()
{ {
delete ui; 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 #define SAVEGAMEWIDGET_H
#include <QWidget> #include <QWidget>
#include "SavegameData.h"
namespace Ui { namespace Ui {
class SavegameWidget; class SavegameWidget;
@ -31,10 +32,13 @@ class SavegameWidget : public QWidget
public: public:
explicit SavegameWidget(QWidget *parent = 0); explicit SavegameWidget(QWidget *parent = 0);
void setSavegameData(SavegameData *savegame, QString savegamePath);
~SavegameWidget(); ~SavegameWidget();
private: private:
Ui::SavegameWidget *ui; Ui::SavegameWidget *ui;
SavegameData *sgdata;
QString sgdPath;
}; };
#endif // SAVEGAMEWIDGET_H #endif // SAVEGAMEWIDGET_H

View file

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