aboutsummaryrefslogtreecommitdiffstats
path: root/qarma
diff options
context:
space:
mode:
Diffstat (limited to 'qarma')
-rw-r--r--qarma/images-preview.patch.old59
1 files changed, 0 insertions, 59 deletions
diff --git a/qarma/images-preview.patch.old b/qarma/images-preview.patch.old
deleted file mode 100644
index 00e9187..0000000
--- a/qarma/images-preview.patch.old
+++ /dev/null
@@ -1,59 +0,0 @@
-diff --git a/Qarma.cpp b/Qarma.cpp
-index 3708360..d1599c5 100644
---- a/Qarma.cpp
-+++ b/Qarma.cpp
-@@ -34,6 +34,7 @@
- #include <QFontDialog>
- #include <QFormLayout>
- #include <QIcon>
-+#include <QImageReader>
- #include <QInputDialog>
- #include <QLabel>
- #include <QLocale>
-@@ -48,6 +49,7 @@
- #include <QSettings>
- #include <QSlider>
- #include <QSocketNotifier>
-+#include <QSplitter>
- #include <QStringBuilder>
- #include <QStringList>
- #include <QTextBrowser>
-@@ -785,6 +787,21 @@ char Qarma::showMessage(const QStringList &args, char type)
- return 0;
- }
-
-+QPixmap thumbnail(const QString &path, uint size)
-+{
-+ QImageReader thumbReader;
-+ thumbReader.setFileName(path);
-+ thumbReader.setQuality(50);
-+ QSize sz = thumbReader.size();
-+ sz.scale(QSize(size,size), Qt::KeepAspectRatio);
-+ thumbReader.setScaledSize(sz);
-+ QImage thumb;
-+ if (thumbReader.read(&thumb))
-+ return QPixmap::fromImage(thumb);
-+ else
-+ return QPixmap();
-+}
-+
- char Qarma::showFileSelection(const QStringList &args)
- {
- QFileDialog *dlg = new QFileDialog;
-@@ -827,6 +844,16 @@ char Qarma::showFileSelection(const QStringList &args)
- if (idx > -1)
- mimeFilter = mimeFilter.left(idx).trimmed() + " (" + mimeFilter.mid(idx+1).trimmed() + ")";
- mimeFilters << mimeFilter;
-+ } else if (args.at(i) == "--preview-images") {
-+ READ_INT(size, UInt, "--preview-images must be followed by a positive number for the thumbnail size");
-+ dlg->setOption(QFileDialog::DontUseNativeDialog);
-+ if (QSplitter *splitter = dlg->findChild<QSplitter*>()) {
-+ QLabel *preview = new QLabel(splitter);
-+ splitter->addWidget(preview);
-+ connect(dlg, &QFileDialog::currentChanged, [=](const QString &path) {
-+ preview->setPixmap(thumbnail(path, size));
-+ });
-+ }
- }
- else { WARN_UNKNOWN_ARG("--file-selection") }
- }