summaryrefslogtreecommitdiff
path: root/bibletime/backend/clanguagemgr.h
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:12 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:12 -0400
commit472963ff3697fb12af111e4a8fa2b985216826d5 (patch)
treee96112476b1f9bdfd462b9007b1e6453ffa0dcc5 /bibletime/backend/clanguagemgr.h
parent15ce9a1454eebac8cfd1eca41da70ae80ece1baa (diff)
Imported Upstream version 1.4.1
Diffstat (limited to 'bibletime/backend/clanguagemgr.h')
-rw-r--r--bibletime/backend/clanguagemgr.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/bibletime/backend/clanguagemgr.h b/bibletime/backend/clanguagemgr.h
new file mode 100644
index 0000000..4e070e2
--- /dev/null
+++ b/bibletime/backend/clanguagemgr.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ clanguagemgr.h - description
+ -------------------
+ begin : Mon Okt 21 2002
+ copyright : (C) 2002 by The BibleTime team
+ email : info@bibletime.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef CLANGUAGEMGR_H
+#define CLANGUAGEMGR_H
+
+//Qt includes
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qvaluelist.h>
+#include <qpixmap.h>
+#include <qmap.h>
+
+/** Manages the anguages of BibleTime and provides functions to work with them.
+ * @author The BibleTime team
+ */
+class CLanguageMgr {
+public:
+ class Language {
+ public:
+ /** Constructor of a language object.
+ * Uses the abbreviation parameter to lookup the language name and to be able to return the name, flag etc.
+ * Possible values for abbrev are de, en, fr, it etc.
+ */
+ Language();
+ Language(const QString& abbrev, const QString& englishName, const QString& translatedName, const QStringList altAbbrevs = QStringList());
+ ~Language();
+ const QString& abbrev() const;
+ const QString& translatedName() const;
+
+ //always define inlines in the header file, or make them not inline.
+ inline const QString& name() const{
+ return m_englishName;
+ }
+
+ const QStringList& alternativeAbbrevs() const;
+ const QPixmap flag();
+ /**
+ * Returns true if this language object is valid, i.e. has an abbrev and name.
+ */
+ const bool isValid();
+ private:
+ QString m_abbrev;
+ QString m_englishName;
+ QString m_translatedName;
+ QStringList m_altAbbrevs;
+ };
+
+ typedef QMap<QString, Language> LangMap;
+
+ CLanguageMgr();
+ virtual ~CLanguageMgr();
+ /**
+ * Returns the standard languages available as standard. Does nothing for Sword.
+ */
+ const CLanguageMgr::LangMap& languages() const;
+ /**
+ * Returns the languages which are available. The languages cover all available modules, but nothing more.
+ */
+// const QStringList availableAbbrevs();
+ const CLanguageMgr::LangMap availableLanguages();
+ const CLanguageMgr::Language& languageForAbbrev( const QString& abbrev );
+ const CLanguageMgr::Language& languageForName( const QString& language );
+ const CLanguageMgr::Language& languageForTranslatedName( const QString& language );
+
+ void debug();
+
+private:
+ void init();
+ const QStringList makeStringList(const QString& abbrevs);
+ LangMap m_langMap;
+};
+
+#endif