diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-15 15:34:15 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-15 15:34:15 -0600 |
commit | 031454e56009d576589c28757f6c6fcf4884095e (patch) | |
tree | ad4c9959d05a814c9090e8fe63ba27057903271b /src/field.cpp | |
parent | 54011e0e1af8cd96162160ecf5d361a59a2c733e (diff) | |
download | tellico-031454e56009d576589c28757f6c6fcf4884095e.tar.gz tellico-031454e56009d576589c28757f6c6fcf4884095e.zip |
Rename a number of old tq methods that are no longer tq specific
Diffstat (limited to 'src/field.cpp')
-rw-r--r-- | src/field.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/field.cpp b/src/field.cpp index c260e9a..0e9b809 100644 --- a/src/field.cpp +++ b/src/field.cpp @@ -26,14 +26,14 @@ #include <tqdatetime.h> namespace { - static const TQRegExp comma_split = TQRegExp(TQString::tqfromLatin1("\\s*,\\s*")); + static const TQRegExp comma_split = TQRegExp(TQString::fromLatin1("\\s*,\\s*")); } using Tellico::Data::Field; //these get overwritten, but are here since they're static TQStringList Field::s_articlesApos; -TQRegExp Field::s_delimiter = TQRegExp(TQString::tqfromLatin1("\\s*;\\s*")); +TQRegExp Field::s_delimiter = TQRegExp(TQString::fromLatin1("\\s*;\\s*")); // this constructor is for anything but Choice type Field::Field(const TQString& name_, const TQString& title_, Type type_/*=Line*/) @@ -54,15 +54,15 @@ Field::Field(const TQString& name_, const TQString& title_, Type type_/*=Line*/) m_flags = AllowMultiple; if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } else { - setProperty(TQString::tqfromLatin1("columns"), TQChar('1')); + setProperty(TQString::fromLatin1("columns"), TQChar('1')); } } else if(m_type == Date) { // hidden from user m_formatFlag = FormatDate; } else if(m_type == Rating) { - setProperty(TQString::tqfromLatin1("minimum"), TQChar('1')); - setProperty(TQString::tqfromLatin1("maximum"), TQChar('5')); + setProperty(TQString::fromLatin1("minimum"), TQChar('1')); + setProperty(TQString::fromLatin1("maximum"), TQChar('5')); } m_id = getID(); } @@ -83,7 +83,7 @@ Field::Field(const Field& field_) m_allowed = field_.allowed(); } else if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } m_id = getID(); } @@ -101,7 +101,7 @@ Field& Field::operator=(const Field& field_) { m_allowed = field_.allowed(); } else if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } m_flags = field_.flags(); m_formatFlag = field_.formatFlag(); @@ -129,10 +129,10 @@ void Field::setType(Field::Type type_) { m_flags |= AllowMultiple; if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } - if(property(TQString::tqfromLatin1("columns")).isEmpty()) { - setProperty(TQString::tqfromLatin1("columns"), TQChar('1')); + if(property(TQString::fromLatin1("columns")).isEmpty()) { + setProperty(TQString::fromLatin1("columns"), TQChar('1')); } } if(isSingleCategory()) { @@ -167,12 +167,12 @@ void Field::setFormatFlag(FormatFlag flag_) { } const TQString& Field::defaultValue() const { - return property(TQString::tqfromLatin1("default")); + return property(TQString::fromLatin1("default")); } void Field::setDefaultValue(const TQString& value_) { if(m_type != Choice || m_allowed.findIndex(value_) > -1) { - setProperty(TQString::tqfromLatin1("default"), value_); + setProperty(TQString::fromLatin1("default"), value_); } } @@ -208,7 +208,7 @@ TQStringList Field::dependsOn() const { return list; } - TQRegExp rx(TQString::tqfromLatin1("%\\{(.+)\\}")); + TQRegExp rx(TQString::fromLatin1("%\\{(.+)\\}")); rx.setMinimal(true); // do NOT call recursively! for(int pos = m_desc.find(rx); pos > -1; pos = m_desc.find(rx, pos+3)) { @@ -246,7 +246,7 @@ TQString Field::format(const TQString& value_, FormatFlag flag_) { TQString Field::formatTitle(const TQString& title_) { TQString newTitle = title_; // special case for multi-column tables, assume user never has '::' in a value - const TQString colonColon = TQString::tqfromLatin1("::"); + const TQString colonColon = TQString::fromLatin1("::"); TQString tail; if(newTitle.find(colonColon) > -1) { tail = colonColon + newTitle.section(colonColon, 1); @@ -265,11 +265,11 @@ TQString Field::formatTitle(const TQString& title_) { // assume white space is already stripped // the articles are already in lower-case if(lower.startsWith(*it + TQChar(' '))) { - TQRegExp regexp(TQChar('^') + TQRegExp::escape(*it) + TQString::tqfromLatin1("\\s*"), false); + TQRegExp regexp(TQChar('^') + TQRegExp::escape(*it) + TQString::fromLatin1("\\s*"), false); // can't just use *it since it's in lower-case TQString article = newTitle.left((*it).length()); newTitle = newTitle.replace(regexp, TQString()) - .append(TQString::tqfromLatin1(", ")) + .append(TQString::fromLatin1(", ")) .append(article); break; } @@ -277,15 +277,15 @@ TQString Field::formatTitle(const TQString& title_) { } // also, arbitrarily impose rule that a space must follow every comma - newTitle.replace(comma_split, TQString::tqfromLatin1(", ")); + newTitle.replace(comma_split, TQString::fromLatin1(", ")); return newTitle + tail; } TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { - static const TQRegExp spaceComma(TQString::tqfromLatin1("[\\s,]")); - static const TQString colonColon = TQString::tqfromLatin1("::"); + static const TQRegExp spaceComma(TQString::fromLatin1("[\\s,]")); + static const TQString colonColon = TQString::fromLatin1("::"); // the ending look-ahead is so that a space is not added at the end - static const TQRegExp periodSpace(TQString::tqfromLatin1("\\.\\s*(?=.)")); + static const TQRegExp periodSpace(TQString::fromLatin1("\\.\\s*(?=.)")); TQStringList entries; if(multiple_) { @@ -307,7 +307,7 @@ TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { tail = colonColon + name.section(colonColon, 1); name = name.section(colonColon, 0, 0); } - name.replace(periodSpace, TQString::tqfromLatin1(". ")); + name.replace(periodSpace, TQString::fromLatin1(". ")); if(Config::autoCapitalization()) { name = capitalize(name); } @@ -320,7 +320,7 @@ TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { if(!Config::autoFormat() || (name.find(',') > -1 && Config::nameSuffixList().grep(lastWord).isEmpty())) { // arbitrarily impose rule that no spaces before a comma and // a single space after every comma - name.replace(comma_split, TQString::tqfromLatin1(", ")); + name.replace(comma_split, TQString::fromLatin1(", ")); names << name + tail; continue; } @@ -354,7 +354,7 @@ TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { } } - return names.join(TQString::tqfromLatin1("; ")); + return names.join(TQString::fromLatin1("; ")); } TQString Field::formatDate(const TQString& date_) { @@ -366,11 +366,11 @@ TQString Field::formatDate(const TQString& date_) { // for empty month or date, use 1 TQStringList s = TQStringList::split('-', date_, true); bool ok = true; - int y = s.count() > 0 ? s[0].toInt(&ok) : TQDate::tqcurrentDate().year(); + int y = s.count() > 0 ? s[0].toInt(&ok) : TQDate::currentDate().year(); if(ok) { empty = false; } else { - y = TQDate::tqcurrentDate().year(); + y = TQDate::currentDate().year(); } int m = s.count() > 1 ? s[1].toInt(&ok) : 1; if(ok) { @@ -392,13 +392,13 @@ TQString Field::formatDate(const TQString& date_) { TQString Field::capitalize(TQString str_) { // regexp to split words - static const TQRegExp rx(TQString::tqfromLatin1("[-\\s,.;]")); + static const TQRegExp rx(TQString::fromLatin1("[-\\s,.;]")); if(str_.isEmpty()) { return str_; } // first letter is always capitalized - str_.replace(0, 1, str_.tqat(0).upper()); + str_.replace(0, 1, str_.at(0).upper()); // special case for french words like l'espace @@ -418,7 +418,7 @@ TQString Field::capitalize(TQString str_) { for(TQStringList::ConstIterator it = s_articlesApos.begin(); it != s_articlesApos.end(); ++it) { if(word.lower().startsWith(*it)) { uint l = (*it).length(); - str_.replace(l, 1, str_.tqat(l).upper()); + str_.replace(l, 1, str_.at(l).upper()); break; } } @@ -435,7 +435,7 @@ TQString Field::capitalize(TQString str_) { for(TQStringList::ConstIterator it = s_articlesApos.begin(); it != s_articlesApos.end(); ++it) { if(word.lower().startsWith(*it)) { uint l = (*it).length(); - str_.replace(pos+l+1, 1, str_.tqat(pos+l+1).upper()); + str_.replace(pos+l+1, 1, str_.at(pos+l+1).upper()); aposMatch = true; break; } @@ -444,7 +444,7 @@ TQString Field::capitalize(TQString str_) { if(!aposMatch) { wordRx.setPattern(TQChar('^') + TQRegExp::escape(word) + TQChar('$')); if(notCap.grep(wordRx).isEmpty() && nextPos-pos > 1) { - str_.replace(pos+1, 1, str_.tqat(pos+1).upper()); + str_.replace(pos+1, 1, str_.at(pos+1).upper()); } } @@ -547,7 +547,7 @@ void Field::convertOldRating(Data::FieldPtr field_) { } if(field_->name() != Latin1Literal("rating") - && field_->property(TQString::tqfromLatin1("rating")) != Latin1Literal("true")) { + && field_->property(TQString::fromLatin1("rating")) != Latin1Literal("true")) { return; // nothing to do } @@ -568,9 +568,9 @@ void Field::convertOldRating(Data::FieldPtr field_) { min = 1; max = 5; } - field_->setProperty(TQString::tqfromLatin1("minimum"), TQString::number(min)); - field_->setProperty(TQString::tqfromLatin1("maximum"), TQString::number(max)); - field_->setProperty(TQString::tqfromLatin1("rating"), TQString()); + field_->setProperty(TQString::fromLatin1("minimum"), TQString::number(min)); + field_->setProperty(TQString::fromLatin1("maximum"), TQString::number(max)); + field_->setProperty(TQString::fromLatin1("rating"), TQString()); field_->setType(Rating); } @@ -586,9 +586,9 @@ void Field::stripArticles(TQString& value) { return; } for(TQStringList::ConstIterator it = articles.begin(); it != articles.end(); ++it) { - TQRegExp rx(TQString::tqfromLatin1("\\b") + *it + TQString::tqfromLatin1("\\b")); + TQRegExp rx(TQString::fromLatin1("\\b") + *it + TQString::fromLatin1("\\b")); value.remove(rx); } value = value.stripWhiteSpace(); - value.remove(TQRegExp(TQString::tqfromLatin1(",$"))); + value.remove(TQRegExp(TQString::fromLatin1(",$"))); } |