changeset 665:17fe7e0c23a1

Drop std:: from cerr, cout, endl; drop toStdString etc; build fix
author Chris Cannam
date Tue, 26 Nov 2013 14:17:48 +0000
parents b4a7c98e4c83
children 7707d9175d55
files .hgsubstate main/MainWindow.cpp main/OSCHandler.cpp main/PreferencesDialog.cpp main/Surveyer.cpp main/main.cpp
diffstat 6 files changed, 66 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Tue Nov 26 13:14:33 2013 +0000
+++ b/.hgsubstate	Tue Nov 26 14:17:48 2013 +0000
@@ -1,5 +1,5 @@
 236814e07bd07473958c1ff89103124536a0c3c8 dataquay
 3c5adc4a864fa75e5b1e67c260b77541aaa4f1f6 sv-dependency-builds
-3fc0df28953377c96e501f41db6fb80d29d6aa4a svapp
-23d3a6eca5c3d98f2875e1b1f58b17bb80c6414b svcore
-eaf4446a1bef283da661e0062f8495e0709f675c svgui
+933b5aed341a626a9db4a26df97ed73468211db4 svapp
+a299c4cec0f82099b61307b8f974fb12c6fb44fd svcore
+692a8b9804fe6b59cedf50d904a4bc983973d607 svgui
--- a/main/MainWindow.cpp	Tue Nov 26 13:14:33 2013 +0000
+++ b/main/MainWindow.cpp	Tue Nov 26 14:17:48 2013 +0000
@@ -122,9 +122,6 @@
 #include <cstdio>
 #include <errno.h>
 
-using std::cerr;
-using std::endl;
-
 using std::vector;
 using std::map;
 using std::set;
@@ -302,7 +299,7 @@
     connect(m_midiInput, SIGNAL(eventsAvailable()),
             this, SLOT(midiEventsAvailable()));
 
-    NetworkPermissionTester tester(this);
+    NetworkPermissionTester tester;
     bool networkPermission = tester.havePermission();
     if (networkPermission) {
         TransformFactory::getInstance()->startPopulationThread();
@@ -1568,7 +1565,7 @@
 	QString name = transforms[i].name;
 	if (name == "") name = transforms[i].identifier;
 
-//        std::cerr << "Plugin Name: " << name << std::endl;
+//        cerr << "Plugin Name: " << name << endl;
 
         TransformDescription::Type type = transforms[i].type;
         QString typeStr = factory->getTransformTypeName(type);
@@ -1602,19 +1599,19 @@
         action->setStatusTip(transforms[i].longDescription);
 
         if (categoryMenus[type].find(category) == categoryMenus[type].end()) {
-            std::cerr << "WARNING: MainWindow::setupMenus: Internal error: "
+            cerr << "WARNING: MainWindow::setupMenus: Internal error: "
                       << "No category menu for transform \""
                       << name << "\" (category = \""
-                      << category << "\")" << std::endl;
+                      << category << "\")" << endl;
         } else {
             categoryMenus[type][category]->addAction(action);
         }
 
         if (makerMenus[type].find(maker) == makerMenus[type].end()) {
-            std::cerr << "WARNING: MainWindow::setupMenus: Internal error: "
+            cerr << "WARNING: MainWindow::setupMenus: Internal error: "
                       << "No maker menu for transform \""
                       << name << "\" (maker = \""
-                      << maker << "\")" << std::endl;
+                      << maker << "\")" << endl;
         } else {
             makerMenus[type][maker]->addAction(action);
         }
@@ -1787,9 +1784,9 @@
         TransformActionReverseMap::iterator ti =
             m_transformActionsReverse.find(transforms[i]);
         if (ti == m_transformActionsReverse.end()) {
-            std::cerr << "WARNING: MainWindow::setupRecentTransformsMenu: "
-                      << "Unknown transform \"" << transforms[i].toStdString()
-                      << "\" in recent transforms list" << std::endl;
+            cerr << "WARNING: MainWindow::setupRecentTransformsMenu: "
+                      << "Unknown transform \"" << transforms[i]
+                      << "\" in recent transforms list" << endl;
             continue;
         }
         if (i == 0) {
@@ -1836,12 +1833,12 @@
 	    Layer *layer = pane->getLayer(j);
 	    if (!layer) continue;
 	    if (observedLayers.find(layer) != observedLayers.end()) {
-//		std::cerr << "found duplicate layer " << layer << std::endl;
+//		cerr << "found duplicate layer " << layer << endl;
 		continue;
 	    }
 
-//	    std::cerr << "found new layer " << layer << " (name = " 
-//		      << layer->getLayerPresentationName() << ")" << std::endl;
+//	    cerr << "found new layer " << layer << " (name = " 
+//		      << layer->getLayerPresentationName() << ")" << endl;
 
 	    orderedLayers.push_back(layer);
 	    observedLayers.insert(layer);
@@ -2416,7 +2413,7 @@
                  items, c, false, &ok);
             if (!ok || item.isEmpty()) return;
             if (m.find(item) == m.end()) {
-                cerr << "WARNING: Model " << item.toStdString()
+                cerr << "WARNING: Model " << item
                      << " not found in list!" << endl;
             } else {
                 model = m[item];
@@ -2563,13 +2560,13 @@
     
     if (!pane) {
 	// shouldn't happen, as the menu action should have been disabled
-	std::cerr << "WARNING: MainWindow::importLayer: no current pane" << std::endl;
+	cerr << "WARNING: MainWindow::importLayer: no current pane" << endl;
 	return;
     }
 
     if (!getMainModel()) {
 	// shouldn't happen, as the menu action should have been disabled
-	std::cerr << "WARNING: MainWindow::importLayer: No main model -- hence no default sample rate available" << std::endl;
+	cerr << "WARNING: MainWindow::importLayer: No main model -- hence no default sample rate available" << endl;
 	return;
     }
 
@@ -2950,8 +2947,8 @@
     QAction *action = dynamic_cast<QAction *>(obj);
     
     if (!action) {
-	std::cerr << "WARNING: MainWindow::openRecentFile: sender is not an action"
-		  << std::endl;
+	cerr << "WARNING: MainWindow::openRecentFile: sender is not an action"
+		  << endl;
 	return;
     }
 
@@ -2978,8 +2975,8 @@
     QAction *action = qobject_cast<QAction *>(s);
 
     if (!action) {
-	std::cerr << "WARNING: MainWindow::applyTemplate: sender is not an action"
-		  << std::endl;
+	cerr << "WARNING: MainWindow::applyTemplate: sender is not an action"
+		  << endl;
 	return;
     }
 
@@ -2987,8 +2984,8 @@
     if (n == "") n = action->text();
 
     if (n == "") {
-        std::cerr << "WARNING: MainWindow::applyTemplate: sender has no name"
-                  << std::endl;
+        cerr << "WARNING: MainWindow::applyTemplate: sender has no name"
+                  << endl;
         return;
     }
 
@@ -3129,16 +3126,16 @@
 void
 MainWindow::closeEvent(QCloseEvent *e)
 {
-//    std::cerr << "MainWindow::closeEvent" << std::endl;
+//    cerr << "MainWindow::closeEvent" << endl;
 
     if (m_openingAudioFile) {
-//        std::cerr << "Busy - ignoring close event" << std::endl;
+//        cerr << "Busy - ignoring close event" << endl;
 	e->ignore();
 	return;
     }
 
     if (!m_abandoning && !checkSaveModified()) {
-//        std::cerr << "Close refused by user - ignoring close event" << endl;
+//        cerr << "Close refused by user - ignoring close event" << endl;
 	e->ignore();
 	return;
     }
@@ -3366,16 +3363,16 @@
     QAction *action = dynamic_cast<QAction *>(s);
     
     if (!action) {
-	std::cerr << "WARNING: MainWindow::addPane: sender is not an action"
-		  << std::endl;
+	cerr << "WARNING: MainWindow::addPane: sender is not an action"
+		  << endl;
 	return;
     }
 
     PaneActionMap::iterator i = m_paneActions.find(action);
 
     if (i == m_paneActions.end()) {
-	std::cerr << "WARNING: MainWindow::addPane: unknown action "
-		  << action->objectName() << std::endl;
+	cerr << "WARNING: MainWindow::addPane: unknown action "
+		  << action->objectName() << endl;
 	return;
     }
 
@@ -3402,7 +3399,7 @@
         configuration.layer != LayerFactory::Spectrum) {
 
 	if (!m_timeRulerLayer) {
-//	    std::cerr << "no time ruler layer, creating one" << std::endl;
+//	    cerr << "no time ruler layer, creating one" << endl;
 	    m_timeRulerLayer = m_document->createMainModelLayer
 		(LayerFactory::TimeRuler);
 	}
@@ -3429,9 +3426,9 @@
         }
 
         if (!model) {
-            std::cerr << "WARNING: Model " << (void *)suggestedModel
+            cerr << "WARNING: Model " << (void *)suggestedModel
                       << " appears in pane action map, but is not reported "
-                      << "by document as a valid transform source" << std::endl;
+                      << "by document as a valid transform source" << endl;
         }
     }
 
@@ -3463,15 +3460,15 @@
     QAction *action = dynamic_cast<QAction *>(s);
     
     if (!action) {
-	std::cerr << "WARNING: MainWindow::addLayer: sender is not an action"
-		  << std::endl;
+	cerr << "WARNING: MainWindow::addLayer: sender is not an action"
+		  << endl;
 	return;
     }
 
     Pane *pane = m_paneStack->getCurrentPane();
     
     if (!pane) {
-	std::cerr << "WARNING: MainWindow::addLayer: no current pane" << std::endl;
+	cerr << "WARNING: MainWindow::addLayer: no current pane" << endl;
 	return;
     }
 
@@ -3511,8 +3508,8 @@
 	LayerActionMap::iterator i = m_layerActions.find(action);
 	
 	if (i == m_layerActions.end()) {
-	    std::cerr << "WARNING: MainWindow::addLayer: unknown action "
-		      << action->objectName() << std::endl;
+	    cerr << "WARNING: MainWindow::addLayer: unknown action "
+		      << action->objectName() << endl;
 	    return;
 	}
 
@@ -3560,12 +3557,12 @@
                     m_document->setChannel(newLayer, i->second.channel);
                     m_document->setModel(newLayer, model);
                 } else {
-                    std::cerr << "WARNING: MainWindow::addLayer: unknown model "
+                    cerr << "WARNING: MainWindow::addLayer: unknown model "
                               << model
                               << " (\""
-                              << (model ? model->objectName().toStdString() : "")
+                              << (model ? model->objectName() : "")
                               << "\") in layer action map"
-                              << std::endl;
+                              << endl;
                 }
             }
         }
@@ -3606,7 +3603,7 @@
 {
     Pane *pane = m_paneStack->getCurrentPane();
     if (!pane) {
-	std::cerr << "WARNING: MainWindow::addLayer: no current pane" << std::endl;
+	cerr << "WARNING: MainWindow::addLayer: no current pane" << endl;
 	return;
     }
 
@@ -3762,7 +3759,7 @@
     float percent = m_playSpeed->mappedValue();
     float factor = mapper.getFactorForValue(percent);
 
-//    std::cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << std::endl;
+//    cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl;
 
     bool something = (position != 100);
 
--- a/main/OSCHandler.cpp	Tue Nov 26 13:14:33 2013 +0000
+++ b/main/OSCHandler.cpp	Tue Nov 26 14:17:48 2013 +0000
@@ -46,8 +46,8 @@
             message.getArg(0).canConvert(QVariant::String)) {
             QString path = message.getArg(0).toString();
             if (open(path, ReplaceMainModel) != FileOpenSucceeded) {
-                std::cerr << "MainWindow::handleOSCMessage: File open failed for path \""
-                          << path << "\"" << std::endl;
+                cerr << "MainWindow::handleOSCMessage: File open failed for path \""
+                          << path << "\"" << endl;
             }
             //!!! we really need to spin here and not return until the
             // file has been completely decoded...
@@ -59,8 +59,8 @@
             message.getArg(0).canConvert(QVariant::String)) {
             QString path = message.getArg(0).toString();
             if (open(path, CreateAdditionalModel) != FileOpenSucceeded) {
-                std::cerr << "MainWindow::handleOSCMessage: File open failed for path \""
-                          << path << "\"" << std::endl;
+                cerr << "MainWindow::handleOSCMessage: File open failed for path \""
+                          << path << "\"" << endl;
             }
         }
 
@@ -76,8 +76,8 @@
         std::vector<QString> recent = m_recentFiles.getRecent();
         if (n >= 0 && n < int(recent.size())) {
             if (open(recent[n], ReplaceMainModel) != FileOpenSucceeded) {
-                std::cerr << "MainWindow::handleOSCMessage: File open failed for path \""
-                          << recent[n] << "\"" << std::endl;
+                cerr << "MainWindow::handleOSCMessage: File open failed for path \""
+                          << recent[n] << "\"" << endl;
             }
         }
 
@@ -294,8 +294,8 @@
                     channel = message.getArg(0).toInt();
                     if (channel < -1 ||
                         channel > int(getMainModel()->getChannelCount())) {
-                        std::cerr << "WARNING: MainWindow::handleOSCMessage: channel "
-                                  << channel << " out of range" << std::endl;
+                        cerr << "WARNING: MainWindow::handleOSCMessage: channel "
+                                  << channel << " out of range" << endl;
                         channel = -1;
                     }
                 }
@@ -306,8 +306,8 @@
                     LayerFactory::getInstance()->getLayerTypeForName(str);
 
                 if (type == LayerFactory::UnknownLayer) {
-                    std::cerr << "WARNING: MainWindow::handleOSCMessage: unknown layer "
-                              << "type " << str << std::endl;
+                    cerr << "WARNING: MainWindow::handleOSCMessage: unknown layer "
+                              << "type " << str << endl;
                 } else {
 
                     LayerConfiguration configuration(type,
@@ -429,7 +429,7 @@
 
             } else {
                 
-                std::cerr << "WARNING: MainWindow::handleOSCMessage: Unknown delete target " << target << std::endl;
+                cerr << "WARNING: MainWindow::handleOSCMessage: Unknown delete target " << target << endl;
             }
         }
 
@@ -544,9 +544,9 @@
         }
 
     } else {
-        std::cerr << "WARNING: MainWindow::handleOSCMessage: Unknown or unsupported "
-                  << "method \"" << message.getMethod().toStdString()
-                  << "\"" << std::endl;
+        cerr << "WARNING: MainWindow::handleOSCMessage: Unknown or unsupported "
+                  << "method \"" << message.getMethod()
+                  << "\"" << endl;
     }
             
 }
--- a/main/PreferencesDialog.cpp	Tue Nov 26 13:14:33 2013 +0000
+++ b/main/PreferencesDialog.cpp	Tue Nov 26 14:17:48 2013 +0000
@@ -221,7 +221,7 @@
         QString f0 = f;
         f.replace("sonic-visualiser_", "").replace(".qm", "");
         if (f == f0) { // our expectations about filename format were not met
-            std::cerr << "INFO: Unexpected filename " << f << " in i18n resource directory" << std::endl;
+            cerr << "INFO: Unexpected filename " << f << " in i18n resource directory" << endl;
         } else {
             m_locales.push_back(f);
             QString displayText;
--- a/main/Surveyer.cpp	Tue Nov 26 13:14:33 2013 +0000
+++ b/main/Surveyer.cpp	Tue Nov 26 14:17:48 2013 +0000
@@ -54,7 +54,7 @@
         // whether they want to or not) set the countdown to -1 so
         // that it is never offered again.
         QUrl url(QString("http://%1/%2").arg(m_hostname).arg(m_testPath));
-        std::cerr << "Surveyer: Test URL is " << url << std::endl;
+        cerr << "Surveyer: Test URL is " << url << endl;
         m_reply = m_nm->get(QNetworkRequest(url));
         connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
                 this, SLOT(error(QNetworkReply::NetworkError)));
@@ -77,7 +77,7 @@
 void
 Surveyer::error(QNetworkReply::NetworkError)
 {
-    std::cerr << "Surveyer: error: " << m_reply->errorString() << std::endl;
+    cerr << "Surveyer: error: " << m_reply->errorString() << endl;
     m_httpFailed = true;
 }
 
--- a/main/main.cpp	Tue Nov 26 13:14:33 2013 +0000
+++ b/main/main.cpp	Tue Nov 26 14:17:48 2013 +0000
@@ -179,7 +179,7 @@
 {
     // Avoid this happening more than once across threads
 
-    std::cerr << "signalHandler: cleaning up and exiting" << std::endl;
+    cerr << "signalHandler: cleaning up and exiting" << endl;
     cleanupMutex.lock();
     if (!cleanedUp) {
         TempDirectory::getInstance()->cleanup();
@@ -266,8 +266,8 @@
     bool oscSupport = true;
 
     if (args.contains("--help") || args.contains("-h") || args.contains("-?")) {
-        std::cerr << QApplication::tr(
-            "\nSonic Visualiser is a program for viewing and exploring audio data\nfor semantic music analysis and annotation.\n\nUsage:\n\n  %1 [--no-audio] [--no-osc] [<file> ...]\n\n  --no-audio: Do not attempt to open an audio output device\n  --no-osc: Do not provide an Open Sound Control port for remote control\n  <file>: One or more Sonic Visualiser (.sv) and audio files may be provided.\n").arg(argv[0]) << std::endl;
+        cerr << QApplication::tr(
+            "\nSonic Visualiser is a program for viewing and exploring audio data\nfor semantic music analysis and annotation.\n\nUsage:\n\n  %1 [--no-audio] [--no-osc] [<file> ...]\n\n  --no-audio: Do not attempt to open an audio output device\n  --no-osc: Do not provide an Open Sound Control port for remote control\n  <file>: One or more Sonic Visualiser (.sv) and audio files may be provided.\n").arg(argv[0]) << endl;
         exit(2);
     }
 
@@ -335,7 +335,7 @@
     if (!success) {
         SVDEBUG << "Failed\nFailed to load Qt translation for locale" << endl;
     } else {
-        std::cerr << "Done" << std::endl;
+        cerr << "Done" << endl;
     }
     application.installTranslator(&qtTranslator);
 
@@ -505,7 +505,7 @@
                 haveMainModel = true;
             }
         } else {
-            std::cerr << "WARNING: Ignoring additional session file argument \"" << path << "\"" << std::endl;
+            cerr << "WARNING: Ignoring additional session file argument \"" << path << "\"" << endl;
             status = MainWindow::FileOpenSucceeded;
         }
     }