NOISSUE tabs -> spaces
This commit is contained in:
@ -61,40 +61,40 @@
|
||||
// internal helper. Converts an integer value to an unique string token
|
||||
template <typename T> struct HexString
|
||||
{
|
||||
inline HexString(const T t) : val(t)
|
||||
{
|
||||
}
|
||||
inline HexString(const T t) : val(t)
|
||||
{
|
||||
}
|
||||
|
||||
inline void write(QChar *&dest) const
|
||||
{
|
||||
const ushort hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
const char *c = reinterpret_cast<const char *>(&val);
|
||||
for (uint i = 0; i < sizeof(T); ++i)
|
||||
{
|
||||
*dest++ = hexChars[*c & 0xf];
|
||||
*dest++ = hexChars[(*c & 0xf0) >> 4];
|
||||
++c;
|
||||
}
|
||||
}
|
||||
const T val;
|
||||
inline void write(QChar *&dest) const
|
||||
{
|
||||
const ushort hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
const char *c = reinterpret_cast<const char *>(&val);
|
||||
for (uint i = 0; i < sizeof(T); ++i)
|
||||
{
|
||||
*dest++ = hexChars[*c & 0xf];
|
||||
*dest++ = hexChars[(*c & 0xf0) >> 4];
|
||||
++c;
|
||||
}
|
||||
}
|
||||
const T val;
|
||||
};
|
||||
|
||||
// specialization to enable fast concatenating of our string tokens to a string
|
||||
template <typename T> struct QConcatenable<HexString<T>>
|
||||
{
|
||||
typedef HexString<T> type;
|
||||
enum
|
||||
{
|
||||
ExactSize = true
|
||||
};
|
||||
static int size(const HexString<T> &)
|
||||
{
|
||||
return sizeof(T) * 2;
|
||||
}
|
||||
static inline void appendTo(const HexString<T> &str, QChar *&out)
|
||||
{
|
||||
str.write(out);
|
||||
}
|
||||
typedef QString ConvertTo;
|
||||
typedef HexString<T> type;
|
||||
enum
|
||||
{
|
||||
ExactSize = true
|
||||
};
|
||||
static int size(const HexString<T> &)
|
||||
{
|
||||
return sizeof(T) * 2;
|
||||
}
|
||||
static inline void appendTo(const HexString<T> &str, QChar *&out)
|
||||
{
|
||||
str.write(out);
|
||||
}
|
||||
typedef QString ConvertTo;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -61,46 +61,46 @@ class QIconLoader;
|
||||
|
||||
struct QIconDirInfo
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Fixed,
|
||||
Scalable,
|
||||
Threshold
|
||||
};
|
||||
QIconDirInfo(const QString &_path = QString())
|
||||
: path(_path), size(0), maxSize(0), minSize(0), threshold(0), type(Threshold)
|
||||
{
|
||||
}
|
||||
QString path;
|
||||
short size;
|
||||
short maxSize;
|
||||
short minSize;
|
||||
short threshold;
|
||||
Type type : 4;
|
||||
enum Type
|
||||
{
|
||||
Fixed,
|
||||
Scalable,
|
||||
Threshold
|
||||
};
|
||||
QIconDirInfo(const QString &_path = QString())
|
||||
: path(_path), size(0), maxSize(0), minSize(0), threshold(0), type(Threshold)
|
||||
{
|
||||
}
|
||||
QString path;
|
||||
short size;
|
||||
short maxSize;
|
||||
short minSize;
|
||||
short threshold;
|
||||
Type type : 4;
|
||||
};
|
||||
|
||||
class QIconLoaderEngineEntry
|
||||
{
|
||||
public:
|
||||
virtual ~QIconLoaderEngineEntry()
|
||||
{
|
||||
}
|
||||
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) = 0;
|
||||
QString filename;
|
||||
QIconDirInfo dir;
|
||||
static int count;
|
||||
virtual ~QIconLoaderEngineEntry()
|
||||
{
|
||||
}
|
||||
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) = 0;
|
||||
QString filename;
|
||||
QIconDirInfo dir;
|
||||
static int count;
|
||||
};
|
||||
|
||||
struct ScalableEntry : public QIconLoaderEngineEntry
|
||||
{
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QIcon svgIcon;
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QIcon svgIcon;
|
||||
};
|
||||
|
||||
struct PixmapEntry : public QIconLoaderEngineEntry
|
||||
{
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QPixmap basePixmap;
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QPixmap basePixmap;
|
||||
};
|
||||
|
||||
typedef QList<QIconLoaderEngineEntry *> QThemeIconEntries;
|
||||
@ -109,107 +109,107 @@ typedef QList<QIconLoaderEngineEntry *> QThemeIconEntries;
|
||||
class QIconLoaderEngineFixed : public QIconEngine
|
||||
{
|
||||
public:
|
||||
QIconLoaderEngineFixed(const QString &iconName = QString());
|
||||
~QIconLoaderEngineFixed();
|
||||
QIconLoaderEngineFixed(const QString &iconName = QString());
|
||||
~QIconLoaderEngineFixed();
|
||||
|
||||
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
QIconEngine *clone() const;
|
||||
bool read(QDataStream &in);
|
||||
bool write(QDataStream &out) const;
|
||||
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
QIconEngine *clone() const;
|
||||
bool read(QDataStream &in);
|
||||
bool write(QDataStream &out) const;
|
||||
|
||||
private:
|
||||
QString key() const;
|
||||
bool hasIcon() const;
|
||||
void ensureLoaded();
|
||||
void virtual_hook(int id, void *data);
|
||||
QIconLoaderEngineEntry *entryForSize(const QSize &size);
|
||||
QIconLoaderEngineFixed(const QIconLoaderEngineFixed &other);
|
||||
QThemeIconEntries m_entries;
|
||||
QString m_iconName;
|
||||
uint m_key;
|
||||
QString key() const;
|
||||
bool hasIcon() const;
|
||||
void ensureLoaded();
|
||||
void virtual_hook(int id, void *data);
|
||||
QIconLoaderEngineEntry *entryForSize(const QSize &size);
|
||||
QIconLoaderEngineFixed(const QIconLoaderEngineFixed &other);
|
||||
QThemeIconEntries m_entries;
|
||||
QString m_iconName;
|
||||
uint m_key;
|
||||
|
||||
friend class QIconLoader;
|
||||
friend class QIconLoader;
|
||||
};
|
||||
|
||||
class QIconTheme
|
||||
{
|
||||
public:
|
||||
QIconTheme(const QString &name);
|
||||
QIconTheme() : m_valid(false)
|
||||
{
|
||||
}
|
||||
QStringList parents()
|
||||
{
|
||||
return m_parents;
|
||||
}
|
||||
QVector<QIconDirInfo> keyList()
|
||||
{
|
||||
return m_keyList;
|
||||
}
|
||||
QString contentDir()
|
||||
{
|
||||
return m_contentDir;
|
||||
}
|
||||
QStringList contentDirs()
|
||||
{
|
||||
return m_contentDirs;
|
||||
}
|
||||
bool isValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
QIconTheme(const QString &name);
|
||||
QIconTheme() : m_valid(false)
|
||||
{
|
||||
}
|
||||
QStringList parents()
|
||||
{
|
||||
return m_parents;
|
||||
}
|
||||
QVector<QIconDirInfo> keyList()
|
||||
{
|
||||
return m_keyList;
|
||||
}
|
||||
QString contentDir()
|
||||
{
|
||||
return m_contentDir;
|
||||
}
|
||||
QStringList contentDirs()
|
||||
{
|
||||
return m_contentDirs;
|
||||
}
|
||||
bool isValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_contentDir;
|
||||
QStringList m_contentDirs;
|
||||
QVector<QIconDirInfo> m_keyList;
|
||||
QStringList m_parents;
|
||||
bool m_valid;
|
||||
QString m_contentDir;
|
||||
QStringList m_contentDirs;
|
||||
QVector<QIconDirInfo> m_keyList;
|
||||
QStringList m_parents;
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
class QIconLoader
|
||||
{
|
||||
public:
|
||||
QIconLoader();
|
||||
QThemeIconEntries loadIcon(const QString &iconName) const;
|
||||
uint themeKey() const
|
||||
{
|
||||
return m_themeKey;
|
||||
}
|
||||
QIconLoader();
|
||||
QThemeIconEntries loadIcon(const QString &iconName) const;
|
||||
uint themeKey() const
|
||||
{
|
||||
return m_themeKey;
|
||||
}
|
||||
|
||||
QString themeName() const
|
||||
{
|
||||
return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme;
|
||||
}
|
||||
void setThemeName(const QString &themeName);
|
||||
QIconTheme theme()
|
||||
{
|
||||
return themeList.value(themeName());
|
||||
}
|
||||
void setThemeSearchPath(const QStringList &searchPaths);
|
||||
QStringList themeSearchPaths() const;
|
||||
QIconDirInfo dirInfo(int dirindex);
|
||||
static QIconLoader *instance();
|
||||
void updateSystemTheme();
|
||||
void invalidateKey()
|
||||
{
|
||||
m_themeKey++;
|
||||
}
|
||||
void ensureInitialized();
|
||||
QString themeName() const
|
||||
{
|
||||
return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme;
|
||||
}
|
||||
void setThemeName(const QString &themeName);
|
||||
QIconTheme theme()
|
||||
{
|
||||
return themeList.value(themeName());
|
||||
}
|
||||
void setThemeSearchPath(const QStringList &searchPaths);
|
||||
QStringList themeSearchPaths() const;
|
||||
QIconDirInfo dirInfo(int dirindex);
|
||||
static QIconLoader *instance();
|
||||
void updateSystemTheme();
|
||||
void invalidateKey()
|
||||
{
|
||||
m_themeKey++;
|
||||
}
|
||||
void ensureInitialized();
|
||||
|
||||
private:
|
||||
QThemeIconEntries findIconHelper(const QString &themeName, const QString &iconName,
|
||||
QStringList &visited) const;
|
||||
uint m_themeKey;
|
||||
bool m_supportsSvg;
|
||||
bool m_initialized;
|
||||
QThemeIconEntries findIconHelper(const QString &themeName, const QString &iconName,
|
||||
QStringList &visited) const;
|
||||
uint m_themeKey;
|
||||
bool m_supportsSvg;
|
||||
bool m_initialized;
|
||||
|
||||
mutable QString m_userTheme;
|
||||
mutable QString m_systemTheme;
|
||||
mutable QStringList m_iconDirs;
|
||||
mutable QHash<QString, QIconTheme> themeList;
|
||||
mutable QString m_userTheme;
|
||||
mutable QString m_systemTheme;
|
||||
mutable QStringList m_iconDirs;
|
||||
mutable QHash<QString, QIconTheme> themeList;
|
||||
};
|
||||
|
||||
} // QtXdg
|
||||
|
Reference in New Issue
Block a user