Commit 98447ac4 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

factorize

parent 78aa6209
......@@ -31,6 +31,12 @@
#include <klocale.h>
#include <kdebug.h>
// Local includes
#include "kpmetadata.h"
using namespace KIPIPlugins;
namespace KIPIPanoramaPlugin
{
......@@ -115,7 +121,7 @@ void CopyFilesTask::run()
kDebug() << "Copying converted RAW files...";
for (ItemUrlsMap::iterator i = (ItemUrlsMap::iterator) urlList->begin(); i != urlList->end(); ++i)
{
if (isRawFile(i.key()))
if (KPMetadata::isRawFile(i.key()))
{
KUrl finalImgUrl(finalPanoUrl);
finalImgUrl.setFileName(i->preprocessedUrl.fileName());
......
......@@ -69,7 +69,7 @@ void PreProcessTask::requestAbort()
void PreProcessTask::run()
{
if (isRawFile(fileUrl.toLocalFile()))
if (KPMetadata::isRawFile(fileUrl))
{
preProcessedUrl->preprocessedUrl = tmpDir;
......
......@@ -37,12 +37,14 @@
namespace KIPIPanoramaPlugin
{
Task::Task(QObject* parent, Action action, const KUrl& workDir)
Task::Task(QObject* const parent, Action action, const KUrl& workDir)
: Job(parent), action(action), successFlag(false), isAbortedFlag(false), tmpDir(workDir)
{}
{
}
Task::~Task()
{}
{
}
bool Task::success() const
{
......@@ -54,17 +56,6 @@ void Task::requestAbort()
isAbortedFlag = true;
}
bool Task::isRawFile(const KUrl& url)
{
QString rawFilesExt(KDcrawIface::KDcraw::rawFiles());
QFileInfo fileInfo(url.toLocalFile());
if (rawFilesExt.toUpper().contains(fileInfo.suffix().toUpper()))
return true;
return false;
}
QString Task::getProcessError(KProcess& proc)
{
QString std = proc.readAll();
......
......@@ -39,18 +39,18 @@ class Task : public ThreadWeaver::Job
{
public:
QString errString;
const Action action;
QString errString;
const Action action;
protected:
bool successFlag;
bool isAbortedFlag;
const KUrl tmpDir;
bool successFlag;
bool isAbortedFlag;
const KUrl tmpDir;
public:
Task(QObject* parent, Action action, const KUrl& workDir);
Task(QObject* const parent, Action action, const KUrl& workDir);
~Task();
bool success() const;
......@@ -60,7 +60,6 @@ protected:
virtual void run() = 0;
static bool isRawFile(const KUrl& url);
static QString getProcessError(KProcess& proc);
};
......
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