From kde-commits Wed Oct 31 22:42:23 2007 From: Anne-Marie Mahfouf Date: Wed, 31 Oct 2007 22:42:23 +0000 To: kde-commits Subject: KDE/kdeedu/klettres/src Message-Id: <1193870543.123982.13237.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119387055023725 SVN commit 731530 by annma: fix display of special chars and position of input letter in Kid theme remove some commented lines M +15 -15 klettres.cpp M +2 -2 klettres.h M +1 -1 klettresui.rc M +1 -1 kltheme.cpp --- trunk/KDE/kdeedu/klettres/src/klettres.cpp #731529:731530 @@ -80,8 +80,6 @@ m_languages = LangUtils::getLanguages(); kDebug() << "m_languages " << m_languages; findLanguages(); - //Prefs::setLanguage(Prefs::defaultLanguage()); - //Prefs::self()->writeConfig(); //MainWindow GUI: menus, tolbars and statusbar setupActions(); setupStatusbar(); @@ -101,7 +99,6 @@ void KLettres::findLanguages() { m_languageNames.clear(); - //m_sortedNames.clear(); //the program scans in khangman/data/ to see what languages data is found //we look in $KDEDIR/share/locale/all_languages from /kdelibs/kdecore/all_languages @@ -121,7 +118,6 @@ } } //never sort m_languageNames as it's m_languages translated - //m_sortedNames = m_languageNames; } QString Prefs::defaultLanguage() @@ -254,15 +250,15 @@ m_levLabel = new QLabel(st); st->addWidget(m_langLabel); st->insertFixedItem("", 1);//add a space - st->addWidget(m_levLabel); + st->addWidget(m_levLabel); statusBar(); } void KLettres::setupToolbars() { - //toolbar for special characters - m_secondToolbar = toolBar("secondToolbar"); - addToolBar ( Qt::BottomToolBarArea, m_secondToolbar); + // Toolbar for special characters + specialCharToolbar = toolBar("specialCharToolbar"); + addToolBar ( Qt::BottomToolBarArea, specialCharToolbar); } void KLettres::optionsPreferences() @@ -279,6 +275,8 @@ connect(dialog, SIGNAL(settingsChanged( const QString &)), this, SLOT(slotUpdateSettings())); dialog->setAttribute( Qt::WA_DeleteOnClose ); dialog->show(); + + } void KLettres::loadSettings() @@ -432,7 +430,6 @@ void KLettres::loadLangToolBar() { - m_secondToolbar->clear(); QString lang = m_languages[Prefs::languageNumber()]; if (LangUtils::hasSpecialChars(lang))//Dutch, English, French and Italian have no special characters { @@ -458,10 +455,13 @@ //allData contains all the words from the file allData = readFileStr.readAll().split("\n"); openFileStream.close(); - for (int i=0; i<(int) allData.count(); i++) { - if (!allData[i].isEmpty()) - m_secondToolbar->addAction (charIcon(allData[i].at(0)));//, i, SIGNAL( clicked() ), this, SLOT( slotPasteChar()), true, i18n("Inserts the character %1").arg(allData[i]), i+1 ); - //TODO fix by creating a new KAction, see KAction API doc + for (int i=0; i<(int) allData.count(); ++i) { + if (!allData[i].isEmpty()) { + QAction *act = specialCharToolbar->addAction(allData.at(i)); + act->setIcon(charIcon(allData.at(i).at(0))); + // used to carry the id + act->setData(i); + } } } } @@ -480,7 +480,7 @@ m_view->enterLetter(allData.at(id)); } -QString KLettres::charIcon(const QChar & c) +QIcon KLettres::charIcon(const QChar & c) { ///Create a name and path for the icon QString s = KStandardDirs::locateLocal("icon", "char" + QString::number(c.unicode()) + ".png"); @@ -515,7 +515,7 @@ ///Save the icon to disk pm.save(s, "PNG"); - return s; + return QIcon(pm); } #include "klettres.moc" --- trunk/KDE/kdeedu/klettres/src/klettres.h #731529:731530 @@ -95,7 +95,7 @@ ///Create an instance of a KToolBar KToolBar *m_mainToolbar; ///Second toolbar with buttons of special characters per language - KToolBar *m_secondToolbar; + KToolBar *specialCharToolbar; ///is false when menubar button is not shown bool menuBool; ///Build the main window menus @@ -107,7 +107,7 @@ /**generates icons for the special characters toolbar * @param c the character that will be painted on the icon */ - QString charIcon(const QChar &c); + QIcon charIcon(const QChar &c); /** *Update the level menu and level combobox * @param id The id of the new level --- trunk/KDE/kdeedu/klettres/src/klettresui.rc #731529:731530 @@ -44,6 +44,6 @@ - Special Characters + Special Characters --- trunk/KDE/kdeedu/klettres/src/kltheme.cpp #731529:731530 @@ -76,7 +76,7 @@ virtual QRect inputRect(const QSize& windowsize) const { - return QRect(windowsize.width()*190/800, windowsize.height()*480/600, 25, 100); + return QRect(windowsize.width()*188/800, windowsize.height()*468/600, 25, 90); } };