summaryrefslogtreecommitdiffstats
path: root/src/document/RoseXmlHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/document/RoseXmlHandler.cpp')
-rw-r--r--src/document/RoseXmlHandler.cpp160
1 files changed, 80 insertions, 80 deletions
diff --git a/src/document/RoseXmlHandler.cpp b/src/document/RoseXmlHandler.cpp
index 99718f3..ea49839 100644
--- a/src/document/RoseXmlHandler.cpp
+++ b/src/document/RoseXmlHandler.cpp
@@ -120,7 +120,7 @@ bool ConfigurationXmlSubHandler::startElement(const TQString&, const TQString&,
// handle alternative encoding for properties with arbitrary names
m_propertyName = atts.value("name");
TQString value = atts.value("value");
- if (value) {
+ if (!value.isNull()) {
m_propertyType = "String";
m_configuration->set<String>(qstrtostr(m_propertyName),
qstrtostr(value));
@@ -433,7 +433,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
// std::cerr << "\n\n\nRosegarden file version = \"" << version << "\"\n\n\n" << std::endl;
- if (smajor) {
+ if (!smajor.isNull()) {
int major = smajor.toInt();
int minor = sminor.toInt();
@@ -477,17 +477,17 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
//
TQString thruStr = atts.value("thrufilter");
- if (thruStr)
+ if (!thruStr.isNull())
getStudio().setMIDIThruFilter(thruStr.toInt());
TQString recordStr = atts.value("recordfilter");
- if (recordStr)
+ if (!recordStr.isNull())
getStudio().setMIDIRecordFilter(recordStr.toInt());
TQString inputStr = atts.value("audioinputpairs");
- if (inputStr) {
+ if (!inputStr.isNull()) {
int inputs = inputStr.toInt();
if (inputs < 1)
inputs = 1; // we simply don't permit no inputs
@@ -498,14 +498,14 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
TQString mixerStr = atts.value("mixerdisplayoptions");
- if (mixerStr) {
+ if (!mixerStr.isNull()) {
unsigned int mixer = mixerStr.toUInt();
getStudio().setMixerDisplayOptions(mixer);
}
TQString metronomeStr = atts.value("metronomedevice");
- if (metronomeStr) {
+ if (!metronomeStr.isNull()) {
DeviceId metronome = metronomeStr.toUInt();
getStudio().setMetronomeDevice(metronome);
}
@@ -519,32 +519,32 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
timeT t = 0;
TQString timeStr = atts.value("time");
- if (timeStr)
+ if (!timeStr.isNull())
t = timeStr.toInt();
int num = 4;
TQString numStr = atts.value("numerator");
- if (numStr)
+ if (!numStr.isNull())
num = numStr.toInt();
int denom = 4;
TQString denomStr = atts.value("denominator");
- if (denomStr)
+ if (!denomStr.isNull())
denom = denomStr.toInt();
bool common = false;
TQString commonStr = atts.value("common");
- if (commonStr)
+ if (!commonStr.isNull())
common = (commonStr == "true");
bool hidden = false;
TQString hiddenStr = atts.value("hidden");
- if (hiddenStr)
+ if (!hiddenStr.isNull())
hidden = (hiddenStr == "true");
bool hiddenBars = false;
TQString hiddenBarsStr = atts.value("hiddenbars");
- if (hiddenBarsStr)
+ if (!hiddenBarsStr.isNull())
hiddenBars = (hiddenBarsStr == "true");
getComposition().addTimeSignature
@@ -554,21 +554,21 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
timeT t = 0;
TQString timeStr = atts.value("time");
- if (timeStr)
+ if (!timeStr.isNull())
t = timeStr.toInt();
tempoT tempo = Composition::getTempoForQpm(120.0);
TQString tempoStr = atts.value("tempo");
TQString targetStr = atts.value("target");
TQString bphStr = atts.value("bph");
- if (tempoStr) {
+ if (!tempoStr.isNull()) {
tempo = tempoStr.toInt();
- } else if (bphStr) {
+ } else if (!bphStr.isNull()) {
tempo = Composition::getTempoForQpm
(double(bphStr.toInt()) / 60.0);
}
- if (targetStr) {
+ if (!targetStr.isNull()) {
getComposition().addTempoAtTime(t, tempo, targetStr.toInt());
} else {
getComposition().addTempoAtTime(t, tempo);
@@ -587,12 +587,12 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
// Get and set the record track
//
TQString recordStr = atts.value("recordtrack");
- if (recordStr) {
+ if (!recordStr.isNull()) {
getComposition().setTrackRecording(recordStr.toInt(), true);
}
TQString recordPlStr = atts.value("recordtracks");
- if (recordPlStr) {
+ if (!recordPlStr.isNull()) {
RG_DEBUG << "Record tracks: " << recordPlStr << endl;
TQStringList recordList = TQStringList::split(',', recordPlStr);
for (TQStringList::iterator i = recordList.begin();
@@ -606,7 +606,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
//
int position = 0;
TQString positionStr = atts.value("pointer");
- if (positionStr) {
+ if (!positionStr.isNull()) {
position = positionStr.toInt();
}
@@ -618,12 +618,12 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
// older defaultTempo.
//
TQString tempoStr = atts.value("compositionDefaultTempo");
- if (tempoStr) {
+ if (!tempoStr.isNull()) {
tempoT tempo = tempoT(tempoStr.toInt());
getComposition().setCompositionDefaultTempo(tempo);
} else {
tempoStr = atts.value("defaultTempo");
- if (tempoStr) {
+ if (!tempoStr.isNull()) {
double tempo = qstrtodouble(tempoStr);
getComposition().setCompositionDefaultTempo
(Composition::getTempoForQpm(tempo));
@@ -639,7 +639,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
TQString loopStartStr = atts.value("loopstart");
TQString loopEndStr = atts.value("loopend");
- if (loopStartStr && loopEndStr) {
+ if (!loopStartStr.isNull() && !loopEndStr.isNull()) {
int loopStart = loopStartStr.toInt();
int loopEnd = loopEndStr.toInt();
@@ -649,7 +649,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
TQString selectedTrackStr = atts.value("selected");
- if (selectedTrackStr) {
+ if (!selectedTrackStr.isNull()) {
TrackId selectedTrack =
(TrackId)selectedTrackStr.toInt();
@@ -657,7 +657,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString soloTrackStr = atts.value("solo");
- if (soloTrackStr) {
+ if (!soloTrackStr.isNull()) {
if (soloTrackStr.toInt() == 1)
getComposition().setSolo(true);
else
@@ -666,7 +666,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
TQString playMetStr = atts.value("playmetronome");
- if (playMetStr) {
+ if (!playMetStr.isNull()) {
if (playMetStr.toInt())
getComposition().setPlayMetronome(true);
else
@@ -674,7 +674,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString recMetStr = atts.value("recordmetronome");
- if (recMetStr) {
+ if (!recMetStr.isNull()) {
if (recMetStr.toInt())
getComposition().setRecordMetronome(true);
else
@@ -682,23 +682,23 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString nextTriggerIdStr = atts.value("nexttriggerid");
- if (nextTriggerIdStr) {
+ if (!nextTriggerIdStr.isNull()) {
getComposition().setNextTriggerSegmentId(nextTriggerIdStr.toInt());
}
TQString copyrightStr = atts.value("copyright");
- if (copyrightStr) {
+ if (!copyrightStr.isNull()) {
getComposition().setCopyrightNote(qstrtostr(copyrightStr));
}
TQString startMarkerStr = atts.value("startMarker");
TQString endMarkerStr = atts.value("endMarker");
- if (startMarkerStr) {
+ if (!startMarkerStr.isNull()) {
getComposition().setStartMarker(startMarkerStr.toInt());
}
- if (endMarkerStr) {
+ if (!endMarkerStr.isNull()) {
getComposition().setEndMarker(endMarkerStr.toInt());
}
@@ -716,17 +716,17 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
bool muted = false;
TQString trackNbStr = atts.value("id");
- if (trackNbStr) {
+ if (!trackNbStr.isNull()) {
id = trackNbStr.toInt();
}
TQString labelStr = atts.value("label");
- if (labelStr) {
+ if (!labelStr.isNull()) {
label = qstrtostr(labelStr);
}
TQString mutedStr = atts.value("muted");
- if (mutedStr) {
+ if (!mutedStr.isNull()) {
if (mutedStr == "true")
muted = true;
else
@@ -734,12 +734,12 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString positionStr = atts.value("position");
- if (positionStr) {
+ if (!positionStr.isNull()) {
position = positionStr.toInt();
}
TQString instrumentStr = atts.value("instrument");
- if (instrumentStr) {
+ if (!instrumentStr.isNull()) {
instrument = instrumentStr.toInt();
}
@@ -754,42 +754,42 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
// here
TQString presetLabelStr = atts.value("defaultLabel");
- if (labelStr) {
+ if (!labelStr.isNull()) {
track->setPresetLabel(presetLabelStr.ascii());
}
TQString clefStr = atts.value("defaultClef");
- if (clefStr) {
+ if (!clefStr.isNull()) {
track->setClef(clefStr.toInt());
}
TQString transposeStr = atts.value("defaultTranspose");
- if (transposeStr) {
+ if (!transposeStr.isNull()) {
track->setTranspose(transposeStr.toInt());
}
TQString colorStr = atts.value("defaultColour");
- if (colorStr) {
+ if (!colorStr.isNull()) {
track->setColor(colorStr.toInt());
}
TQString highplayStr = atts.value("defaultHighestPlayable");
- if (highplayStr) {
+ if (!highplayStr.isNull()) {
track->setHighestPlayable(highplayStr.toInt());
}
TQString lowplayStr = atts.value("defaultLowestPlayable");
- if (lowplayStr) {
+ if (!lowplayStr.isNull()) {
track->setLowestPlayable(lowplayStr.toInt());
}
TQString staffSizeStr = atts.value("staffSize");
- if (staffSizeStr) {
+ if (!staffSizeStr.isNull()) {
track->setStaffSize(staffSizeStr.toInt());
}
TQString staffBracketStr = atts.value("staffBracket");
- if (staffBracketStr) {
+ if (!staffBracketStr.isNull()) {
track->setStaffBracket(staffBracketStr.toInt());
}
@@ -809,17 +809,17 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
int track = -1, startTime = 0;
unsigned int colourindex = 0;
TQString trackNbStr = atts.value("track");
- if (trackNbStr) {
+ if (!trackNbStr.isNull()) {
track = trackNbStr.toInt();
}
TQString startIdxStr = atts.value("start");
- if (startIdxStr) {
+ if (!startIdxStr.isNull()) {
startTime = startIdxStr.toInt();
}
TQString segmentType = (atts.value("type")).lower();
- if (segmentType) {
+ if (!segmentType.isNull()) {
if (segmentType == "audio") {
int audioFileId = atts.value("file").toInt();
@@ -854,7 +854,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString delayStr = atts.value("delay");
- if (delayStr) {
+ if (!delayStr.isNull()) {
RG_DEBUG << "Delay string is \"" << delayStr << "\"" << endl;
long delay = delayStr.toLong();
RG_DEBUG << "Delay is " << delay << endl;
@@ -864,8 +864,8 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
TQString rtDelaynSec = atts.value("rtdelaynsec");
TQString rtDelayuSec = atts.value("rtdelayusec");
TQString rtDelaySec = atts.value("rtdelaysec");
- if (rtDelaySec && (rtDelaynSec || rtDelayuSec)) {
- if (rtDelaynSec) {
+ if (!rtDelaySec.isNull() && (!rtDelaynSec.isNull() || !rtDelayuSec.isNull())) {
+ if (!rtDelaynSec.isNull()) {
m_currentSegment->setRealTimeDelay
(RealTime(rtDelaySec.toInt(),
rtDelaynSec.toInt()));
@@ -877,31 +877,31 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString transposeStr = atts.value("transpose");
- if (transposeStr)
+ if (!transposeStr.isNull())
m_currentSegment->setTranspose(transposeStr.toInt());
// fill in the label
TQString labelStr = atts.value("label");
- if (labelStr)
+ if (!labelStr.isNull())
m_currentSegment->setLabel(qstrtostr(labelStr));
m_currentSegment->setTrack(track);
//m_currentSegment->setStartTime(startTime);
TQString colourIndStr = atts.value("colourindex");
- if (colourIndStr) {
+ if (!colourIndStr.isNull()) {
colourindex = colourIndStr.toInt();
}
m_currentSegment->setColourIndex(colourindex);
TQString snapGridSizeStr = atts.value("snapgridsize");
- if (snapGridSizeStr) {
+ if (!snapGridSizeStr.isNull()) {
m_currentSegment->setSnapGridSize(snapGridSizeStr.toInt());
}
TQString viewFeaturesStr = atts.value("viewfeatures");
- if (viewFeaturesStr) {
+ if (!viewFeaturesStr.isNull()) {
m_currentSegment->setViewFeatures(viewFeaturesStr.toInt());
}
@@ -913,21 +913,21 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
TQString triggerRetuneStr = atts.value("triggerretune");
TQString triggerAdjustTimeStr = atts.value("triggeradjusttimes");
- if (triggerIdStr) {
+ if (!triggerIdStr.isNull()) {
int pitch = -1;
- if (triggerPitchStr)
+ if (!triggerPitchStr.isNull())
pitch = triggerPitchStr.toInt();
int velocity = -1;
- if (triggerVelocityStr)
+ if (!triggerVelocityStr.isNull())
velocity = triggerVelocityStr.toInt();
TriggerSegmentRec *rec =
getComposition().addTriggerSegment(m_currentSegment,
triggerIdStr.toInt(),
pitch, velocity);
if (rec) {
- if (triggerRetuneStr)
+ if (!triggerRetuneStr.isNull())
rec->setDefaultRetune(triggerRetuneStr.lower() == "true");
- if (triggerAdjustTimeStr)
+ if (!triggerAdjustTimeStr.isNull())
rec->setDefaultTimeAdjust(qstrtostr(triggerAdjustTimeStr));
}
m_currentSegment->setStartTimeDataMember(startTime);
@@ -937,7 +937,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
}
TQString endMarkerStr = atts.value("endmarker");
- if (endMarkerStr) {
+ if (!endMarkerStr.isNull()) {
delete m_segmentEndMarkerTime;
m_segmentEndMarkerTime = new timeT(endMarkerStr.toInt());
}
@@ -1246,10 +1246,10 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
skipToNextPlayDevice();
if (m_device) {
- if (nameStr && nameStr != "") {
+ if (!nameStr.isNull() && nameStr != "") {
m_device->setName(qstrtostr(nameStr));
}
- } else if (nameStr && nameStr != "") {
+ } else if (!nameStr.isNull() && nameStr != "") {
addMIDIDevice(nameStr, m_createDevices); // also sets m_device
}
}
@@ -1366,7 +1366,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
m_lsb),
pc,
qstrtostr(nameStr),
- keyMappingStr ? qstrtostr(keyMappingStr) : "");
+ (!keyMappingStr.isNull()) ? qstrtostr(keyMappingStr) : "");
if (m_device->getType() == Device::Midi) {
// Insert the program
@@ -1412,7 +1412,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
if (m_keyMapping) {
TQString numStr = atts.value("number");
TQString namStr = atts.value("name");
- if (numStr && namStr) {
+ if (!numStr.isNull() && !namStr.isNull()) {
m_keyNameMap[numStr.toInt()] = qstrtostr(namStr);
}
}
@@ -1702,7 +1702,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
std::string program = "";
TQString progStr = atts.value("program");
- if (progStr) {
+ if (!progStr.isNull()) {
program = qstrtostr(progStr);
}
@@ -1715,8 +1715,8 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
AudioPlugin *plugin = 0;
AudioPluginManager *apm = getAudioPluginManager();
- if (!identifier) {
- if (atts.value("id")) {
+ if (identifier.isNull()) {
+ if (!(atts.value("id")).isNull()) {
unsigned long id = atts.value("id").toULong();
if (apm)
plugin = apm->getPluginByUniqueId(id);
@@ -1750,10 +1750,10 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
// we shouldn't be halting import of the RG file just because
// we can't match a plugin
//
- if (identifier) {
+ if (!identifier.isNull()) {
RG_DEBUG << "WARNING: RoseXmlHandler: plugin " << identifier << " not found" << endl;
m_pluginsNotFound.insert(identifier);
- } else if (atts.value("id")) {
+ } else if (!(atts.value("id")).isNull()) {
RG_DEBUG << "WARNING: RoseXmlHandler: plugin uid " << atts.value("id") << " not found" << endl;
} else {
m_errorString = "No plugin identifier or uid specified";
@@ -1764,7 +1764,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
if (lcName == "synth") {
TQString identifier = atts.value("identifier");
- if (identifier) {
+ if (!identifier.isNull()) {
RG_DEBUG << "WARNING: RoseXmlHandler: no instrument for plugin " << identifier << endl;
m_pluginsNotFound.insert(identifier);
}
@@ -1823,19 +1823,19 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
MidiMetronome metronome(instrument);
- if (atts.value("barpitch"))
+ if (!(atts.value("barpitch")).isNull())
metronome.setBarPitch(atts.value("barpitch").toInt());
- if (atts.value("beatpitch"))
+ if (!(atts.value("beatpitch")).isNull())
metronome.setBeatPitch(atts.value("beatpitch").toInt());
- if (atts.value("subbeatpitch"))
+ if (!(atts.value("subbeatpitch")).isNull())
metronome.setSubBeatPitch(atts.value("subbeatpitch").toInt());
- if (atts.value("depth"))
+ if (!(atts.value("depth")).isNull())
metronome.setDepth(atts.value("depth").toInt());
- if (atts.value("barvelocity"))
+ if (!(atts.value("barvelocity")).isNull())
metronome.setBarVelocity(atts.value("barvelocity").toInt());
- if (atts.value("beatvelocity"))
+ if (!(atts.value("beatvelocity")).isNull())
metronome.setBeatVelocity(atts.value("beatvelocity").toInt());
- if (atts.value("subbeatvelocity"))
+ if (!(atts.value("subbeatvelocity")).isNull())
metronome.setSubBeatVelocity(atts.value("subbeatvelocity").toInt());
dynamic_cast<MidiDevice*>(m_device)->
@@ -1964,7 +1964,7 @@ RoseXmlHandler::startElement(const TQString& namespaceURI,
int channel = atts.value("channel").toInt();
TQString type = atts.value("type");
- if (type) {
+ if (!type.isNull()) {
if (type.lower() == "buss") {
if (m_instrument)
m_instrument->setAudioInputToBuss(value, channel);
@@ -2359,7 +2359,7 @@ RoseXmlHandler::setMIDIDeviceName(TQString name)
arg << (unsigned int)md->getId();
arg << name;
- std::cerr << "Renaming device " << md->getId() << " to " << name << std::endl;
+ std::cerr << "Renaming device " << md->getId() << " to " << name.ascii() << std::endl;
rgapp->sequencerSend("renameDevice(unsigned int, TQString)",
data);