Turn on calculating of image statistics
This commit is contained in:
+17
-5
@@ -5,13 +5,14 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
const int DEFAULT_WIDTH = 3;
|
||||
const int DEFAULT_WIDTH = 2;
|
||||
|
||||
Image::Image(const QString name) :
|
||||
Image::Image(const QString name, ImageRingList *ringList) :
|
||||
m_loading(false),
|
||||
m_released(true),
|
||||
m_current(false),
|
||||
m_name(name)
|
||||
m_name(name),
|
||||
m_ringList(ringList)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,7 +22,7 @@ void Image::load()
|
||||
{
|
||||
m_loading = true;
|
||||
m_released = false;
|
||||
QThreadPool::globalInstance()->start(new LoadRunable(m_name, this));
|
||||
QThreadPool::globalInstance()->start(new LoadRunable(m_name, this, m_ringList->calculateStats()));
|
||||
}
|
||||
if(!m_loading && !m_pixmap.isNull())
|
||||
emit pixmapLoaded(this);
|
||||
@@ -67,6 +68,7 @@ void Image::imageLoaded(QImage img, ImageInfoData info)
|
||||
|
||||
ImageRingList::ImageRingList(QObject *parent) : QObject(parent)
|
||||
, m_liveMode(false)
|
||||
, m_calculateStats(false)
|
||||
{
|
||||
connect(&m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)));
|
||||
}
|
||||
@@ -146,6 +148,16 @@ void ImageRingList::setLiveMode(bool live)
|
||||
m_liveMode = live;
|
||||
}
|
||||
|
||||
void ImageRingList::setCalculateStats(bool stats)
|
||||
{
|
||||
m_calculateStats = stats;
|
||||
}
|
||||
|
||||
bool ImageRingList::calculateStats() const
|
||||
{
|
||||
return m_calculateStats;
|
||||
}
|
||||
|
||||
void ImageRingList::setFiles(const QStringList files, const QString ¤tFile)
|
||||
{
|
||||
QThreadPool::globalInstance()->clear();
|
||||
@@ -153,7 +165,7 @@ void ImageRingList::setFiles(const QStringList files, const QString ¤tFile
|
||||
m_images.clear();
|
||||
foreach(const QString &file, files)
|
||||
{
|
||||
ImagePtr ptr = make_shared<Image>(file);
|
||||
ImagePtr ptr = make_shared<Image>(file, this);
|
||||
connect(ptr.get(), SIGNAL(pixmapLoaded(Image*)), this, SLOT(imageLoaded(Image*)));
|
||||
m_images.append(ptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user