/* * 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 . */ #include "backupitem.h" #include "ui_backupitem.h" #include "utils.h" #include #include const QString BackupItem::nameTemplate = "" "

%1

" "

%2

" ""; BackupItem::BackupItem(QWidget *parent) : QWidget(parent), ui(new Ui::BackupItem) { ui->setupUi(this); // connect the buttons connect(ui->openButton, SIGNAL(clicked()), this, SLOT(openDirectory())); connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeEntry())); } BackupItem::~BackupItem() { delete ui; } void BackupItem::openDirectory() { QDesktopServices::openUrl(QUrl("file:///" + path)); } void BackupItem::removeEntry() { emit deleteEntry(this); } const QPixmap *BackupItem::getIconPixmap() { return ui->itemPicture->pixmap(); } void BackupItem::setDirectory(const QString path) { this->path = path; } void BackupItem::setItemInfo(const QString name, const QString size) { ui->itemName->setText(nameTemplate.arg(name, size)); } int BackupItem::getIconWidth() { return ui->itemPicture->width(); } void BackupItem::setItemIcon(const QString path, int width) { ui->itemPicture->setMinimumWidth(width); ui->itemPicture->setPixmap(QPixmap(path)); } bool BackupItem::lessThan(const BackupItem *s1, const BackupItem *s2) { return s1->title.compare(s2->title) < 0; }