Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 380:d8bde801ebd4 tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 02 Jul 2014 17:31:48 +0100 |
parents | 6a84102c006a |
children | ad33fdc4ad92 |
comparison
equal
deleted
inserted
replaced
372:1162c93e7688 | 380:d8bde801ebd4 |
---|---|
152 m_openingAudioFile(false), | 152 m_openingAudioFile(false), |
153 m_abandoning(false), | 153 m_abandoning(false), |
154 m_labeller(0), | 154 m_labeller(0), |
155 m_lastPlayStatusSec(0), | 155 m_lastPlayStatusSec(0), |
156 m_initialDarkBackground(false), | 156 m_initialDarkBackground(false), |
157 m_defaultFfwdRwdStep(2, 0) | 157 m_defaultFfwdRwdStep(2, 0), |
158 m_statusLabel(0) | |
158 { | 159 { |
159 Profiler profiler("MainWindowBase::MainWindowBase"); | 160 Profiler profiler("MainWindowBase::MainWindowBase"); |
160 | 161 |
161 #ifdef Q_WS_X11 | 162 #ifdef Q_WS_X11 |
162 XSetErrorHandler(handle_x11_error); | 163 XSetErrorHandler(handle_x11_error); |
1118 | 1119 |
1119 labeller.labelAll<SparseOneDimensionalModel::Point>(*sodm, &ms); | 1120 labeller.labelAll<SparseOneDimensionalModel::Point>(*sodm, &ms); |
1120 } | 1121 } |
1121 | 1122 |
1122 MainWindowBase::FileOpenStatus | 1123 MainWindowBase::FileOpenStatus |
1123 MainWindowBase::open(QString fileOrUrl, AudioFileOpenMode mode) | 1124 MainWindowBase::openPath(QString fileOrUrl, AudioFileOpenMode mode) |
1124 { | 1125 { |
1125 ProgressDialog dialog(tr("Opening file or URL..."), true, 2000, this); | 1126 ProgressDialog dialog(tr("Opening file or URL..."), true, 2000, this); |
1126 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); | 1127 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); |
1127 return open(FileSource(fileOrUrl, &dialog), mode); | 1128 return open(FileSource(fileOrUrl, &dialog), mode); |
1128 } | 1129 } |
1149 bool rdfSession = false; | 1150 bool rdfSession = false; |
1150 if (rdf) { | 1151 if (rdf) { |
1151 RDFImporter::RDFDocumentType rdfType = | 1152 RDFImporter::RDFDocumentType rdfType = |
1152 RDFImporter::identifyDocumentType | 1153 RDFImporter::identifyDocumentType |
1153 (QUrl::fromLocalFile(source.getLocalFilename()).toString()); | 1154 (QUrl::fromLocalFile(source.getLocalFilename()).toString()); |
1154 // cerr << "RDF type: " << (int)rdfType << endl; | |
1155 if (rdfType == RDFImporter::AudioRefAndAnnotations || | 1155 if (rdfType == RDFImporter::AudioRefAndAnnotations || |
1156 rdfType == RDFImporter::AudioRef) { | 1156 rdfType == RDFImporter::AudioRef) { |
1157 rdfSession = true; | 1157 rdfSession = true; |
1158 } else if (rdfType == RDFImporter::NotRDF) { | 1158 } else if (rdfType == RDFImporter::NotRDF) { |
1159 rdf = false; | 1159 rdf = false; |
1202 | 1202 |
1203 MainWindowBase::FileOpenStatus | 1203 MainWindowBase::FileOpenStatus |
1204 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, | 1204 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, |
1205 QString templateName) | 1205 QString templateName) |
1206 { | 1206 { |
1207 // SVDEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ")" << endl; | 1207 SVDEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ")" << endl; |
1208 | 1208 |
1209 if (templateName == "") { | 1209 if (templateName == "") { |
1210 templateName = getDefaultSessionTemplate(); | 1210 templateName = getDefaultSessionTemplate(); |
1211 } | 1211 } |
1212 | 1212 |
1213 cerr << "template is: \"" << templateName << "\"" << endl; | 1213 // cerr << "template is: \"" << templateName << "\"" << endl; |
1214 | 1214 |
1215 if (!source.isAvailable()) return FileOpenFailed; | 1215 if (!source.isAvailable()) return FileOpenFailed; |
1216 source.waitForData(); | 1216 source.waitForData(); |
1217 | 1217 |
1218 m_openingAudioFile = true; | 1218 m_openingAudioFile = true; |
1670 | 1670 |
1671 return FileOpenSucceeded; | 1671 return FileOpenSucceeded; |
1672 } | 1672 } |
1673 | 1673 |
1674 MainWindowBase::FileOpenStatus | 1674 MainWindowBase::FileOpenStatus |
1675 MainWindowBase::openSessionFile(QString fileOrUrl) | 1675 MainWindowBase::openSessionPath(QString fileOrUrl) |
1676 { | 1676 { |
1677 ProgressDialog dialog(tr("Opening session..."), true, 2000, this); | 1677 ProgressDialog dialog(tr("Opening session..."), true, 2000, this); |
1678 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); | 1678 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); |
1679 return openSession(FileSource(fileOrUrl, &dialog)); | 1679 return openSession(FileSource(fileOrUrl, &dialog)); |
1680 } | 1680 } |
2449 } else { | 2449 } else { |
2450 m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks); | 2450 m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks); |
2451 } | 2451 } |
2452 } | 2452 } |
2453 | 2453 |
2454 QLabel * | |
2455 MainWindowBase::getStatusLabel() const | |
2456 { | |
2457 if (!m_statusLabel) { | |
2458 m_statusLabel = new QLabel(); | |
2459 statusBar()->addWidget(m_statusLabel, 1); | |
2460 } | |
2461 | |
2462 QList<QFrame *> frames = statusBar()->findChildren<QFrame *>(); | |
2463 foreach (QFrame *f, frames) { | |
2464 f->setFrameStyle(QFrame::NoFrame); | |
2465 } | |
2466 | |
2467 return m_statusLabel; | |
2468 } | |
2469 | |
2454 void | 2470 void |
2455 MainWindowBase::toggleStatusBar() | 2471 MainWindowBase::toggleStatusBar() |
2456 { | 2472 { |
2457 QSettings settings; | 2473 QSettings settings; |
2458 settings.beginGroup("MainWindow"); | 2474 settings.beginGroup("MainWindow"); |
2747 | 2763 |
2748 if (m_paneStack && m_paneStack->getCurrentPane()) { | 2764 if (m_paneStack && m_paneStack->getCurrentPane()) { |
2749 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); | 2765 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); |
2750 } else { | 2766 } else { |
2751 m_myStatusMessage = ""; | 2767 m_myStatusMessage = ""; |
2752 statusBar()->showMessage(""); | 2768 getStatusLabel()->setText(""); |
2753 } | 2769 } |
2754 } | 2770 } |
2755 | 2771 |
2756 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : | 2772 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : |
2757 m_mw(mw), | 2773 m_mw(mw), |
3054 } | 3070 } |
3055 | 3071 |
3056 m_myStatusMessage = tr("Playing: %1 of %2 (%3 remaining)") | 3072 m_myStatusMessage = tr("Playing: %1 of %2 (%3 remaining)") |
3057 .arg(nowStr).arg(thenStr).arg(remainingStr); | 3073 .arg(nowStr).arg(thenStr).arg(remainingStr); |
3058 | 3074 |
3059 statusBar()->showMessage(m_myStatusMessage); | 3075 getStatusLabel()->setText(m_myStatusMessage); |
3060 } | 3076 } |
3061 | 3077 |
3062 void | 3078 void |
3063 MainWindowBase::globalCentreFrameChanged(int ) | 3079 MainWindowBase::globalCentreFrameChanged(int ) |
3064 { | 3080 { |
3271 } | 3287 } |
3272 | 3288 |
3273 void | 3289 void |
3274 MainWindowBase::contextHelpChanged(const QString &s) | 3290 MainWindowBase::contextHelpChanged(const QString &s) |
3275 { | 3291 { |
3292 QLabel *lab = getStatusLabel(); | |
3293 | |
3276 if (s == "" && m_myStatusMessage != "") { | 3294 if (s == "" && m_myStatusMessage != "") { |
3277 statusBar()->showMessage(m_myStatusMessage); | 3295 if (lab->text() != m_myStatusMessage) { |
3296 lab->setText(m_myStatusMessage); | |
3297 } | |
3278 return; | 3298 return; |
3279 } | 3299 } |
3280 statusBar()->showMessage(s); | 3300 |
3301 lab->setText(s); | |
3281 } | 3302 } |
3282 | 3303 |
3283 void | 3304 void |
3284 MainWindowBase::openHelpUrl(QString url) | 3305 MainWindowBase::openHelpUrl(QString url) |
3285 { | 3306 { |