#include <KUrl>
-BackupWidget::BackupWidget(KUrl projectUrl, KUrl projectFolder, const QString &projectId, QWidget * parent) :
+BackupWidget::BackupWidget(const KUrl &projectUrl, const KUrl &projectFolder, const QString &projectId, QWidget * parent) :
QDialog(parent)
{
setupUi(this);
setWindowTitle(i18n("Restore Backup File"));
- KUrl backupFile;
-
if (projectUrl.isEmpty()) {
// No url, means we opened the backup dialog from an empty project
info_label->setText(i18n("Showing all backup files in folder"));
m_projectWildcard = '*';
- }
- else {
+ } else {
info_label->setText(i18n("Showing backup files for %1", projectUrl.fileName()));
m_projectWildcard = projectUrl.fileName().section('.', 0, -2);
if (!projectId.isEmpty()) m_projectWildcard.append('-' + projectId);
connect(project_url, SIGNAL(textChanged(QString)), this, SLOT(slotParseBackupFiles()));
backup_list->setCurrentRow(0);
backup_list->setMinimumHeight(QFontMetrics(font()).lineSpacing() * 12);
-
}
-
-
BackupWidget::~BackupWidget()
{
-
}
void BackupWidget::slotParseBackupFiles()
backup_list->clear();
QListWidgetItem *item;
QString label;
- for (int i = 0; i < resultList.count(); i++) {
+ for (int i = 0; i < resultList.count(); ++i) {
label = resultList.at(i).lastModified().toString(Qt::SystemLocaleLongDate);
- if (m_projectWildcard.startsWith('*')) {
+ if (m_projectWildcard.startsWith(QLatin1Char('*'))) {
// Displaying all backup files, so add project name in the entries
label.prepend(resultList.at(i).fileName().section('-', 0, -7) + ".kdenlive - ");
}
backup_preview->setPixmap(QPixmap());
return;
}
- QString path = backup_list->currentItem()->data(Qt::UserRole).toString();
+ const QString path = backup_list->currentItem()->data(Qt::UserRole).toString();
QPixmap pix(path + ".png");
backup_preview->setPixmap(pix);
}
-QString BackupWidget::selectedFile()
+QString BackupWidget::selectedFile() const
{
- if (!backup_list->currentItem()) return QString();
+ if (!backup_list->currentItem())
+ return QString();
return backup_list->currentItem()->data(Qt::UserRole).toString();
}
+
+#include "backupwidget.moc"