kde-workspace/kcontrol/kfontinst/lib/Style.h
Ivailo Monev de7cddaba2 generic: adjust to Katie changes
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2019-05-08 14:51:07 +00:00

86 lines
3 KiB
C++

#ifndef __STYLE_H__
#define __STYLE_H__
/*
* KFontInst - KDE Font Installer
*
* Copyright 2003-2009 Craig Drummond <craig@kde.org>
*
* ----
*
* 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <QtCore/QSet>
#include <QtCore/QMetaType>
#include <QtDBus/QtDBus>
#include "kfontinst_export.h"
#include "File.h"
#include <QDomElement>
#include <QTextStream>
namespace KFI
{
class KFONTINST_EXPORT Style
{
public:
Style(quint32 v=0, bool sc=false, qulonglong ws=0) : itsValue(v), itsWritingSystems(ws), itsScalable(sc) { }
Style(const QDomElement &elem, bool loadFiles);
bool operator==(const Style &o) const { return itsValue==o.itsValue; }
QString toXml(bool disabled, const QString &family, QTextStream &s) const;
FileCont::ConstIterator add(const File &f) const { return itsFiles.insert(f); }
void remove(const File &f) const { itsFiles.remove(f); }
quint32 value() const { return itsValue; }
void setWritingSystems(qulonglong ws) const { itsWritingSystems=ws; }
qulonglong writingSystems() const { return itsWritingSystems; }
const FileCont & files() const { return itsFiles; }
void setScalable(bool sc=true) const { itsScalable=sc; }
bool scalable() const { return itsScalable; }
void clearFiles() const { itsFiles.clear(); }
void setFiles(const FileCont &f) const { itsFiles=f; }
void addFiles(const FileCont &f) const { itsFiles+=f; }
void removeFiles(const FileCont &f) const { itsFiles-=f; }
private:
quint32 itsValue;
mutable qulonglong itsWritingSystems;
mutable bool itsScalable;
mutable FileCont itsFiles;
};
typedef QSet<Style> StyleCont;
inline KDE_EXPORT uint qHash(const Style &key)
{
return key.value();
}
}
Q_DECLARE_METATYPE(KFI::Style)
QT_BEGIN_NAMESPACE
KDE_EXPORT QDBusArgument & operator<<(QDBusArgument &argument, const KFI::Style &obj);
KDE_EXPORT const QDBusArgument & operator>>(const QDBusArgument &argument, KFI::Style &obj);
QT_END_NAMESPACE
#endif