comparison main/MainWindow.cpp @ 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
comparison
equal deleted inserted replaced
164:75cafe7a9246 165:33280c031d19
58 #include "base/PlayParameterRepository.h" 58 #include "base/PlayParameterRepository.h"
59 #include "base/XmlExportable.h" 59 #include "base/XmlExportable.h"
60 #include "base/CommandHistory.h" 60 #include "base/CommandHistory.h"
61 #include "base/Profiler.h" 61 #include "base/Profiler.h"
62 #include "base/Clipboard.h" 62 #include "base/Clipboard.h"
63 #include "base/UnitDatabase.h"
64 #include "base/ColourDatabase.h"
63 #include "osc/OSCQueue.h" 65 #include "osc/OSCQueue.h"
64 66
65 // For version information 67 // For version information
66 #include "vamp/vamp.h" 68 #include "vamp/vamp.h"
67 #include "vamp-sdk/PluginBase.h" 69 #include "vamp-sdk/PluginBase.h"
136 m_preferencesDialog(0), 138 m_preferencesDialog(0),
137 m_keyReference(new KeyReference()) 139 m_keyReference(new KeyReference())
138 { 140 {
139 setWindowTitle(tr("Sonic Visualiser")); 141 setWindowTitle(tr("Sonic Visualiser"));
140 142
141 UnitDatabase::getInstance()->registerUnit("Hz"); 143 UnitDatabase *udb = UnitDatabase::getInstance();
142 UnitDatabase::getInstance()->registerUnit("dB"); 144 udb->registerUnit("Hz");
143 UnitDatabase::getInstance()->registerUnit("s"); 145 udb->registerUnit("dB");
146 udb->registerUnit("s");
147
148 ColourDatabase *cdb = ColourDatabase::getInstance();
149 cdb->addColour(Qt::black, tr("Black"));
150 cdb->addColour(Qt::darkRed, tr("Red"));
151 cdb->addColour(Qt::darkBlue, tr("Blue"));
152 cdb->addColour(Qt::darkGreen, tr("Green"));
153 cdb->addColour(QColor(200, 50, 255), tr("Purple"));
154 cdb->addColour(QColor(255, 150, 50), tr("Orange"));
144 155
145 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), 156 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
146 this, SLOT(documentModified())); 157 this, SLOT(documentModified()));
147 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()), 158 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),
148 this, SLOT(documentRestored())); 159 this, SLOT(documentRestored()));
2755 m_playTarget = AudioTargetFactory::createCallbackTarget(m_playSource); 2766 m_playTarget = AudioTargetFactory::createCallbackTarget(m_playSource);
2756 if (!m_playTarget) { 2767 if (!m_playTarget) {
2757 QMessageBox::warning 2768 QMessageBox::warning
2758 (this, tr("Couldn't open audio device"), 2769 (this, tr("Couldn't open audio device"),
2759 tr("Could not open an audio device for playback.\nAudio playback will not be available during this session.\n"), 2770 tr("Could not open an audio device for playback.\nAudio playback will not be available during this session.\n"),
2760 QMessageBox::Ok, 0); 2771 QMessageBox::Ok);
2761 } 2772 }
2762 connect(m_fader, SIGNAL(valueChanged(float)), 2773 connect(m_fader, SIGNAL(valueChanged(float)),
2763 m_playTarget, SLOT(setOutputGain(float))); 2774 m_playTarget, SLOT(setOutputGain(float)));
2764 } 2775 }
2765 2776
3228 3239
3229 int button = 3240 int button =
3230 QMessageBox::warning(this, 3241 QMessageBox::warning(this,
3231 tr("Session modified"), 3242 tr("Session modified"),
3232 tr("The current session has been modified.\nDo you want to save it?"), 3243 tr("The current session has been modified.\nDo you want to save it?"),
3233 QMessageBox::Yes, 3244 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
3234 QMessageBox::No, 3245 QMessageBox::Yes);
3235 QMessageBox::Cancel);
3236 3246
3237 if (button == QMessageBox::Yes) { 3247 if (button == QMessageBox::Yes) {
3238 saveSession(); 3248 saveSession();
3239 if (m_documentModified) { // save failed -- don't proceed! 3249 if (m_documentModified) { // save failed -- don't proceed!
3240 return false; 3250 return false;
4362 QMessageBox::warning 4372 QMessageBox::warning
4363 (this, 4373 (this,
4364 tr("Failed to generate layer"), 4374 tr("Failed to generate layer"),
4365 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.") 4375 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.")
4366 .arg(transformName), 4376 .arg(transformName),
4367 QMessageBox::Ok, 0); 4377 QMessageBox::Ok);
4368 } 4378 }
4369 4379
4370 void 4380 void
4371 MainWindow::modelRegenerationFailed(QString layerName, QString transformName) 4381 MainWindow::modelRegenerationFailed(QString layerName, QString transformName)
4372 { 4382 {
4373 QMessageBox::warning 4383 QMessageBox::warning
4374 (this, 4384 (this,
4375 tr("Failed to regenerate layer"), 4385 tr("Failed to regenerate layer"),
4376 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.") 4386 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.")
4377 .arg(layerName).arg(transformName), 4387 .arg(layerName).arg(transformName),
4378 QMessageBox::Ok, 0); 4388 QMessageBox::Ok);
4379 } 4389 }
4380 4390
4381 void 4391 void
4382 MainWindow::rightButtonMenuRequested(Pane *pane, QPoint position) 4392 MainWindow::rightButtonMenuRequested(Pane *pane, QPoint position)
4383 { 4393 {