| 47 | } |
| 48 | |
| 49 | AnimeInfoEditor::AnimeInfoEditor(Anime *anime, QWidget *parent) : |
| 50 | CFramelessDialog(tr("Edit Anime Info - %1").arg(anime->name()), parent, true, true, false), |
| 51 | airDateChanged(false), epsChanged(false), staffChanged(false), descChanged(false), curAnime(anime) |
| 52 | { |
| 53 | QLabel *airTimeLabel = new QLabel(tr("Air Date"), this); |
| 54 | dateEdit = new ElaCalendarPicker(this); |
| 55 | dateEdit->setSelectedDate(QDate::fromString(anime->airDate(), "yyyy-MM-dd")); |
| 56 | QLabel *epsLabel = new QLabel(tr("Episodes"), this); |
| 57 | epsSpin = new ElaSpinBox(this); |
| 58 | epsSpin->setRange(0, INT_MAX); |
| 59 | epsSpin->setValue(anime->epCount()); |
| 60 | |
| 61 | QHBoxLayout *hLayout = new QHBoxLayout; |
| 62 | hLayout->setContentsMargins(0, 0, 0, 0); |
| 63 | hLayout->addWidget(airTimeLabel); |
| 64 | hLayout->addWidget(dateEdit); |
| 65 | hLayout->addSpacing(20); |
| 66 | hLayout->addWidget(epsLabel); |
| 67 | hLayout->addWidget(epsSpin); |
| 68 | hLayout->addStretch(1); |
| 69 | |
| 70 | QLabel *aliasLabel = new QLabel(tr("Alias"), this); |
| 71 | FontIconButton *addAliasBtn = new FontIconButton(QChar(0xe667), "", 12, 10, 0, this); |
| 72 | addAliasBtn->setObjectName(QStringLiteral("FontIconToolButton")); |
| 73 | QHBoxLayout *hAliasLayout = new QHBoxLayout; |
| 74 | hAliasLayout->setContentsMargins(0, 0, 0, 0); |
| 75 | hAliasLayout->addWidget(aliasLabel); |
| 76 | hAliasLayout->addWidget(addAliasBtn); |
| 77 | hAliasLayout->addStretch(1); |
| 78 | AliasPanel *aliasPanel = new AliasPanel(anime->name(), this); |
| 79 | |
| 80 | QLabel *staffLabel = new QLabel(tr("Staff Info"), this); |
| 81 | QTreeView *staffView = new QTreeView(this); |
| 82 | staffView->setContextMenuPolicy(Qt::CustomContextMenu); |
| 83 | staffView->setEditTriggers(QAbstractItemView::DoubleClicked); |
| 84 | staffView->setRootIsDecorated(false); |
| 85 | staffView->setFont(QFont(GlobalObjects::normalFont, 11)); |
| 86 | staffView->header()->setFont(QFont(GlobalObjects::normalFont, 12)); |
| 87 | staffView->setItemDelegate(new StaffItemDelegate(staffView)); |
| 88 | staffView->setAlternatingRowColors(true); |
| 89 | staffModel = new StaffModel(anime, this); |
| 90 | staffView->setModel(staffModel); |
| 91 | |
| 92 | QLabel *descLabel = new QLabel(tr("Description"), this); |
| 93 | descEdit = new KTextEdit(this); |
| 94 | descEdit->setPlainText(anime->description()); |
| 95 | |
| 96 | QWidget *pageContainer = new QWidget(this); |
| 97 | QVBoxLayout *pageVLayout = new QVBoxLayout(pageContainer); |
| 98 | pageVLayout->setContentsMargins(0, 0, 0, 0); |
| 99 | pageVLayout->addLayout(hLayout); |
| 100 | pageVLayout->addLayout(hAliasLayout); |
| 101 | pageVLayout->addWidget(aliasPanel); |
| 102 | pageVLayout->addWidget(descLabel); |
| 103 | pageVLayout->addWidget(descEdit, 1); |
| 104 | pageVLayout->addWidget(staffLabel); |
| 105 | pageVLayout->addWidget(staffView, 1); |
| 106 | // pageVLayout->addStretch(1); |
nothing calls this directly
no test coverage detected