summaryrefslogtreecommitdiffstats
path: root/configurationdialog.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-12-11 13:06:20 +0100
committerArno <am@disconnect.de>2010-12-11 13:06:20 +0100
commitc3b7144f5aef2906d85339d3b9c5bf8eaa3a6356 (patch)
treecb5c3d8d6ad572148f36cfc8b75307fdea386b9f /configurationdialog.cpp
parenta87e4d8c3c2102e9728dd5df303acca7ae08b343 (diff)
downloadSheMov-c3b7144f5aef2906d85339d3b9c5bf8eaa3a6356.tar.gz
SheMov-c3b7144f5aef2906d85339d3b9c5bf8eaa3a6356.tar.bz2
SheMov-c3b7144f5aef2906d85339d3b9c5bf8eaa3a6356.zip
Implement hover over movies
What started as an attempt to show a frame from a movie when hovering over it, ended in a huge bugfix commit for hover related stuff. This commit is definitely not atomic. When hovering over a movie present on the filesytem a frame is shown. The time frame is configurable. While digging into the code I noticed some bugs. Bugfixes: * fix label for hove archive action. It was labeled for hovering over directories in FSWidget. * Hovering over directories didn't have an action. Also read the appropriate value from QSettings. Other: * add icons for hovering over directories and hovering over movies * replace SheMov::toggleHover(pics|some other) with a QSignalMapper
Diffstat (limited to 'configurationdialog.cpp')
-rw-r--r--configurationdialog.cpp52
1 files changed, 41 insertions, 11 deletions
diff --git a/configurationdialog.cpp b/configurationdialog.cpp
index c8e7197..08186e9 100644
--- a/configurationdialog.cpp
+++ b/configurationdialog.cpp
@@ -59,10 +59,15 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q
mFfProbePath->setCompleter(fsCompleter);
pathGrid->addWidget(pathl3, 2, 0);
pathGrid->addWidget(mFfProbePath, 2, 1);
- QLabel *pathl4 = new QLabel(tr("DVD mount directory"));
- mDvdMountPath = new QLineEdit;
+ QLabel *pathl4 = new QLabel(tr("Path to ffmpeg"));
+ mFfMpegPath = new QLineEdit;
+ mFfMpegPath->setCompleter(fsCompleter);
pathGrid->addWidget(pathl4, 3, 0);
- pathGrid->addWidget(mDvdMountPath, 3, 1);
+ pathGrid->addWidget(mFfMpegPath, 3, 1);
+ QLabel *pathl5 = new QLabel(tr("DVD mount directory"));
+ mDvdMountPath = new QLineEdit;
+ pathGrid->addWidget(pathl5, 4, 0);
+ pathGrid->addWidget(mDvdMountPath, 4, 1);
pathGrid->setAlignment(Qt::AlignTop);
pathBox->setLayout(pathGrid);
QVBoxLayout *pathLayout = new QVBoxLayout;
@@ -72,17 +77,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 *pathl5 = new QLabel(tr("Windows drive"));
+ QLabel *pathl6 = 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(pathl5, 0, 0);
+ copyGrid->addWidget(pathl6, 0, 0);
copyGrid->addWidget(mWindowsDrive, 0, 1);
- QLabel *pathl6 = new QLabel(tr("Strip from path"));
+ QLabel *pathl7 = new QLabel(tr("Strip from path"));
mStripPath = new QLineEdit;
- copyGrid->addWidget(pathl6, 1, 0);
+ copyGrid->addWidget(pathl7, 1, 0);
copyGrid->addWidget(mStripPath, 1, 1);
copyGrid->setAlignment(Qt::AlignTop);
copyBox->setLayout(copyGrid);
@@ -113,11 +118,21 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q
mHoverOpacity = new QSpinBox;
mHoverOpacity->setMinimum(1);
mHoverOpacity->setMaximum(10);
+ mHoverMovies = new QCheckBox(tr("Show frame when hovering over movie"));
+ connect(mHoverMovies, SIGNAL(clicked(bool)), this, SLOT(setGrabFrameEnabled(bool)));
+ hoverLayout->addWidget(mHoverMovies);
+ QGridLayout *miscInputGrid = new QGridLayout;
QLabel *miscl6 = new QLabel(tr("Opacity of hover window"));
- QHBoxLayout *opacityLayout = new QHBoxLayout;
- opacityLayout->addWidget(miscl6);
- opacityLayout->addWidget(mHoverOpacity);
- hoverLayout->addLayout(opacityLayout);
+ miscInputGrid->addWidget(miscl6, 0, 0);
+ miscInputGrid->addWidget(mHoverOpacity, 0, 1);
+ QLabel *miscl7 = new QLabel(tr("Grab frame at ([hh:mm:ss])"));
+ mGrabFrameFrom = new QLineEdit;
+ QRegExp frameValid("\\d{2}:\\d{2}:\\d{2}");
+ QRegExpValidator *frameValidator = new QRegExpValidator(frameValid, this);
+ mGrabFrameFrom->setValidator(frameValidator);
+ miscInputGrid->addWidget(miscl7, 1, 0);
+ miscInputGrid->addWidget(mGrabFrameFrom, 1, 1);
+ hoverLayout->addLayout(miscInputGrid);
hoverBox->setLayout(hoverLayout);
//misc - assemble
@@ -185,6 +200,10 @@ void ConfigurationDialog::accept(){
QDialog::accept();
}
+void ConfigurationDialog::setGrabFrameEnabled(bool enabled){
+ mGrabFrameFrom->setEnabled(enabled);
+}
+
void ConfigurationDialog::readSettings(){
QSettings s;
@@ -196,12 +215,16 @@ void ConfigurationDialog::readSettings(){
}
mHoverPics->setChecked(s.value("ui/hoverpics", false).toBool());
mHoverArchive->setChecked(s.value("ui/hoverarchive", false).toBool());
+ mHoverMovies->setChecked(s.value("ui/hovermovies", false).toBool());
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());
//read paths
mArchiveDir->setText(s.value("paths/archivedir").toString());
mBurnDir->setText(s.value("paths/burn").toString());
mFfProbePath->setText(s.value("paths/ffprobe").toString());
+ mFfMpegPath->setText(s.value("paths/ffmpeg").toString());
mDvdMountPath->setText(s.value("paths/dvdmount").toString());
mWindowsDrive->setText(s.value("paths/windowsdrive").toString());
mStripPath->setText(s.value("paths/strippath").toString());
@@ -225,6 +248,11 @@ void ConfigurationDialog::writeSettings(){
if(ffProbeInfo.exists() && ffProbeInfo.isExecutable()){
s.setValue("paths/ffprobe", ffprobe);
}
+ QString ffmpeg = mFfMpegPath->text();
+ QFileInfo ffMpegInfo(ffmpeg);
+ if(ffMpegInfo.exists() && ffMpegInfo.isExecutable()){
+ s.setValue("paths/ffmpeg", ffmpeg);
+ }
if(checkDvdPath()){
s.setValue("paths/dvdmount", mDvdMountPath->text());
}
@@ -235,6 +263,8 @@ void ConfigurationDialog::writeSettings(){
s.setValue("ui/hoverpics", (mHoverPics->checkState() == Qt::Checked));
s.setValue("ui/hoverarchive", (mHoverArchive->checkState() == Qt::Checked));
s.setValue("ui/hoveropacity", mHoverOpacity->value());
+ s.setValue("ui/hovermovies", (mHoverMovies->checkState() == Qt::Checked));
+ s.setValue("ui/grabframe", mGrabFrameFrom->text());
//write database
s.setValue("database/hostname", mDatabaseHost->text());