Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 378:a7a643988390
Fix #1024 - avoid status bar repainting all its siblings when its message changes (and it resizes) by using a widget in the status bar for the label instead of the bar itself.
| author | Chris Cannam | 
|---|---|
| date | Wed, 02 Jul 2014 15:09:51 +0100 | 
| parents | 20bab95852c1 | 
| children | 6a84102c006a | 
   comparison
  equal
  deleted
  inserted
  replaced
| 377:3c724eac1798 | 378:a7a643988390 | 
|---|---|
| 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); | 
| 2448 } else { | 2449 } else { | 
| 2449 m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks); | 2450 m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks); | 
| 2450 } | 2451 } | 
| 2451 } | 2452 } | 
| 2452 | 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 return m_statusLabel; | |
| 2462 } | |
| 2463 | |
| 2453 void | 2464 void | 
| 2454 MainWindowBase::toggleStatusBar() | 2465 MainWindowBase::toggleStatusBar() | 
| 2455 { | 2466 { | 
| 2456 QSettings settings; | 2467 QSettings settings; | 
| 2457 settings.beginGroup("MainWindow"); | 2468 settings.beginGroup("MainWindow"); | 
| 2746 | 2757 | 
| 2747 if (m_paneStack && m_paneStack->getCurrentPane()) { | 2758 if (m_paneStack && m_paneStack->getCurrentPane()) { | 
| 2748 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); | 2759 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); | 
| 2749 } else { | 2760 } else { | 
| 2750 m_myStatusMessage = ""; | 2761 m_myStatusMessage = ""; | 
| 2751 statusBar()->showMessage(""); | 2762 getStatusLabel()->setText(""); | 
| 2752 } | 2763 } | 
| 2753 } | 2764 } | 
| 2754 | 2765 | 
| 2755 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : | 2766 MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : | 
| 2756 m_mw(mw), | 2767 m_mw(mw), | 
| 3053 } | 3064 } | 
| 3054 | 3065 | 
| 3055 m_myStatusMessage = tr("Playing: %1 of %2 (%3 remaining)") | 3066 m_myStatusMessage = tr("Playing: %1 of %2 (%3 remaining)") | 
| 3056 .arg(nowStr).arg(thenStr).arg(remainingStr); | 3067 .arg(nowStr).arg(thenStr).arg(remainingStr); | 
| 3057 | 3068 | 
| 3058 statusBar()->showMessage(m_myStatusMessage); | 3069 getStatusLabel()->setText(m_myStatusMessage); | 
| 3059 } | 3070 } | 
| 3060 | 3071 | 
| 3061 void | 3072 void | 
| 3062 MainWindowBase::globalCentreFrameChanged(int ) | 3073 MainWindowBase::globalCentreFrameChanged(int ) | 
| 3063 { | 3074 { | 
| 3270 } | 3281 } | 
| 3271 | 3282 | 
| 3272 void | 3283 void | 
| 3273 MainWindowBase::contextHelpChanged(const QString &s) | 3284 MainWindowBase::contextHelpChanged(const QString &s) | 
| 3274 { | 3285 { | 
| 3275 QStatusBar *bar = statusBar(); | 3286 QLabel *lab = getStatusLabel(); | 
| 3276 | 3287 | 
| 3277 if (s == "" && m_myStatusMessage != "") { | 3288 if (s == "" && m_myStatusMessage != "") { | 
| 3278 if (bar->currentMessage() != m_myStatusMessage) { | 3289 if (lab->text() != m_myStatusMessage) { | 
| 3279 bar->showMessage(m_myStatusMessage); | 3290 lab->setText(m_myStatusMessage); | 
| 3280 } | 3291 } | 
| 3281 return; | 3292 return; | 
| 3282 } | 3293 } | 
| 3283 | 3294 | 
| 3284 bar->showMessage(s); | 3295 lab->setText(s); | 
| 3285 } | 3296 } | 
| 3286 | 3297 | 
| 3287 void | 3298 void | 
| 3288 MainWindowBase::openHelpUrl(QString url) | 3299 MainWindowBase::openHelpUrl(QString url) | 
| 3289 { | 3300 { | 
