diff options
Diffstat (limited to 'src/gui/editors/notation/NoteFontMap.cpp')
-rw-r--r-- | src/gui/editors/notation/NoteFontMap.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/gui/editors/notation/NoteFontMap.cpp b/src/gui/editors/notation/NoteFontMap.cpp index 9036f20..47fc9f5 100644 --- a/src/gui/editors/notation/NoteFontMap.cpp +++ b/src/gui/editors/notation/NoteFontMap.cpp @@ -147,7 +147,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString s; s = attributes.value("name"); - if (s) { + if (!s.isNull()) { m_name = qstrtostr(s); m_srcDirectory = m_name; } @@ -157,28 +157,28 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString s; s = attributes.value("origin"); - if (s) + if (!s.isNull()) m_origin = qstrtostr(s); s = attributes.value("copyright"); - if (s) + if (!s.isNull()) m_copyright = qstrtostr(s); s = attributes.value("mapped-by"); - if (s) + if (!s.isNull()) m_mappedBy = qstrtostr(s); s = attributes.value("type"); - if (s) + if (!s.isNull()) m_type = qstrtostr(s); s = attributes.value("autocrop"); - if (s) { + if (!s.isNull()) { std::cerr << "Warning: autocrop attribute in note font mapping file is no longer supported\n(all fonts are now always autocropped)" << std::endl; } s = attributes.value("smooth"); - if (s) + if (!s.isNull()) m_smooth = (s.lower() == "true"); } else if (lcName == "font-sizes") { @@ -195,46 +195,46 @@ NoteFontMap::startElement(const TQString &, const TQString &, SizeData &sizeData = m_sizes[noteHeight]; s = attributes.value("staff-line-thickness"); - if (s) + if (!s.isNull()) sizeData.setStaffLineThickness(s.toInt()); s = attributes.value("leger-line-thickness"); - if (s) + if (!s.isNull()) sizeData.setLegerLineThickness(s.toInt()); s = attributes.value("stem-thickness"); - if (s) + if (!s.isNull()) sizeData.setStemThickness(s.toInt()); s = attributes.value("beam-thickness"); - if (s) + if (!s.isNull()) sizeData.setBeamThickness(s.toInt()); s = attributes.value("stem-length"); - if (s) + if (!s.isNull()) sizeData.setStemLength(s.toInt()); s = attributes.value("flag-spacing"); - if (s) + if (!s.isNull()) sizeData.setFlagSpacing(s.toInt()); s = attributes.value("border-x"); - if (s) { + if (!s.isNull()) { std::cerr << "Warning: border-x attribute in note font mapping file is no longer supported\n(use hotspot-x for note head or flag)" << std::endl; } s = attributes.value("border-y"); - if (s) { + if (!s.isNull()) { std::cerr << "Warning: border-y attribute in note font mapping file is no longer supported" << std::endl; } int fontId = 0; s = attributes.value("font-id"); - if (s) + if (!s.isNull()) fontId = s.toInt(); s = attributes.value("font-height"); - if (s) + if (!s.isNull()) sizeData.setFontHeight(fontId, s.toInt()); } else if (lcName == "font-scale") { @@ -250,7 +250,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString s; s = attributes.value("font-height"); - if (s) + if (!s.isNull()) fontHeight = qstrtodouble(s); else { m_errorString = "font-height is a required attribute of font-scale"; @@ -258,32 +258,32 @@ NoteFontMap::startElement(const TQString &, const TQString &, } s = attributes.value("staff-line-thickness"); - if (s) + if (!s.isNull()) staffLineThickness = qstrtodouble(s); s = attributes.value("leger-line-thickness"); - if (s) + if (!s.isNull()) legerLineThickness = qstrtodouble(s); s = attributes.value("stem-thickness"); - if (s) + if (!s.isNull()) stemThickness = qstrtodouble(s); s = attributes.value("beam-thickness"); - if (s) + if (!s.isNull()) beamThickness = qstrtodouble(s); s = attributes.value("stem-length"); - if (s) + if (!s.isNull()) stemLength = qstrtodouble(s); s = attributes.value("flag-spacing"); - if (s) + if (!s.isNull()) flagSpacing = qstrtodouble(s); int fontId = 0; s = attributes.value("font-id"); - if (s) + if (!s.isNull()) fontId = s.toInt(); //!!! need to be able to calculate max size -- checkFont needs @@ -389,7 +389,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, int icode = -1; bool ok = false; - if (code) { + if (!code.isNull()) { icode = code.stripWhiteSpace().toInt(&ok); if (!ok || icode < 0) { m_errorString = @@ -402,7 +402,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, int iglyph = -1; ok = false; - if (glyph) { + if (!glyph.isNull()) { iglyph = glyph.stripWhiteSpace().toInt(&ok); if (!ok || iglyph < 0) { m_errorString = @@ -417,15 +417,15 @@ NoteFontMap::startElement(const TQString &, const TQString &, m_errorString = "symbol must have either src, code, or glyph attribute"; return false; } - if (src) + if (!src.isNull()) symbolData.setSrc(qstrtostr(src)); TQString inversionSrc = attributes.value("inversion-src"); - if (inversionSrc) + if (!inversionSrc.isNull()) symbolData.setInversionSrc(qstrtostr(inversionSrc)); TQString inversionCode = attributes.value("inversion-code"); - if (inversionCode) { + if (!inversionCode.isNull()) { icode = inversionCode.stripWhiteSpace().toInt(&ok); if (!ok || icode < 0) { m_errorString = @@ -437,7 +437,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, } TQString inversionGlyph = attributes.value("inversion-glyph"); - if (inversionGlyph) { + if (!inversionGlyph.isNull()) { iglyph = inversionGlyph.stripWhiteSpace().toInt(&ok); if (!ok || iglyph < 0) { m_errorString = @@ -449,7 +449,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, } TQString fontId = attributes.value("font-id"); - if (fontId) { + if (!fontId.isNull()) { int n = fontId.stripWhiteSpace().toInt(&ok); if (!ok || n < 0) { m_errorString = @@ -482,7 +482,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString s = attributes.value("x"); double x = -1.0; - if (s) + if (!s.isNull()) x = qstrtodouble(s); s = attributes.value("y"); @@ -509,12 +509,12 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString s = attributes.value("x"); int x = 0; - if (s) + if (!s.isNull()) x = s.toInt(); s = attributes.value("y"); int y = 0; - if (s) + if (!s.isNull()) y = s.toInt(); HotspotDataMap::iterator i = m_hotspots.find(m_hotspotCharName); @@ -541,7 +541,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, s = attributes.value("x"); int x = 0; - if (s) + if (!s.isNull()) x = s.toInt(); s = attributes.value("y"); @@ -566,7 +566,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString id = attributes.value("font-id"); int n = -1; bool ok = false; - if (id) { + if (!id.isNull()) { n = id.stripWhiteSpace().toInt(&ok); if (!ok) { m_errorString = @@ -582,8 +582,8 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString name = attributes.value("name"); TQString names = attributes.value("names"); - if (name) { - if (names) { + if (!name.isNull()) { + if (!names.isNull()) { m_errorString = "font-requirement may have name or names attribute, but not both"; return false; } @@ -595,11 +595,11 @@ NoteFontMap::startElement(const TQString &, const TQString &, m_systemFontNames[n] = name; delete font; } else { - std::cerr << TQString("Warning: Unable to load font \"%1\"").tqarg(name) << std::endl; + std::cerr << TQString("Warning: Unable to load font \"%1\"").tqarg(name).ascii() << std::endl; m_ok = false; } - } else if (names) { + } else if (!names.isNull()) { bool have = false; TQStringList list = TQStringList::split(",", names, false); @@ -615,7 +615,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, } if (!have) { std::cerr << TQString("Warning: Unable to load any of the fonts in \"%1\""). - tqarg(names) << std::endl; + tqarg(names).ascii() << std::endl; m_ok = false; } @@ -627,7 +627,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, TQString s = attributes.value("strategy").lower(); SystemFont::Strategy strategy = SystemFont::PreferGlyphs; - if (s) { + if (!s.isNull()) { if (s == "prefer-glyphs") strategy = SystemFont::PreferGlyphs; else if (s == "prefer-codes") @@ -637,7 +637,7 @@ NoteFontMap::startElement(const TQString &, const TQString &, else if (s == "only-codes") strategy = SystemFont::OnlyCodes; else { - std::cerr << "Warning: Unknown strategy value " << s + std::cerr << "Warning: Unknown strategy value " << s.ascii() << " (known values are prefer-glyphs, prefer-codes," << " only-glyphs, only-codes)" << std::endl; } @@ -725,11 +725,11 @@ NoteFontMap::checkFile(int size, std::string &src) const if (!pixmapFileLowerInfo.isReadable()) { if (pixmapFileMixedName != pixmapFileLowerName) { std::cerr << "Warning: Unable to open pixmap file " - << pixmapFileMixedName << " or " << pixmapFileLowerName + << pixmapFileMixedName.ascii() << " or " << pixmapFileLowerName.ascii() << std::endl; } else { std::cerr << "Warning: Unable to open pixmap file " - << pixmapFileMixedName << std::endl; + << pixmapFileMixedName.ascii() << std::endl; } return false; } else { |