changeset 247:21b9b25bff48

* More useful status bar text -- show the current play time and the extents of the visible area * Add update-i18n.sh to update the i18n/ts and qm files -- I can't get qmake to do the right thing now that the project file has been split up into several project files * Fix missing Q_OBJECTs, etc, reported by lupdate * Update Russian translation from AlexandrE
author Chris Cannam
date Wed, 07 Mar 2007 17:07:02 +0000
parents d7eeffbb8aaf
children 084ae1c213ee
files base/PropertyContainer.cpp base/RealTime.cpp base/RealTime.h data/fileio/MIDIFileReader.h data/model/FFTModel.h data/model/SparseModel.h
diffstat 6 files changed, 48 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/base/PropertyContainer.cpp	Mon Mar 05 15:32:55 2007 +0000
+++ b/base/PropertyContainer.cpp	Wed Mar 07 17:07:02 2007 +0000
@@ -255,6 +255,6 @@
 QString
 PropertyContainer::SetPropertyCommand::getName() const
 {
-    return m_pc->tr("Set %1 Property").arg(m_pn);
+    return tr("Set %1 Property").arg(m_pn);
 }
 
--- a/base/RealTime.cpp	Mon Mar 05 15:32:55 2007 +0000
+++ b/base/RealTime.cpp	Wed Mar 07 17:07:02 2007 +0000
@@ -125,7 +125,7 @@
 std::string
 RealTime::toText(bool fixedDp) const
 {
-    if (*this < RealTime::zeroTime) return "-" + (-*this).toText();
+    if (*this < RealTime::zeroTime) return "-" + (-*this).toText(fixedDp);
 
     std::stringstream out;
 
@@ -173,6 +173,41 @@
     return s;
 }
 
+std::string
+RealTime::toSecText() const
+{
+    if (*this < RealTime::zeroTime) return "-" + (-*this).toSecText();
+
+    std::stringstream out;
+
+    if (sec >= 3600) {
+	out << (sec / 3600) << ":";
+    }
+
+    if (sec >= 60) {
+	out << (sec % 3600) / 60 << ":";
+    }
+
+    if (sec >= 10) {
+	out << ((sec % 60) / 10);
+    }
+
+    out << (sec % 10);
+    
+    if (sec < 60) {
+        out << "s";
+    }
+
+	
+#if (__GNUC__ < 3)
+    out << std::ends;
+#endif
+
+    std::string s = out.str();
+
+    return s;
+}
+
 RealTime
 RealTime::operator*(int m) const
 {
--- a/base/RealTime.h	Mon Mar 05 15:32:55 2007 +0000
+++ b/base/RealTime.h	Wed Mar 07 17:07:02 2007 +0000
@@ -111,6 +111,11 @@
     //
     std::string toText(bool fixedDp = false) const;
 
+    // Return a user-readable string to the nearest second in a form
+    // like "6s" (for less than a minute) or "2:21" (for more).
+    //
+    std::string toSecText() const;
+
     // Convenience functions for handling sample frames
     //
     static long realTime2Frame(const RealTime &r, unsigned int sampleRate);
--- a/data/fileio/MIDIFileReader.h	Mon Mar 05 15:32:55 2007 +0000
+++ b/data/fileio/MIDIFileReader.h	Wed Mar 07 17:07:02 2007 +0000
@@ -35,6 +35,8 @@
 
 class MIDIFileReader : public DataFileReader, public QObject
 {
+    Q_OBJECT
+
 public:
     MIDIFileReader(QString path, size_t mainModelSampleRate);
     virtual ~MIDIFileReader();
--- a/data/model/FFTModel.h	Mon Mar 05 15:32:55 2007 +0000
+++ b/data/model/FFTModel.h	Wed Mar 07 17:07:02 2007 +0000
@@ -21,6 +21,8 @@
 
 class FFTModel : public DenseThreeDimensionalModel
 {
+    Q_OBJECT
+
 public:
     FFTModel(const DenseTimeValueModel *model,
              int channel,
--- a/data/model/SparseModel.h	Mon Mar 05 15:32:55 2007 +0000
+++ b/data/model/SparseModel.h	Wed Mar 07 17:07:02 2007 +0000
@@ -35,6 +35,8 @@
 template <typename PointType>
 class SparseModel : public Model
 {
+    Q_OBJECT
+
 public:
     SparseModel(size_t sampleRate, size_t resolution,
 		bool notifyOnAdd = true);