void ICUUnicodeSupport::_addEncoding<2>(const char* _encoding) { Utf16Buffer buf16; utf8_to_utf16_unsafe(buf16, char_cast<const uint8_t*>(_encoding), strlen(_encoding)); String str; StringHolder<2>(str).assign( buf16.data(), buf16.size() ); addEncoding(str); }
Editor::Editor( QWidget * parent , const char * name ) : QWidget( parent, name, WDestructiveClose ) { m = new QMenuBar( this, "menu" ); QPopupMenu * file = new QPopupMenu(); Q_CHECK_PTR( file ); m->insertItem( "&File", file ); file->insertItem( "&New", this, SLOT(newDoc()), ALT+Key_N ); file->insertItem( "&Open...", this, SLOT(load()), ALT+Key_O ); file->insertItem( "&Save...", this, SLOT(save()), ALT+Key_S ); file->insertSeparator(); open_as = new QPopupMenu(); file->insertItem( "Open &As", open_as ); save_as = new QPopupMenu(); file->insertItem( "Sa&ve As", save_as ); file->insertItem( "Add &Encoding", this, SLOT(addEncoding()) ); #ifndef QT_NO_PRINTER file->insertSeparator(); file->insertItem( "&Print...", this, SLOT(print()), ALT+Key_P ); #endif file->insertSeparator(); file->insertItem( "&Close", this, SLOT(close()),ALT+Key_W ); file->insertItem( "&Quit", qApp, SLOT(closeAllWindows()), ALT+Key_Q ); connect( save_as, SIGNAL(activated(int)), this, SLOT(saveAsEncoding(int)) ); connect( open_as, SIGNAL(activated(int)), this, SLOT(openAsEncoding(int)) ); rebuildCodecList(); QPopupMenu * edit = new QPopupMenu(); Q_CHECK_PTR( edit ); m->insertItem( "&Edit", edit ); edit->insertItem( "To &Uppercase", this, SLOT(toUpper()), ALT+Key_U ); edit->insertItem( "To &Lowercase", this, SLOT(toLower()), ALT+Key_L ); #ifndef QT_NO_FONTDIALOG edit->insertSeparator(); edit->insertItem( "&Select Font" , this, SLOT(font()), ALT+Key_T ); #endif changed = FALSE; e = new QMultiLineEdit( this, "editor" ); connect( e, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); // We use Unifont - if you have it installed you'll see all // Unicode character glyphs. // // Unifont only comes in one pixel size, so we cannot let // it change pixel size as the display DPI changes. // QFont unifont("unifont",16,50); unifont.setPixelSize(16); e->setFont( unifont ); e->setFocus(); }
void ICUUnicodeSupport::_addEncoding<1>(const char* _encoding) { addEncoding(_encoding); }