changeset 165:33280c031d19

* Add a colour database, and Add New Colour function to the colour combo in property box. The colour property is only correctly handled in the waveform layer so far. * Add en_GB translation, to translate those annoying Color texts in the Qt colour picker dialog.
author Chris Cannam
date Wed, 11 Jul 2007 17:21:37 +0000
parents 75cafe7a9246
children 4d762fe10919
files i18n/sonic-visualiser_en_GB.qm i18n/sonic-visualiser_en_GB.ts main/MainWindow.cpp main/main.cpp sonic-visualiser.qrc
diffstat 5 files changed, 61 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
Binary file i18n/sonic-visualiser_en_GB.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/i18n/sonic-visualiser_en_GB.ts	Wed Jul 11 17:21:37 2007 +0000
@@ -0,0 +1,29 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>QColorDialog</name>
+    <message>
+        <source>Color</source>
+        <translation>Colour</translation>
+    </message>
+    <message>
+        <source>&amp;Basic colors</source>
+        <translation>&amp;Basic colours</translation>
+    </message>
+    <message>
+        <source>&amp;Custom colors</source>
+        <translation>&amp;Custom colours</translation>
+    </message>
+    <message>
+        <source>&amp;Define Custom Colors &gt;&gt;</source>
+        <translation>&amp;Define Custom Colours &gt;&gt;</translation>
+    </message>
+    <message>
+        <source>&amp;Add to Custom Colors</source>
+        <translation>&amp;Add to Custom Colours</translation>
+    </message>
+    <message>
+        <source>Select color</source>
+        <translation>Select colour</translation>
+    </message>
+</context>
+</TS>
--- a/main/MainWindow.cpp	Thu Jul 05 15:36:37 2007 +0000
+++ b/main/MainWindow.cpp	Wed Jul 11 17:21:37 2007 +0000
@@ -60,6 +60,8 @@
 #include "base/CommandHistory.h"
 #include "base/Profiler.h"
 #include "base/Clipboard.h"
+#include "base/UnitDatabase.h"
+#include "base/ColourDatabase.h"
 #include "osc/OSCQueue.h"
 
 // For version information
@@ -138,9 +140,18 @@
 {
     setWindowTitle(tr("Sonic Visualiser"));
 
-    UnitDatabase::getInstance()->registerUnit("Hz");
-    UnitDatabase::getInstance()->registerUnit("dB");
-    UnitDatabase::getInstance()->registerUnit("s");
+    UnitDatabase *udb = UnitDatabase::getInstance();
+    udb->registerUnit("Hz");
+    udb->registerUnit("dB");
+    udb->registerUnit("s");
+
+    ColourDatabase *cdb = ColourDatabase::getInstance();
+    cdb->addColour(Qt::black, tr("Black"));
+    cdb->addColour(Qt::darkRed, tr("Red"));
+    cdb->addColour(Qt::darkBlue, tr("Blue"));
+    cdb->addColour(Qt::darkGreen, tr("Green"));
+    cdb->addColour(QColor(200, 50, 255), tr("Purple"));
+    cdb->addColour(QColor(255, 150, 50), tr("Orange"));
 
     connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
 	    this, SLOT(documentModified()));
@@ -2757,7 +2768,7 @@
 	QMessageBox::warning
 	    (this, tr("Couldn't open audio device"),
 	     tr("Could not open an audio device for playback.\nAudio playback will not be available during this session.\n"),
-	     QMessageBox::Ok, 0);
+	     QMessageBox::Ok);
     }
     connect(m_fader, SIGNAL(valueChanged(float)),
 	    m_playTarget, SLOT(setOutputGain(float)));
@@ -3230,9 +3241,8 @@
 	QMessageBox::warning(this,
 			     tr("Session modified"),
 			     tr("The current session has been modified.\nDo you want to save it?"),
-			     QMessageBox::Yes,
-			     QMessageBox::No,
-			     QMessageBox::Cancel);
+			     QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
+                             QMessageBox::Yes);
 
     if (button == QMessageBox::Yes) {
 	saveSession();
@@ -4364,7 +4374,7 @@
          tr("Failed to generate layer"),
          tr("Failed to generate a derived layer.\n\nThe layer transform \"%1\" failed.\n\nThis probably means that a plugin failed to initialise, perhaps because it\nrejected the processing block size that was requested.")
          .arg(transformName),
-         QMessageBox::Ok, 0);
+         QMessageBox::Ok);
 }
 
 void
@@ -4375,7 +4385,7 @@
          tr("Failed to regenerate layer"),
          tr("Failed to regenerate derived layer \"%1\".\n\nThe layer transform \"%2\" failed to run.\n\nThis probably means the layer used a plugin that is not currently available.")
          .arg(layerName).arg(transformName),
-         QMessageBox::Ok, 0);
+         QMessageBox::Ok);
 }
 
 void
--- a/main/main.cpp	Thu Jul 05 15:36:37 2007 +0000
+++ b/main/main.cpp	Wed Jul 11 17:21:37 2007 +0000
@@ -31,6 +31,7 @@
 #include <QSettings>
 #include <QIcon>
 #include <QSessionManager>
+#include <QDir>
 
 #include <iostream>
 #include <signal.h>
@@ -236,7 +237,17 @@
     QTranslator qtTranslator;
     QString qtTrName = QString("qt_%1").arg(language);
     std::cerr << "Loading " << qtTrName.toStdString() << "..." << std::endl;
-    qtTranslator.load(qtTrName);
+    bool success = false;
+    if (!(success = qtTranslator.load(qtTrName))) {
+        QString qtDir = getenv("QTDIR");
+        if (qtDir != "") {
+            success = qtTranslator.load
+                (qtTrName, QDir(qtDir).filePath("translations"));
+        }
+    }
+    if (!success) {
+        std::cerr << "Failed to load Qt translation for locale" << std::endl;
+    }
     application.installTranslator(&qtTranslator);
 
     QTranslator svTranslator;
--- a/sonic-visualiser.qrc	Thu Jul 05 15:36:37 2007 +0000
+++ b/sonic-visualiser.qrc	Wed Jul 11 17:21:37 2007 +0000
@@ -83,6 +83,7 @@
     <file>samples/strike.wav</file>
     <file>samples/tap.wav</file>
     <file>i18n/sonic-visualiser_ru.qm</file>
+    <file>i18n/sonic-visualiser_en_GB.qm</file>
     <file>i18n/tips_en.xml</file>
 </qresource>
 </RCC>