Commit 7edc98d1 authored by Marcel Wiesweg's avatar Marcel Wiesweg
Browse files

Adapt to PreviewSettings everywhere.

Import tool has its own, simpler settings.
LightTable reuses main settings.

CCBUG: 205776
parent 9ddedf90
......@@ -788,6 +788,7 @@ if(DIGIKAM_CAN_BE_COMPILED)
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/loadsavetask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/previewloadthread.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/previewtask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/previewsettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/thumbnailbasic.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/thumbnailcreator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/threadimageio/thumbnailloadthread.cpp
......
......@@ -36,6 +36,7 @@
#include "dimg.h"
#include "dimgpreviewitem.h"
#include "imagezoomsettings.h"
#include "previewsettings.h"
namespace Digikam
{
......@@ -106,7 +107,7 @@ public:
int previewSize;
QString path;
bool loadFullImageSize;
PreviewSettings previewSettings;
PreviewLoadThread* previewThread;
PreviewLoadThread* preloadThread;
QStringList pathsToPreload;
......
......@@ -39,6 +39,7 @@
#include "loadingcacheinterface.h"
#include "loadingdescription.h"
#include "previewloadthread.h"
#include "previewsettings.h"
namespace Digikam
{
......@@ -61,7 +62,6 @@ DImgPreviewItem::DImgPreviewItemPrivate::DImgPreviewItemPrivate()
{
state = DImgPreviewItem::NoImage;
previewSize = 1024;
loadFullImageSize = false;
exifRotate = false;
previewThread = 0;
preloadThread = 0;
......@@ -104,6 +104,18 @@ void DImgPreviewItem::setDisplayingWidget(QWidget* const widget)
d->previewThread->setDisplayingWidget(widget);
}
void DImgPreviewItem::setPreviewSettings(const PreviewSettings& settings)
{
Q_D(DImgPreviewItem);
if (settings == d->previewSettings)
{
return;
}
d->previewSettings = settings;
reload();
}
/*
void DImgPreviewItem::setLoadFullImageSize(bool b)
{
Q_D(DImgPreviewItem);
......@@ -116,6 +128,7 @@ void DImgPreviewItem::setLoadFullImageSize(bool b)
d->loadFullImageSize = b;
reload();
}
*/
QString DImgPreviewItem::path() const
{
......@@ -142,15 +155,7 @@ void DImgPreviewItem::setPath(const QString& path, bool rePreview)
else
{
d->state = Loading;
if (d->loadFullImageSize)
{
d->previewThread->loadHighQuality(d->path);
}
else
{
d->previewThread->load(d->path, d->previewSize);
}
d->previewThread->load(d->path, d->previewSettings, d->previewSize);
emit stateChanged(d->state);
}
......@@ -297,15 +302,7 @@ void DImgPreviewItem::preloadNext()
}
QString preloadPath = d->pathsToPreload.takeFirst();
if (d->loadFullImageSize)
{
d->preloadThread->loadHighQuality(preloadPath);
}
else
{
d->preloadThread->load(preloadPath, d->previewSize);
}
d->preloadThread->load(preloadPath, d->previewSettings, d->previewSize);
}
void DImgPreviewItem::slotFileChanged(const QString& path)
......
......@@ -41,6 +41,7 @@ class DImg;
class ICCSettingsContainer;
class ImageInfo;
class LoadingDescription;
class PreviewSettings;
class DIGIKAM_EXPORT DImgPreviewItem : public GraphicsDImgItem
{
......@@ -62,7 +63,7 @@ public:
virtual ~DImgPreviewItem();
void setDisplayingWidget(QWidget* const widget);
void setLoadFullImageSize(bool b);
void setPreviewSettings(const PreviewSettings& settings);
QString path() const;
void setPath(const QString& path, bool rePreview = false);
......
......@@ -44,6 +44,7 @@
#include "previewlayout.h"
#include "thememanager.h"
#include "importsettings.h"
#include "previewsettings.h"
namespace Digikam
{
......@@ -459,7 +460,9 @@ void ImportPreviewView::slotThemeChanged()
void ImportPreviewView::slotSetupChanged()
{
previewItem()->setLoadFullImageSize(ImportSettings::instance()->getPreviewLoadFullImageSize());
PreviewSettings settings;
settings.quality = ImportSettings::instance()->getPreviewLoadFullImageSize() ? PreviewSettings::HighQualityPreview : PreviewSettings::FastPreview;
previewItem()->setPreviewSettings(settings);
d->toolBar->setVisible(ImportSettings::instance()->getPreviewShowIcons());
setShowText(ImportSettings::instance()->getPreviewShowIcons());
......
......@@ -161,10 +161,10 @@ LightTableView::~LightTableView()
delete d;
}
void LightTableView::setLoadFullImageSize(bool b)
void LightTableView::setPreviewSettings(const PreviewSettings& settings)
{
d->leftPreview->previewItem()->setLoadFullImageSize(b);
d->rightPreview->previewItem()->setLoadFullImageSize(b);
d->leftPreview->previewItem()->setPreviewSettings(settings);
d->rightPreview->previewItem()->setPreviewSettings(settings);
}
void LightTableView::setSyncPreview(bool sync)
......
......@@ -37,6 +37,8 @@
namespace Digikam
{
class PreviewSettings;
class LightTableView : public QFrame
{
Q_OBJECT
......@@ -55,7 +57,7 @@ public:
ImageInfo leftImageInfo() const;
ImageInfo rightImageInfo() const;
void setLoadFullImageSize(bool b);
void setPreviewSettings(const PreviewSettings& settings);
void checkForSelection(const ImageInfo& info);
void toggleFullScreen(bool set);
......
......@@ -142,7 +142,6 @@ LightTableWindow::LightTableWindow()
// ------------------------------------------------
setupConnections();
slotSidebarTabTitleStyleChanged();
slotColorManagementOptionsChanged();
readSettings();
......@@ -206,7 +205,8 @@ void LightTableWindow::applySettings()
d->autoLoadOnRightPanel = group.readEntry("Auto Load Right Panel", true);
d->autoSyncPreview = group.readEntry("Auto Sync Preview", true);
d->clearOnCloseAction->setChecked(group.readEntry("Clear On Close", false));
d->previewView->setLoadFullImageSize(group.readEntry("Load Full Image size", false));
//d->previewView->setLoadFullImageSize(group.readEntry("Load Full Image size", false));
slotApplicationSettingsChanged();
// Restore full screen Mode
readFullScreenSettings(group);
......@@ -350,7 +350,7 @@ void LightTableWindow::setupConnections()
this, SLOT(slotProgressBarCancelButtonPressed()));
connect(ApplicationSettings::instance(), SIGNAL(setupChanged()),
this, SLOT(slotSidebarTabTitleStyleChanged()));
this, SLOT(slotApplicationSettingsChanged()));
connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()),
this, SLOT(slotThemeChanged()));
......@@ -1598,13 +1598,15 @@ void LightTableWindow::slotShowMenuBar()
menuBar()->setVisible(d->showMenuBarAction->isChecked());
}
void LightTableWindow::slotSidebarTabTitleStyleChanged()
void LightTableWindow::slotApplicationSettingsChanged()
{
d->leftSideBar->setStyle(ApplicationSettings::instance()->getSidebarTitleStyle());
d->rightSideBar->setStyle(ApplicationSettings::instance()->getSidebarTitleStyle());
/// @todo Which part of the settings has to be reloaded?
// d->rightSideBar->applySettings();
d->previewView->setPreviewSettings(ApplicationSettings::instance()->getPreviewSettings());
}
void LightTableWindow::moveEvent(QMoveEvent* e)
......
......@@ -155,7 +155,7 @@ private Q_SLOTS:
void slotDBStat();
void slotFileWithDefaultApplication();
void slotSidebarTabTitleStyleChanged();
void slotApplicationSettingsChanged();
void slotThemeChanged();
void slotRefreshStatusBar();
......
......@@ -78,12 +78,7 @@ void FingerprintsTask::run()
{
if(!d->cancel)
{
LoadingDescription description(d->path, HaarIface::preferredSize(), LoadingDescription::ConvertToSRGB);
description.rawDecodingSettings.optimizeTimeLoading();
description.rawDecodingSettings.rawPrm.sixteenBitsImage = false;
description.rawDecodingSettings.rawPrm.halfSizeColorImage = true;
description.rawDecodingHint = LoadingDescription::RawDecodingTimeOptimized;
DImg dimg = PreviewLoadThread::loadSynchronously(description);
DImg dimg = PreviewLoadThread::loadFastSynchronously(d->path, HaarIface::preferredSize());
if(d->cancel)
return;
......
......@@ -91,12 +91,7 @@ void ImageQualityTask::run()
{
// Get item preview to perform quality analysis. No need to load whole image, this will be slower.
// TODO : check if 1024 pixels size is enough to get suitable Quality results.
LoadingDescription description(d->path, 1024, LoadingDescription::ConvertToSRGB);
description.rawDecodingSettings.optimizeTimeLoading();
description.rawDecodingSettings.rawPrm.sixteenBitsImage = false;
description.rawDecodingSettings.rawPrm.halfSizeColorImage = true;
description.rawDecodingHint = LoadingDescription::RawDecodingTimeOptimized;
DImg dimg = PreviewLoadThread::loadSynchronously(description);
DImg dimg = PreviewLoadThread::loadFastSynchronously(d->path, 1024);
if (!dimg.isNull() && !d->cancel)
{
......
......@@ -103,14 +103,14 @@ SetupLightTable::SetupLightTable(QWidget* const parent)
interfaceOptionsGroup);
d->autoLoadOnRightPanel->setWhatsThis(i18n("Set this option to automatically load an image "
"into the right panel when the corresponding item is selected on the thumbbar."));
/*
d->loadFullImageSize = new QCheckBox(i18n("Load full-sized image"), interfaceOptionsGroup);
d->loadFullImageSize->setWhatsThis(i18n("<p>Set this option to load images at their full size "
"for preview, rather than at a reduced size. As this option "
"will make it take longer to load images, only use it if you have "
"a fast computer.</p>"
"<p><b>Note:</b> for Raw images, a half size version of the Raw data "
"is used instead of the embedded JPEG preview.</p>"));
"is used instead of the embedded JPEG preview.</p>"));*/
d->clearOnClose = new QCheckBox(i18n("Clear the light table on close"));
d->clearOnClose->setWhatsThis(i18n("Set this option to remove all images "
......@@ -120,7 +120,7 @@ SetupLightTable::SetupLightTable(QWidget* const parent)
gLayout->addWidget(d->autoSyncPreview);
gLayout->addWidget(d->autoLoadOnRightPanel);
gLayout->addWidget(d->loadFullImageSize);
//gLayout->addWidget(d->loadFullImageSize);
gLayout->addWidget(d->clearOnClose);
gLayout->setMargin(KDialog::spacingHint());
gLayout->setSpacing(0);
......@@ -159,7 +159,7 @@ void SetupLightTable::readSettings()
d->fullScreenSettings->readSettings(group);
d->autoSyncPreview->setChecked(group.readEntry(d->configAutoSyncPreviewEntry, true));
d->autoLoadOnRightPanel->setChecked(group.readEntry(d->configAutoLoadRightPanelEntry, true));
d->loadFullImageSize->setChecked(group.readEntry(d->configLoadFullImagesizeEntry, false));
//d->loadFullImageSize->setChecked(group.readEntry(d->configLoadFullImagesizeEntry, false));
d->clearOnClose->setChecked(group.readEntry(d->configClearOnCloseEntry, false));
}
......@@ -170,7 +170,7 @@ void SetupLightTable::applySettings()
d->fullScreenSettings->saveSettings(group);
group.writeEntry(d->configAutoSyncPreviewEntry, d->autoSyncPreview->isChecked());
group.writeEntry(d->configAutoLoadRightPanelEntry, d->autoLoadOnRightPanel->isChecked());
group.writeEntry(d->configLoadFullImagesizeEntry, d->loadFullImageSize->isChecked());
//group.writeEntry(d->configLoadFullImagesizeEntry, d->loadFullImageSize->isChecked());
group.writeEntry(d->configClearOnCloseEntry, d->clearOnClose->isChecked());
config->sync();
}
......
......@@ -47,15 +47,15 @@ class SlideImage::Private
public:
Private() :
useFullSizePreviews(false),
deskSize(1024),
previewThread(0),
previewPreloadThread(0)
{
}
bool useFullSizePreviews;
PreviewSettings previewSettings;
QSize deskSize;
int deskSize;
QPixmap pixmap;
KUrl currentImage;
......@@ -88,37 +88,23 @@ SlideImage::~SlideImage()
delete d;
}
void SlideImage::setLoadFullImageSize(bool b)
void SlideImage::setPreviewSettings(const PreviewSettings& settings)
{
d->useFullSizePreviews = b;
d->previewSettings = settings;
// calculate preview size which is used for fast previews
QSize desktopSize = KGlobalSettings::desktopGeometry(parentWidget()).size();
d->deskSize = qMax(640, qMax(desktopSize.height(), desktopSize.width()));
}
void SlideImage::setLoadUrl(const KUrl& url)
{
d->currentImage = url;
if (d->useFullSizePreviews)
{
d->previewThread->loadHighQuality(url.toLocalFile());
}
else
{
QSize deskSize = KGlobalSettings::desktopGeometry(parentWidget()).size();
d->previewThread->load(url.toLocalFile(), qMax(deskSize.width(), deskSize.height()));
}
d->previewThread->load(url.toLocalFile(), d->previewSettings, d->deskSize);
}
void SlideImage::setPreloadUrl(const KUrl& url)
{
if (d->useFullSizePreviews)
{
d->previewPreloadThread->loadHighQuality(url.toLocalFile());
}
else
{
QSize deskSize = KGlobalSettings::desktopGeometry(parentWidget()).size();
d->previewPreloadThread->load(url.toLocalFile(), qMax(deskSize.width(), deskSize.height()));
}
d->previewPreloadThread->load(url.toLocalFile(), d->previewSettings, d->deskSize);
}
void SlideImage::paintEvent(QPaintEvent*)
......
......@@ -37,6 +37,8 @@
#include "digikam_export.h"
#include "loadingdescription.h"
class PreviewSettings;
namespace Digikam
{
......@@ -49,7 +51,7 @@ public:
explicit SlideImage(QWidget* const parent = 0);
~SlideImage();
void setLoadFullImageSize(bool b);
void setPreviewSettings(const PreviewSettings& settings);
void setLoadUrl(const KUrl& url);
void setPreloadUrl(const KUrl& url);
......
......@@ -113,7 +113,7 @@ SlideShow::SlideShow(const SlideShowSettings& settings)
// ---------------------------------------------------------------
d->imageView = new SlideImage(this);
d->imageView->setLoadFullImageSize(d->settings.useFullSizePreviews);
d->imageView->setPreviewSettings(d->settings.previewSettings);
d->imageView->installEventFilter(this);
connect(d->imageView, SIGNAL(signalImageLoaded(bool)),
......
......@@ -70,7 +70,6 @@ SlideShowSettings::SlideShowSettings()
printMakeModel = false;
printExpoSensitivity = false;
printTags = false;
useFullSizePreviews = true;
showProgressIndicator = true;
slideScreen = -2;
}
......
......@@ -38,6 +38,7 @@
#include "infocontainer.h"
#include "digikam_export.h"
#include "previewsettings.h"
namespace Digikam
{
......@@ -169,7 +170,7 @@ public:
/** Load images (previews) in full size, not reduced version
*/
bool useFullSizePreviews;
PreviewSettings previewSettings;
/** List of pictures URL to slide
*/
......
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