Show PSM icons in backup manager.
This commit is contained in:
2
qcma.pro
2
qcma.pro
@@ -28,6 +28,7 @@ SOURCES += src/main.cpp \
|
|||||||
src/cmaevent.cpp \
|
src/cmaevent.cpp \
|
||||||
src/clientmanager.cpp \
|
src/clientmanager.cpp \
|
||||||
src/filterlineedit.cpp \
|
src/filterlineedit.cpp \
|
||||||
|
src/dds.cpp \
|
||||||
# forms
|
# forms
|
||||||
src/forms/backupitem.cpp \
|
src/forms/backupitem.cpp \
|
||||||
src/forms/backupmanagerform.cpp \
|
src/forms/backupmanagerform.cpp \
|
||||||
@@ -51,6 +52,7 @@ HEADERS += \
|
|||||||
src/cmaevent.h \
|
src/cmaevent.h \
|
||||||
src/clientmanager.h \
|
src/clientmanager.h \
|
||||||
src/filterlineedit.h \
|
src/filterlineedit.h \
|
||||||
|
src/dds.h \
|
||||||
# forms
|
# forms
|
||||||
src/forms/backupitem.h \
|
src/forms/backupitem.h \
|
||||||
src/forms/backupmanagerform.h \
|
src/forms/backupmanagerform.h \
|
||||||
|
1027
src/dds.cpp
Normal file
1027
src/dds.cpp
Normal file
File diff suppressed because it is too large
Load Diff
30
src/dds.h
Normal file
30
src/dds.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* QCMA: Cross-platform content manager assistant for the PS Vita
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Codestation
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KIMG_DDS_H
|
||||||
|
#define KIMG_DDS_H
|
||||||
|
|
||||||
|
#include <QImage>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
bool loadDDS(const QString &filename, QImage *image);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@@ -20,6 +20,7 @@
|
|||||||
#include "backupitem.h"
|
#include "backupitem.h"
|
||||||
#include "ui_backupitem.h"
|
#include "ui_backupitem.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "dds.h"
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@@ -74,10 +75,17 @@ int BackupItem::getIconWidth()
|
|||||||
return ui->itemPicture->width();
|
return ui->itemPicture->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackupItem::setItemIcon(const QString path, int width)
|
void BackupItem::setItemIcon(const QString path, int width, bool try_dds)
|
||||||
{
|
{
|
||||||
ui->itemPicture->setMinimumWidth(width);
|
ui->itemPicture->setMinimumWidth(width);
|
||||||
ui->itemPicture->setPixmap(QPixmap(path));
|
QPixmap pixmap(path);
|
||||||
|
if((pixmap.width() <= 0 || pixmap.height() <= 0) && try_dds) {
|
||||||
|
QImage image;
|
||||||
|
if(loadDDS(path, &image)) {
|
||||||
|
pixmap = QPixmap::fromImage(image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->itemPicture->setPixmap(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BackupItem::lessThan(const BackupItem *s1, const BackupItem *s2)
|
bool BackupItem::lessThan(const BackupItem *s1, const BackupItem *s2)
|
||||||
|
@@ -35,7 +35,7 @@ public:
|
|||||||
~BackupItem();
|
~BackupItem();
|
||||||
|
|
||||||
void setItemInfo(const QString name, const QString size);
|
void setItemInfo(const QString name, const QString size);
|
||||||
void setItemIcon(const QString path, int width = 48);
|
void setItemIcon(const QString path, int width = 48, bool try_dds = false);
|
||||||
void setDirectory(const QString path);
|
void setDirectory(const QString path);
|
||||||
const QPixmap *getIconPixmap();
|
const QPixmap *getIconPixmap();
|
||||||
int getIconWidth();
|
int getIconWidth();
|
||||||
|
@@ -177,7 +177,7 @@ void BackupManagerForm::loadBackupListing(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
item->setItemInfo(game_name, size);
|
item->setItemInfo(game_name, size);
|
||||||
item->setItemIcon(QDir(parent_path).absoluteFilePath(sys_dir ? "icon0.png" : "ICON0.PNG"), img_width);
|
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->setDirectory(obj->path + QDir::separator() + meta->name);
|
||||||
item->resize(646, 70);
|
item->resize(646, 70);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user