Warning, file /office/calligra/libs/widgets/KoGlobal.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
0003    Copyright 2002, 2003 David Faure <faure@kde.org>
0004    Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License as published by the Free Software Foundation; either
0009    version 2 of the License, or (at your option) any later version.
0010 
0011    This library is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014    Library General Public License for more details.
0015 
0016    You should have received a copy of the GNU Library General Public License
0017    along with this library; see the file COPYING.LIB.  If not, write to
0018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #ifndef KOGLOBAL_H
0023 #define KOGLOBAL_H
0024 
0025 #include <QStringList>
0026 #include <QFont>
0027 #include <QMap>
0028 
0029 #include "kowidgets_export.h"
0030 
0031 class KConfig;
0032 
0033 class KOWIDGETS_EXPORT KoGlobal
0034 {
0035 public:
0036     KoGlobal();
0037 
0038     /// For KoApplication
0039     static void initialize()  {
0040         (void)self(); // I don't want to make KGlobal instances public, so self() is private
0041     }
0042     /**
0043      * Return the default font for Calligra programs.
0044      * This is (currently) the same as the KDE-global default font,
0045      * except that it is guaranteed to have a point size set,
0046      * never a pixel size (see @ref QFont).
0047      */
0048     static QFont defaultFont()  {
0049         return self()->_defaultFont();
0050     }
0051 
0052     /**
0053      * @return the global KConfig object around calligrarc.
0054      * calligrarc is used for Calligra-wide settings, from totally unrelated classes,
0055      * so this is the centralization of the KConfig object so that the file is
0056      * parsed only once
0057      */
0058     static KConfig* calligraConfig() {
0059         return self()->_calligraConfig();
0060     }
0061 
0062     /// Return the list of available languages, in their displayable form
0063     /// (translated names)
0064     static QStringList listOfLanguages() {
0065         return self()->_listOfLanguages();
0066     }
0067     /// Return the list of available languages, in their internal form
0068     /// e.g. "fr" or "en_US", here called "tag"
0069     static QStringList listOfLanguageTags() {
0070         return self()->_listOfLanguageTags();
0071     }
0072     /// For a given language display name, return its tag
0073     static QString tagOfLanguage(const QString & _lang);
0074     /// For a given language tag, return its display name
0075     static QString languageFromTag(const QString &_lang);
0076 
0077     ~KoGlobal();
0078 
0079 private:
0080     static KoGlobal* self();
0081 
0082     QFont _defaultFont();
0083     QStringList _listOfLanguages();
0084     QStringList _listOfLanguageTags();
0085     KConfig* _calligraConfig();
0086     void createListOfLanguages();
0087 
0088     int m_pointSize;
0089     typedef QMap<QString, QString> LanguageMap;
0090     LanguageMap m_langMap; // display-name -> language tag
0091     KConfig* m_calligraConfig;
0092     // No BC problem here, constructor is private, feel free to add members
0093 
0094     friend class this_is_a_singleton; // work around gcc warning
0095 };
0096 
0097 #endif // KOGLOBAL