This repository was archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddedImage.cpp
More file actions
55 lines (48 loc) · 1.43 KB
/
EmbeddedImage.cpp
File metadata and controls
55 lines (48 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "EmbeddedImage.h"
#include <QFileInfo>
#include <QProcess>
#include <QStringList>
#include <QDir>
#include <QDebug>
EmbeddedImage::EmbeddedImage(const QString &_originalImagePath)
{
QFileInfo fi(_originalImagePath);
if (fi.exists())
{
m_originalImagePath = _originalImagePath;
}
else
{
// log
}
}
bool EmbeddedImage::extractEmbeddedImage()
{
QString ufrawExec = "/usr/local/bin/ufraw-batch";
QStringList args;
args.append(m_originalImagePath);
args.append("--embedded-image");
QFileInfo info(m_originalImagePath);
QDir currentWorkDir = info.dir();
m_embeddedImagePath = currentWorkDir.absolutePath() + "/" + info.baseName() + ".embedded.jpg";
QFileInfo infoEmbed(m_embeddedImagePath);
if (infoEmbed.exists())
return true;
QProcess *ufrawCall = new QProcess(this);
ufrawCall->setProgram(ufrawExec);
ufrawCall->setArguments(args);
ufrawCall->start(ufrawExec, args);
ufrawCall->waitForFinished();
//QObject::connect(ufrawCall, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) {
//m_embeddedImagePath = currentWorkDir.absolutePath() + "/" + info.baseName() + ".embedded.jpg";
return true;
//});
}
QString EmbeddedImage::embeddedImagePath()
{
return m_embeddedImagePath;
}
QString EmbeddedImage::originalImagePath()
{
return m_originalImagePath;
}