summaryrefslogtreecommitdiffstats
path: root/archiveitemcoveredit.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-29 14:54:55 +0200
committerArno <am@disconnect.de>2010-05-29 15:12:41 +0200
commitca84789d9f288e39936a288c17eff247cb0f4a3f (patch)
treee4c70bd2eccd65378edc09fea0b8cdce13d2de3d /archiveitemcoveredit.cpp
parentd95e3f02d6615854547bded419de81395b28c2c5 (diff)
downloadSheMov-ca84789d9f288e39936a288c17eff247cb0f4a3f.tar.gz
SheMov-ca84789d9f288e39936a288c17eff247cb0f4a3f.tar.bz2
SheMov-ca84789d9f288e39936a288c17eff247cb0f4a3f.zip
Implement new ArchiveItemEditDialog
Use ArchiveItemEditDialog instead of EditArchiveItemDialog. The latter will soon be obsolete and removed. Terrible naming, though. This commit is not as atomic as I want it to be, but it can't be helped. I had to fix several bugs in ArchveItemInfoEdit and ArchiveItemCoverEdit on the way: -Fix layout of ArchiveItemCoverEdit -Make white background of warning label in ArchiveItemCoverEdit work -Add function to ArchiveItemInfoEdit to init the ActorModel and FileInfoModel -Add function to ArchiveItemInfoEdit to return selected actors Beware: The update button still does nothing!
Diffstat (limited to 'archiveitemcoveredit.cpp')
-rw-r--r--archiveitemcoveredit.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/archiveitemcoveredit.cpp b/archiveitemcoveredit.cpp
index 41672d7..5f0deb6 100644
--- a/archiveitemcoveredit.cpp
+++ b/archiveitemcoveredit.cpp
@@ -16,6 +16,7 @@
#include <QSettings>
#include <QSettings>
#include <QFileInfo>
+#include <QPalette>
#include <algorithm>
@@ -35,24 +36,30 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
//Warning
QLabel *descriptionLabel = new QLabel(tr("Edit covers of movie - if the movie already has covers you have to unlock the specific cover for changing it. Then click browse to select a new cover. WARNING: The old cover will be deleted from archive if you submit the changes!"));
- descriptionLabel->setBackgroundRole(QPalette::Light);
+ descriptionLabel->setWordWrap(true);
+ descriptionLabel->setAutoFillBackground(true);
descriptionLabel->setFrameStyle(QFrame::Box);
+ descriptionLabel->setMargin(5);
+ QPalette palette = descriptionLabel->palette();
+ palette.setColor(QPalette::Window, Qt::white);
+ descriptionLabel->setPalette(palette);
mainLayout->addWidget(descriptionLabel);
+ mainLayout->addSpacing(15);
//Front cover
QLabel *frontCoverLabel = new QLabel(tr("Front cover"));
coverLayout->addWidget(frontCoverLabel, 0, 0);
mFrontCover = new QLineEdit;
mInitialValue.insert(mFrontCover, QString());
- coverLayout->addWidget(mFrontCover);
+ coverLayout->addWidget(mFrontCover, 0, 1);
mBrowseFront = new QPushButton(tr("Browse..."));
connect(mBrowseFront, SIGNAL(clicked()), browseMapper, SLOT(map()));
browseMapper->setMapping(mBrowseFront, mFrontCover);
- coverLayout->addWidget(mBrowseFront, 0, 1);
+ coverLayout->addWidget(mBrowseFront, 0, 2);
mViewFront = new QPushButton(tr("View"));
connect(mViewFront, SIGNAL(clicked()), viewMapper, SLOT(map()));
viewMapper->setMapping(mViewFront, mFrontCover);
- coverLayout->addWidget(mViewFront, 0, 2);
+ coverLayout->addWidget(mViewFront, 0, 3);
mUnlockFront = new QCheckBox;
mCheckboxTexts.insert(mUnlockFront, qMakePair(tr("Unlock front cover"), tr("Reset and lock front cover")));
mUnlockFront->setText(mCheckboxTexts.value(mUnlockFront).first);
@@ -60,22 +67,22 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
mBrowseMap.insert(mUnlockFront, mBrowseFront);
connect(mUnlockFront, SIGNAL(stateChanged(int)), unlockMapper, SLOT(map()));
unlockMapper->setMapping(mUnlockFront, mFrontCover);
- coverLayout->addWidget(mUnlockFront, 1, 1, 0, 2, Qt::AlignRight);
+ coverLayout->addWidget(mUnlockFront, 1, 2, 1, 2, Qt::AlignLeft);
//Back cover
QLabel *backCoverLabel = new QLabel(tr("Back cover"));
coverLayout->addWidget(backCoverLabel, 2, 0);
mBackCover = new QLineEdit;
mInitialValue.insert(mBackCover, QString());
- coverLayout->addWidget(mBackCover);
+ coverLayout->addWidget(mBackCover, 2, 1);
mBrowseBack = new QPushButton(tr("Browse..."));
connect(mBrowseBack, SIGNAL(clicked()), browseMapper, SLOT(map()));
browseMapper->setMapping(mBrowseBack, mBackCover);
- coverLayout->addWidget(mBrowseBack, 2, 1);
+ coverLayout->addWidget(mBrowseBack, 2, 2);
mViewBack = new QPushButton(tr("View"));
connect(mViewBack, SIGNAL(clicked()), viewMapper, SLOT(map()));
viewMapper->setMapping(mViewBack, mBackCover);
- coverLayout->addWidget(mViewBack, 2, 2);
+ coverLayout->addWidget(mViewBack, 2, 3);
mUnlockBack = new QCheckBox;
mCheckboxTexts.insert(mUnlockBack, qMakePair(tr("Unlock back cover"), tr("Reset and lock back cover")));
mUnlockBack->setText(mCheckboxTexts.value(mUnlockBack).first);
@@ -83,22 +90,22 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
mBrowseMap.insert(mUnlockBack, mBrowseBack);
connect(mUnlockBack, SIGNAL(stateChanged(int)), unlockMapper, SLOT(map()));
unlockMapper->setMapping(mUnlockBack, mBackCover);
- coverLayout->addWidget(mUnlockBack, 3, 1, 0, 2, Qt::AlignRight);
+ coverLayout->addWidget(mUnlockBack, 3, 2, 1, 2, Qt::AlignLeft);
//General cover
QLabel *generalCoverLabel = new QLabel(tr("General cover"));
coverLayout->addWidget(generalCoverLabel, 4, 0);
mGeneralCover = new QLineEdit;
mInitialValue.insert(mGeneralCover, QString());
- coverLayout->addWidget(mGeneralCover);
+ coverLayout->addWidget(mGeneralCover, 4, 1);
mBrowseGeneral = new QPushButton(tr("Browse..."));
connect(mBrowseGeneral, SIGNAL(clicked()), browseMapper, SLOT(map()));
browseMapper->setMapping(mBrowseGeneral, mGeneralCover);
- coverLayout->addWidget(mBrowseGeneral, 4, 1);
+ coverLayout->addWidget(mBrowseGeneral, 4, 2);
mViewGeneral = new QPushButton(tr("View"));
connect(mViewGeneral, SIGNAL(clicked()), viewMapper, SLOT(map()));
viewMapper->setMapping(mViewGeneral, mGeneralCover);
- coverLayout->addWidget(mViewGeneral, 4, 2);
+ coverLayout->addWidget(mViewGeneral, 4, 3);
mUnlockGeneral = new QCheckBox;
mCheckboxTexts.insert(mUnlockGeneral, qMakePair(tr("Unlock general cover"), tr("Reset and lock general cover")));
mUnlockGeneral->setText(mCheckboxTexts.value(mUnlockGeneral).first);
@@ -106,7 +113,7 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
mBrowseMap.insert(mUnlockGeneral, mBrowseGeneral);
connect(mUnlockGeneral, SIGNAL(stateChanged(int)), unlockMapper, SLOT(map()));
unlockMapper->setMapping(mUnlockGeneral, mGeneralCover);
- coverLayout->addWidget(mUnlockGeneral, 5, 1, 0, 2, Qt::AlignRight);
+ coverLayout->addWidget(mUnlockGeneral, 5, 2, 1, 2, Qt::AlignLeft);
//Connect QSignalMappers
connect(unlockMapper, SIGNAL(mapped(QWidget*)), this, SLOT(unlock(QWidget*)));
@@ -115,6 +122,7 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
//Setup Widget
mainLayout->addLayout(coverLayout);
+ mainLayout->addStretch();
setLayout(mainLayout);
}
@@ -125,7 +133,7 @@ void ArchiveItemCoverEdit::setCovers(const QList<QVariant> &covers){
it = std::find_if(covers.constBegin(), covers.constEnd(), std::bind2nd(CoverItem::findType(), "front"));
QString initialValue;
if(it != covers.constEnd()){
- initialValue = it->value<CoverItem>().fileName();
+ initialValue = it->value<CoverItem>().fullPath();
}
mFrontCover->setText(initialValue);
mInitialValue[mFrontCover] = initialValue;
@@ -135,7 +143,7 @@ void ArchiveItemCoverEdit::setCovers(const QList<QVariant> &covers){
//Set back cover
it = std::find_if(covers.constBegin(), covers.constEnd(), std::bind2nd(CoverItem::findType(), "back"));
if(it != covers.constEnd()){
- initialValue = it->value<CoverItem>().fileName();
+ initialValue = it->value<CoverItem>().fullPath();
}
mBackCover->setText(initialValue);
mInitialValue[mBackCover] = initialValue;
@@ -145,7 +153,7 @@ void ArchiveItemCoverEdit::setCovers(const QList<QVariant> &covers){
//Set general cover
it = std::find_if(covers.constBegin(), covers.constEnd(), std::bind2nd(CoverItem::findType(), "general"));
if(it != covers.constEnd()){
- initialValue = it->value<CoverItem>().fileName();
+ initialValue = it->value<CoverItem>().fullPath();
}
mGeneralCover->setText(initialValue);
mInitialValue[mGeneralCover] = initialValue;