blob: 0cd11eba7a97e90505cad7d5fc05403b0f2778b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
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
2 of the License, or (at your option) any later version.
*/
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QTabWidget>
#include "archiveitemeditdialog.h"
#include "archiveiteminfoedit.h"
#include "archiveitemcoveredit.h"
#include "moviemodelsingleton.h"
#include "moviemodel.h"
#include "movieitem.h"
#include "fileinfomodel.h"
ArchiveItemEditDialog::ArchiveItemEditDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
//Init dialog
QVBoxLayout *mainLayout = new QVBoxLayout;
//Tab widget
mTab = new QTabWidget;
mInfoEdit = new ArchiveItemInfoEdit;
mTab->addTab(mInfoEdit, tr("General"));
mCoverEdit = new ArchiveItemCoverEdit;
mTab->addTab(mCoverEdit, tr("Covers"));
mainLayout->addWidget(mTab);
//Button layout
QHBoxLayout *buttonLayout = new QHBoxLayout;
mCancel = new QPushButton(tr("Cancel"));
connect(mCancel, SIGNAL(clicked()), this, SLOT(reject()));
mUpdate = new QPushButton(tr("Update"));
connect(mUpdate, SIGNAL(clicked()), this, SLOT(accept()));
buttonLayout->addStretch();
buttonLayout->addWidget(mCancel);
buttonLayout->addWidget(mUpdate);
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
}
void ArchiveItemEditDialog::setMovie(const QModelIndex &idx){
if(!idx.isValid()){
return;
}
//Numbers and title setup
mInfoEdit->setTitle(idx.data(MovieModel::TitleBaseRole).toString());
mInfoEdit->setDvd(idx.data(MovieModel::DvdRole).toInt());
mInfoEdit->setSeries(idx.data(MovieModel::SeriesNoRole).toInt());
mInfoEdit->setPart(idx.data(MovieModel::PartNoRole).toInt());
mInfoEdit->setGenre(idx.data(MovieModel::GenreRole).toString());
mInfoEdit->setQuality(idx.data(MovieModel::QualityRole).toInt());
//File and actor info
mInfoEdit->setup(idx);
//Set covers
mCoverEdit->setCovers(idx.data(MovieModel::CoverRole).toList());
}
|