1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/*
SPDX-FileCopyrightText: 2009-2010 Michael G. Hansen <mike at mghansen dot de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kipiimagecollectionshared.h"
// Qt includes
#include <QDir>
namespace KXMLKipiCmd
{
KipiImageCollectionShared::KipiImageCollectionShared(const QUrl& albumPath)
: ImageCollectionShared(),
m_albumPath(albumPath),
m_images()
{
// go through the album and add its images:
const QString albumPathString = m_albumPath.toLocalFile();
// add only the files, because recursion through directories should be
// handled in KipiInterface::add[Selected]Album
// TODO: restrict the search to images!
const QFileInfoList files = QDir(albumPathString).entryInfoList(QDir::Files);
for (QFileInfoList::const_iterator it = files.constBegin(); it!=files.constEnd(); ++it)
{
m_images.append(QUrl::fromLocalFile(it->absoluteFilePath()));
}
}
KipiImageCollectionShared::KipiImageCollectionShared(const QList<QUrl>& images)
: ImageCollectionShared(),
m_images(images)
{
}
KipiImageCollectionShared::~KipiImageCollectionShared()
{
}
QString KipiImageCollectionShared::name()
{
return m_albumPath.url();
}
QList<QUrl> KipiImageCollectionShared::images()
{
return m_images;
}
void KipiImageCollectionShared::addImages(const QList<QUrl>& images)
{
m_images.append(images);
}
void KipiImageCollectionShared::addImage(const QUrl &image)
{
m_images.append(image);
}
QUrl KipiImageCollectionShared::path()
{
return m_albumPath;
}
QUrl KipiImageCollectionShared::uploadPath()
{
return m_albumPath;
}
QUrl KipiImageCollectionShared::uploadRoot()
{
return m_albumPath;
}
bool KipiImageCollectionShared::isDirectory()
{
return true;
}
} // namespace KXMLKipiCmd
|