diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:43:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:43:15 +0000 |
commit | e654398e46e37abf457b2b1122ab898d2c51c49f (patch) | |
tree | d39ee6440f3c3663c3ead84a2d4cc2d034667e96 /noatun/modules/kjofol-skin/kjprefs.cpp | |
parent | e4f29b18e19394b9352f52a6c0d0d0e3932cf511 (diff) | |
download | tdemultimedia-e654398e46e37abf457b2b1122ab898d2c51c49f.tar.gz tdemultimedia-e654398e46e37abf457b2b1122ab898d2c51c49f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1157644 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun/modules/kjofol-skin/kjprefs.cpp')
-rw-r--r-- | noatun/modules/kjofol-skin/kjprefs.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/noatun/modules/kjofol-skin/kjprefs.cpp b/noatun/modules/kjofol-skin/kjprefs.cpp index 0cadc5ac..4231d0ff 100644 --- a/noatun/modules/kjofol-skin/kjprefs.cpp +++ b/noatun/modules/kjofol-skin/kjprefs.cpp @@ -14,19 +14,19 @@ #include "parser.h" // system includes -#include <qcheckbox.h> -#include <qcombobox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qslider.h> -#include <qpixmap.h> -#include <qtabwidget.h> -#include <qtextbrowser.h> -#include <qfileinfo.h> -#include <qstringlist.h> -#include <qregexp.h> +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> +#include <tqslider.h> +#include <tqpixmap.h> +#include <tqtabwidget.h> +#include <tqtextbrowser.h> +#include <tqfileinfo.h> +#include <tqstringlist.h> +#include <tqregexp.h> #include <knuminput.h> #include <kconfig.h> @@ -43,19 +43,19 @@ #include <kfontcombo.h> #include <kcolorcombo.h> -static QString expand(QString s); +static TQString expand(TQString s); -KJPrefs::KJPrefs(QObject* parent) +KJPrefs::KJPrefs(TQObject* parent) : CModule(i18n("K-Jöfol Skins"), i18n("Skin Selection For the K-Jöfol Plugin"), "style", parent) { cfg = KGlobal::config(); - QVBoxLayout *vbox = new QVBoxLayout(this); + TQVBoxLayout *vbox = new TQVBoxLayout(this); vbox->setAutoAdd(true); vbox->setSpacing( 0 ); vbox->setMargin( 0 ); - mTabWidget = new QTabWidget( this, "mTabWidget" ); + mTabWidget = new TQTabWidget( this, "mTabWidget" ); mSkinselectorWidget = new KJSkinselector ( mTabWidget, "mSkinselectorWidget" ); mGuiSettingsWidget = new KJGuiSettings ( mTabWidget, "mGuiSettingsWidget" ); @@ -63,9 +63,9 @@ KJPrefs::KJPrefs(QObject* parent) mTabWidget->insertTab( mSkinselectorWidget, i18n("&Skin Selector") ); mTabWidget->insertTab( mGuiSettingsWidget, i18n("O&ther Settings") ); - connect ( mSkinselectorWidget->mSkins, SIGNAL(activated(const QString&)), SLOT(showPreview(const QString&)) ); - connect ( mSkinselectorWidget->installButton, SIGNAL(clicked()), this, SLOT(installNewSkin()) ); - connect ( mSkinselectorWidget->mRemoveButton, SIGNAL(clicked()), this, SLOT(removeSelectedSkin()) ); + connect ( mSkinselectorWidget->mSkins, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(showPreview(const TQString&)) ); + connect ( mSkinselectorWidget->installButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(installNewSkin()) ); + connect ( mSkinselectorWidget->mRemoveButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(removeSelectedSkin()) ); reopen(); // fill the skinlist and draw a preview } @@ -88,7 +88,7 @@ void KJPrefs::reopen() // reload config and set stuff in dialog mGuiSettingsWidget->useSysFont->setChecked( cfg->readBoolEntry("Use SysFont", false) ); mGuiSettingsWidget->cmbSysFont->setCurrentFont( cfg->readEntry("SysFont Family", KGlobalSettings::generalFont().family()) ); - QColor tmpColor = QColor(255,255,255); + TQColor tmpColor = TQColor(255,255,255); mGuiSettingsWidget->cmbSysFontColor->setColor( cfg->readColorEntry("SysFont Color", &tmpColor)); @@ -127,18 +127,18 @@ void KJPrefs::reopen() // reload config and set stuff in dialog break; } - QStringList skins; - QStringList skinLocations = KGlobal::dirs()->findDirs("data", "noatun/skins/kjofol"); + TQStringList skins; + TQStringList skinLocations = KGlobal::dirs()->findDirs("data", "noatun/skins/kjofol"); // iterate through all paths where Noatun is searching for kjofol-skins for (uint i = 0; i < skinLocations.count(); ++i ) { - QStringList skinDirs = QDir(skinLocations[i]).entryList(); + TQStringList skinDirs = TQDir(skinLocations[i]).entryList(); // iterate trough all dirs (normally, users can fsck every dir-struct *g*) containing a skin for (uint k = 2; k < skinDirs.count(); ++k ) { - QDir skinDirCnt = QDir ( skinLocations[i]+skinDirs[k], "*.rc", QDir::Name|QDir::IgnoreCase, QDir::Files ); + TQDir skinDirCnt = TQDir ( skinLocations[i]+skinDirs[k], "*.rc", TQDir::Name|TQDir::IgnoreCase, TQDir::Files ); // make a list of all .rc-files in a skindir - QStringList rcFiles = skinDirCnt.entryList(); + TQStringList rcFiles = skinDirCnt.entryList(); // iterate trough all those rc.-files in a skindir for (uint j = 0; j < rcFiles.count(); j++ ) { @@ -150,14 +150,14 @@ void KJPrefs::reopen() // reload config and set stuff in dialog skins.sort(); - QString loaded = cfg->readEntry("SkinResource", locate("data", "noatun/skins/kjofol/kjofol/kjofol.rc") ); + TQString loaded = cfg->readEntry("SkinResource", locate("data", "noatun/skins/kjofol/kjofol/kjofol.rc") ); loaded = loaded.mid(loaded.findRev("/")+1); // remove path loaded = loaded.left( loaded.length() - 3 ); // remove ".rc" mSkinselectorWidget->mSkins->clear(); int index = 0; - for (QStringList::Iterator i=skins.begin(); i!=skins.end(); ++i) + for (TQStringList::Iterator i=skins.begin(); i!=skins.end(); ++i) { *i = (*i).left( (*i).length() - 3 ); mSkinselectorWidget->mSkins->insertItem(*i); @@ -174,7 +174,7 @@ void KJPrefs::reopen() // reload config and set stuff in dialog void KJPrefs::save() { // kdDebug(66666) << k_funcinfo << "called." << endl; - QString skin=::expand ( mSkinselectorWidget->mSkins->currentText() ); + TQString skin=::expand ( mSkinselectorWidget->mSkins->currentText() ); // first load skin and then save config to prevent // reloading a broken skin after a crash @@ -206,7 +206,7 @@ void KJPrefs::save() emit configChanged(); } -QString KJPrefs::skin( void ) const +TQString KJPrefs::skin( void ) const { // return full path to currently loaded skin return ::expand( mSkinselectorWidget->mSkins->currentText() ); @@ -312,24 +312,24 @@ void KJPrefs::setUseSysFont( bool mode ) save(); // not sure if that's a good idea or doing saving by hand in here } -QFont KJPrefs::sysFont(void) const +TQFont KJPrefs::sysFont(void) const { - QString family = mGuiSettingsWidget->cmbSysFont->currentFont(); + TQString family = mGuiSettingsWidget->cmbSysFont->currentFont(); // kdDebug(66666) << k_funcinfo << "family=" << family << endl; - return QFont( family ); + return TQFont( family ); } -void KJPrefs::setSysFont(QFont &fnt) +void KJPrefs::setSysFont(TQFont &fnt) { mGuiSettingsWidget->cmbSysFont->setCurrentFont( fnt.family() ); } -QColor KJPrefs::sysFontColor(void) const +TQColor KJPrefs::sysFontColor(void) const { return mGuiSettingsWidget->cmbSysFontColor->color(); } -void KJPrefs::sysFontColor(QColor &c) +void KJPrefs::sysFontColor(TQColor &c) { mGuiSettingsWidget->cmbSysFontColor->setColor( c ); } @@ -345,19 +345,19 @@ bool KJPrefs::displaySplash( void ) const } -void KJPrefs::showPreview(const QString &_skin) +void KJPrefs::showPreview(const TQString &_skin) { Parser p; p.open( ::expand(_skin) ); - QImage image = p.image(p["BackgroundImage"][1]); + TQImage image = p.image(p["BackgroundImage"][1]); if (!image.isNull()) { mPixmap.convertFromImage(image); mPixmap.setMask( KJWidget::getMask(image) ); } else - mPixmap=QPixmap(); + mPixmap=TQPixmap(); mSkinselectorWidget->mPreview->setPixmap(mPixmap); mSkinselectorWidget->mAboutText->setText(p.about()); @@ -406,7 +406,7 @@ void KJPrefs::installNewSkin( void ) // create a dir with name of the skinarchive // path to unpack to: pathToTmp/filename.ext/ - QString tmpUnpackPath = locateLocal("tmp", srcFile.fileName()+"/" ); + TQString tmpUnpackPath = locateLocal("tmp", srcFile.fileName()+"/" ); kdDebug(66666) << "tmpUnpackPath: " << tmpUnpackPath.latin1() << endl; // Our extract-process, TODO: wanna have kio_(un)zip instead :) @@ -429,10 +429,10 @@ void KJPrefs::installNewSkin( void ) return; } - QDir tmpCnt = QDir ( tmpUnpackPath ); - tmpCnt.setFilter ( QDir::Dirs ); + TQDir tmpCnt = TQDir ( tmpUnpackPath ); + tmpCnt.setFilter ( TQDir::Dirs ); - QStringList dirList = tmpCnt.entryList(); + TQStringList dirList = tmpCnt.entryList(); // Iterate trough all subdirs of tmpUnpackPath (including "."!) for ( unsigned int i = 0; i < dirList.count(); i++ ) { @@ -440,8 +440,8 @@ void KJPrefs::installNewSkin( void ) if ( dirList[i] == ".." ) continue; - QDir tmpSubCnt = QDir( tmpUnpackPath + dirList[i], "*.rc;*.RC;*.Rc;*.rC", QDir::Name|QDir::IgnoreCase, QDir::Files ); - kdDebug(66666) << "Searching for *.rc in " << QString(tmpUnpackPath+dirList[i]).latin1() << endl; + TQDir tmpSubCnt = TQDir( tmpUnpackPath + dirList[i], "*.rc;*.RC;*.Rc;*.rC", TQDir::Name|TQDir::IgnoreCase, TQDir::Files ); + kdDebug(66666) << "Searching for *.rc in " << TQString(tmpUnpackPath+dirList[i]).latin1() << endl; // oh, no .rc file in current dir, let's go to next dir in list if ( tmpSubCnt.count() == 0 ) @@ -488,7 +488,7 @@ void KJPrefs::installNewSkin( void ) kdDebug(66666) << "src: " << src.path().latin1() << endl; kdDebug(66666) << "dst: " << dst.path().latin1() << endl; KIO::Job *job = KIO::copy(src,dst); - connect ( job, SIGNAL(result(KIO::Job*)), this, SLOT(slotResult(KIO::Job*)) ); + connect ( job, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotResult(KIO::Job*)) ); skinInstalled = true; } } // END iterate trough dirList @@ -508,43 +508,43 @@ void KJPrefs::installNewSkin( void ) void KJPrefs::removeSelectedSkin( void ) { - QString question = i18n("Are you sure you want to remove %1?\n" + TQString question = i18n("Are you sure you want to remove %1?\n" "This will delete the files installed by this skin "). arg ( mSkinselectorWidget->mSkins->currentText() ); cfg->setGroup("KJofol-Skins"); - QString loadedSkin = cfg->readEntry("SkinResource", "kjofol"); -// kdDebug(66666) << "loaded Skin Name: " << QFileInfo(loadedSkin).baseName().latin1() << endl; + TQString loadedSkin = cfg->readEntry("SkinResource", "kjofol"); +// kdDebug(66666) << "loaded Skin Name: " << TQFileInfo(loadedSkin).baseName().latin1() << endl; int r = KMessageBox::warningContinueCancel ( this, question, i18n("Confirmation"), KStdGuiItem::del() ); if ( r != KMessageBox::Continue ) return; - bool deletingCurrentSkin = ( mSkinselectorWidget->mSkins->currentText() == QFileInfo(loadedSkin).baseName() ); + bool deletingCurrentSkin = ( mSkinselectorWidget->mSkins->currentText() == TQFileInfo(loadedSkin).baseName() ); // Now find the dir to delete !!! - QString dirToDelete = QString (""); - QStringList skinLocations = KGlobal::dirs()->findDirs("data", "noatun/skins/kjofol"); + TQString dirToDelete = TQString (""); + TQStringList skinLocations = KGlobal::dirs()->findDirs("data", "noatun/skins/kjofol"); // iterate through all paths where Noatun is searching for kjofol-skins for (uint i = 0; i < skinLocations.count(); ++i ) { - QStringList skinDirs = QDir(skinLocations[i]).entryList(); + TQStringList skinDirs = TQDir(skinLocations[i]).entryList(); // iterate trough all dirs containing a skin for (uint k = 0; k < skinDirs.count(); ++k ) { - QDir skinDirCnt = QDir ( skinLocations[i]+skinDirs[k], "*.rc", QDir::Name|QDir::IgnoreCase, QDir::Files ); + TQDir skinDirCnt = TQDir ( skinLocations[i]+skinDirs[k], "*.rc", TQDir::Name|TQDir::IgnoreCase, TQDir::Files ); // make a list of all .rc-files in a skindir - QStringList rcFiles = skinDirCnt.entryList(); + TQStringList rcFiles = skinDirCnt.entryList(); // iterate trough all those rc.-files in a skindir for (uint j = 0; j < rcFiles.count(); j++ ) { if ( rcFiles[j].left(rcFiles[j].length()-3) == mSkinselectorWidget->mSkins->currentText() ) // found skinname.rc :) { - dirToDelete = QString ( skinLocations[i]+skinDirs[k] ); + dirToDelete = TQString ( skinLocations[i]+skinDirs[k] ); kdDebug(66666) << "FOUND SKIN @ " << dirToDelete.latin1() << endl; } } @@ -555,7 +555,7 @@ void KJPrefs::removeSelectedSkin( void ) { kdDebug(66666) << "Deleting Skindir: " << dirToDelete.latin1() << endl; KIO::Job *job = KIO::del( dirToDelete, false, true ); - connect ( job, SIGNAL(result(KIO::Job*)), this, SLOT(slotResult(KIO::Job*)) ); + connect ( job, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotResult(KIO::Job*)) ); } int item = -1; @@ -597,51 +597,51 @@ void KJPrefs::slotResult(KIO::Job *job ) // takes name of rc-file without .rc at the end and returns full path to rc-file -static QString expand(QString s) +static TQString expand(TQString s) { // kdDebug(66666) << "expand( "<< s.latin1() << " )" << endl; - QStringList skinLocations = KGlobal::dirs()->findDirs("data", "noatun/skins/kjofol"); + TQStringList skinLocations = KGlobal::dirs()->findDirs("data", "noatun/skins/kjofol"); // iterate through all paths where Noatun is searching for kjofol-skins for (uint i = 0; i < skinLocations.count(); ++i ) { - QStringList skinDirs = QDir(skinLocations[i]).entryList(); + TQStringList skinDirs = TQDir(skinLocations[i]).entryList(); // iterate trough all dirs containing a skin for (uint k = 0; k < skinDirs.count(); ++k ) { - QDir skinDirCnt = QDir ( skinLocations[i]+skinDirs[k], "*.rc", QDir::Name|QDir::IgnoreCase, QDir::Files ); + TQDir skinDirCnt = TQDir ( skinLocations[i]+skinDirs[k], "*.rc", TQDir::Name|TQDir::IgnoreCase, TQDir::Files ); // make a list of all .rc-files in a skindir - QStringList rcFiles = skinDirCnt.entryList(); + TQStringList rcFiles = skinDirCnt.entryList(); // iterate trough all those rc.-files in a skindir for (uint j = 0; j < rcFiles.count(); j++ ) { if ( rcFiles[j].left(rcFiles[j].length()-3) == s ) // found $s.rc :) { -// kdDebug(66666) << "expand() found: " << QString(skinLocations[i]+skinDirs[k]+"/"+rcFiles[j]).latin1() << endl; +// kdDebug(66666) << "expand() found: " << TQString(skinLocations[i]+skinDirs[k]+"/"+rcFiles[j]).latin1() << endl; return (skinLocations[i]+skinDirs[k]+"/"+rcFiles[j]); } } } } - return QString(); + return TQString(); } -QString filenameNoCase(const QString &filename, int badNodes) +TQString filenameNoCase(const TQString &filename, int badNodes) { - QStringList names=QStringList::split('/', filename); - QString full; + TQStringList names=TQStringList::split('/', filename); + TQString full; int number=(int)names.count(); - for (QStringList::Iterator i=names.begin(); i!=names.end(); ++i) + for (TQStringList::Iterator i=names.begin(); i!=names.end(); ++i) { full+="/"; if (number<=badNodes) { - QDir d(full); - QStringList files=d.entryList(); - files=files.grep(QRegExp("^"+ (*i) + "$", false)); + TQDir d(full); + TQStringList files=d.entryList(); + files=files.grep(TQRegExp("^"+ (*i) + "$", false)); if (!files.count()) return ""; *i=files.grep(*i, false)[0]; |