diff data/model/Model.cpp @ 1527:710e6250a401 zoom

Merge from default branch
author Chris Cannam
date Mon, 17 Sep 2018 13:51:14 +0100
parents 9d37c8cf9686
children d3814e07b8aa
line wrap: on
line diff
--- a/data/model/Model.cpp	Mon Dec 12 15:18:52 2016 +0000
+++ b/data/model/Model.cpp	Mon Sep 17 13:51:14 2018 +0100
@@ -27,9 +27,11 @@
 //    SVDEBUG << "Model::~Model(" << this << ")" << endl;
 
     if (!m_aboutToDelete) {
-        SVDEBUG << "NOTE: Model::~Model(" << this << ", \""
-                  << objectName() << "\"): Model deleted "
-                  << "with no aboutToDelete notification" << endl;
+        SVDEBUG << "NOTE: Model(" << this << ", \""
+                << objectName() << "\", type uri <"
+                << m_typeUri << ">)::~Model(): Model deleted "
+                << "with no aboutToDelete notification"
+                << endl;
     }
 
     if (m_alignment) {
@@ -38,6 +40,20 @@
     }
 }
 
+int
+Model::getNextId()
+{
+    static int nextId = 0;
+    static QMutex mutex;
+    QMutexLocker locker(&mutex);
+    int i = nextId;
+    if (nextId == INT_MAX) {
+        nextId = INT_MIN;
+    }
+    ++nextId;
+    return i;
+}
+
 void
 Model::setSourceModel(Model *model)
 {
@@ -59,13 +75,16 @@
 void
 Model::aboutToDelete()
 {
-//    cerr << "Model(" << this << ")::aboutToDelete()" << endl;
+//    SVDEBUG << "Model(" << this << ", \""
+//            << objectName() << "\", type uri <"
+//            << m_typeUri << ">)::aboutToDelete()" << endl;
 
     if (m_aboutToDelete) {
-        cerr << "WARNING: Model(" << this << ", \""
-                  << objectName() << "\")::aboutToDelete: "
-                  << "aboutToDelete called more than once for the same model"
-                  << endl;
+        SVDEBUG << "WARNING: Model(" << this << ", \""
+                << objectName() << "\", type uri <"
+                << m_typeUri << ">)::aboutToDelete: "
+                << "aboutToDelete called more than once for the same model"
+                << endl;
     }
 
     emit aboutToBeDeleted();
@@ -180,12 +199,12 @@
 {
     stream << indent;
     stream << QString("<model id=\"%1\" name=\"%2\" sampleRate=\"%3\" start=\"%4\" end=\"%5\" %6/>\n")
-	.arg(getObjectExportId(this))
-	.arg(encodeEntities(objectName()))
-	.arg(getSampleRate())
-	.arg(getStartFrame())
-	.arg(getEndFrame())
-	.arg(extraAttributes);
+        .arg(getObjectExportId(this))
+        .arg(encodeEntities(objectName()))
+        .arg(getSampleRate())
+        .arg(getStartFrame())
+        .arg(getEndFrame())
+        .arg(extraAttributes);
 }