changeset 86:e076e676439b

* Add file open/save operations to main toolbar * Allow opening any sort of file from toolbar file open function * First cut at on-disc cacheing for decoded mp3/ogg files * Permit un-snapped selection by holding Shift
author Chris Cannam
date Thu, 27 Apr 2006 17:29:19 +0000
parents ea730e3f9ace
children 7de62a884810
files base/System.h base/TempDirectory.cpp
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/base/System.h	Thu Apr 27 11:49:34 2006 +0000
+++ b/base/System.h	Thu Apr 27 17:29:19 2006 +0000
@@ -45,7 +45,7 @@
 
 #define MLOCK(a,b)   ::mlock((a),(b))
 #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)
-#define MUNLOCK_SAMPLEBLOCK(a) do { const float &b = *(a).begin(); MUNLOCK(&b, (a).capacity() * sizeof(float)); } while(0);
+#define MUNLOCK_SAMPLEBLOCK(a) do { if (!(a).empty()) { const float &b = *(a).begin(); MUNLOCK(&b, (a).capacity() * sizeof(float)); } } while(0);
 
 #define DLOPEN(a,b)  dlopen((a).toStdString().c_str(),(b))
 #define DLSYM(a,b)   dlsym((a),(b))
--- a/base/TempDirectory.cpp	Thu Apr 27 11:49:34 2006 +0000
+++ b/base/TempDirectory.cpp	Thu Apr 27 17:29:19 2006 +0000
@@ -70,7 +70,8 @@
     
     if (m_tmpdir != "") return m_tmpdir;
 
-    QDir systemTempDir = QDir::temp();
+//!!!    QDir tempDirBase = QDir::temp();
+    QDir tempDirBase = QDir::home();
 
     // Generate a temporary directory.  Qt4.1 doesn't seem to be able
     // to do this for us, and mkdtemp is not standard.  This method is
@@ -98,8 +99,8 @@
 
         QString candidate = QString("sv_%1").arg(suffix);
 
-        if (QDir::temp().mkpath(candidate)) {
-            m_tmpdir = systemTempDir.filePath(candidate);
+        if (tempDirBase.mkpath(candidate)) {
+            m_tmpdir = tempDirBase.filePath(candidate);
             break;
         }
 
@@ -108,7 +109,7 @@
 
     if (m_tmpdir == "") {
         throw DirectoryCreationFailed(QString("temporary subdirectory in %1")
-                                      .arg(systemTempDir.canonicalPath()));
+                                      .arg(tempDirBase.canonicalPath()));
     }
 
     return m_tmpdir;