remove a few conversions.

maybe moving the stringtable into a fuynction makes sens to prevent
initialization on startup...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23838 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-19 22:17:36 +00:00
parent 16fa6c5f0f
commit 1fe1450af9

View File

@ -39,7 +39,7 @@ namespace {
/// name of unicode block, start and end code point /// name of unicode block, start and end code point
struct UnicodeBlocks { struct UnicodeBlocks {
char const * name; QString name;
char_type start; char_type start;
char_type end; char_type end;
}; };
@ -146,9 +146,9 @@ UnicodeBlocks unicode_blocks[] = {
const int no_blocks = sizeof(unicode_blocks) / sizeof(UnicodeBlocks); const int no_blocks = sizeof(unicode_blocks) / sizeof(UnicodeBlocks);
QString getCodePoint(char_type c) QLatin1String getCodePoint(char_type c)
{ {
char buf[10]; static char buf[10];
sprintf(buf, "0x%04x", c); sprintf(buf, "0x%04x", c);
return QLatin1String(buf); return QLatin1String(buf);
} }
@ -295,7 +295,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
if (!show_all) { if (!show_all) {
for (int i = 0 ; i < no_blocks; ++i) for (int i = 0 ; i < no_blocks; ++i)
if (unicode_blocks[i].name == fromqstr(category)) { if (unicode_blocks[i].name == category) {
range_start = unicode_blocks[i].start; range_start = unicode_blocks[i].start;
range_end = unicode_blocks[i].end; range_end = unicode_blocks[i].end;
break; break;
@ -320,7 +320,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
if (show_all || c >= range_start && c <= range_end) { if (show_all || c >= range_start && c <= range_end) {
lwi->setTextAlignment(Qt::AlignCenter); lwi->setTextAlignment(Qt::AlignCenter);
lwi->setToolTip( lwi->setToolTip(
qt_("Character: ") + toqstr(c) + "\n" + qt_("Character: ") + toqstr(c) + '\n' +
qt_("Code Point: ") + getCodePoint(c) qt_("Code Point: ") + getCodePoint(c)
); );
symbolsLW->addItem(lwi); symbolsLW->addItem(lwi);
@ -352,13 +352,13 @@ void GuiSymbols::updateSymbolList(bool update_combo)
} }
QString const GuiSymbols::getBlock(char_type c) const QString GuiSymbols::getBlock(char_type c) const
{ {
int i = 0; int i = 0;
while (c > unicode_blocks[i].end && i < no_blocks) while (c > unicode_blocks[i].end && i < no_blocks)
++i; ++i;
if (unicode_blocks[i].name) if (!unicode_blocks[i].name.isEmpty())
return toqstr(unicode_blocks[i].name); return unicode_blocks[i].name;
return QString(); return QString();
} }