summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2011-01-09 11:08:52 +0100
committerArno <am@disconnect.de>2011-01-09 11:08:52 +0100
commitcde287db9cb3ae5739cb45c5639313ea4847c960 (patch)
tree04cf6a5ed5a1682745fa16b8fa1e4d0cf946d24b
parent70ad086ccaf69cf4592db90a641daf0a23ab1428 (diff)
downloadSheMov-cde287db9cb3ae5739cb45c5639313ea4847c960.tar.gz
SheMov-cde287db9cb3ae5739cb45c5639313ea4847c960.tar.bz2
SheMov-cde287db9cb3ae5739cb45c5639313ea4847c960.zip
Automatically add files in configured folder when archiving movies
Added an option to automatically add files in a configurable folder when archiving movies. It's intended for putting cover files in that directory so they don't have to be added manually.
-rw-r--r--configurationdialog.cpp25
-rw-r--r--configurationdialog.h2
-rw-r--r--shemov.cpp11
3 files changed, 34 insertions, 4 deletions
diff --git a/configurationdialog.cpp b/configurationdialog.cpp
index 2818bee..2381c60 100644
--- a/configurationdialog.cpp
+++ b/configurationdialog.cpp
@@ -77,6 +77,11 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q
mDvdMountPath = new QLineEdit;
pathGrid->addWidget(pathl5, 4, 0);
pathGrid->addWidget(mDvdMountPath, 4, 1);
+ QLabel *pathl6 = new QLabel(tr("Cover directory"));
+ mCoverPath = new QLineEdit;
+ mCoverPath->setCompleter(fsCompleter);
+ pathGrid->addWidget(pathl6, 5, 0);
+ pathGrid->addWidget(mCoverPath, 5, 1);
pathGrid->setAlignment(Qt::AlignTop);
pathBox->setLayout(pathGrid);
QVBoxLayout *pathLayout = new QVBoxLayout;
@@ -86,17 +91,17 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q
//copy path options
QGroupBox *copyBox = new QGroupBox(tr("Copy path options"));
QGridLayout *copyGrid = new QGridLayout;
- QLabel *pathl6 = new QLabel(tr("Windows drive"));
+ QLabel *pathl7 = new QLabel(tr("Windows drive"));
mWindowsDrive = new QLineEdit;
QRegExp pathValid("[a-z]{1}:");
pathValid.setCaseSensitivity(Qt::CaseInsensitive);
QRegExpValidator *pathValidator = new QRegExpValidator(pathValid, this);
mWindowsDrive->setValidator(pathValidator);
- copyGrid->addWidget(pathl6, 0, 0);
+ copyGrid->addWidget(pathl7, 0, 0);
copyGrid->addWidget(mWindowsDrive, 0, 1);
- QLabel *pathl7 = new QLabel(tr("Strip from path"));
+ QLabel *pathl8 = new QLabel(tr("Strip from path"));
mStripPath = new QLineEdit;
- copyGrid->addWidget(pathl7, 1, 0);
+ copyGrid->addWidget(pathl8, 1, 0);
copyGrid->addWidget(mStripPath, 1, 1);
copyGrid->setAlignment(Qt::AlignTop);
copyBox->setLayout(copyGrid);
@@ -149,9 +154,17 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q
hoverLayout->addLayout(miscInputGrid);
hoverBox->setLayout(hoverLayout);
+ //misc - archiving movies
+ QGroupBox *archiveBox = new QGroupBox(tr("Archiving options"));
+ QVBoxLayout *archiveLayout = new QVBoxLayout;
+ mAutoAddCovers = new QCheckBox(tr("Automatically add covers"));
+ archiveLayout->addWidget(mAutoAddCovers);
+ archiveBox->setLayout(archiveLayout);
+
//misc - assemble
miscLayout->addWidget(iconBox);
miscLayout->addWidget(hoverBox);
+ miscLayout->addWidget(archiveBox);
miscWidget->setLayout(miscLayout);
mTab->addTab(miscWidget, tr("Misc. settings"));
@@ -318,6 +331,7 @@ void ConfigurationDialog::readSettings(){
mHoverOpacity->setValue(s.value("ui/hoveropacity", 10).toInt());
mGrabFrameFrom->setText(s.value("ui/grabframe", "00:00:00").toString());
mGrabFrameFrom->setEnabled(s.value("ui/hovermovies", false).toBool());
+ mAutoAddCovers->setChecked(s.value("ui/autoaddcovers", false).toBool());
//read paths
mArchiveDir->setText(s.value("paths/archivedir").toString());
@@ -325,6 +339,7 @@ void ConfigurationDialog::readSettings(){
mFfProbePath->setText(s.value("paths/ffprobe").toString());
mFfMpegPath->setText(s.value("paths/ffmpeg").toString());
mDvdMountPath->setText(s.value("paths/dvdmount").toString());
+ mCoverPath->setText(s.value("paths/coverpath").toString());
mWindowsDrive->setText(s.value("paths/windowsdrive").toString());
mStripPath->setText(s.value("paths/strippath").toString());
@@ -379,6 +394,7 @@ void ConfigurationDialog::writeSettings(){
}
s.setValue("paths/windowsdrive", mWindowsDrive->text());
s.setValue("paths/strippath", mStripPath->text());
+ s.setValue("paths/coverpath", mCoverPath->text());
s.setValue("ui/folderIcon", mIconForFolder->currentText());
s.setValue("ui/hoverpics", (mHoverPics->checkState() == Qt::Checked));
@@ -386,6 +402,7 @@ void ConfigurationDialog::writeSettings(){
s.setValue("ui/hoveropacity", mHoverOpacity->value());
s.setValue("ui/hovermovies", (mHoverMovies->checkState() == Qt::Checked));
s.setValue("ui/grabframe", mGrabFrameFrom->text());
+ s.setValue("ui/autoaddcovers", (mAutoAddCovers->checkState() == Qt::Checked));
//write database
s.setValue("database/hostname", mDatabaseHost->text());
diff --git a/configurationdialog.h b/configurationdialog.h
index 092fec8..4d4717f 100644
--- a/configurationdialog.h
+++ b/configurationdialog.h
@@ -52,6 +52,7 @@ class ConfigurationDialog : public QDialog {
QLineEdit *mFfProbePath;
QLineEdit *mFfMpegPath;
QLineEdit *mDvdMountPath;
+ QLineEdit *mCoverPath;
QLineEdit *mDatabaseHost;
QLineEdit *mDatabaseName;
QLineEdit *mDatabaseUsername;
@@ -63,6 +64,7 @@ class ConfigurationDialog : public QDialog {
QCheckBox *mHoverPics;
QCheckBox *mHoverArchive;
QCheckBox *mHoverMovies;
+ QCheckBox *mAutoAddCovers;
QSpinBox *mHoverOpacity;
QLabel *mSeenColor;
QLabel *mClipboardColor;
diff --git a/shemov.cpp b/shemov.cpp
index fbe4cb9..51a432f 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -29,6 +29,8 @@
#include <QToolBar>
#include <QIcon>
#include <QHeaderView>
+#include <QDir>
+#include <QFileInfo>
#include <sys/vfs.h>
@@ -257,6 +259,15 @@ void SheMov::newMovieWizardWithFiles(){
foreach(QModelIndex sel, selected){
mNewMovieWizard->infoPage()->addFile(sel.data(QFileSystemModel::FilePathRole).toString());
}
+ QSettings s;
+ bool autoAddCovers = s.value("ui/autoaddcovers", false).toBool();
+ QString coverPath = s.value("paths/coverpath").toString();
+ if(autoAddCovers && !coverPath.isEmpty()){
+ QDir coverDir(coverPath);
+ foreach(QFileInfo fi, coverDir.entryInfoList(QDir::Files)){
+ mNewMovieWizard->infoPage()->addFile(fi.absoluteFilePath());
+ }
+ }
mNewMovieWizard->show();
}