Commit 2e06153a authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove configuration UI for thumbnailer

The options are very undiscoverable in dolphin and having
an option for this seems quite overkill to me. If people really want to
have this kind of configurability they should be using an image
viewer instead of looking at the thumbnails.

For compatibility the config file is still read.

It also causes issues from a dependency kind of view.
Task: https://phabricator.kde.org/T14695
parent 59fc3f94
......@@ -177,96 +177,6 @@ ThumbCreator::Flags FFMpegThumbnailer::flags() const
return (Flags)(None);
}
QWidget *FFMpegThumbnailer::createConfigurationWidget()
{
QWidget* widget = new QWidget();
QFormLayout* formLayout = new QFormLayout(widget);
QCheckBox* addFilmStripCheckBox = new QCheckBox (
i18nc("@option:check For checkbox labeled 'Embed filmstrip effect'", "Embed"));
addFilmStripCheckBox->setObjectName("FFMpegThumbnailer::addFilmStripCheckBox");
addFilmStripCheckBox->setChecked(FFMpegThumbnailerSettings::filmstrip());
formLayout->addRow(i18nc("@label:checkbox", "Embed filmstrip effect"), addFilmStripCheckBox);
QString seekPercentagesStr;
for (const int sp : FFMpegThumbnailerSettings::sequenceSeekPercentages()) {
if (!seekPercentagesStr.isEmpty()) {
seekPercentagesStr.append(' ');
}
seekPercentagesStr.append(QString::number(sp));
}
QLineEdit* sequenceSeekPercentagesLineEdit = new QLineEdit();
sequenceSeekPercentagesLineEdit->setObjectName("FFMpegThumbnailer::sequenceSeekPercentagesLineEdit");
sequenceSeekPercentagesLineEdit->setText(seekPercentagesStr);
sequenceSeekPercentagesLineEdit->setToolTip(i18nc("@info:tooltip",
"List of integers, separated by space or comma"));
formLayout->addRow(i18nc("@label:textbox", "Sequence seek percentages"), sequenceSeekPercentagesLineEdit);
QSpinBox* thumbCacheSizeSpinBox = new QSpinBox();
thumbCacheSizeSpinBox->setObjectName("FFMpegThumbnailer::thumbCacheSizeSpinBox");
thumbCacheSizeSpinBox->setRange(0, std::numeric_limits<int>::max());
thumbCacheSizeSpinBox->setValue(FFMpegThumbnailerSettings::cacheSize());
thumbCacheSizeSpinBox->setSuffix(i18nc("Kibibyte used as a spinbox suffix", " KiB"));
formLayout->addRow(i18nc("@label:spinbox", "Cache size"), thumbCacheSizeSpinBox);
return widget;
}
void FFMpegThumbnailer::writeConfiguration(const QWidget* configurationWidget)
{
if (!configurationWidget) {
qCCritical(ffmpegthumbs_LOG) << "Invalid configuration widget";
return;
}
QCheckBox* addFilmStripCheckBox = configurationWidget->findChild<QCheckBox*> (
"FFMpegThumbnailer::addFilmStripCheckBox");
QLineEdit* sequenceSeekPercentagesLineEdit = configurationWidget->findChild<QLineEdit*> (
"FFMpegThumbnailer::sequenceSeekPercentagesLineEdit");
QSpinBox* thumbCacheSizeSpinBox = configurationWidget->findChild<QSpinBox*> (
"FFMpegThumbnailer::thumbCacheSizeSpinBox");
if (!addFilmStripCheckBox || !sequenceSeekPercentagesLineEdit || !thumbCacheSizeSpinBox) {
qCCritical(ffmpegthumbs_LOG) << "Invalid configuration widget";
return;
}
FFMpegThumbnailerSettings* settings = FFMpegThumbnailerSettings::self();
settings->setFilmstrip(addFilmStripCheckBox->isChecked());
const QString seekPercentagesStr = sequenceSeekPercentagesLineEdit->text();
const QVector<QStringRef> seekPercentagesStrList = seekPercentagesStr.splitRef (
QRegularExpression("(\\s*,\\s*)|\\s+"), Qt::SkipEmptyParts);
QList<int> seekPercentages;
bool seekPercentagesValid = true;
for (const QStringRef& str : seekPercentagesStrList) {
const int sp = str.toInt(&seekPercentagesValid);
if (!seekPercentagesValid) {
break;
}
seekPercentages << sp;
}
if (seekPercentagesValid) {
settings->setSequenceSeekPercentages(seekPercentages);
}
settings->setCacheSize(thumbCacheSizeSpinBox->value());
m_thumbCache.setMaxCost(thumbCacheSizeSpinBox->value());
// Assume that the video file has an embedded thumb, in which case it gets inserted before the
// regular seek percentage-based thumbs. If we find out that the video doesn't have one, we can
// correct that overestimation.
updateSequenceIndexWraparoundPoint(1.0);
settings->save();
}
void FFMpegThumbnailer::updateSequenceIndexWraparoundPoint(float offset)
{
float wraparoundPoint = offset;
......
......@@ -31,8 +31,6 @@ public:
~FFMpegThumbnailer() override;
bool create(const QString& path, int width, int height, QImage& img) override;
Flags flags() const override;
QWidget* createConfigurationWidget() override;
void writeConfiguration(const QWidget* configurationWidget) override;
private:
void updateSequenceIndexWraparoundPoint(float offset);
......
......@@ -61,4 +61,3 @@ CacheThumbnail=true
HandleSequences=true
ThumbnailerVersion=2
IgnoreMaximumSize=true
Configurable=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment