Commit bd7e2ae1 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

factoring

parent 98447ac4
......@@ -42,7 +42,7 @@ using namespace KIPIPlugins;
namespace KIPIPanoramaPlugin
{
PreProcessTask::PreProcessTask(QObject* parent, const KUrl& workDir, int id, ItemPreprocessedUrls& targetUrls,
PreProcessTask::PreProcessTask(QObject* const parent, const KUrl& workDir, int id, ItemPreprocessedUrls& targetUrls,
const KUrl& sourceUrl, const RawDecodingSettings& rawSettings)
: Task(parent, PREPROCESS_INPUT, workDir), id(id),
fileUrl(sourceUrl), preProcessedUrl(&targetUrls), settings(rawSettings)
......@@ -71,7 +71,7 @@ void PreProcessTask::run()
{
if (KPMetadata::isRawFile(fileUrl))
{
preProcessedUrl->preprocessedUrl = tmpDir;
preProcessedUrl->preprocessedUrl = tmpDir;
if (!convertRaw())
{
......@@ -82,10 +82,10 @@ void PreProcessTask::run()
else
{
// NOTE: in this case, preprocessed Url is the original file Url.
preProcessedUrl->preprocessedUrl = fileUrl;
preProcessedUrl->preprocessedUrl = fileUrl;
}
preProcessedUrl->previewUrl = tmpDir;
preProcessedUrl->previewUrl = tmpDir;
if (!computePreview(preProcessedUrl->preprocessedUrl))
{
......@@ -131,7 +131,7 @@ bool PreProcessTask::computePreview(const KUrl& inUrl)
bool PreProcessTask::convertRaw()
{
const KUrl& inUrl = fileUrl;
KUrl &outUrl = preProcessedUrl->preprocessedUrl;
KUrl &outUrl = preProcessedUrl->preprocessedUrl;
int width, height, rgbmax;
QByteArray imageData;
......
......@@ -49,18 +49,18 @@ class PreProcessTask : public Task
public:
const int id;
const int id;
private:
const KUrl fileUrl;
ItemPreprocessedUrls* const preProcessedUrl;
const RawDecodingSettings settings;
QPointer<KDcraw> rawProcess;
const KUrl fileUrl;
ItemPreprocessedUrls* const preProcessedUrl;
const RawDecodingSettings settings;
QPointer<KDcraw> rawProcess;
public:
PreProcessTask(QObject* parent, const KUrl& workDir, int id, ItemPreprocessedUrls& targetUrls,
PreProcessTask(QObject* const parent, const KUrl& workDir, int id, ItemPreprocessedUrls& targetUrls,
const KUrl& sourceUrl, const RawDecodingSettings& rawSettings);
PreProcessTask(const KUrl& workDir, int id, ItemPreprocessedUrls& targetUrls,
const KUrl& sourceUrl, const RawDecodingSettings& rawSettings);
......@@ -76,7 +76,6 @@ private:
bool computePreview(const KUrl& inUrl);
bool convertRaw();
};
} // namespace KIPIPanoramaPlugin
......
......@@ -526,14 +526,11 @@ void SwWindow::uploadNextPhoto()
m_progressDlg->progressBar()->setValue(m_imagesCount);
QString imgPath = m_transferQueue.first().path();
// check if we have to RAW file -> use preview image then
QString rawFilesExt(KDcraw::rawFiles());
QFileInfo fileInfo(imgPath);
QString caption;
bool isRAW = rawFilesExt.toUpper().contains(fileInfo.suffix().toUpper());
bool res;
bool res;
// check if we have to RAW file -> use preview image then
bool isRAW = KPMetadata::isRawFile(imgPath);
if (isRAW || m_widget->m_resizeChB->isChecked())
{
if (!prepareImageForUpload(imgPath, isRAW, caption))
......
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