mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
move languageData() out of qt_helpers.cpp
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24670 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dece756aff
commit
fbb8c063ec
@ -116,10 +116,23 @@ static QList<FamilyPair> familyData()
|
||||
return families;
|
||||
}
|
||||
|
||||
|
||||
static QList<LanguagePair> languageData()
|
||||
{
|
||||
QList<LanguagePair> list;
|
||||
Languages::const_iterator it = languages.begin();
|
||||
for (; it != languages.end(); ++it) {
|
||||
list << LanguagePair(
|
||||
qt_(it->second.display()), toqstr(it->second.lang()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
template<typename T>
|
||||
void fillCombo(QComboBox * combo, QList<T> list)
|
||||
void fillCombo(QComboBox * combo, QList<T> const & list)
|
||||
{
|
||||
typename QList<T>::const_iterator cit = list.begin();
|
||||
for (; cit != list.end(); ++cit)
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include "GuiDialog.h"
|
||||
#include "ui_CharacterUi.h"
|
||||
#include "qt_helpers.h" // for LanguagePair
|
||||
#include "Font.h"
|
||||
|
||||
#include <utility>
|
||||
@ -45,6 +44,7 @@ typedef std::pair<QString, FontShape> ShapePair;
|
||||
typedef std::pair<QString, FontSize> SizePair;
|
||||
typedef std::pair<QString, FontState> BarPair;
|
||||
typedef std::pair<QString, ColorCode> ColorPair;
|
||||
typedef std::pair<QString, QString> LanguagePair;
|
||||
|
||||
class GuiCharacter : public GuiDialog, public Ui::CharacterUi
|
||||
{
|
||||
|
@ -510,10 +510,6 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
QList<LanguagePair> langs = languageData();
|
||||
for (int i = 0; i != langs.size(); ++i)
|
||||
lang_.append(langs[i].second);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||
@ -790,10 +786,12 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(change_adaptor()));
|
||||
// language & quotes
|
||||
|
||||
QList<LanguagePair>::const_iterator lit = langs.begin();
|
||||
QList<LanguagePair>::const_iterator lend = langs.end();
|
||||
for (; lit != lend; ++lit)
|
||||
langModule->languageCO->addItem(lit->first);
|
||||
Languages::const_iterator lit = languages.begin();
|
||||
Languages::const_iterator lend = languages.end();
|
||||
for (; lit != lend; ++lit) {
|
||||
lang_.append(toqstr(lit->second.lang()));
|
||||
langModule->languageCO->addItem(qt_(lit->second.display()));
|
||||
}
|
||||
|
||||
// Always put the default encoding in the first position.
|
||||
// It is special because the displayed text is translated.
|
||||
|
@ -13,19 +13,20 @@
|
||||
|
||||
#include "GuiPrefs.h"
|
||||
|
||||
#include "qt_helpers.h"
|
||||
#include "FileDialog.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "GuiFontExample.h"
|
||||
#include "GuiFontLoader.h"
|
||||
#include "GuiKeySymbol.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "BufferList.h"
|
||||
#include "Color.h"
|
||||
#include "ConverterCache.h"
|
||||
#include "FileDialog.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "GuiFontExample.h"
|
||||
#include "GuiKeySymbol.h"
|
||||
#include "KeyMap.h"
|
||||
#include "KeySequence.h"
|
||||
#include "Language.h"
|
||||
#include "LyXAction.h"
|
||||
#include "PanelStack.h"
|
||||
#include "paper.h"
|
||||
@ -1658,12 +1659,11 @@ PrefLanguage::PrefLanguage(QWidget * parent)
|
||||
|
||||
defaultLanguageCO->clear();
|
||||
|
||||
// store the lang identifiers for later
|
||||
//foreach (LanguagePair const & lpair, languageData(false)) {
|
||||
QList<LanguagePair> l = languageData();
|
||||
foreach (LanguagePair const & lpair, l) {
|
||||
defaultLanguageCO->addItem(lpair.first);
|
||||
lang_.append(lpair.second);
|
||||
Languages::const_iterator lit = languages.begin();
|
||||
Languages::const_iterator lend = languages.end();
|
||||
for (; lit != lend; ++lit) {
|
||||
lang_.append(toqstr(lit->second.lang()));
|
||||
defaultLanguageCO->addItem(qt_(lit->second.display()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,55 +160,6 @@ QString const qt_(string const & str)
|
||||
return toqstr(_(str));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class Sorter
|
||||
{
|
||||
public:
|
||||
#if !defined(USE_WCHAR_T) && defined(__GNUC__)
|
||||
bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const
|
||||
{
|
||||
return lhs.first < rhs.first;
|
||||
}
|
||||
#else
|
||||
Sorter() : loc_ok(true)
|
||||
{
|
||||
try {
|
||||
loc_ = locale("");
|
||||
} catch (...) {
|
||||
loc_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const
|
||||
{
|
||||
// FIXME: would that be "QString::localeAwareCompare()"?
|
||||
if (loc_ok)
|
||||
return loc_(fromqstr(lhs.first), fromqstr(rhs.first));
|
||||
else
|
||||
return lhs.first < rhs.first;
|
||||
}
|
||||
private:
|
||||
locale loc_;
|
||||
bool loc_ok;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
QList<LanguagePair> languageData()
|
||||
{
|
||||
QList<LanguagePair> list;
|
||||
Languages::const_iterator it = languages.begin();
|
||||
for (; it != languages.end(); ++it) {
|
||||
list << LanguagePair(
|
||||
qt_(it->second.display()), toqstr(it->second.lang()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
void rescanTexStyles()
|
||||
{
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <utility>
|
||||
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
@ -70,11 +68,6 @@ void setValid(QWidget * widget, bool valid);
|
||||
QString const qt_(std::string const & str);
|
||||
|
||||
///
|
||||
typedef std::pair<QString, QString> LanguagePair;
|
||||
|
||||
///
|
||||
QList<LanguagePair> languageData();
|
||||
|
||||
support::FileName libFileSearch(QString const & dir, QString const & name,
|
||||
QString const & ext = QString());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user