flags.h 1.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 *  Copyright (C) 2010 Andriy Rysin (rysin@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; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef FLAGS_H_
#define FLAGS_H_

Alexander Lohnau's avatar
Alexander Lohnau committed
22
#include <QMap>
23
24
#include <QObject>
#include <QString>
25
#include <QIcon>
26
27

class QIcon;
28
class LayoutUnit;
29
class KeyboardConfig;
30
struct Rules;
31
32
33

class Flags : public QObject
{
Alexander Lohnau's avatar
Alexander Lohnau committed
34
    Q_OBJECT
35
36

public:
Alexander Lohnau's avatar
Alexander Lohnau committed
37
    const QIcon getIcon(const QString &layout);
38

Alexander Lohnau's avatar
Alexander Lohnau committed
39
40
    static QString getLongText(const LayoutUnit &layoutUnit, const Rules *rules);
    static QString getShortText(const LayoutUnit &layoutUnit, const KeyboardConfig &keyboardConfig);
41
42

private:
Alexander Lohnau's avatar
Alexander Lohnau committed
43
44
    QIcon createIcon(const QString &layout);
    QString getCountryFromLayoutName(const QString &fullLayoutName) const;
45

Alexander Lohnau's avatar
Alexander Lohnau committed
46
    QMap<QString, QIcon> iconMap;
47
48
49
};

#endif /* FLAGS_H_ */