comparison framework/MainWindowBase.cpp @ 294:933b5aed341a

Drop toStdString() and toLocal8Bit().data(), with debug header we can stream QStrings
author Chris Cannam
date Tue, 26 Nov 2013 14:14:25 +0000
parents 068235cf5bf7
children 14b1768e5406 c837368b1faf 428ce32a8dd9
comparison
equal deleted inserted replaced
293:068235cf5bf7 294:933b5aed341a
1130 1130
1131 if (templateName == "") { 1131 if (templateName == "") {
1132 templateName = getDefaultSessionTemplate(); 1132 templateName = getDefaultSessionTemplate();
1133 } 1133 }
1134 1134
1135 cerr << "template is: \"" << templateName.toStdString() << "\"" << endl; 1135 cerr << "template is: \"" << templateName << "\"" << endl;
1136 1136
1137 if (!source.isAvailable()) return FileOpenFailed; 1137 if (!source.isAvailable()) return FileOpenFailed;
1138 source.waitForData(); 1138 source.waitForData();
1139 1139
1140 m_openingAudioFile = true; 1140 m_openingAudioFile = true;
1446 PaneCallback callback(this); 1446 PaneCallback callback(this);
1447 QFile file(path); 1447 QFile file(path);
1448 1448
1449 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { 1449 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
1450 cerr << "ERROR: MainWindowBase::openLayer(" 1450 cerr << "ERROR: MainWindowBase::openLayer("
1451 << source.getLocation().toStdString() 1451 << source.getLocation()
1452 << "): Failed to open file for reading" << endl; 1452 << "): Failed to open file for reading" << endl;
1453 return FileOpenFailed; 1453 return FileOpenFailed;
1454 } 1454 }
1455 1455
1456 SVFileReader reader(m_document, callback, source.getLocation()); 1456 SVFileReader reader(m_document, callback, source.getLocation());
1465 QXmlInputSource inputSource(&file); 1465 QXmlInputSource inputSource(&file);
1466 reader.parse(inputSource); 1466 reader.parse(inputSource);
1467 1467
1468 if (!reader.isOK()) { 1468 if (!reader.isOK()) {
1469 cerr << "ERROR: MainWindowBase::openLayer(" 1469 cerr << "ERROR: MainWindowBase::openLayer("
1470 << source.getLocation().toStdString() 1470 << source.getLocation()
1471 << "): Failed to read XML file: " 1471 << "): Failed to read XML file: "
1472 << reader.getErrorString() << endl; 1472 << reader.getErrorString() << endl;
1473 return FileOpenFailed; 1473 return FileOpenFailed;
1474 } 1474 }
1475 1475
1724 // priority over a bundled one; we don't unbundle, but 1724 // priority over a bundled one; we don't unbundle, but
1725 // open directly from the bundled file (where applicable) 1725 // open directly from the bundled file (where applicable)
1726 ResourceFinder rf; 1726 ResourceFinder rf;
1727 QString tfile = rf.getResourcePath("templates", templateName + ".svt"); 1727 QString tfile = rf.getResourcePath("templates", templateName + ".svt");
1728 if (tfile != "") { 1728 if (tfile != "") {
1729 cerr << "SV loading template file " << tfile.toStdString() << endl; 1729 cerr << "SV loading template file " << tfile << endl;
1730 return openSessionTemplate(FileSource("file:" + tfile)); 1730 return openSessionTemplate(FileSource("file:" + tfile));
1731 } else { 1731 } else {
1732 return FileOpenFailed; 1732 return FileOpenFailed;
1733 } 1733 }
1734 } 1734 }
1735 1735
1736 MainWindowBase::FileOpenStatus 1736 MainWindowBase::FileOpenStatus
1737 MainWindowBase::openSessionTemplate(FileSource source) 1737 MainWindowBase::openSessionTemplate(FileSource source)
1738 { 1738 {
1739 cerr << "MainWindowBase::openSessionTemplate(" << source.getLocation().toStdString() << ")" << endl; 1739 cerr << "MainWindowBase::openSessionTemplate(" << source.getLocation() << ")" << endl;
1740 1740
1741 if (!source.isAvailable()) return FileOpenFailed; 1741 if (!source.isAvailable()) return FileOpenFailed;
1742 source.waitForData(); 1742 source.waitForData();
1743 1743
1744 QXmlInputSource *inputSource = 0; 1744 QXmlInputSource *inputSource = 0;
2064 TempWriteFile temp(path); 2064 TempWriteFile temp(path);
2065 2065
2066 BZipFileDevice bzFile(temp.getTemporaryFilename()); 2066 BZipFileDevice bzFile(temp.getTemporaryFilename());
2067 if (!bzFile.open(QIODevice::WriteOnly)) { 2067 if (!bzFile.open(QIODevice::WriteOnly)) {
2068 cerr << "Failed to open session file \"" 2068 cerr << "Failed to open session file \""
2069 << temp.getTemporaryFilename().toStdString() 2069 << temp.getTemporaryFilename()
2070 << "\" for writing: " 2070 << "\" for writing: "
2071 << bzFile.errorString() << endl; 2071 << bzFile.errorString() << endl;
2072 return false; 2072 return false;
2073 } 2073 }
2074 2074
2109 TempWriteFile temp(path); 2109 TempWriteFile temp(path);
2110 2110
2111 QFile file(temp.getTemporaryFilename()); 2111 QFile file(temp.getTemporaryFilename());
2112 if (!file.open(QIODevice::WriteOnly)) { 2112 if (!file.open(QIODevice::WriteOnly)) {
2113 cerr << "Failed to open session template file \"" 2113 cerr << "Failed to open session template file \""
2114 << temp.getTemporaryFilename().toStdString() 2114 << temp.getTemporaryFilename()
2115 << "\" for writing: " 2115 << "\" for writing: "
2116 << file.errorString().toStdString() << endl; 2116 << file.errorString() << endl;
2117 return false; 2117 return false;
2118 } 2118 }
2119 2119
2120 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 2120 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2121 2121