traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/core Project.cpp ReadSource.cpp Re...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core Project.cpp ReadSource.cpp Re...
Date: Mon, 23 Apr 2007 11:52:24 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/04/23 11:52:24

Modified files:
        src/core       : Project.cpp ReadSource.cpp ResourcesManager.cpp 
                         Track.cpp Utils.cpp Utils.h 

Log message:
        * various small cleanups
        * add frames_to_hms() function
        * renamed project file from project.traverso to project.tpf to avoid 
overwriting 
        of 0.40.0 based project files when opened with older version!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Project.cpp?cvsroot=traverso&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.cpp?cvsroot=traverso&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ResourcesManager.cpp?cvsroot=traverso&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.cpp?cvsroot=traverso&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Utils.cpp?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Utils.h?cvsroot=traverso&r1=1.7&r2=1.8

Patches:
Index: Project.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Project.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Project.cpp 17 Apr 2007 19:56:46 -0000      1.29
+++ Project.cpp 23 Apr 2007 11:52:24 -0000      1.30
@@ -129,7 +129,7 @@
        
        QFile file;
        if (projectfile.isEmpty()) {
-               file.setFileName(rootDir + "/project.traverso");
+               file.setFileName(rootDir + "/project.tpf");
        } else {
                file.setFileName(projectfile);
        }
@@ -146,7 +146,7 @@
        if (!doc.setContent(&file, &errorMsg))
        {
                file.close();
-               info().critical(tr("Project %1: Failed to parse 
project.traverso file! (%2)")
+               info().critical(tr("Project %1: Failed to parse project.tpf 
file! (%2)")
                                .arg(title).arg(errorMsg));
                return -1;
        }
@@ -157,9 +157,8 @@
        QDomNode propertiesNode = docElem.firstChildElement("Properties");
        QDomElement e = propertiesNode.toElement();
        
-       if (e.attribute("projectfileversion", "").toInt() != 
PROJECT_FILE_VERSION) {
-               PERROR("Project File Version does not match, cannot load 
project :-(");
-               info().warning("Project File Version does not match, unable to 
load Project!");
+       if (e.attribute("projectfileversion", "-1").toInt() != 
PROJECT_FILE_VERSION) {
+               info().warning(tr("Project File Version does not match, unable 
to load Project!"));
                return -1;
        }
 
@@ -212,11 +211,12 @@
 {
        PENTER;
        QDomDocument doc("Project");
-       QString fileName = rootDir + "/project.traverso";
+       QString fileName = rootDir + "/project.tpf";
        
        QFile::remove(fileName + "~");
        QFile backup(fileName);
        backup.rename(fileName + "~");
+       QFile::remove(fileName);
        
        QFile data( fileName );
 
@@ -237,6 +237,8 @@
 
 QDomNode Project::get_state(QDomDocument doc, bool istemplate)
 {
+       PENTER;
+       
        QDomElement projectNode = doc.createElement("Project");
        QDomElement properties = doc.createElement("Properties");
 
@@ -261,14 +263,12 @@
 
        // Get the AudioSources Node, and append
        if (! istemplate) {
-//             printf("getting resources state\n");
                projectNode.appendChild(m_asmanager->get_state(doc));
        }
 
        // Get all the Songs
        QDomNode songsNode = doc.createElement("Songs");
 
-//     printf("getting all Songs states\n");
        foreach(Song* song, m_songs) {
                songsNode.appendChild(song->get_state(doc, istemplate));
        }

Index: ReadSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- ReadSource.cpp      29 Mar 2007 11:09:38 -0000      1.21
+++ ReadSource.cpp      23 Apr 2007 11:52:24 -0000      1.22
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2006 Remon Sijrier 
+Copyright (C) 2006-2007 Remon Sijrier 
 
 This file is part of Traverso
 
@@ -17,7 +17,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: ReadSource.cpp,v 1.21 2007/03/29 11:09:38 r_sijrier Exp $
 */
 
 #include "ReadSource.h"
@@ -50,7 +49,7 @@
        Project* project = pm().get_project();
        
        // Check if the audiofile exists in our project audiosources dir
-       // and give it priority over the dir as given by the project.traverso 
file
+       // and give it priority over the dir as given by the project.tpf file
        // This makes it possible to move project directories without Traverso 
being
        // unable to find it's audiosources!
        if (QFile::exists(project->get_root_dir() + "/audiosources/" + m_name)) 
{

Index: ResourcesManager.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ResourcesManager.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- ResourcesManager.cpp        16 Apr 2007 18:44:26 -0000      1.4
+++ ResourcesManager.cpp        23 Apr 2007 11:52:24 -0000      1.5
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2006 Remon Sijrier 
+Copyright (C) 2006-2007 Remon Sijrier 
 
 This file is part of Traverso
 
@@ -17,7 +17,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: ResourcesManager.cpp,v 1.4 2007/04/16 18:44:26 r_sijrier Exp $
 */
 
 #include "ResourcesManager.h"
@@ -60,8 +59,8 @@
 
 QDomNode ResourcesManager::get_state( QDomDocument doc )
 {
+       PENTER;
 
-//     printf("ResourcesManager::get_state\n");
        QDomElement asmNode = doc.createElement("ResourcesManager");
        
        QDomElement audioSourcesElement = doc.createElement("AudioSources");
@@ -93,7 +92,7 @@
                } else {
                        // In case it wasn't we should use the 'old' domNode 
which 
                        // was set during set_state();
-                       audioClipsElement.appendChild(clip->m_domNode);
+                       audioClipsElement.appendChild(clip->get_dom_node()); 
                }
        }
        

Index: Track.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- Track.cpp   17 Apr 2007 19:56:46 -0000      1.50
+++ Track.cpp   23 Apr 2007 11:52:24 -0000      1.51
@@ -170,7 +170,7 @@
                        
                        clip->set_song(m_song);
                        clip->set_track(this);
-                       clip->set_state(clip->m_domNode);
+                       clip->set_state(clip->get_dom_node());
                        m_song->get_audioclip_manager()->add_clip(clip);
                        private_add_clip(clip);
                        

Index: Utils.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Utils.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Utils.cpp   25 Mar 2007 20:01:09 -0000      1.6
+++ Utils.cpp   23 Apr 2007 11:52:24 -0000      1.7
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2005-2006 Remon Sijrier
+    Copyright (C) 2005-2007 Remon Sijrier
 
     This file is part of Traverso
 
@@ -45,6 +45,20 @@
        return spos;
 }
 
+QString frame_to_hms(double nframes, int rate)
+{
+       long unsigned int remainder;
+       int hours, mins, secs;
+
+       hours = (int) (nframes / (3600 * rate));
+       remainder = (long unsigned int) (nframes - (hours * 3600 * rate));
+       mins = (int) (remainder / ( 60 * rate ));
+       remainder -= mins * 60 * rate;
+       secs = (int) (remainder / rate);
+       return QString().sprintf("%02d:%02d:%02d", hours, mins, secs);
+}
+
+
 nframes_t smpte_to_frame( QString str, int rate )
 {
        nframes_t out = 0;
@@ -105,5 +119,5 @@
        return pixmap;
 }
 
-//eof
 
+//eof

Index: Utils.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Utils.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Utils.h     25 Mar 2007 20:01:09 -0000      1.7
+++ Utils.h     23 Apr 2007 11:52:24 -0000      1.8
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2005-2006 Remon Sijrier 
+    Copyright (C) 2005-2007 Remon Sijrier 
  
     This file is part of Traverso
  
@@ -31,6 +31,7 @@
 class QString;
 
 QString frame_to_smpte(nframes_t nframes, int rate);
+QString frame_to_hms(double nframes, int rate);
 nframes_t smpte_to_frame(QString str, int rate);
 QString coefficient_to_dbstring(float coeff);
 QDateTime extract_date_time(qint64 id);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]