summaryrefslogtreecommitdiffstats
path: root/kcoloredit/palette.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-02 19:23:46 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-02 19:23:46 +0000
commiteba47f8f0637f451e21348187591e1f1fd58ac74 (patch)
tree448f10b95c656604acc331a3236c1e59bde5c1ad /kcoloredit/palette.cpp
parentc7e8736c69373f48b0401319757c742e8607431a (diff)
downloadtdegraphics-eba47f8f0637f451e21348187591e1f1fd58ac74.tar.gz
tdegraphics-eba47f8f0637f451e21348187591e1f1fd58ac74.zip
TQt conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1158446 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcoloredit/palette.cpp')
-rw-r--r--kcoloredit/palette.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/kcoloredit/palette.cpp b/kcoloredit/palette.cpp
index 1e11aa27..42758b41 100644
--- a/kcoloredit/palette.cpp
+++ b/kcoloredit/palette.cpp
@@ -15,10 +15,10 @@
* *
***************************************************************************/
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
#include <kglobal.h>
#include <kstandarddirs.h>
#include <klocale.h>
@@ -45,17 +45,17 @@ void Palette::init() {
colors.setAutoDelete(true);
}
-QStringList Palette::kdePalettes() {
- QStringList paletteList;
+TQStringList Palette::kdePalettes() {
+ TQStringList paletteList;
KGlobal::dirs()->findAllResources("config", palettesDir + "/*", false, true, paletteList);
return paletteList;
}
-void Palette::setName(const QString& name) {
+void Palette::setName(const TQString& name) {
m_name = name;
}
-const QString& Palette::name() const {
+const TQString& Palette::name() const {
return m_name;
}
@@ -102,20 +102,20 @@ void Palette::paste(const int index, Palette& palette) {
insert(index + colorIndex, new Color( *palette.color(colorIndex) ));
}
-bool Palette::load(QTextStream& stream, bool loadName /* = true */) {
+bool Palette::load(TQTextStream& stream, bool loadName /* = true */) {
bool result = true;
setName("KDE palette");
int lineNum = 0;
while (!stream.atEnd()) {
- QString string = stream.readLine().append(' ');
- if(string.find( QRegExp("[^\\s]") ) == -1 ||
+ TQString string = stream.readLine().append(' ');
+ if(string.find( TQRegExp("[^\\s]") ) == -1 ||
string.stripWhiteSpace().at( 0 ) == '#' ||
( loadName && lineNum == 0 )) {
if(loadName && lineNum == 0)
setName(string.stripWhiteSpace());
} else {
Color* newColor = new Color();
- int position = string.find(QRegExp( "[^\\s]" ));
+ int position = string.find(TQRegExp( "[^\\s]" ));
for(int componentIndex = 0; componentIndex < Color::COMPONENTS_NUM;
++componentIndex) {
if(position == -1) {
@@ -123,13 +123,13 @@ bool Palette::load(QTextStream& stream, bool loadName /* = true */) {
result = false;
break;
}
- int endPosition = string.find(QRegExp( "\\s" ), position);
+ int endPosition = string.find(TQRegExp( "\\s" ), position);
if(endPosition == -1) {
m_errorString = i18n("Invalid format");
result = false;
break;
}
- QString componentString = string.mid(position, endPosition - position);
+ TQString componentString = string.mid(position, endPosition - position);
int componentValue = componentString.toInt(&result);
if(!result ||
componentValue < 0 ||
@@ -139,7 +139,7 @@ bool Palette::load(QTextStream& stream, bool loadName /* = true */) {
break;
}
newColor->setComponent(componentIndex, componentValue);
- position = string.find(QRegExp( "[^\\s]" ), endPosition);
+ position = string.find(TQRegExp( "[^\\s]" ), endPosition);
}
if(!result) {
delete newColor;
@@ -156,44 +156,44 @@ bool Palette::load(QTextStream& stream, bool loadName /* = true */) {
return result;
}
-bool Palette::load(const QString& fileName) {
+bool Palette::load(const TQString& fileName) {
bool result = true;
- QFile file(fileName);
+ TQFile file(fileName);
if(!file.open( IO_ReadOnly )) {
m_errorString = i18n("Could not open file");
result = false;
} else {
- QTextStream stream(&file);
+ TQTextStream stream(&file);
result = load(stream);
file.close();
}
return result;
}
-bool Palette::save(QTextStream& stream, const QFile* file /* = 0 */,
+bool Palette::save(TQTextStream& stream, const TQFile* file /* = 0 */,
bool saveName /* = true */) {
bool result = true;
if(saveName)
- stream << name() + QString("\n");
+ stream << name() + TQString("\n");
if(file && file->status() != IO_Ok) {
m_errorString = i18n("Write error");
result = false;
} else
for(int colorIndex = 0; colorIndex < length(); ++colorIndex) {
Color* col = color(colorIndex);
- QString redComponentString;
- QString greenComponentString;
- QString blueComponentString;
+ TQString redComponentString;
+ TQString greenComponentString;
+ TQString blueComponentString;
redComponentString.setNum(col->component( Color::RED_INDEX ));
greenComponentString.setNum(col->component( Color::GREEN_INDEX ));
blueComponentString.setNum(col->component( Color::BLUE_INDEX ));
- QString nameString = col->name();
+ TQString nameString = col->name();
if(!nameString.isEmpty())
nameString.prepend(" ");
- stream << redComponentString + QString(" ") +
- greenComponentString + QString(" ") +
+ stream << redComponentString + TQString(" ") +
+ greenComponentString + TQString(" ") +
blueComponentString +
- nameString + QString("\n");
+ nameString + TQString("\n");
if(file && file->status() != IO_Ok) {
m_errorString = i18n("Write error");
result = false;
@@ -203,14 +203,14 @@ bool Palette::save(QTextStream& stream, const QFile* file /* = 0 */,
return result;
}
-bool Palette::save(const QString& fileName) {
+bool Palette::save(const TQString& fileName) {
bool result = true;
- QFile file(fileName);
+ TQFile file(fileName);
if(!file.open( IO_WriteOnly|IO_Truncate )) {
m_errorString = i18n("Could not open file for writing");
result = false;
} else {
- QTextStream stream(&file);
+ TQTextStream stream(&file);
result = save(stream);
file.close();
}
@@ -221,6 +221,6 @@ void Palette::deleteContents() {
colors.clear();
}
-const QString& Palette::errorString() const {
+const TQString& Palette::errorString() const {
return m_errorString;
}