~ubuntu-branches/ubuntu/trusty/bibletime/trusty

« back to all changes in this revision

Viewing changes to src/frontend/settingsdialogs/clanguagesettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Marsden
  • Date: 2009-11-18 17:30:00 UTC
  • mfrom: (1.3.4 upstream) (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091118173000-endkhjz5qai88tvr
Tags: 2.4-1
* New upstream version 2.4
* debian/control: 
  - Replace incorrect bibletime-data Depends on lib4qt-gui
    with bibletime Depends on libqtgui4 (>= 4.4.0). (Closes: #556209).
  - Add Build-depends: on zlib1g-dev and libcurl4-gnutls-dev 
    (Closes: #556805).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//
2
 
// C++ Implementation: clanguagesettings
3
 
//
4
 
// Description: 
5
 
//
6
 
//
7
 
// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
8
 
//
9
 
// Copyright: See COPYING file that comes with this distribution
10
 
//
11
 
//
12
 
 
13
 
#include "clanguagesettings.h"
14
 
 
 
1
/*********
 
2
*
 
3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
 
4
*
 
5
* Copyright 1999-2009 by the BibleTime developers.
 
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
 
7
*
 
8
**********/
 
9
 
 
10
#include "frontend/settingsdialogs/clanguagesettings.h"
 
11
 
 
12
#include <QCheckBox>
 
13
#include <QComboBox>
 
14
#include <QHBoxLayout>
 
15
#include <QLabel>
 
16
#include <QVBoxLayout>
 
17
#include <QWidget>
 
18
#include "frontend/settingsdialogs/cfontchooser.h"
15
19
#include "util/cpointers.h"
16
 
#include "util/ctoolclass.h"
17
20
#include "util/cresmgr.h"
18
 
#include "util/directoryutil.h"
19
 
 
20
 
#include <QWidget>
21
 
#include <QVBoxLayout>
22
 
#include <QHBoxLayout>
23
 
#include <QComboBox>
24
 
#include <QCheckBox>
25
 
#include <QLabel>
26
 
 
27
 
 
28
 
#include "cfontchooser.h"
29
 
 
30
 
 
31
 
//Sword includes
 
21
#include "util/tool.h"
 
22
#include "util/directory.h"
 
23
 
 
24
// Sword includes:
32
25
#include <localemgr.h>
33
26
#include <swlocale.h>
34
27
 
 
28
 
35
29
CLanguageSettingsPage::CLanguageSettingsPage(QWidget* /*parent*/)
36
 
 : BtConfigPage()
37
 
{
38
 
 
39
 
        QVBoxLayout* layout = new QVBoxLayout(this);
40
 
 
41
 
        //Sword locales
42
 
        layout->addWidget(
43
 
        CToolClass::explanationLabel(
44
 
                        this,
45
 
                        tr(""),
46
 
                        tr("Select the language in which the Biblical book names are displayed.")
47
 
                        ));
48
 
 
49
 
        m_swordLocaleCombo = new QComboBox(this);
50
 
        QLabel* label = new QLabel( tr("Language for names of Bible books:"), this);
51
 
        label->setBuddy(m_swordLocaleCombo);
52
 
        m_swordLocaleCombo->setToolTip(tr("The languages which can be used for the biblical booknames"));
53
 
 
54
 
 
55
 
        QHBoxLayout* hBoxLayout = new QHBoxLayout();
56
 
        hBoxLayout->addWidget(label);
57
 
        hBoxLayout->addWidget(m_swordLocaleCombo);
58
 
        hBoxLayout->addStretch();
59
 
        layout->addLayout(hBoxLayout);
60
 
 
61
 
        QStringList languageNames;
62
 
        languageNames.append( languageMgr()->languageForAbbrev("en_US")->translatedName() );
63
 
 
64
 
        std::list<sword::SWBuf> locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
65
 
        for (std::list<sword::SWBuf>::const_iterator it = locales.begin(); it != locales.end(); it++) 
66
 
        {
67
 
                //    qWarning("working on %s", (*it).c_str());
68
 
                const CLanguageMgr::Language* const l = 
69
 
                        CPointers::languageMgr()->languageForAbbrev( sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str())->getName() );
70
 
 
71
 
                if (l->isValid()) 
72
 
                {
73
 
                        languageNames.append( l->translatedName() );
74
 
                }
75
 
                else 
76
 
                {
77
 
                        languageNames.append(
78
 
                                sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str())->getDescription()
79
 
                        );
80
 
                }
81
 
        } //for
82
 
 
83
 
        languageNames.sort();
84
 
        m_swordLocaleCombo->addItems( languageNames );
85
 
 
86
 
        const CLanguageMgr::Language* const l =
87
 
                CPointers::languageMgr()->languageForAbbrev( CBTConfig::get(CBTConfig::language) );
88
 
 
89
 
        QString currentLanguageName;
90
 
        if ( l->isValid() && languageNames.contains(l->translatedName()) ) 
91
 
        {       //tranlated language name is in the box
92
 
                currentLanguageName = l->translatedName();
93
 
        }
94
 
        else 
95
 
        {       //a language like "German Abbrevs" might be the language to set
96
 
                sword::SWLocale* locale =
97
 
                        sword::LocaleMgr::getSystemLocaleMgr()->getLocale( CBTConfig::get(CBTConfig::language).toLocal8Bit() );
98
 
                if (locale) 
99
 
                {
100
 
                        currentLanguageName = QString::fromLatin1(locale->getDescription());
101
 
                }
102
 
        }
103
 
 
104
 
        if (currentLanguageName.isEmpty()) 
105
 
        {       // set english as default if nothing was chosen
106
 
                Q_ASSERT(languageMgr()->languageForAbbrev("en_US"));
107
 
                currentLanguageName = languageMgr()->languageForAbbrev("en_US")->translatedName();
108
 
        }
109
 
 
110
 
        //now set the item with the right name as current item
111
 
        for (int i = 0; i < m_swordLocaleCombo->count(); ++i) 
112
 
        {
113
 
                if (currentLanguageName == m_swordLocaleCombo->itemText(i)) 
114
 
                {
115
 
                        m_swordLocaleCombo->setCurrentIndex(i);
116
 
                        break; //item found, finish the loop
117
 
                }
118
 
        }
119
 
 
120
 
        layout->addSpacing(20);
121
 
 
122
 
        //Font settings
123
 
        
124
 
        layout->addWidget(
125
 
                CToolClass::explanationLabel(
126
 
                        this,
127
 
                        tr("Fonts"),
128
 
                        tr("You can specify a custom font for each language.")
129
 
                )
130
 
        );
131
 
        QHBoxLayout* hLayout = new QHBoxLayout();
132
 
 
133
 
        m_usageCombo = new QComboBox(this);
134
 
        m_usageCombo->setToolTip(tr("The font selection below will apply to all texts in this language"));
135
 
 
136
 
        hLayout->addWidget(m_usageCombo);
137
 
 
138
 
        CLanguageMgr::LangMap langMap = languageMgr()->availableLanguages();
139
 
 
140
 
        for (CLanguageMgr::LangMapIterator it = langMap.constBegin() ; it != langMap.constEnd(); ++it ) 
141
 
        {
142
 
                const QString name =
143
 
                        (*it)->translatedName().isEmpty()
144
 
                        ? (*it)->abbrev()
145
 
                        : (*it)->translatedName();
146
 
 
147
 
                m_fontMap.insert(name, CBTConfig::get(*it) );
148
 
        }
149
 
 
150
 
        for( QMap<QString, CBTConfig::FontSettingsPair>::Iterator it = m_fontMap.begin(); it != m_fontMap.end(); ++it ) 
151
 
        {
152
 
                if ( m_fontMap[it.key()].first ) 
153
 
                {       //show font icon
154
 
                        m_usageCombo->addItem(util::filesystem::DirectoryUtil::getIcon("fonts.svg"), it.key() );
155
 
                }
156
 
                else 
157
 
                {       //don't show icon for font
158
 
                        m_usageCombo->addItem(it.key());
159
 
                }
160
 
        }
161
 
 
162
 
        m_useOwnFontCheck = new QCheckBox(tr("Use custom font"), this);
163
 
        m_useOwnFontCheck->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
164
 
        connect(m_useOwnFontCheck, SIGNAL(toggled(bool)), SLOT(useOwnFontClicked(bool)) );
165
 
        hLayout->addWidget(m_useOwnFontCheck);
166
 
 
167
 
        layout->addLayout(hLayout);
168
 
        hLayout->setContentsMargins(0,0,0,0);
169
 
        //#warning TODO: remember the last selected font and jump there.
170
 
 
171
 
        m_fontChooser = new CFontChooser(this);
172
 
 
173
 
        //TODO: Eeli's wishlist: why not show something relevant here, like a Bible verse in chosen (not tr()'ed!) language?
174
 
        QString sampleText;
175
 
        sampleText.append("1 In the beginning God created the heaven and the earth.  ");
 
30
        : BtConfigPage() {
 
31
    namespace DU = util::directory;
 
32
 
 
33
    QVBoxLayout* layout = new QVBoxLayout(this);
 
34
 
 
35
    //Sword locales
 
36
    layout->addWidget(
 
37
        util::tool::explanationLabel(
 
38
            this,
 
39
            tr(""),
 
40
            tr("Select the language in which the Biblical book names are displayed.")
 
41
        ));
 
42
 
 
43
    m_swordLocaleCombo = new QComboBox(this);
 
44
    QLabel* label = new QLabel( tr("Language for names of Bible books:"), this);
 
45
    label->setBuddy(m_swordLocaleCombo);
 
46
    m_swordLocaleCombo->setToolTip(tr("The languages which can be used for the biblical booknames"));
 
47
 
 
48
 
 
49
    QHBoxLayout* hBoxLayout = new QHBoxLayout();
 
50
    hBoxLayout->addWidget(label);
 
51
    hBoxLayout->addWidget(m_swordLocaleCombo);
 
52
    hBoxLayout->addStretch();
 
53
    layout->addLayout(hBoxLayout);
 
54
 
 
55
    QStringList languageNames;
 
56
    languageNames.append( languageMgr()->languageForAbbrev("en_US")->translatedName() );
 
57
 
 
58
    std::list<sword::SWBuf> locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
 
59
    for (std::list<sword::SWBuf>::const_iterator it = locales.begin(); it != locales.end(); it++) {
 
60
        //    qWarning("working on %s", (*it).c_str());
 
61
        const CLanguageMgr::Language* const l =
 
62
            CPointers::languageMgr()->languageForAbbrev( sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str())->getName() );
 
63
 
 
64
        if (l->isValid()) {
 
65
            languageNames.append( l->translatedName() );
 
66
        }
 
67
        else {
 
68
            languageNames.append(
 
69
                sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str())->getDescription()
 
70
            );
 
71
        }
 
72
    } //for
 
73
 
 
74
    languageNames.sort();
 
75
    m_swordLocaleCombo->addItems( languageNames );
 
76
 
 
77
    const CLanguageMgr::Language* const l =
 
78
        CPointers::languageMgr()->languageForAbbrev( CBTConfig::get(CBTConfig::language) );
 
79
 
 
80
    QString currentLanguageName;
 
81
    if ( l->isValid() && languageNames.contains(l->translatedName()) ) {        //tranlated language name is in the box
 
82
        currentLanguageName = l->translatedName();
 
83
    }
 
84
    else {      //a language like "German Abbrevs" might be the language to set
 
85
        sword::SWLocale* locale =
 
86
            sword::LocaleMgr::getSystemLocaleMgr()->getLocale( CBTConfig::get(CBTConfig::language).toLocal8Bit() );
 
87
        if (locale) {
 
88
            currentLanguageName = QString::fromLatin1(locale->getDescription());
 
89
        }
 
90
    }
 
91
 
 
92
    if (currentLanguageName.isEmpty()) {        // set english as default if nothing was chosen
 
93
        Q_ASSERT(languageMgr()->languageForAbbrev("en_US"));
 
94
        currentLanguageName = languageMgr()->languageForAbbrev("en_US")->translatedName();
 
95
    }
 
96
 
 
97
    //now set the item with the right name as current item
 
98
    for (int i = 0; i < m_swordLocaleCombo->count(); ++i) {
 
99
        if (currentLanguageName == m_swordLocaleCombo->itemText(i)) {
 
100
            m_swordLocaleCombo->setCurrentIndex(i);
 
101
            break; //item found, finish the loop
 
102
        }
 
103
    }
 
104
 
 
105
    layout->addSpacing(20);
 
106
 
 
107
    //Font settings
 
108
 
 
109
    layout->addWidget(
 
110
        util::tool::explanationLabel(
 
111
            this,
 
112
            tr("Fonts"),
 
113
            tr("You can specify a custom font for each language.")
 
114
        )
 
115
    );
 
116
    QHBoxLayout* hLayout = new QHBoxLayout();
 
117
 
 
118
    m_usageCombo = new QComboBox(this);
 
119
    m_usageCombo->setToolTip(tr("The font selection below will apply to all texts in this language"));
 
120
 
 
121
    hLayout->addWidget(m_usageCombo);
 
122
 
 
123
    CLanguageMgr::LangMap langMap = languageMgr()->availableLanguages();
 
124
 
 
125
    for (CLanguageMgr::LangMapIterator it = langMap.constBegin() ; it != langMap.constEnd(); ++it ) {
 
126
        const QString name =
 
127
            (*it)->translatedName().isEmpty()
 
128
            ? (*it)->abbrev()
 
129
            : (*it)->translatedName();
 
130
 
 
131
        m_fontMap.insert(name, CBTConfig::get(*it) );
 
132
    }
 
133
 
 
134
    for ( QMap<QString, CBTConfig::FontSettingsPair>::Iterator it = m_fontMap.begin(); it != m_fontMap.end(); ++it ) {
 
135
        if ( m_fontMap[it.key()].first ) {      //show font icon
 
136
            m_usageCombo->addItem(DU::getIcon("fonts.svg"), it.key() );
 
137
        }
 
138
        else {  //don't show icon for font
 
139
            m_usageCombo->addItem(it.key());
 
140
        }
 
141
    }
 
142
 
 
143
    m_useOwnFontCheck = new QCheckBox(tr("Use custom font"), this);
 
144
    m_useOwnFontCheck->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
145
    connect(m_useOwnFontCheck, SIGNAL(toggled(bool)), SLOT(useOwnFontClicked(bool)) );
 
146
    hLayout->addWidget(m_useOwnFontCheck);
 
147
 
 
148
    layout->addLayout(hLayout);
 
149
    hLayout->setContentsMargins(0, 0, 0, 0);
 
150
    /// \todo remember the last selected font and jump there.
 
151
 
 
152
    m_fontChooser = new CFontChooser(this);
 
153
 
 
154
    /// \todo Eeli's wishlist: why not show something relevant here, like a Bible verse in chosen (not tr()'ed!) language?
 
155
    QString sampleText;
 
156
    sampleText.append("1 In the beginning God created the heaven and the earth.  ");
176
157
    sampleText.append("2 And the earth was without form, and void; and darkness was on the face of the deep.");
177
 
        sampleText.append(" And the Spirit of God moved on the face of the waters.");
178
 
 
179
 
        m_fontChooser->setSampleText(sampleText);
180
 
        layout->addWidget(m_fontChooser);
181
 
 
182
 
        connect(m_fontChooser, SIGNAL(fontSelected(const QFont&)), SLOT(newDisplayWindowFontSelected(const QFont&)));
183
 
        connect(m_usageCombo, SIGNAL(activated(const QString&)), SLOT(newDisplayWindowFontAreaSelected(const QString&)));
184
 
 
185
 
        m_fontChooser->setFont( m_fontMap[m_usageCombo->currentText()].second );
186
 
        useOwnFontClicked( m_fontMap[m_usageCombo->currentText()].first );
187
 
        m_useOwnFontCheck->setChecked( m_fontMap[m_usageCombo->currentText()].first );
188
 
        m_fontChooser->setMinimumSize(m_fontChooser->sizeHint());
189
 
}
190
 
 
191
 
 
192
 
CLanguageSettingsPage::~CLanguageSettingsPage()
193
 
{
194
 
}
195
 
 
196
 
void CLanguageSettingsPage::save()
197
 
{
198
 
        for(QMap<QString, CBTConfig::FontSettingsPair>::Iterator it = m_fontMap.begin(); it != m_fontMap.end(); ++it ) 
199
 
        {
200
 
                const CLanguageMgr::Language* const lang = languageMgr()->languageForTranslatedName(it.key());
201
 
                if (!lang->isValid())
202
 
                {       //we possibly use a language, for which we have only the abbrev
203
 
                        if (!lang->abbrev().isEmpty()) {
204
 
                                CLanguageMgr::Language l(it.key(), it.key(), it.key()); //create a temp language
205
 
                                CBTConfig::set(&l, it.value());
206
 
                        }
207
 
                }
208
 
                else 
209
 
                {
210
 
                        CBTConfig::set(lang, it.value());
211
 
                }
212
 
        }
213
 
 
214
 
 
215
 
        QString languageAbbrev;
216
 
 
217
 
        const QString currentLanguageName = m_swordLocaleCombo->currentText();
218
 
        const CLanguageMgr::Language* const l = CPointers::languageMgr()->languageForTranslatedName( currentLanguageName );
219
 
 
220
 
        if (l && l->isValid()) 
221
 
        {
222
 
                languageAbbrev = l->abbrev();
223
 
        }
224
 
        else 
225
 
        {       //it can be the lang abbrev like de_abbrev or the Sword description
226
 
                std::list <sword::SWBuf> locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
227
 
 
228
 
                for (std::list <sword::SWBuf>::iterator it = locales.begin(); it != locales.end(); it++) 
229
 
                {
230
 
                        sword::SWLocale* locale = sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str());
231
 
                        Q_ASSERT(locale);
232
 
 
233
 
                        if ( locale && (QString::fromLatin1(locale->getDescription()) == currentLanguageName) ) 
234
 
                        {
235
 
                                languageAbbrev = QString::fromLatin1(locale->getName()); //we found the abbrevation for the current language
236
 
                                break;
237
 
                        }
238
 
                }
239
 
 
240
 
                if (languageAbbrev.isEmpty()) 
241
 
                {
242
 
                        languageAbbrev = currentLanguageName; //probably a non-standard locale name like de_abbrev
243
 
                }
244
 
        }
245
 
 
246
 
        if (!languageAbbrev.isEmpty()) 
247
 
        {
248
 
                CBTConfig::set(CBTConfig::language, languageAbbrev);
249
 
        }
 
158
    sampleText.append(" And the Spirit of God moved on the face of the waters.");
 
159
 
 
160
    m_fontChooser->setSampleText(sampleText);
 
161
    layout->addWidget(m_fontChooser);
 
162
 
 
163
    connect(m_fontChooser, SIGNAL(fontSelected(const QFont&)), SLOT(newDisplayWindowFontSelected(const QFont&)));
 
164
    connect(m_usageCombo, SIGNAL(activated(const QString&)), SLOT(newDisplayWindowFontAreaSelected(const QString&)));
 
165
 
 
166
    m_fontChooser->setFont( m_fontMap[m_usageCombo->currentText()].second );
 
167
    useOwnFontClicked( m_fontMap[m_usageCombo->currentText()].first );
 
168
    m_useOwnFontCheck->setChecked( m_fontMap[m_usageCombo->currentText()].first );
 
169
    m_fontChooser->setMinimumSize(m_fontChooser->sizeHint());
 
170
}
 
171
 
 
172
 
 
173
CLanguageSettingsPage::~CLanguageSettingsPage() {
 
174
}
 
175
 
 
176
void CLanguageSettingsPage::save() {
 
177
    for (QMap<QString, CBTConfig::FontSettingsPair>::Iterator it = m_fontMap.begin(); it != m_fontMap.end(); ++it ) {
 
178
        const CLanguageMgr::Language* const lang = languageMgr()->languageForTranslatedName(it.key());
 
179
        if (!lang->isValid()) {         //we possibly use a language, for which we have only the abbrev
 
180
            if (!lang->abbrev().isEmpty()) {
 
181
                CLanguageMgr::Language l(it.key(), it.key(), it.key()); //create a temp language
 
182
                CBTConfig::set(&l, it.value());
 
183
            }
 
184
        }
 
185
        else {
 
186
            CBTConfig::set(lang, it.value());
 
187
        }
 
188
    }
 
189
 
 
190
 
 
191
    QString languageAbbrev;
 
192
 
 
193
    const QString currentLanguageName = m_swordLocaleCombo->currentText();
 
194
    const CLanguageMgr::Language* const l = CPointers::languageMgr()->languageForTranslatedName( currentLanguageName );
 
195
 
 
196
    if (l && l->isValid()) {
 
197
        languageAbbrev = l->abbrev();
 
198
    }
 
199
    else {      //it can be the lang abbrev like de_abbrev or the Sword description
 
200
        std::list <sword::SWBuf> locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
 
201
 
 
202
        for (std::list <sword::SWBuf>::iterator it = locales.begin(); it != locales.end(); it++) {
 
203
            sword::SWLocale* locale = sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str());
 
204
            Q_ASSERT(locale);
 
205
 
 
206
            if ( locale && (QString::fromLatin1(locale->getDescription()) == currentLanguageName) ) {
 
207
                languageAbbrev = QString::fromLatin1(locale->getName()); //we found the abbrevation for the current language
 
208
                break;
 
209
            }
 
210
        }
 
211
 
 
212
        if (languageAbbrev.isEmpty()) {
 
213
            languageAbbrev = currentLanguageName; //probably a non-standard locale name like de_abbrev
 
214
        }
 
215
    }
 
216
 
 
217
    if (!languageAbbrev.isEmpty()) {
 
218
        CBTConfig::set(CBTConfig::language, languageAbbrev);
 
219
    }
250
220
}
251
221
 
252
222
/**  */
253
 
void CLanguageSettingsPage::newDisplayWindowFontSelected(const QFont &newFont) 
254
 
{
255
 
        //belongs to the languages/fonts page
256
 
        CBTConfig::FontSettingsPair oldSettings = m_fontMap[ m_usageCombo->currentText() ];
257
 
        m_fontMap.insert( m_usageCombo->currentText(), CBTConfig::FontSettingsPair(oldSettings.first, newFont) );
 
223
void CLanguageSettingsPage::newDisplayWindowFontSelected(const QFont &newFont) {
 
224
    //belongs to the languages/fonts page
 
225
    CBTConfig::FontSettingsPair oldSettings = m_fontMap[ m_usageCombo->currentText() ];
 
226
    m_fontMap.insert( m_usageCombo->currentText(), CBTConfig::FontSettingsPair(oldSettings.first, newFont) );
258
227
}
259
228
 
260
229
/** Called when the combobox contents is changed */
261
 
void CLanguageSettingsPage::newDisplayWindowFontAreaSelected(const QString& usage)
262
 
{
263
 
        //belongs to fonts/languages
264
 
        useOwnFontClicked( m_fontMap[usage].first );
265
 
        m_useOwnFontCheck->setChecked( m_fontMap[usage].first );
 
230
void CLanguageSettingsPage::newDisplayWindowFontAreaSelected(const QString& usage) {
 
231
    //belongs to fonts/languages
 
232
    useOwnFontClicked( m_fontMap[usage].first );
 
233
    m_useOwnFontCheck->setChecked( m_fontMap[usage].first );
266
234
 
267
 
        m_fontChooser->setFont( m_fontMap[usage].second );
 
235
    m_fontChooser->setFont( m_fontMap[usage].second );
268
236
}
269
237
 
270
238
 
271
239
/** This slot is called when the "Use own font for language" bo was clicked. */
272
 
void CLanguageSettingsPage::useOwnFontClicked( bool isOn ) 
273
 
{       
274
 
        //belongs to fonts/languages
275
 
        
276
 
        m_fontChooser->setEnabled(isOn);
277
 
        m_fontMap[ m_usageCombo->currentText() ].first = isOn;
278
 
 
279
 
        if (isOn) 
280
 
        {       //show font icon
281
 
                m_usageCombo->setItemIcon(m_usageCombo->currentIndex(), util::filesystem::DirectoryUtil::getIcon("fonts.svg") );
282
 
        }
283
 
        else 
284
 
        {    //don't show
285
 
                m_usageCombo->setItemText(m_usageCombo->currentIndex(), m_usageCombo->currentText() ); //TODO: should this change icon to empty?
286
 
        }
287
 
}
288
 
 
289
 
 
290
 
QString CLanguageSettingsPage::iconName()
291
 
{
292
 
        return CResMgr::settings::fonts::icon;
293
 
}
294
 
QString CLanguageSettingsPage::label()
295
 
{
296
 
        //: Empty string, don't translate
297
 
        return tr("");
298
 
}
299
 
QString CLanguageSettingsPage::header()
300
 
{
301
 
        return tr("Languages");
 
240
void CLanguageSettingsPage::useOwnFontClicked(bool isOn) {
 
241
    namespace DU = util::directory;
 
242
 
 
243
    //belongs to fonts/languages
 
244
 
 
245
    m_fontChooser->setEnabled(isOn);
 
246
    m_fontMap[ m_usageCombo->currentText() ].first = isOn;
 
247
 
 
248
    if (isOn) {         //show font icon
 
249
        m_usageCombo->setItemIcon(m_usageCombo->currentIndex(), DU::getIcon("fonts.svg"));
 
250
    }
 
251
    else {   //don't show
 
252
        m_usageCombo->setItemText(m_usageCombo->currentIndex(), m_usageCombo->currentText() ); /// \todo should this change icon to empty?
 
253
    }
 
254
}
 
255
 
 
256
 
 
257
QString CLanguageSettingsPage::iconName() {
 
258
    return CResMgr::settings::fonts::icon;
 
259
}
 
260
QString CLanguageSettingsPage::label() {
 
261
    //: Empty string, don't translate
 
262
    return tr("");
 
263
}
 
264
QString CLanguageSettingsPage::header() {
 
265
    return tr("Languages");
302
266
}