summaryrefslogtreecommitdiffstats
path: root/src/gui/editors/notation/NoteFontMap.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-06 20:59:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-06 20:59:29 +0000
commit11f31c37e5fa4889d9989f10272f44845449cb7b (patch)
tree4383da04a76c497950d957fc6120b0fd0d9082c2 /src/gui/editors/notation/NoteFontMap.cpp
parent832eb69d571e8e518db45d0c0e6fbc0f00690209 (diff)
downloadrosegarden-11f31c37e5fa4889d9989f10272f44845449cb7b.tar.gz
rosegarden-11f31c37e5fa4889d9989f10272f44845449cb7b.zip
Initial TQt conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1172292 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/editors/notation/NoteFontMap.cpp')
-rw-r--r--src/gui/editors/notation/NoteFontMap.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/gui/editors/notation/NoteFontMap.cpp b/src/gui/editors/notation/NoteFontMap.cpp
index e11c126..9640087 100644
--- a/src/gui/editors/notation/NoteFontMap.cpp
+++ b/src/gui/editors/notation/NoteFontMap.cpp
@@ -32,12 +32,12 @@
#include "base/Exception.h"
#include "SystemFont.h"
#include <kglobal.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qpixmap.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqpixmap.h>
+#include <tqregexp.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
namespace Rosegarden
@@ -54,23 +54,23 @@ NoteFontMap::NoteFontMap(std::string name) :
{
m_fontDirectory = KGlobal::dirs()->findResource("appdata", "fonts/");
- QString mapFileName;
+ TQString mapFileName;
- QString mapFileMixedName = QString("%1/mappings/%2.xml")
+ TQString mapFileMixedName = TQString("%1/mappings/%2.xml")
.arg(m_fontDirectory)
.arg(strtoqstr(name));
- QFileInfo mapFileMixedInfo(mapFileMixedName);
+ TQFileInfo mapFileMixedInfo(mapFileMixedName);
if (!mapFileMixedInfo.isReadable()) {
- QString lowerName = strtoqstr(name).lower();
- lowerName.replace(QRegExp(" "), "_");
- QString mapFileLowerName = QString("%1/mappings/%2.xml")
+ TQString lowerName = strtoqstr(name).lower();
+ lowerName.replace(TQRegExp(" "), "_");
+ TQString mapFileLowerName = TQString("%1/mappings/%2.xml")
.arg(m_fontDirectory)
.arg(lowerName);
- QFileInfo mapFileLowerInfo(mapFileLowerName);
+ TQFileInfo mapFileLowerInfo(mapFileLowerName);
if (!mapFileLowerInfo.isReadable()) {
if (mapFileLowerName != mapFileMixedName) {
@@ -89,10 +89,10 @@ NoteFontMap::NoteFontMap(std::string name) :
mapFileName = mapFileMixedName;
}
- QFile mapFile(mapFileName);
+ TQFile mapFile(mapFileName);
- QXmlInputSource source(mapFile);
- QXmlSimpleReader reader;
+ TQXmlInputSource source(mapFile);
+ TQXmlSimpleReader reader;
reader.setContentHandler(this);
reader.setErrorHandler(this);
bool ok = reader.parse(source);
@@ -112,7 +112,7 @@ NoteFontMap::~NoteFontMap()
}
bool
-NoteFontMap::characters(QString &chars)
+NoteFontMap::characters(TQString &chars)
{
if (!m_characterDestination)
return true;
@@ -131,11 +131,11 @@ NoteFontMap::toSize(int baseSize, double factor, bool limitAtOne)
}
bool
-NoteFontMap::startElement(const QString &, const QString &,
- const QString &qName,
- const QXmlAttributes &attributes)
+NoteFontMap::startElement(const TQString &, const TQString &,
+ const TQString &qName,
+ const TQXmlAttributes &attributes)
{
- QString lcName = qName.lower();
+ TQString lcName = qName.lower();
m_characterDestination = 0;
// The element names are actually unique within the whole file;
@@ -144,7 +144,7 @@ NoteFontMap::startElement(const QString &, const QString &,
if (lcName == "rosegarden-font-encoding") {
- QString s;
+ TQString s;
s = attributes.value("name");
if (s) {
@@ -154,7 +154,7 @@ NoteFontMap::startElement(const QString &, const QString &,
} else if (lcName == "font-information") {
- QString s;
+ TQString s;
s = attributes.value("origin");
if (s)
@@ -185,7 +185,7 @@ NoteFontMap::startElement(const QString &, const QString &,
}
else if (lcName == "font-size") {
- QString s = attributes.value("note-height");
+ TQString s = attributes.value("note-height");
if (!s) {
m_errorString = "note-height is a required attribute of font-size";
return false;
@@ -247,7 +247,7 @@ NoteFontMap::startElement(const QString &, const QString &,
double legerLineThickness = -1.0;
double stemThickness = -1.0;
- QString s;
+ TQString s;
s = attributes.value("font-height");
if (s)
@@ -334,7 +334,7 @@ NoteFontMap::startElement(const QString &, const QString &,
}
else if (lcName == "src-directory") {
- QString d = attributes.value("name");
+ TQString d = attributes.value("name");
if (!d) {
m_errorString = "name is a required attribute of src-directory";
return false;
@@ -346,7 +346,7 @@ NoteFontMap::startElement(const QString &, const QString &,
int bn = 0, fn = 0;
bool ok;
- QString base = attributes.value("base");
+ TQString base = attributes.value("base");
if (!base) {
m_errorString = "base is a required attribute of codebase";
return false;
@@ -354,12 +354,12 @@ NoteFontMap::startElement(const QString &, const QString &,
bn = base.toInt(&ok);
if (!ok || bn < 0) {
m_errorString =
- QString("invalid base attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid base attribute \"%1\" (must be integer >= 0)").
arg(base);
return false;
}
- QString fontId = attributes.value("font-id");
+ TQString fontId = attributes.value("font-id");
if (!fontId) {
m_errorString = "font-id is a required attribute of codebase";
return false;
@@ -367,7 +367,7 @@ NoteFontMap::startElement(const QString &, const QString &,
fn = fontId.stripWhiteSpace().toInt(&ok);
if (!ok || fn < 0) {
m_errorString =
- QString("invalid font-id attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid font-id attribute \"%1\" (must be integer >= 0)").
arg(fontId);
return false;
}
@@ -376,16 +376,16 @@ NoteFontMap::startElement(const QString &, const QString &,
} else if (lcName == "symbol") {
- QString symbolName = attributes.value("name");
+ TQString symbolName = attributes.value("name");
if (!symbolName) {
m_errorString = "name is a required attribute of symbol";
return false;
}
SymbolData symbolData;
- QString src = attributes.value("src");
- QString code = attributes.value("code");
- QString glyph = attributes.value("glyph");
+ TQString src = attributes.value("src");
+ TQString code = attributes.value("code");
+ TQString glyph = attributes.value("glyph");
int icode = -1;
bool ok = false;
@@ -393,7 +393,7 @@ NoteFontMap::startElement(const QString &, const QString &,
icode = code.stripWhiteSpace().toInt(&ok);
if (!ok || icode < 0) {
m_errorString =
- QString("invalid code attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid code attribute \"%1\" (must be integer >= 0)").
arg(code);
return false;
}
@@ -406,7 +406,7 @@ NoteFontMap::startElement(const QString &, const QString &,
iglyph = glyph.stripWhiteSpace().toInt(&ok);
if (!ok || iglyph < 0) {
m_errorString =
- QString("invalid glyph attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid glyph attribute \"%1\" (must be integer >= 0)").
arg(glyph);
return false;
}
@@ -420,40 +420,40 @@ NoteFontMap::startElement(const QString &, const QString &,
if (src)
symbolData.setSrc(qstrtostr(src));
- QString inversionSrc = attributes.value("inversion-src");
+ TQString inversionSrc = attributes.value("inversion-src");
if (inversionSrc)
symbolData.setInversionSrc(qstrtostr(inversionSrc));
- QString inversionCode = attributes.value("inversion-code");
+ TQString inversionCode = attributes.value("inversion-code");
if (inversionCode) {
icode = inversionCode.stripWhiteSpace().toInt(&ok);
if (!ok || icode < 0) {
m_errorString =
- QString("invalid inversion code attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid inversion code attribute \"%1\" (must be integer >= 0)").
arg(inversionCode);
return false;
}
symbolData.setInversionCode(icode);
}
- QString inversionGlyph = attributes.value("inversion-glyph");
+ TQString inversionGlyph = attributes.value("inversion-glyph");
if (inversionGlyph) {
iglyph = inversionGlyph.stripWhiteSpace().toInt(&ok);
if (!ok || iglyph < 0) {
m_errorString =
- QString("invalid inversion glyph attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid inversion glyph attribute \"%1\" (must be integer >= 0)").
arg(inversionGlyph);
return false;
}
symbolData.setInversionGlyph(iglyph);
}
- QString fontId = attributes.value("font-id");
+ TQString fontId = attributes.value("font-id");
if (fontId) {
int n = fontId.stripWhiteSpace().toInt(&ok);
if (!ok || n < 0) {
m_errorString =
- QString("invalid font-id attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid font-id attribute \"%1\" (must be integer >= 0)").
arg(fontId);
return false;
}
@@ -466,7 +466,7 @@ NoteFontMap::startElement(const QString &, const QString &,
}
else if (lcName == "hotspot") {
- QString s = attributes.value("name");
+ TQString s = attributes.value("name");
if (!s) {
m_errorString = "name is a required attribute of hotspot";
return false;
@@ -480,7 +480,7 @@ NoteFontMap::startElement(const QString &, const QString &,
return false;
}
- QString s = attributes.value("x");
+ TQString s = attributes.value("x");
double x = -1.0;
if (s)
x = qstrtodouble(s);
@@ -507,7 +507,7 @@ NoteFontMap::startElement(const QString &, const QString &,
return false;
}
- QString s = attributes.value("x");
+ TQString s = attributes.value("x");
int x = 0;
if (s)
x = s.toInt();
@@ -532,7 +532,7 @@ NoteFontMap::startElement(const QString &, const QString &,
return false;
}
- QString s = attributes.value("note-height");
+ TQString s = attributes.value("note-height");
if (!s) {
m_errorString = "note-height is a required attribute of when";
return false;
@@ -563,14 +563,14 @@ NoteFontMap::startElement(const QString &, const QString &,
}
else if (lcName == "font-requirement") {
- QString id = attributes.value("font-id");
+ TQString id = attributes.value("font-id");
int n = -1;
bool ok = false;
if (id) {
n = id.stripWhiteSpace().toInt(&ok);
if (!ok) {
m_errorString =
- QString("invalid font-id attribute \"%1\" (must be integer >= 0)").
+ TQString("invalid font-id attribute \"%1\" (must be integer >= 0)").
arg(id);
return false;
}
@@ -579,8 +579,8 @@ NoteFontMap::startElement(const QString &, const QString &,
return false;
}
- QString name = attributes.value("name");
- QString names = attributes.value("names");
+ TQString name = attributes.value("name");
+ TQString names = attributes.value("names");
if (name) {
if (names) {
@@ -595,15 +595,15 @@ NoteFontMap::startElement(const QString &, const QString &,
m_systemFontNames[n] = name;
delete font;
} else {
- std::cerr << QString("Warning: Unable to load font \"%1\"").arg(name) << std::endl;
+ std::cerr << TQString("Warning: Unable to load font \"%1\"").arg(name) << std::endl;
m_ok = false;
}
} else if (names) {
bool have = false;
- QStringList list = QStringList::split(",", names, false);
- for (QStringList::Iterator i = list.begin(); i != list.end(); ++i) {
+ TQStringList list = TQStringList::split(",", names, false);
+ for (TQStringList::Iterator i = list.begin(); i != list.end(); ++i) {
SystemFont *font = SystemFont::loadSystemFont
(SystemFontSpec(*i, 12));
if (font) {
@@ -614,7 +614,7 @@ NoteFontMap::startElement(const QString &, const QString &,
}
}
if (!have) {
- std::cerr << QString("Warning: Unable to load any of the fonts in \"%1\"").
+ std::cerr << TQString("Warning: Unable to load any of the fonts in \"%1\"").
arg(names) << std::endl;
m_ok = false;
}
@@ -624,7 +624,7 @@ NoteFontMap::startElement(const QString &, const QString &,
return false;
}
- QString s = attributes.value("strategy").lower();
+ TQString s = attributes.value("strategy").lower();
SystemFont::Strategy strategy = SystemFont::PreferGlyphs;
if (s) {
@@ -654,25 +654,25 @@ NoteFontMap::startElement(const QString &, const QString &,
}
bool
-NoteFontMap::error(const QXmlParseException& exception)
+NoteFontMap::error(const TQXmlParseException& exception)
{
- m_errorString = QString("%1 at line %2, column %3: %4")
+ m_errorString = TQString("%1 at line %2, column %3: %4")
.arg(exception.message())
.arg(exception.lineNumber())
.arg(exception.columnNumber())
.arg(m_errorString);
- return QXmlDefaultHandler::error(exception);
+ return TQXmlDefaultHandler::error(exception);
}
bool
-NoteFontMap::fatalError(const QXmlParseException& exception)
+NoteFontMap::fatalError(const TQXmlParseException& exception)
{
- m_errorString = QString("%1 at line %2, column %3: %4")
+ m_errorString = TQString("%1 at line %2, column %3: %4")
.arg(exception.message())
.arg(exception.lineNumber())
.arg(exception.columnNumber())
.arg(m_errorString);
- return QXmlDefaultHandler::fatalError(exception);
+ return TQXmlDefaultHandler::fatalError(exception);
}
std::set<int>
@@ -704,23 +704,23 @@ NoteFontMap::getCharNames() const
bool
NoteFontMap::checkFile(int size, std::string &src) const
{
- QString pixmapFileMixedName = QString("%1/%2/%3/%4.xpm")
+ TQString pixmapFileMixedName = TQString("%1/%2/%3/%4.xpm")
.arg(m_fontDirectory)
.arg(strtoqstr(m_srcDirectory))
.arg(size)
.arg(strtoqstr(src));
- QFileInfo pixmapFileMixedInfo(pixmapFileMixedName);
+ TQFileInfo pixmapFileMixedInfo(pixmapFileMixedName);
if (!pixmapFileMixedInfo.isReadable()) {
- QString pixmapFileLowerName = QString("%1/%2/%3/%4.xpm")
+ TQString pixmapFileLowerName = TQString("%1/%2/%3/%4.xpm")
.arg(m_fontDirectory)
.arg(strtoqstr(m_srcDirectory).lower())
.arg(size)
.arg(strtoqstr(src));
- QFileInfo pixmapFileLowerInfo(pixmapFileLowerName);
+ TQFileInfo pixmapFileLowerInfo(pixmapFileLowerName);
if (!pixmapFileLowerInfo.isReadable()) {
if (pixmapFileMixedName != pixmapFileLowerName) {
@@ -803,7 +803,7 @@ const
SystemFontNameMap::const_iterator fni = m_systemFontNames.find(fontId);
if (fontId < 0 || fni == m_systemFontNames.end())
return false;
- QString fontName = fni->second;
+ TQString fontName = fni->second;
CharBaseMap::const_iterator bi = m_bases.find(fontId);
if (bi == m_bases.end())
@@ -994,7 +994,7 @@ NoteFontMap::HotspotData::getHotspot(int size, int width, int height,
QStringList
NoteFontMap::getSystemFontNames() const
{
- QStringList names;
+ TQStringList names;
for (SystemFontNameMap::const_iterator i = m_systemFontNames.begin();
i != m_systemFontNames.end(); ++i) {
names.append(i->second);