File indexing completed on 2024-04-21 16:29:36

0001 /***************************************************************************
0002  *   Copyright (C) 2008 by Trever Fischer                                  *
0003  *   wm161@wm161.net                                                       *
0004  *   Copyright (C) 2010-2012 by Daniel Nicoletti                           *
0005  *   dantti12@gmail.com                                                    *
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or modify  *
0008  *   it under the terms of the GNU General Public License as published by  *
0009  *   the Free Software Foundation; either version 2 of the License, or     *
0010  *   (at your option) any later version.                                   *
0011  *                                                                         *
0012  *   This program is distributed in the hope that it will be useful,       *
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0015  *   GNU General Public License for more details.                          *
0016  *                                                                         *
0017  *   You should have received a copy of the GNU General Public License     *
0018  *   along with this program; see the file COPYING. If not, write to       *
0019  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0020  *   Boston, MA 02110-1301, USA.                                           *
0021  ***************************************************************************/
0022 
0023 #ifndef PK_ICONS_H
0024 #define PK_ICONS_H
0025 
0026 #include <QObject>
0027 
0028 #include <Transaction>
0029 #include <QIcon>
0030 
0031 #define KPK_ICON_SIZE 64
0032 
0033 class Q_DECL_EXPORT PkIcons : public QObject
0034 {
0035     Q_OBJECT
0036 public Q_SLOTS:
0037     static QIcon   groupsIcon(PackageKit::Transaction::Group group);
0038     static QString statusIconName(PackageKit::Transaction::Status status);
0039     static QIcon   statusIcon(PackageKit::Transaction::Status status);
0040     static QString statusAnimation(PackageKit::Transaction::Status status);
0041     static QString actionIconName(PackageKit::Transaction::Role role);
0042     static QIcon   actionIcon(PackageKit::Transaction::Role role);
0043     static QIcon   packageIcon(PackageKit::Transaction::Info state);
0044     static QString restartIconName(PackageKit::Transaction::Restart type);
0045     static QIcon   restartIcon(PackageKit::Transaction::Restart type);
0046     static QIcon   getIcon(const QString &name);
0047     static QIcon   getIcon(const QString &name, const QString &defaultName);
0048     static QIcon   getPreloadedIcon(const QString &name);
0049     static QString lastCacheRefreshIconName(uint lastTime);
0050 
0051 private:
0052     static void configure();
0053 
0054     static QHash<QString, QIcon> cache;
0055     static bool init;
0056 };
0057 
0058 #endif