Show if savedata, updates or dlc are present.

This commit is contained in:
codestation
2014-01-17 16:58:09 -04:30
parent 9c8a3e0176
commit bafae021ed
6 changed files with 174 additions and 36 deletions

View File

@@ -25,9 +25,16 @@
#include <QDesktopServices>
#include <QUrl>
const QString BackupItem::nameTemplate = "<html><head/><body>"
"<p><span style=\" font-size:12pt; font-weight:600;\">%1</span></p>"
"<p><span style=\" font-size:10pt;\">%2</span></p>"
const QString BackupItem::gameTemplate = "<html><head/><body>"
"<p><span style=\" font-size:13pt; font-weight:600;\">%1</span></p>"
"</body></html>";
const QString BackupItem::sizeTemplate = "<html><head/><body>"
"<p><span style=\" font-size:10pt;\">%1</span></p>"
"</body></html>";
const QString BackupItem::infoTemplate = "<html><head/><body>"
"<p><span style=\" font-size:10pt;\">&nbsp;%1</span></p>"
"</body></html>";
BackupItem::BackupItem(QWidget *parent) :
@@ -60,14 +67,16 @@ const QPixmap *BackupItem::getIconPixmap()
return ui->itemPicture->pixmap();
}
void BackupItem::setDirectory(const QString path)
void BackupItem::setDirectory(const QString &path)
{
this->path = path;
}
void BackupItem::setItemInfo(const QString name, const QString size)
void BackupItem::setItemInfo(const QString &name, const QString &size, const QString &extra)
{
ui->itemName->setText(nameTemplate.arg(name, size));
ui->gameLabel->setText(gameTemplate.arg(name));
ui->sizeLabel->setText(sizeTemplate.arg(size));
ui->infoLabel->setText(infoTemplate.arg(extra));
}
int BackupItem::getIconWidth()
@@ -75,7 +84,7 @@ int BackupItem::getIconWidth()
return ui->itemPicture->width();
}
void BackupItem::setItemIcon(const QString path, int width, bool try_dds)
void BackupItem::setItemIcon(const QString &path, int width, bool try_dds)
{
ui->itemPicture->setMinimumWidth(width);
QPixmap pixmap(path);

View File

@@ -34,9 +34,9 @@ public:
explicit BackupItem(QWidget *parent = 0);
~BackupItem();
void setItemInfo(const QString name, const QString size);
void setItemIcon(const QString path, int width = 48, bool try_dds = false);
void setDirectory(const QString path);
void setItemInfo(const QString &name, const QString &size, const QString &extra);
void setItemIcon(const QString &path, int width = 48, bool try_dds = false);
void setDirectory(const QString &path);
const QPixmap *getIconPixmap();
int getIconWidth();
@@ -48,7 +48,9 @@ public:
private:
QString path;
Ui::BackupItem *ui;
static const QString nameTemplate;
static const QString gameTemplate;
static const QString sizeTemplate;
static const QString infoTemplate;
signals:
void deleteEntry(BackupItem *entry);

View File

@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>634</width>
<height>86</height>
<width>638</width>
<height>75</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string/>
</property>
@@ -42,11 +48,57 @@
</widget>
</item>
<item>
<widget class="QLabel" name="itemName">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Game Name&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;0.00 GiB&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="rightMargin">
<number>5</number>
</property>
</widget>
<item>
<widget class="QLabel" name="gameLabel">
<property name="text">
<string>&lt;p&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Game Name&lt;/span&gt;&lt;/p&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="sizeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;0.00 GiB&lt;/span&gt;&lt;/p&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="infoLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;[APP] [SAVE] [UPDATE] [DLC]&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">

View File

@@ -193,15 +193,28 @@ void BackupManagerForm::loadBackupListing(int index)
connect(item, SIGNAL(deleteEntry(BackupItem*)), this, SLOT(removeEntry(BackupItem*)));
QString size = readable_size(meta->size);
// check if the game data is present, else is just a LiveArea launcher
if(sys_dir && !(QDir(base_path + QDir::separator() + "app").exists() || QDir(base_path + QDir::separator() + "game").exists())) {
size.append(tr(" - (Launcher only)"));
QString info;
// check if is listing PS Vita games
if(index == 0) {
if(QDir(base_path + QDir::separator() + "app").exists()) {
info.append(tr(" [GAME]"));
}
if(QDir(base_path + QDir::separator() + "savedata").exists()) {
info.append(tr(" [SAVE]"));
}
if(QDir(base_path + QDir::separator() + "patch").exists()) {
info.append(tr(" [UPDATE]"));
}
if(QDir(base_path + QDir::separator() + "addcont").exists()) {
info.append(tr(" [DLC]"));
}
}
item->setItemInfo(game_name, size);
item->setItemInfo(game_name, size, info);
item->setItemIcon(QDir(parent_path).absoluteFilePath(sys_dir ? "icon0.png" : "ICON0.PNG"), img_width, ohfi == VITA_OHFI_PSMAPP);
item->setDirectory(obj->path + QDir::separator() + meta->name);
item->resize(646, 75);
item->resize(646, 68);
item_list << item;
meta = meta->next_metadata;
@@ -216,7 +229,7 @@ void BackupManagerForm::loadBackupListing(int index)
// insert the sorted items into the table
for(it = item_list.begin(), row = 0; it != item_list.end(); ++it, ++row) {
ui->tableWidget->setCellWidget(row, 0, *it);
vert_header->resizeSection(row, 75);
vert_header->resizeSection(row, 68);
}
vert_header->setUpdatesEnabled(true);