diff options
Diffstat (limited to 'kkbswitch/kbconfig.cpp')
-rw-r--r-- | kkbswitch/kbconfig.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/kkbswitch/kbconfig.cpp b/kkbswitch/kbconfig.cpp index b7c5cac..41bb6f1 100644 --- a/kkbswitch/kbconfig.cpp +++ b/kkbswitch/kbconfig.cpp @@ -30,9 +30,9 @@ #include <kdebug.h> #include <kglobalaccel.h> -#include <qnamespace.h> -#include <qpainter.h> -#include <qimage.h> +#include <ntqnamespace.h> +#include <ntqpainter.h> +#include <ntqimage.h> #include "kbconfig.h" #include "xkeyboard.h" @@ -79,20 +79,20 @@ void KBConfig::load(KConfig *config){ m_use_shortcuts = config->readBoolEntry(USE_SHORTCUTS_ENTRY, false); XKeyboard *xkb = XKeyboard::self(); - QStringList list; + TQStringList list; xkb->getGroupNames(list); unsigned int i = 0; m_groups.clear(); m_groups.resize(xkb->getNumKbdGroups()); - QString name; - for (QStringList::Iterator iter = list.begin(); iter != list.end(); iter++, i++) { + TQString name; + for (TQStringList::Iterator iter = list.begin(); iter != list.end(); iter++, i++) { name = *iter; - if (name == QString::null) name = i18n("<Unnamed>"); + if (name == TQString::null) name = i18n("<Unnamed>"); m_groups.insert(i, new KBGroup(name)); } - QValueVector<QPixmap> pixlist; - QStringList iconpaths; + TQValueVector<TQPixmap> pixlist; + TQStringList iconpaths; drawIcons(m_icon_style, &pixlist, &iconpaths); for (i = 0; i < m_groups.count(); i++) { m_groups[i]->setPixmap(pixlist[i]); @@ -102,9 +102,9 @@ void KBConfig::load(KConfig *config){ if (m_keys) delete m_keys; m_keys = new KGlobalAccel(NULL); for (int i = 0; i < groupCount(); i++) { - m_keys->insert(QString::fromLatin1("SetGroup %1").arg(i), + m_keys->insert(TQString::fromLatin1("SetGroup %1").arg(i), i18n("Activate %1 keyboard layout").arg(m_groups[i]->getName()), - QString::null, Qt::ALT+Qt::CTRL+Qt::Key_1 + i, KKey::QtWIN+Qt::CTRL+Qt::Key_1 + i, + TQString::null, TQt::ALT+TQt::CTRL+TQt::Key_1 + i, KKey::QtWIN+TQt::CTRL+TQt::Key_1 + i, kapp, SLOT(slotGroupSelected(int))); } m_keys->readSettings(config); @@ -124,11 +124,11 @@ void KBConfig::save(KConfig *config) m_keys->writeSettings(config); } -void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, - QStringList *iconpaths) +void KBConfig::drawIcons(IconStyle icon_style, TQValueVector<TQPixmap> *icons, + TQStringList *iconpaths) { - QString path, countryCode, langCode; - QStringList layouts; + TQString path, countryCode, langCode; + TQStringList layouts; KGlobal::dirs()->addResourceDir("appdata", "."); KConfig map("group_names", true, true, "appdata"); @@ -147,9 +147,9 @@ void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, map.setGroup("Languages"); langCode = map.readEntry(m_groups[i]->getName()); if (langCode.isEmpty()) langCode = countryCode; - QPixmap &pix = (*icons)[i]; + TQPixmap &pix = (*icons)[i]; pix.resize(0, 0); - path = QString::null; + path = TQString::null; if (icon_style == ICON_FLAG /*&& !countryCode.isEmpty()*/) drawFlagPixmap(pix, path, countryCode, i, config); else if (icon_style == ICON_CODE_AND_FLAG /*&& !countryCode.isEmpty()*/) @@ -165,8 +165,8 @@ void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, /*void KBConfig::guessGroupPixmaps(){ KGlobal::dirs()->addResourceDir("appdata", "."); KConfig map("group_names", true, true, "appdata"); - QString path, countryCode, langCode; - QPixmap pix; + TQString path, countryCode, langCode; + TQPixmap pix; for (unsigned int i = 0; i < m_groups.count(); i++) { if (m_groups[i]->getPixmap().isNull()) { @@ -187,7 +187,7 @@ void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, } }*/ -bool KBConfig::getGroupImage(QImage &img, QString &path, const QString &code, +bool KBConfig::getGroupImage(TQImage &img, TQString &path, const TQString &code, int group, KConfig *config) { bool ret = true; @@ -197,12 +197,12 @@ bool KBConfig::getGroupImage(QImage &img, QString &path, const QString &code, if (path.isEmpty() || !img.load(path)) { if (code.isEmpty()) ret = false; else { - path = locate("locale", QString("l10n/%1/flag.png").arg(code)); + path = locate("locale", TQString("l10n/%1/flag.png").arg(code)); if (!path.isEmpty()) ret = img.load(path); else { // I am told in Red Hat 9 standard KDE flag pixmaps are missing. // Workaround: we have to simulate them by rescaling GKB's pixmaps - path = QString("/usr/share/pixmaps/gkb/%1.png").arg(code); + path = TQString("/usr/share/pixmaps/gkb/%1.png").arg(code); ret = img.load(path) && !img.isNull(); need_to_scale = true; } @@ -216,62 +216,62 @@ bool KBConfig::getGroupImage(QImage &img, QString &path, const QString &code, return ret; } -void KBConfig::drawFlagPixmap(QPixmap &pix, QString &path, const QString &code, +void KBConfig::drawFlagPixmap(TQPixmap &pix, TQString &path, const TQString &code, int group, KConfig *config) { - QImage img; + TQImage img; if (getGroupImage(img, path, code, group, config)) pix.convertFromImage(img); } -void KBConfig::drawCodePixmap(QPixmap &pix, const QString &code) +void KBConfig::drawCodePixmap(TQPixmap &pix, const TQString &code) { pix.resize(19, 16); - QPainter painter(&pix); - QFont font("helvetica", 9, QFont::Bold); + TQPainter painter(&pix); + TQFont font("helvetica", 9, TQFont::Bold); font.setPixelSize(10); painter.setFont(font); painter.setPen(KGlobalSettings::highlightedTextColor()); pix.fill(KGlobalSettings::highlightColor()); painter.drawText(1, 0, pix.width(), pix.height(), - Qt::AlignHCenter | Qt::AlignVCenter, code.upper()); + TQt::AlignHCenter | TQt::AlignVCenter, code.upper()); - /*QSize size = painter.fontMetrics().size(0, code.upper()); + /*TQSize size = painter.fontMetrics().size(0, code.upper()); kdDebug() << size.width() << " x " << size.height() << endl;*/ } -void KBConfig::drawCodeAndFlagPixmap(QPixmap &pix, QString &path, - const QString &countryCode, const QString &langCode, int group, KConfig *config) +void KBConfig::drawCodeAndFlagPixmap(TQPixmap &pix, TQString &path, + const TQString &countryCode, const TQString &langCode, int group, KConfig *config) { - QImage img; + TQImage img; if (!getGroupImage(img, path, countryCode, group, config)) return; // could not find flag if (img.depth() <= 8) img = img.convertDepth(32); // the following code is taken from kdebase/kxkb/pixmap.cpp for (int y = 0; y < img.height(); y++) for(int x = 0; x < img.width(); x++) { - QRgb rgb = img.pixel(x, y); - img.setPixel(x, y, qRgb(qRed(rgb)*3/4, qGreen(rgb)*3/4, qBlue(rgb)*3/4)); + TQRgb rgb = img.pixel(x, y); + img.setPixel(x, y, tqRgb(tqRed(rgb)*3/4, tqGreen(rgb)*3/4, tqBlue(rgb)*3/4)); } pix.convertFromImage(img); - QPainter painter(&pix); - painter.setPen(Qt::black); - painter.setFont(QFont("helvetica", 10, QFont::Bold)); - painter.drawText(1, 1, pix.width(), pix.height()-2, Qt::AlignCenter, langCode); - painter.setPen(Qt::white); - painter.drawText(0, 0, pix.width(), pix.height()-2, Qt::AlignCenter, langCode); + TQPainter painter(&pix); + painter.setPen(TQt::black); + painter.setFont(TQFont("helvetica", 10, TQFont::Bold)); + painter.drawText(1, 1, pix.width(), pix.height()-2, TQt::AlignCenter, langCode); + painter.setPen(TQt::white); + painter.drawText(0, 0, pix.width(), pix.height()-2, TQt::AlignCenter, langCode); } -void KBConfig::drawDefaultPixmap(QPixmap &pix, int group) +void KBConfig::drawDefaultPixmap(TQPixmap &pix, int group) { pix.resize(FLAG_ICON_WIDTH, FLAG_ICON_HEIGHT); - QPainter painter(&pix); + TQPainter painter(&pix); pix.fill(); painter.drawText(0, 0, pix.width(), pix.height(), - Qt::AlignHCenter | Qt::AlignVCenter, QString::number(group+1)); + TQt::AlignHCenter | TQt::AlignVCenter, TQString::number(group+1)); } void KBConfig::checkKeysEnabled() @@ -283,14 +283,14 @@ void KBConfig::checkKeysEnabled() /** No descriptions */ /*void KBConfig::drawDefaultPixmaps(){ - QPixmap pix(16, 16); - QPainter painter(&pix); + TQPixmap pix(16, 16); + TQPainter painter(&pix); for (unsigned int i = 0; i < m_groups.count(); i++) { if (m_groups[i]->getPixmap().isNull()) { pix.fill(); painter.drawText(0, 0, pix.width(), pix.height(), - Qt::AlignHCenter | Qt::AlignVCenter, QString::number(i+1)); + TQt::AlignHCenter | TQt::AlignVCenter, TQString::number(i+1)); m_groups[i]->setPixmap(pix); } } @@ -298,8 +298,8 @@ void KBConfig::checkKeysEnabled() /** No descriptions */ /*void KBConfig::loadConfiguredPixmaps(KConfig *config){ - QString path; - QPixmap pix; + TQString path; + TQPixmap pix; config->setGroup(ICONS_SECTION); for (unsigned int i = 0; i < m_groups.count(); i++) { path = config->readEntry(entryForGroup(i)); @@ -315,18 +315,18 @@ void KBConfig::checkKeysEnabled() /*! - \fn KBConfig::getXkbLayouts(const QStringList &layouts) + \fn KBConfig::getXkbLayouts(const TQStringList &layouts) */ -void KBConfig::getXkbLayouts(QStringList &layouts) +void KBConfig::getXkbLayouts(TQStringList &layouts) { #if HAVE_X11_EXTENSIONS_XKBRULES_H && HAVE_LIBXKBFILE XkbRF_VarDefsRec vardefs; int i; usleep(10000); - if (XkbRF_GetNamesProp(qt_xdisplay(), NULL, &vardefs)) { - layouts = QStringList::split(',', vardefs.layout, true); - for (QStringList::Iterator it = layouts.begin(); it != layouts.end(); ++it) { + if (XkbRF_GetNamesProp(tqt_xdisplay(), NULL, &vardefs)) { + layouts = TQStringList::split(',', vardefs.layout, true); + for (TQStringList::Iterator it = layouts.begin(); it != layouts.end(); ++it) { i = 0; while ((*it)[i] >= 'a' && (*it)[i] <= 'z') i++; *it = (*it).left(i); |