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

Batch Queue Manager : add new option to turn on/off multi-core support. This...

Batch Queue Manager : add new option to turn on/off multi-core support. This option is now turn off by default due to some dysfunctions under Windows, until it will be hack and fixed.
Note that problem are not reproducible under OSX and Linux here. Options is implemnted for digiKam 3.3.0 release.
CCBUGS: 315025
CCBUGS: 318198
CCBUGS: 318577
CCBUGS: 320358
parent 47ed5da4
......@@ -6,7 +6,7 @@
* Date : 2009-02-06
* Description : Thread actions manager.
*
* Copyright (C) 2009-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2009-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2012 by Pankaj Kumar <me at panks dot me>
*
* This program is free software; you can redistribute it
......@@ -30,12 +30,15 @@
#include <kstandarddirs.h>
#include <kdebug.h>
#include <threadweaver/JobCollection.h>
#include <solid/device.h>
// Local includes
#include "config-digikam.h"
#include "task.h"
using namespace Solid;
namespace Digikam
{
......@@ -73,6 +76,15 @@ ActionThread::~ActionThread()
void ActionThread::setSettings(const QueueSettings& settings)
{
d->settings = settings;
if (!d->settings.useMultiCoreCPU)
{
setMaximumNumberOfThreads(1);
}
else
{
setMaximumNumberOfThreads(qMax(Device::listFromType(DeviceInterface::Processor).count(), 1));
}
}
void ActionThread::processQueueItems(const QList<AssignedBatchTools>& items)
......
......@@ -6,7 +6,7 @@
* Date : 2009-02-06
* Description : Thread actions manager.
*
* Copyright (C) 2009-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2009-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2012 by Pankaj Kumar <me at panks dot me>
*
* This program is free software; you can redistribute it
......
......@@ -6,7 +6,7 @@
* Date : 2009-02-21
* Description : Queue common settings container.
*
* Copyright (C) 2009-2012 Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2009-2013 Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -66,6 +66,7 @@ public:
QueueSettings()
{
useMultiCoreCPU = false;
exifSetOrientation = true;
useOrgAlbum = true;
conflictRule = DIFFNAME;
......@@ -75,6 +76,8 @@ public:
public:
bool useMultiCoreCPU;
/// Setting managed through Metadata control panel.
bool exifSetOrientation;
......
......@@ -200,7 +200,7 @@ bool WorkflowManager::save()
}
QDomDocument doc("queuelist");
doc.setContent(QString("<!DOCTYPE XMLQueueList><queuelist version=\"1.0\" client=\"digikam\" encoding=\"UTF-8\"/>"));
doc.setContent(QString("<!DOCTYPE XMLQueueList><queuelist version=\"2.0\" client=\"digikam\" encoding=\"UTF-8\"/>"));
QDomElement docElem = doc.documentElement();
{
......@@ -228,6 +228,10 @@ bool WorkflowManager::save()
data.setAttribute(QString::fromLatin1("value"), q.qSettings.useOrgAlbum);
elm.appendChild(data);
data = doc.createElement(QString::fromLatin1("usemulticorecpu"));
data.setAttribute(QString::fromLatin1("value"), q.qSettings.useMultiCoreCPU);
elm.appendChild(data);
data = doc.createElement(QString::fromLatin1("workingurl"));
data.setAttribute(QString::fromLatin1("value"), q.qSettings.workingUrl.path());
elm.appendChild(data);
......@@ -377,6 +381,10 @@ bool WorkflowManager::load(QStringList& failed)
{
q.qSettings.useOrgAlbum = (bool)val2.toUInt(&ok);
}
else if (name2 == "usemulticorecpu")
{
q.qSettings.useMultiCoreCPU = (bool)val2.toUInt(&ok);
}
else if (name2 == "workingurl")
{
q.qSettings.workingUrl = KUrl(val2);
......
......@@ -90,6 +90,7 @@ public:
extractJPEGButton(0),
demosaicingButton(0),
useOrgAlbum(0),
useMutiCoreCPU(0),
albumSel(0),
advancedRenameManager(0),
advancedRenameWidget(0),
......@@ -112,6 +113,7 @@ public:
QRadioButton* demosaicingButton;
QCheckBox* useOrgAlbum;
QCheckBox* useMutiCoreCPU;
AlbumSelectWidget* albumSel;
......@@ -188,7 +190,7 @@ QueueSettingsView::QueueSettingsView(QWidget* const parent)
QWidget* const rawLoadingBox = new QWidget(panel);
QVBoxLayout* const vlay2 = new QVBoxLayout(rawLoadingBox);
d->rawLoadingButtonGroup = new QButtonGroup(rawLoadingBox);
d->demosaicingButton = new QRadioButton(i18n("Perform RAW demosaicing"), rawLoadingBox);
d->demosaicingButton = new QRadioButton(i18n("Perform RAW demosaicing"), rawLoadingBox);
d->extractJPEGButton = new QRadioButton(i18n("Extract embedded preview (faster)"), rawLoadingBox);
d->rawLoadingButtonGroup->addButton(d->extractJPEGButton, QueueSettings::USEEMBEDEDJPEG);
d->rawLoadingButtonGroup->addButton(d->demosaicingButton, QueueSettings::DEMOSAICING);
......@@ -217,13 +219,17 @@ QueueSettingsView::QueueSettingsView(QWidget* const parent)
vlay->addWidget(d->overwriteButton);
vlay->setMargin(0);
vlay->setSpacing(0);
d->useMutiCoreCPU = new QCheckBox(i18n("Use multi-core CPU to increase speed"), panel);
d->useMutiCoreCPU->setWhatsThis(i18n("Turn on this option to use all CPU core from your computer "
"to process more than one item from a queue at the same time."));
// -------------
layout->addWidget(d->rawLoadingLabel);
layout->addWidget(rawLoadingBox);
layout->addWidget(d->conflictLabel);
layout->addWidget(conflictBox);
layout->addWidget(d->useMutiCoreCPU);
layout->setMargin(KDialog::spacingHint());
layout->setSpacing(KDialog::spacingHint());
layout->addStretch();
......@@ -244,6 +250,9 @@ QueueSettingsView::QueueSettingsView(QWidget* const parent)
connect(d->useOrgAlbum, SIGNAL(toggled(bool)),
this, SLOT(slotSettingsChanged()));
connect(d->useMutiCoreCPU, SIGNAL(toggled(bool)),
this, SLOT(slotSettingsChanged()));
connect(d->albumSel, SIGNAL(itemSelectionChanged()),
this, SLOT(slotSettingsChanged()));
......@@ -297,6 +306,7 @@ void QueueSettingsView::slotResetSettings()
{
blockSignals(true);
d->useOrgAlbum->setChecked(true);
d->useMutiCoreCPU->setChecked(false);
// TODO: reset d->albumSel
d->renamingButtonGroup->button(QueueSettings::USEORIGINAL)->setChecked(true);
d->conflictButtonGroup->button(QueueSettings::DIFFNAME)->setChecked(true);
......@@ -310,6 +320,7 @@ void QueueSettingsView::slotResetSettings()
void QueueSettingsView::slotQueueSelected(int, const QueueSettings& settings, const AssignedBatchTools&)
{
d->useOrgAlbum->setChecked(settings.useOrgAlbum);
d->useMutiCoreCPU->setChecked(settings.useMultiCoreCPU);
d->albumSel->setEnabled(!settings.useOrgAlbum);
d->albumSel->setCurrentAlbumUrl(settings.workingUrl);
......@@ -333,6 +344,7 @@ void QueueSettingsView::slotSettingsChanged()
d->albumSel->setEnabled(!d->useOrgAlbum->isChecked());
settings.useOrgAlbum = d->useOrgAlbum->isChecked();
settings.useMultiCoreCPU = d->useMutiCoreCPU->isChecked();
settings.workingUrl = d->albumSel->currentAlbumUrl();
settings.renamingRule = (QueueSettings::RenamingRule)d->renamingButtonGroup->checkedId();
......
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