From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/fonts/fonts.cpp | 180 ++++++++++++++++++++-------------------- kcontrol/fonts/fonts.h | 44 +++++----- kcontrol/fonts/kxftconfig.cpp | 186 +++++++++++++++++++++--------------------- kcontrol/fonts/kxftconfig.h | 78 +++++++++--------- 4 files changed, 244 insertions(+), 244 deletions(-) (limited to 'kcontrol/fonts') diff --git a/kcontrol/fonts/fonts.cpp b/kcontrol/fonts/fonts.cpp index c50c89bc9..b082cf1fa 100644 --- a/kcontrol/fonts/fonts.cpp +++ b/kcontrol/fonts/fonts.cpp @@ -8,17 +8,17 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -126,18 +126,18 @@ static const char *aa_vbgr_xpm[]={ static const char** aaPixmaps[]={ aa_rgb_xpm, aa_bgr_xpm, aa_vrgb_xpm, aa_vbgr_xpm }; /**** DLL Interface ****/ -typedef KGenericFactory FontFactory; +typedef KGenericFactory FontFactory; K_EXPORT_COMPONENT_FACTORY( kcm_fonts, FontFactory("kcmfonts") ) /**** FontUseItem ****/ FontUseItem::FontUseItem( - QWidget * parent, - const QString &name, - const QString &grp, - const QString &key, - const QString &rc, - const QFont &default_fnt, + TQWidget * parent, + const TQString &name, + const TQString &grp, + const TQString &key, + const TQString &rc, + const TQFont &default_fnt, bool f ) : KFontRequester(parent, 0L, f), @@ -172,7 +172,7 @@ void FontUseItem::readFont( bool useDefaults ) config->setReadDefaults( useDefaults ); config->setGroup(_rcgroup); - QFont tmpFnt(_default); + TQFont tmpFnt(_default); setFont( config->readFontEntry(_rckey, &tmpFnt), isFixedOnly() ); if (deleteme) delete config; } @@ -194,9 +194,9 @@ void FontUseItem::writeFont() } } -void FontUseItem::applyFontDiff( const QFont &fnt, int fontDiffFlags ) +void FontUseItem::applyFontDiff( const TQFont &fnt, int fontDiffFlags ) { - QFont _font( font() ); + TQFont _font( font() ); if (fontDiffFlags & KFontChooser::FontDiffSize) { _font.setPointSize( fnt.pointSize() ); @@ -215,36 +215,36 @@ void FontUseItem::applyFontDiff( const QFont &fnt, int fontDiffFlags ) /**** FontAASettings ****/ -FontAASettings::FontAASettings(QWidget *parent) +FontAASettings::FontAASettings(TQWidget *parent) : KDialogBase(parent, "FontAASettings", true, i18n("Configure Anti-Alias Settings"), Ok|Cancel, Ok, true), changesMade(false) { - QWidget *mw=new QWidget(this); - QGridLayout *layout=new QGridLayout(mw, 1, 1, 0, KDialog::spacingHint()); + TQWidget *mw=new TQWidget(this); + TQGridLayout *layout=new TQGridLayout(mw, 1, 1, 0, KDialog::spacingHint()); - excludeRange=new QCheckBox(i18n("E&xclude range:"), mw), + excludeRange=new TQCheckBox(i18n("E&xclude range:"), mw), layout->addWidget(excludeRange, 0, 0); excludeFrom=new KDoubleNumInput(0, 72, 8.0, 1, 1, mw), excludeFrom->setSuffix(i18n(" pt")); layout->addWidget(excludeFrom, 0, 1); - excludeToLabel=new QLabel(i18n(" to "), mw); + excludeToLabel=new TQLabel(i18n(" to "), mw); layout->addWidget(excludeToLabel, 0, 2); excludeTo=new KDoubleNumInput(0, 72, 15.0, 1, 1, mw); excludeTo->setSuffix(i18n(" pt")); layout->addWidget(excludeTo, 0, 3); - useSubPixel=new QCheckBox(i18n("&Use sub-pixel hinting:"), mw); + useSubPixel=new TQCheckBox(i18n("&Use sub-pixel hinting:"), mw); layout->addWidget(useSubPixel, 1, 0); - QWhatsThis::add(useSubPixel, i18n("If you have a TFT or LCD screen you" + TQWhatsThis::add(useSubPixel, i18n("If you have a TFT or LCD screen you" " can further improve the quality of displayed fonts by selecting" " this option.
Sub-pixel hinting is also known as ClearType(tm).
" "
This will not work with CRT monitors.")); - subPixelType=new QComboBox(false, mw); + subPixelType=new TQComboBox(false, mw); layout->addMultiCellWidget(subPixelType, 1, 1, 1, 3); - QWhatsThis::add(subPixelType, i18n("In order for sub-pixel hinting to" + TQWhatsThis::add(subPixelType, i18n("In order for sub-pixel hinting to" " work correctly you need to know how the sub-pixels of your display" " are aligned.
" " On TFT or LCD displays a single pixel is actually composed of" @@ -252,31 +252,31 @@ FontAASettings::FontAASettings(QWidget *parent) " have a linear ordering of RGB sub-pixel, some have BGR.")); for(int t=KXftConfig::SubPixel::None+1; t<=KXftConfig::SubPixel::Vbgr; ++t) - subPixelType->insertItem(QPixmap(aaPixmaps[t-1]), KXftConfig::description((KXftConfig::SubPixel::Type)t)); + subPixelType->insertItem(TQPixmap(aaPixmaps[t-1]), KXftConfig::description((KXftConfig::SubPixel::Type)t)); #ifdef HAVE_FONTCONFIG - QLabel *hintingLabel=new QLabel(i18n("Hinting style: "), mw); + TQLabel *hintingLabel=new TQLabel(i18n("Hinting style: "), mw); layout->addWidget(hintingLabel, 2, 0); - hintingStyle=new QComboBox(false, mw); + hintingStyle=new TQComboBox(false, mw); layout->addMultiCellWidget(hintingStyle, 2, 2, 1, 3); for(int s=KXftConfig::Hint::NotSet+1; s<=KXftConfig::Hint::Full; ++s) hintingStyle->insertItem(KXftConfig::description((KXftConfig::Hint::Style)s)); - QString hintingText(i18n("Hinting is a process used to enhance the quality of fonts at small sizes.")); - QWhatsThis::add(hintingStyle, hintingText); - QWhatsThis::add(hintingLabel, hintingText); + TQString hintingText(i18n("Hinting is a process used to enhance the quality of fonts at small sizes.")); + TQWhatsThis::add(hintingStyle, hintingText); + TQWhatsThis::add(hintingLabel, hintingText); #endif load(); enableWidgets(); setMainWidget(mw); - connect(excludeRange, SIGNAL(toggled(bool)), SLOT(changed())); - connect(useSubPixel, SIGNAL(toggled(bool)), SLOT(changed())); - connect(excludeFrom, SIGNAL(valueChanged(double)), SLOT(changed())); - connect(excludeTo, SIGNAL(valueChanged(double)), SLOT(changed())); - connect(subPixelType, SIGNAL(activated(const QString &)), SLOT(changed())); + connect(excludeRange, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); + connect(useSubPixel, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); + connect(excludeFrom, TQT_SIGNAL(valueChanged(double)), TQT_SLOT(changed())); + connect(excludeTo, TQT_SIGNAL(valueChanged(double)), TQT_SLOT(changed())); + connect(subPixelType, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(changed())); #ifdef HAVE_FONTCONFIG - connect(hintingStyle, SIGNAL(activated(const QString &)), SLOT(changed())); + connect(hintingStyle, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(changed())); #endif } @@ -375,7 +375,7 @@ bool FontAASettings::save( bool useAA ) xft.setHintStyle(hStyle); - QString hs(KXftConfig::toStr(hStyle)); + TQString hs(KXftConfig::toStr(hStyle)); if(!hs.isEmpty() && hs!=kglobals.readEntry("XftHintStyle")) { @@ -492,12 +492,12 @@ int FontAASettings::exec() /**** KFonts ****/ -static QCString desktopConfigName() +static TQCString desktopConfigName() { int desktop=0; if (qt_xdisplay()) desktop = DefaultScreen(qt_xdisplay()); - QCString name; + TQCString name; if (desktop == 0) name = "kdesktoprc"; else @@ -506,10 +506,10 @@ static QCString desktopConfigName() return name; } -KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) +KFonts::KFonts(TQWidget *parent, const char *name, const TQStringList &) : KCModule(FontFactory::instance(), parent, name) { - QStringList nameGroupKeyRc; + TQStringList nameGroupKeyRc; nameGroupKeyRc << i18n("General") << "General" << "font" << "" @@ -520,15 +520,15 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) << i18n("Taskbar") << "General" << "taskbarFont" << "" << i18n("Desktop") << "FMSettings" << "StandardFont" << desktopConfigName(); - QValueList defaultFontList; + TQValueList defaultFontList; // Keep in sync with kdelibs/kdecore/kglobalsettings.cpp - QFont f0("Sans Serif", 10); - QFont f1("Monospace", 10); - QFont f2("Sans Serif", 10); - QFont f3("Sans Serif", 10, QFont::Bold); - QFont f4("Sans Serif", 10); + TQFont f0("Sans Serif", 10); + TQFont f1("Monospace", 10); + TQFont f2("Sans Serif", 10); + TQFont f3("Sans Serif", 10, TQFont::Bold); + TQFont f4("Sans Serif", 10); f0.setPointSize(10); f1.setPointSize(10); @@ -538,7 +538,7 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) defaultFontList << f0 << f1 << f2 << f0 << f3 << f4 << f0; - QValueList fixedList; + TQValueList fixedList; fixedList << false @@ -549,7 +549,7 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) << false << false; - QStringList quickHelpList; + TQStringList quickHelpList; quickHelpList << i18n("Used for normal text (e.g. button labels, list items).") @@ -560,29 +560,29 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) << i18n("Used by the taskbar.") << i18n("Used for desktop icons."); - QVBoxLayout * layout = - new QVBoxLayout(this, 0, KDialog::spacingHint()); + TQVBoxLayout * layout = + new TQVBoxLayout(this, 0, KDialog::spacingHint()); - QGridLayout * fontUseLayout = - new QGridLayout(layout, nameGroupKeyRc.count() / 4, 3); + TQGridLayout * fontUseLayout = + new TQGridLayout(layout, nameGroupKeyRc.count() / 4, 3); fontUseLayout->setColStretch(0, 0); fontUseLayout->setColStretch(1, 1); fontUseLayout->setColStretch(2, 0); - QValueList::ConstIterator defaultFontIt(defaultFontList.begin()); - QValueList::ConstIterator fixedListIt(fixedList.begin()); - QStringList::ConstIterator quickHelpIt(quickHelpList.begin()); - QStringList::ConstIterator it(nameGroupKeyRc.begin()); + TQValueList::ConstIterator defaultFontIt(defaultFontList.begin()); + TQValueList::ConstIterator fixedListIt(fixedList.begin()); + TQStringList::ConstIterator quickHelpIt(quickHelpList.begin()); + TQStringList::ConstIterator it(nameGroupKeyRc.begin()); unsigned int count = 0; while (it != nameGroupKeyRc.end()) { - QString name = *it; it++; - QString group = *it; it++; - QString key = *it; it++; - QString file = *it; it++; + TQString name = *it; it++; + TQString group = *it; it++; + TQString key = *it; it++; + TQString file = *it; it++; FontUseItem * i = new FontUseItem( @@ -596,10 +596,10 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) ); fontUseList.append(i); - connect(i, SIGNAL(fontSelected(const QFont &)), SLOT(fontSelected())); + connect(i, TQT_SIGNAL(fontSelected(const TQFont &)), TQT_SLOT(fontSelected())); - QLabel * fontUse = new QLabel(name+":", this); - QWhatsThis::add(fontUse, *quickHelpIt++); + TQLabel * fontUse = new TQLabel(name+":", this); + TQWhatsThis::add(fontUse, *quickHelpIt++); fontUseLayout->addWidget(fontUse, count, 0); fontUseLayout->addWidget(i, count, 1); @@ -607,40 +607,40 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) ++count; } - QHBoxLayout *hblay = new QHBoxLayout(layout, KDialog::spacingHint()); + TQHBoxLayout *hblay = new TQHBoxLayout(layout, KDialog::spacingHint()); hblay->addStretch(); - QPushButton * fontAdjustButton = new QPushButton(i18n("Ad&just All Fonts..."), this); - QWhatsThis::add(fontAdjustButton, i18n("Click to change all fonts")); + TQPushButton * fontAdjustButton = new TQPushButton(i18n("Ad&just All Fonts..."), this); + TQWhatsThis::add(fontAdjustButton, i18n("Click to change all fonts")); hblay->addWidget( fontAdjustButton ); - connect(fontAdjustButton, SIGNAL(clicked()), SLOT(slotApplyFontDiff())); + connect(fontAdjustButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotApplyFontDiff())); layout->addSpacing(KDialog::spacingHint()); - QGridLayout* lay = new QGridLayout(layout, 2, 4, KDialog::spacingHint()); + TQGridLayout* lay = new TQGridLayout(layout, 2, 4, KDialog::spacingHint()); lay->setColStretch( 3, 10 ); - QLabel* label = new QLabel( i18n( "Use a&nti-aliasing:" ), this ); + TQLabel* label = new TQLabel( i18n( "Use a&nti-aliasing:" ), this ); lay->addWidget( label, 0, 0 ); - cbAA = new QComboBox( this ); + cbAA = new TQComboBox( this ); cbAA->insertItem( i18n( "Enabled" )); // change AASetting type if order changes cbAA->insertItem( i18n( "System settings" )); cbAA->insertItem( i18n( "Disabled" )); - QWhatsThis::add(cbAA, i18n("If this option is selected, KDE will smooth the edges of curves in " + TQWhatsThis::add(cbAA, i18n("If this option is selected, KDE will smooth the edges of curves in " "fonts.")); - aaSettingsButton = new QPushButton( i18n( "Configure..." ), this); - connect(aaSettingsButton, SIGNAL(clicked()), SLOT(slotCfgAa())); + aaSettingsButton = new TQPushButton( i18n( "Configure..." ), this); + connect(aaSettingsButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotCfgAa())); label->setBuddy( cbAA ); lay->addWidget( cbAA, 0, 1 ); lay->addWidget( aaSettingsButton, 0, 2 ); - connect(cbAA, SIGNAL(activated(int)), SLOT(slotUseAntiAliasing())); + connect(cbAA, TQT_SIGNAL(activated(int)), TQT_SLOT(slotUseAntiAliasing())); - label = new QLabel( i18n( "Force fonts DPI:" ), this ); + label = new TQLabel( i18n( "Force fonts DPI:" ), this ); lay->addWidget( label, 1, 0 ); - comboForceDpi = new QComboBox( this ); + comboForceDpi = new TQComboBox( this ); label->setBuddy( comboForceDpi ); comboForceDpi->insertItem( i18n( "Disabled" )); // change DPISetti ng type if order changes comboForceDpi->insertItem( i18n( "96 DPI" )); comboForceDpi->insertItem( i18n( "120 DPI" )); - QString whatsthis = i18n( + TQString whatsthis = i18n( "

This option forces a specific DPI value for fonts. It may be useful" " when the real DPI of the hardware is not detected properly and it" " is also often misused when poor quality fonts are used that do not" @@ -651,8 +651,8 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) " ServerLocalArgs= in $KDEDIR/share/config/kdm/kdmrc). When fonts do not render" " properly with real DPI value better fonts should be used or configuration" " of font hinting should be checked.

" ); - QWhatsThis::add(comboForceDpi, whatsthis); - connect( comboForceDpi, SIGNAL( activated( int )), SLOT( changed())); + TQWhatsThis::add(comboForceDpi, whatsthis); + connect( comboForceDpi, TQT_SIGNAL( activated( int )), TQT_SLOT( changed())); lay->addWidget( comboForceDpi, 1, 1 ); layout->addStretch(1); @@ -727,17 +727,17 @@ void KFonts::save() if( dpi == DPINone && dpi_original != DPINone ) { KProcIO proc; proc << "xrdb" << "-quiet" << "-remove" << "-nocpp"; - proc.writeStdin( QCString( "Xft.dpi" ), true ); + proc.writeStdin( TQCString( "Xft.dpi" ), true ); proc.closeWhenDone(); proc.start( KProcess::Block ); } // KDE-1.x support - KSimpleConfig* config = new KSimpleConfig( QDir::homeDirPath() + "/.kderc" ); + KSimpleConfig* config = new KSimpleConfig( TQDir::homeDirPath() + "/.kderc" ); config->setGroup( "General" ); for ( FontUseItem* i = fontUseList.first(); i; i = fontUseList.next() ) { if("font"==i->rcKey()) - QSettings().writeEntry("/qt/font", i->font().toString()); + TQSettings().writeEntry("/qt/font", i->font().toString()); kdDebug(1208) << "write entry " << i->rcKey() << endl; config->writeEntry( i->rcKey(), i->font() ); } @@ -772,7 +772,7 @@ void KFonts::save() void KFonts::slotApplyFontDiff() { - QFont font = QFont(fontUseList.first()->font()); + TQFont font = TQFont(fontUseList.first()->font()); int fontDiffFlags = 0; int ret = KFontDialog::getFontDiff(font,fontDiffFlags); diff --git a/kcontrol/fonts/fonts.h b/kcontrol/fonts/fonts.h index ca1ab7729..0adb2565d 100644 --- a/kcontrol/fonts/fonts.h +++ b/kcontrol/fonts/fonts.h @@ -8,7 +8,7 @@ #ifndef FONTS_H #define FONTS_H -#include +#include #include #include @@ -27,24 +27,24 @@ class FontUseItem : public KFontRequester Q_OBJECT public: - FontUseItem(QWidget * parent, const QString &name, const QString &grp, - const QString &key, const QString &rc, const QFont &default_fnt, + FontUseItem(TQWidget * parent, const TQString &name, const TQString &grp, + const TQString &key, const TQString &rc, const TQFont &default_fnt, bool fixed = false); void readFont( bool useDefaults ); void writeFont(); void setDefault(); - void applyFontDiff(const QFont &fnt, int fontDiffFlags); + void applyFontDiff(const TQFont &fnt, int fontDiffFlags); - const QString& rcFile() { return _rcfile; } - const QString& rcGroup() { return _rcgroup; } - const QString& rcKey() { return _rckey; } + const TQString& rcFile() { return _rcfile; } + const TQString& rcGroup() { return _rcgroup; } + const TQString& rcKey() { return _rckey; } private: - QString _rcfile; - QString _rcgroup; - QString _rckey; - QFont _default; + TQString _rcfile; + TQString _rcgroup; + TQString _rckey; + TQFont _default; }; class FontAASettings : public KDialogBase @@ -53,7 +53,7 @@ class FontAASettings : public KDialogBase public: - FontAASettings(QWidget *parent); + FontAASettings(TQWidget *parent); bool save( bool useAA ); bool load(); @@ -74,15 +74,15 @@ protected slots: private: - QCheckBox *excludeRange; - QCheckBox *useSubPixel; + TQCheckBox *excludeRange; + TQCheckBox *useSubPixel; KDoubleNumInput *excludeFrom; KDoubleNumInput *excludeTo; - QComboBox *subPixelType; + TQComboBox *subPixelType; #ifdef HAVE_FONTCONFIG - QComboBox *hintingStyle; + TQComboBox *hintingStyle; #endif - QLabel *excludeToLabel; + TQLabel *excludeToLabel; bool changesMade; }; @@ -94,7 +94,7 @@ class KFonts : public KCModule Q_OBJECT public: - KFonts(QWidget *parent, const char *name, const QStringList &); + KFonts(TQWidget *parent, const char *name, const TQStringList &); ~KFonts(); virtual void load(); @@ -113,10 +113,10 @@ private: enum DPISetting { DPINone, DPI96, DPI120 }; AASetting useAA, useAA_original; DPISetting dpi_original; - QComboBox *cbAA; - QComboBox* comboForceDpi; - QPushButton *aaSettingsButton; - QPtrList fontUseList; + TQComboBox *cbAA; + TQComboBox* comboForceDpi; + TQPushButton *aaSettingsButton; + TQPtrList fontUseList; FontAASettings *aaSettings; }; diff --git a/kcontrol/fonts/kxftconfig.cpp b/kcontrol/fonts/kxftconfig.cpp index 22621f5e6..682672a7a 100644 --- a/kcontrol/fonts/kxftconfig.cpp +++ b/kcontrol/fonts/kxftconfig.cpp @@ -23,14 +23,14 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #ifdef HAVE_FONTCONFIG #include @@ -41,40 +41,40 @@ using namespace std; -QString KXftConfig::contractHome(QString path) +TQString KXftConfig::contractHome(TQString path) { if (!path.isEmpty() && '/'==path[0]) { - QString home(QDir::homeDirPath()); + TQString home(TQDir::homeDirPath()); if(path.startsWith(home)) { unsigned int len = home.length(); if(path.length() == len || path[len] == '/') - return path.replace(0, len, QString::fromLatin1("~")); + return path.replace(0, len, TQString::fromLatin1("~")); } } return path; } -QString KXftConfig::expandHome(QString path) +TQString KXftConfig::expandHome(TQString path) { if(!path.isEmpty() && '~'==path[0]) - return 1==path.length() ? QDir::homeDirPath() : path.replace(0, 1, QDir::homeDirPath()); + return 1==path.length() ? TQDir::homeDirPath() : path.replace(0, 1, TQDir::homeDirPath()); return path; } static int point2Pixel(double point) { - return (int)(((point*QPaintDevice::x11AppDpiY())/72.0)+0.5); + return (int)(((point*TQPaintDevice::x11AppDpiY())/72.0)+0.5); } static int pixel2Point(double pixel) { - return (int)(((pixel*72.0)/(double)QPaintDevice::x11AppDpiY())+0.5); + return (int)(((pixel*72.0)/(double)TQPaintDevice::x11AppDpiY())+0.5); } static bool equal(double d1, double d2) @@ -82,11 +82,11 @@ static bool equal(double d1, double d2) return (fabs(d1 - d2) < 0.0001); } -static QString dirSyntax(const QString &d) +static TQString dirSyntax(const TQString &d) { if(!d.isNull()) { - QString ds(d); + TQString ds(d); ds.replace("//", "/"); @@ -101,11 +101,11 @@ static QString dirSyntax(const QString &d) return d; } -static QString xDirSyntax(const QString &d) +static TQString xDirSyntax(const TQString &d) { if(!d.isNull()) { - QString ds(d); + TQString ds(d); int slashPos=ds.findRev('/'); if(slashPos==(((int)ds.length())-1)) @@ -116,32 +116,32 @@ static QString xDirSyntax(const QString &d) return d; } -static bool check(const QString &path, unsigned int fmt, bool checkW=false) +static bool check(const TQString &path, unsigned int fmt, bool checkW=false) { KDE_struct_stat info; - QCString pathC(QFile::encodeName(path)); + TQCString pathC(TQFile::encodeName(path)); return 0==KDE_lstat(pathC, &info) && (info.st_mode&S_IFMT)==fmt && (!checkW || 0==::access(pathC, W_OK)); } -inline bool fExists(const QString &p) +inline bool fExists(const TQString &p) { return check(p, S_IFREG, false); } -inline bool dWritable(const QString &p) +inline bool dWritable(const TQString &p) { return check(p, S_IFDIR, true); } -inline bool dExists(const QString &p) +inline bool dExists(const TQString &p) { return check(p, S_IFDIR, false); } -static QString getDir(const QString &f) +static TQString getDir(const TQString &f) { - QString d(f); + TQString d(f); int slashPos=d.findRev('/'); @@ -151,16 +151,16 @@ static QString getDir(const QString &f) return dirSyntax(d); } -static time_t getTimeStamp(const QString &item) +static time_t getTimeStamp(const TQString &item) { KDE_struct_stat info; - return !item.isNull() && 0==KDE_lstat(QFile::encodeName(item), &info) ? info.st_mtime : 0; + return !item.isNull() && 0==KDE_lstat(TQFile::encodeName(item), &info) ? info.st_mtime : 0; } #ifdef HAVE_FONTCONFIG -inline QString fileSyntax(const QString &f) { return xDirSyntax(f); } +inline TQString fileSyntax(const TQString &f) { return xDirSyntax(f); } // // Obtain location of config file to use. // @@ -174,20 +174,20 @@ inline QString fileSyntax(const QString &f) { return xDirSyntax(f); } // $HOME/<...>/.fonts.conf // $HOME/<...>/fonts.conf // -QString getConfigFile(bool system) +TQString getConfigFile(bool system) { #if (FC_VERSION>=20300) static const char * constKdeRootFcFile="00kde.conf"; #endif FcStrList *list=FcConfigGetConfigFiles(FcConfigGetCurrent()); - QStringList files; + TQStringList files; FcChar8 *file; - QString home(dirSyntax(QDir::homeDirPath())); + TQString home(dirSyntax(TQDir::homeDirPath())); while((file=FcStrListNext(list))) { - QString f((const char *)file); + TQString f((const char *)file); if(fExists(f)) { @@ -195,7 +195,7 @@ QString getConfigFile(bool system) files.append(f); } #if (FC_VERSION>=20300) - if(system && dExists(f) && (-1!=f.find(QRegExp("/conf\\.d/?$")) || -1!=f.find(QRegExp("/conf\\.d?$"))) ) + if(system && dExists(f) && (-1!=f.find(TQRegExp("/conf\\.d/?$")) || -1!=f.find(TQRegExp("/conf\\.d?$"))) ) return dirSyntax(f)+constKdeRootFcFile; // This ones good enough for me! #endif } @@ -204,11 +204,11 @@ QString getConfigFile(bool system) // Go through list of files, looking for the preferred one... if(files.count()) { - QStringList::Iterator it(files.begin()), + TQStringList::Iterator it(files.begin()), end(files.end()); for(; it!=end; ++it) - if(-1!=(*it).find(QRegExp(system ? "/local\\.conf$" : "/\\.?fonts\\.conf$"))) + if(-1!=(*it).find(TQRegExp(system ? "/local\\.conf$" : "/\\.?fonts\\.conf$"))) return *it; return files.front(); // Just return the 1st one... } @@ -216,7 +216,7 @@ QString getConfigFile(bool system) return system ? "/etc/fonts/local.conf" : fileSyntax(home+"/.fonts.conf"); // Hmmm... no known files? } -static QString getEntry(QDomElement element, const char *type, unsigned int numAttributes, ...) +static TQString getEntry(TQDomElement element, const char *type, unsigned int numAttributes, ...) { if(numAttributes==element.attributes().length()) { @@ -239,11 +239,11 @@ static QString getEntry(QDomElement element, const char *type, unsigned int numA if(ok) { - QDomNode n=element.firstChild(); + TQDomNode n=element.firstChild(); if(!n.isNull()) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); if(!e.isNull() && type==e.tagName()) return e.text(); @@ -251,7 +251,7 @@ static QString getEntry(QDomElement element, const char *type, unsigned int numA } } - return QString::null; + return TQString::null; } static KXftConfig::SubPixel::Type strToType(const char *str) @@ -379,7 +379,7 @@ static bool readNum(char **ptr, double *num) return false; } -static KXftConfig::ListItem * getFirstItem(QPtrList &list) +static KXftConfig::ListItem * getFirstItem(TQPtrList &list) { KXftConfig::ListItem *cur; @@ -390,7 +390,7 @@ static KXftConfig::ListItem * getFirstItem(QPtrList &list) } #endif -static KXftConfig::ListItem * getLastItem(QPtrList &list) +static KXftConfig::ListItem * getLastItem(TQPtrList &list) { KXftConfig::ListItem *cur; @@ -401,16 +401,16 @@ static KXftConfig::ListItem * getLastItem(QPtrList &list) } #ifndef HAVE_FONTCONFIG -static const QString defaultPath("/usr/X11R6/lib/X11/XftConfig"); -static const QString defaultUserFile(".xftconfig"); +static const TQString defaultPath("/usr/X11R6/lib/X11/XftConfig"); +static const TQString defaultUserFile(".xftconfig"); static const char * constSymEnc="\"glyphs-fontspecific\""; -static const QString constConfigFiles[]= +static const TQString constConfigFiles[]= { defaultPath, "/etc/X11/XftConfig", - QString::null + TQString::null }; #endif @@ -441,7 +441,7 @@ KXftConfig::KXftConfig(int required, bool system) m_file=defaultPath; } else - m_file= QString(QDir::homeDirPath()+"/"+defaultUserFile); + m_file= TQString(TQDir::homeDirPath()+"/"+defaultUserFile); #endif #ifndef HAVE_FONTCONFIG m_symbolFamilies.setAutoDelete(true); @@ -475,7 +475,7 @@ bool KXftConfig::reset() m_subPixel.reset(); #ifdef HAVE_FONTCONFIG - QFile f(m_file); + TQFile f(m_file); if(f.open(IO_ReadOnly)) { @@ -493,7 +493,7 @@ bool KXftConfig::reset() if(m_doc.documentElement().isNull()) m_doc.appendChild(m_doc.createElement("fontconfig")); #else - QFile f(m_file); + TQFile f(m_file); m_size=0; delete [] m_data; @@ -563,8 +563,8 @@ bool KXftConfig::apply() if(fExists(m_file) && getTimeStamp(m_file)!=m_time) { KXftConfig newConfig(m_required, m_system); - QStringList list; - QStringList::Iterator it; + TQStringList list; + TQStringList::Iterator it; if(m_required&Dirs) { @@ -607,7 +607,7 @@ bool KXftConfig::apply() } #ifdef HAVE_FONTCONFIG - FcAtomic *atomic=FcAtomicCreate((const unsigned char *)((const char *)(QFile::encodeName(m_file)))); + FcAtomic *atomic=FcAtomicCreate((const unsigned char *)((const char *)(TQFile::encodeName(m_file)))); ok=false; if(atomic) @@ -642,7 +642,7 @@ bool KXftConfig::apply() const char qtDocTypeLine[] = ""; const char docTypeLine[] = ""; - QString str(m_doc.toString()); + TQString str(m_doc.toString()); int idx; if(0!=str.find(" &list, const QString &i) +KXftConfig::ListItem * KXftConfig::findItem(TQPtrList &list, const TQString &i) { ListItem *item; @@ -967,7 +967,7 @@ KXftConfig::ListItem * KXftConfig::findItem(QPtrList &list, const QStr return item; } -void KXftConfig::clearList(QPtrList &list) +void KXftConfig::clearList(TQPtrList &list) { ListItem *item; @@ -975,9 +975,9 @@ void KXftConfig::clearList(QPtrList &list) removeItem(list, item); } -QStringList KXftConfig::getList(QPtrList &list) +TQStringList KXftConfig::getList(TQPtrList &list) { - QStringList res; + TQStringList res; ListItem *item; for(item=list.first(); item; item=list.next()) @@ -987,7 +987,7 @@ QStringList KXftConfig::getList(QPtrList &list) return res; } -void KXftConfig::addItem(QPtrList &list, const QString &i) +void KXftConfig::addItem(TQPtrList &list, const TQString &i) { ListItem *item=findItem(list, i); @@ -1004,7 +1004,7 @@ void KXftConfig::addItem(QPtrList &list, const QString &i) item->toBeRemoved=false; } -void KXftConfig::removeItem(QPtrList &list, ListItem *item) +void KXftConfig::removeItem(TQPtrList &list, ListItem *item) { if(item) { @@ -1019,11 +1019,11 @@ void KXftConfig::removeItem(QPtrList &list, ListItem *item) void KXftConfig::readContents() { #ifdef HAVE_FONTCONFIG - QDomNode n = m_doc.documentElement().firstChild(); + TQDomNode n = m_doc.documentElement().firstChild(); while(!n.isNull()) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); if(!e.isNull()) if("dir"==e.tagName()) @@ -1033,14 +1033,14 @@ void KXftConfig::readContents() } else if("match"==e.tagName()) { - QString str; + TQString str; switch(e.childNodes().count()) { case 1: if(m_required&SubPixelType && "font"==e.attribute("target")) { - QDomElement ene=e.firstChild().toElement(); + TQDomElement ene=e.firstChild().toElement(); if(!ene.isNull() && "edit"==ene.tagName()) if(!(str=getEntry(ene, "const", 2, "name", "rgba", "mode", "assign")).isNull()) @@ -1069,8 +1069,8 @@ void KXftConfig::readContents() if(m_required&ExcludeRange && "font"==e.attribute("target")) // CPD: Is target "font" or "pattern" ???? { bool foundFalse=false; - QDomNode en=e.firstChild(); - QString family; + TQDomNode en=e.firstChild(); + TQString family; double from=-1.0, to=-1.0, pixelFrom=-1.0, @@ -1078,7 +1078,7 @@ void KXftConfig::readContents() while(!en.isNull()) { - QDomElement ene=en.toElement(); + TQDomElement ene=en.toElement(); if(!ene.isNull()) if("test"==ene.tagName()) @@ -1263,8 +1263,8 @@ void KXftConfig::applyDirs() for(item=m_dirs.first(); item; item=m_dirs.next()) if(!item->toBeRemoved && item->node.isNull()) { - QDomElement newNode = m_doc.createElement("dir"); - QDomText text = m_doc.createTextNode(contractHome(xDirSyntax(item->str))); + TQDomElement newNode = m_doc.createElement("dir"); + TQDomText text = m_doc.createTextNode(contractHome(xDirSyntax(item->str))); newNode.appendChild(text); @@ -1277,10 +1277,10 @@ void KXftConfig::applyDirs() void KXftConfig::applySubPixelType() { - QDomElement matchNode = m_doc.createElement("match"), + TQDomElement matchNode = m_doc.createElement("match"), typeNode = m_doc.createElement("const"), editNode = m_doc.createElement("edit"); - QDomText typeText = m_doc.createTextNode(toStr(m_subPixel.type)); + TQDomText typeText = m_doc.createTextNode(toStr(m_subPixel.type)); matchNode.setAttribute("target", "font"); editNode.setAttribute("mode", "assign"); @@ -1309,10 +1309,10 @@ void KXftConfig::applyHintStyle() } else { - QDomElement matchNode = m_doc.createElement("match"), + TQDomElement matchNode = m_doc.createElement("match"), typeNode = m_doc.createElement("const"), editNode = m_doc.createElement("edit"); - QDomText typeText = m_doc.createTextNode(toStr(m_hint.style)); + TQDomText typeText = m_doc.createTextNode(toStr(m_hint.style)); matchNode.setAttribute("target", "font"); editNode.setAttribute("mode", "assign"); @@ -1330,10 +1330,10 @@ void KXftConfig::applyHintStyle() void KXftConfig::applyHinting() { - QDomElement matchNode = m_doc.createElement("match"), + TQDomElement matchNode = m_doc.createElement("match"), typeNode = m_doc.createElement("bool"), editNode = m_doc.createElement("edit"); - QDomText typeText = m_doc.createTextNode(m_hinting.set ? "true" : "false"); + TQDomText typeText = m_doc.createTextNode(m_hinting.set ? "true" : "false"); matchNode.setAttribute("target", "font"); editNode.setAttribute("mode", "assign"); @@ -1362,20 +1362,20 @@ void KXftConfig::applyExcludeRange(bool pixel) } else { - QString fromString, + TQString fromString, toString; fromString.setNum(range.from); toString.setNum(range.to); - QDomElement matchNode = m_doc.createElement("match"), + TQDomElement matchNode = m_doc.createElement("match"), fromTestNode = m_doc.createElement("test"), fromNode = m_doc.createElement("double"), toTestNode = m_doc.createElement("test"), toNode = m_doc.createElement("double"), editNode = m_doc.createElement("edit"), boolNode = m_doc.createElement("bool"); - QDomText fromText = m_doc.createTextNode(fromString), + TQDomText fromText = m_doc.createTextNode(fromString), toText = m_doc.createTextNode(toString), boolText = m_doc.createTextNode("false"); @@ -1405,17 +1405,17 @@ void KXftConfig::applyExcludeRange(bool pixel) } } -void KXftConfig::removeItems(QPtrList &list) +void KXftConfig::removeItems(TQPtrList &list) { ListItem *item; - QDomElement docElem = m_doc.documentElement(); + TQDomElement docElem = m_doc.documentElement(); for(item=list.first(); item; item=list.next()) if(item->toBeRemoved && !item->node.isNull()) docElem.removeChild(item->node); } #else -void KXftConfig::outputDir(std::ofstream &f, const QString &str) +void KXftConfig::outputDir(std::ofstream &f, const TQString &str) { f << "dir \"" << contractHome(xDirSyntax(str)).local8Bit() << "\"" << endl; } @@ -1430,7 +1430,7 @@ void KXftConfig::outputNewDirs(std::ofstream &f) m_dirs.clear(); } -void KXftConfig::outputSymbolFamily(std::ofstream &f, const QString &str) +void KXftConfig::outputSymbolFamily(std::ofstream &f, const TQString &str) { f << "match any family == \"" << str.local8Bit() << "\" edit encoding = " << constSymEnc << ';' << endl; } @@ -1491,10 +1491,10 @@ void KXftConfig::setAntiAliasing( bool set ) void KXftConfig::applyAntiAliasing() { - QDomElement matchNode = m_doc.createElement("match"), + TQDomElement matchNode = m_doc.createElement("match"), typeNode = m_doc.createElement("bool"), editNode = m_doc.createElement("edit"); - QDomText typeText = m_doc.createTextNode(m_antiAliasing.set ? "true" : "false"); + TQDomText typeText = m_doc.createTextNode(m_antiAliasing.set ? "true" : "false"); matchNode.setAttribute("target", "font"); editNode.setAttribute("mode", "assign"); @@ -1530,14 +1530,14 @@ bool KXftConfig::aliasingEnabled() void KXftConfig::setAntiAliasing( bool set ) { - QSettings().writeEntry("/qt/useXft", set); + TQSettings().writeEntry("/qt/useXft", set); if (set) - QSettings().writeEntry("/qt/enableXft", set); + TQSettings().writeEntry("/qt/enableXft", set); } bool KXftConfig::getAntiAliasing() const { - return QSettings().readBoolEntry("/qt/useXft"); + return TQSettings().readBoolEntry("/qt/useXft"); } diff --git a/kcontrol/fonts/kxftconfig.h b/kcontrol/fonts/kxftconfig.h index 6828f1d88..cb5cd71f5 100644 --- a/kcontrol/fonts/kxftconfig.h +++ b/kcontrol/fonts/kxftconfig.h @@ -24,15 +24,15 @@ #include "config.h" #endif -#include -#include -#include +#include +#include +#include #include #include #include #ifdef HAVE_FONTCONFIG -#include +#include #endif class KXftConfig @@ -61,12 +61,12 @@ class KXftConfig struct Item { #ifdef HAVE_FONTCONFIG - Item(QDomNode &n) : node(n), toBeRemoved(false) {} + Item(TQDomNode &n) : node(n), toBeRemoved(false) {} Item() : toBeRemoved(false) {} virtual void reset() { node.clear(); toBeRemoved=false; } bool added() { return node.isNull(); } - QDomNode node; + TQDomNode node; #else Item(char *s, char *e) : start(s), end(e), toBeRemoved(false) {} virtual void reset() { start=end=NULL; toBeRemoved=false; } @@ -82,13 +82,13 @@ class KXftConfig struct ListItem : public Item { #ifdef HAVE_FONTCONFIG - ListItem(const QString &st, QDomNode &n) : Item(n), str(st) {} - ListItem(const QString &st) : str(st) {} + ListItem(const TQString &st, TQDomNode &n) : Item(n), str(st) {} + ListItem(const TQString &st) : str(st) {} #else - ListItem(const QString &st, char *s=NULL, char *e=NULL) : Item(s, e), str(st) {} + ListItem(const TQString &st, char *s=NULL, char *e=NULL) : Item(s, e), str(st) {} #endif - QString str; + TQString str; }; struct SubPixel : public Item @@ -103,7 +103,7 @@ class KXftConfig }; #ifdef HAVE_FONTCONFIG - SubPixel(Type t, QDomNode &n) : Item(n), type(t) {} + SubPixel(Type t, TQDomNode &n) : Item(n), type(t) {} SubPixel(Type t=None) : type(t) {} #else SubPixel(Type t=None, char *s=NULL, char *e=NULL) : Item(s, e), type(t) {} @@ -116,7 +116,7 @@ class KXftConfig struct Exclude : public Item { #ifdef HAVE_FONTCONFIG - Exclude(double f, double t, QDomNode &n) : Item(n), from(f), to(t) {} + Exclude(double f, double t, TQDomNode &n) : Item(n), from(f), to(t) {} Exclude(double f=0, double t=0) : from(f), to(t) {} #else Exclude(double f=0, double t=0, char *s=NULL, char *e=NULL) : Item(s, e), from(f), to(t) {} @@ -139,7 +139,7 @@ class KXftConfig Full }; - Hint(Style s, QDomNode &n) : Item(n), style(s) {} + Hint(Style s, TQDomNode &n) : Item(n), style(s) {} Hint(Style s=NotSet) : style(s) {} void reset() { Item::reset(); style=NotSet; } @@ -149,7 +149,7 @@ class KXftConfig struct Hinting : public Item { - Hinting(bool s, QDomNode &n) : Item(n), set(s) {} + Hinting(bool s, TQDomNode &n) : Item(n), set(s) {} Hinting(bool s=true) : set(s) {} void reset() { Item::reset(); set=true; } @@ -159,7 +159,7 @@ class KXftConfig struct AntiAliasing : public Item { - AntiAliasing(bool s, QDomNode &n) : Item(n), set(s) {} + AntiAliasing(bool s, TQDomNode &n) : Item(n), set(s) {} AntiAliasing(bool s=true) : set(s) {} void reset() { Item::reset(); set=true; } @@ -170,8 +170,8 @@ class KXftConfig public: - static QString contractHome(QString path); - static QString expandHome(QString path); + static TQString contractHome(TQString path); + static TQString expandHome(TQString path); // // Constructor @@ -193,38 +193,38 @@ class KXftConfig void setSubPixelType(SubPixel::Type type); // SubPixel::None => turn off sub-pixel hinting bool getExcludeRange(double &from, double &to); void setExcludeRange(double from, double to); // from:0, to:0 => turn off exclude range - void addDir(const QString &d); - void removeDir(const QString &d); + void addDir(const TQString &d); + void removeDir(const TQString &d); void clearDirs() { clearList(m_dirs); } - QStringList getDirs() { return getList(m_dirs); } + TQStringList getDirs() { return getList(m_dirs); } #ifdef HAVE_FONTCONFIG bool getHintStyle(Hint::Style &style); void setHintStyle(Hint::Style style); #else - void addSymbolFamily(const QString &f) { addItem(m_symbolFamilies, f); } - void removeSymbolFamily(const QString &f) { removeItem(m_symbolFamilies, f); } + void addSymbolFamily(const TQString &f) { addItem(m_symbolFamilies, f); } + void removeSymbolFamily(const TQString &f) { removeItem(m_symbolFamilies, f); } void clearSymbolFamilies() { clearList(m_symbolFamilies); } - QStringList getSymbolFamilies() { return getList(m_symbolFamilies); } + TQStringList getSymbolFamilies() { return getList(m_symbolFamilies); } #endif void setAntiAliasing(bool set); bool getAntiAliasing() const; bool changed() { return m_madeChanges; } - static QString description(SubPixel::Type t); + static TQString description(SubPixel::Type t); static const char * toStr(SubPixel::Type t); #ifdef HAVE_FONTCONFIG - static QString description(Hint::Style s); + static TQString description(Hint::Style s); static const char * toStr(Hint::Style s); #endif - bool hasDir(const QString &d); + bool hasDir(const TQString &d); private: - ListItem * findItem(QPtrList &list, const QString &i); - void clearList(QPtrList &list); - static QStringList getList(QPtrList &list); - void addItem(QPtrList &list, const QString &i); - void removeItem(QPtrList &list, ListItem *item); - void removeItem(QPtrList &list, const QString &i) { removeItem(list, findItem(list, i)); } + ListItem * findItem(TQPtrList &list, const TQString &i); + void clearList(TQPtrList &list); + static TQStringList getList(TQPtrList &list); + void addItem(TQPtrList &list, const TQString &i); + void removeItem(TQPtrList &list, ListItem *item); + void removeItem(TQPtrList &list, const TQString &i) { removeItem(list, findItem(list, i)); } void readContents(); #ifdef HAVE_FONTCONFIG void applyDirs(); @@ -237,11 +237,11 @@ class KXftConfig void setHinting(bool set); void applyHinting(); void applyExcludeRange(bool pixel); - void removeItems(QPtrList &list); + void removeItems(TQPtrList &list); #else - void outputDir(std::ofstream &f, const QString &str); + void outputDir(std::ofstream &f, const TQString &str); void outputNewDirs(std::ofstream &f); - void outputSymbolFamily(std::ofstream &f, const QString &str); + void outputSymbolFamily(std::ofstream &f, const TQString &str); void outputNewSymbolFamilies(std::ofstream &f); void outputSubPixelType(std::ofstream &f, bool ifNew); void outputExcludeRange(std::ofstream &f, bool ifNew, bool pixel); @@ -258,13 +258,13 @@ class KXftConfig AntiAliasing m_antiAliasing; bool aliasingEnabled(); #else - QPtrList m_symbolFamilies; + TQPtrList m_symbolFamilies; #endif - QPtrList m_dirs; - QString m_file; + TQPtrList m_dirs; + TQString m_file; int m_required; #ifdef HAVE_FONTCONFIG - QDomDocument m_doc; + TQDomDocument m_doc; #else int m_size; char *m_data; -- cgit v1.2.3