You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kipi-plugins/kipi-plugins/htmlexport/galleryinfo.h

97 lines
2.6 KiB

/*
A KIPI plugin to generate HTML image galleries
Copyright 2006 by Aurelien Gateau <aurelien dot gateau at free.fr>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
#ifndef GALLERYINFO_H
#define GALLERYINFO_H
// TQt
#include <tqvaluelist.h>
// KDE
#include <kurl.h>
// KIPI
#include <libkipi/imagecollection.h>
// Local
#include <theme.h>
#include <htmlexportconfig.h>
namespace KIPIHTMLExport {
/**
* This class stores all the export settings. It is initialized by the
* Wizard and read by the Generator.
*/
class GalleryInfo : public Config {
public:
/**
* Convenience method to get destURL as a KURL rather than a TQString
*/
KURL destKURL() const {
return KURL(destURL());
}
TQString fullFormatString() const {
return getEnumString("fullFormat");
}
TQString thumbnailFormatString() const {
return getEnumString("thumbnailFormat");
}
TQValueList<KIPI::ImageCollection> mCollectionList;
TQString getThemeParameterValue(const TQString& theme, const TQString& parameter, const TQString& defaultValue) const;
void setThemeParameterValue(const TQString& theme, const TQString& parameter, const TQString& value);
private:
/**
* TDEConfigXT enums are mapped to ints.
* This method returns the string associated to the enum value.
*/
TQString getEnumString(const TQString& itemName) const {
// findItem is not marked const :-(
GalleryInfo* that=const_cast<GalleryInfo*>(this);
TDEConfigSkeletonItem* tmp=that->findItem(itemName);
TDEConfigSkeleton::ItemEnum* item=dynamic_cast<TDEConfigSkeleton::ItemEnum*>(tmp);
Q_ASSERT(item);
if (!item) return TQString();
int value=item->value();
TQValueList<TDEConfigSkeleton::ItemEnum::Choice> lst=item->choices();
TQValueList<TDEConfigSkeleton::ItemEnum::Choice>::ConstIterator
it=lst.begin(), end=lst.end();
for (int pos=0; it!=end; ++it, pos++) {
if (pos==value) {
return (*it).name;
}
}
return TQString();
}
};
} // namespace
#endif /* GALLERYINFO_H */