From ec3418479b28ca8e162f84d76c2eed78c27a114c Mon Sep 17 00:00:00 2001 From: am Date: Mon, 20 Jul 2009 17:37:08 +0000 Subject: -started on editing the archive -big probs with the covers, I'll stop for now, can't think straight any more -changes to MovieModel -changes to MovieItem -modified CoverEditor to allow adding files (untested) git-svn-id: file:///var/svn/repos2/shemov/trunk@392 f440f766-f032-0410-8965-dc7d17de2ca0 --- covereditor.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'covereditor.cpp') diff --git a/covereditor.cpp b/covereditor.cpp index 618c0a9..5472f23 100644 --- a/covereditor.cpp +++ b/covereditor.cpp @@ -9,10 +9,13 @@ #include #include #include +#include +#include +#include #include "covereditor.h" -CoverEditor::CoverEditor(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f){ +CoverEditor::CoverEditor(Mode mode, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), mMode(mode){ QGridLayout *mainLayout = new QGridLayout; QLabel *l1 = new QLabel(tr("Front cover")); mFrontCover = new QComboBox; @@ -30,6 +33,15 @@ CoverEditor::CoverEditor(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f mMovie = new QComboBox; mainLayout->addWidget(l4, 3, 0); mainLayout->addWidget(mMovie, 3, 1); + mAddFile = new QPushButton(tr("Add cover")); + if(mode == Archive){ + mAddFile->setVisible(false); + }else{ + l4->setVisible(false); + mMovie->setVisible(false); + } + connect(mAddFile, SIGNAL(clicked()), this, SLOT(addFile())); + mainLayout->addWidget(mAddFile, 4, 1); setLayout(mainLayout); } @@ -115,6 +127,24 @@ const QString CoverEditor::movie() const{ } +void CoverEditor::addFile(){ + QSettings s; + QString startDir = s.value("ui/selectstartup").toString(); + QStringList files = QFileDialog::getOpenFileNames(this, "Select covers to add to list", startDir); + foreach(QString f, files){ + if(!mCoverPaths.contains(f)){ + files << f; + int idx(-1); + if((idx = f.lastIndexOf('/')) != -1){ + f.remove(0, idx + 1); + mFrontCover->addItem(f); + mBackCover->addItem(f); + mCovers->addItem(f); + } + } + } +} + const QString CoverEditor::findPath(const QString &name) const{ QString retval; foreach(QString s, mCoverPaths){ -- cgit v1.2.3-70-g09d2