From 5fffd5361bffb16cd3129e34f6a5e16a2b7af478 Mon Sep 17 00:00:00 2001
From: SeeLook <945374+SeeLook@users.noreply.github.com>
Date: Fri, 13 Feb 2015 22:15:27 +0100
Subject: [PATCH] Volume view pause button background unified, fixed respecting
 of paused input after closeing any dailog, Version bump 1.1.5-beta

---
 CMakeLists.txt                             |  2 +-
 TODO                                       |  1 -
 changes                                    |  2 ++
 src/libs/core/nootkaconfig.h               |  2 +-
 src/libs/sound/widgets/tintonationview.cpp |  2 +-
 src/libs/sound/widgets/tpitchview.cpp      |  5 +--
 src/libs/sound/widgets/tvolumeview.cpp     | 41 ++++++++++------------
 src/plugins/settings/audioinsettings.cpp   |  3 +-
 8 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ef319fa8..88f231a91 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ project(nootka)
 
 SET(Nootka_VERSION_MAJOR  "1")
 SET(Nootka_VERSION_MINOR  "1")
-SET(Nootka_VERSION_PATCH  "5-alpha")
+SET(Nootka_VERSION_PATCH  "5-beta")
 
 SET(Nootka_VERSION       "${Nootka_VERSION_MAJOR}.${Nootka_VERSION_MINOR}")
 SET(Nootka_VERSION_FULL  "${Nootka_VERSION}.${Nootka_VERSION_PATCH}")
diff --git a/TODO b/TODO
index 006a97534..356a16a2c 100644
--- a/TODO
+++ b/TODO
@@ -16,7 +16,6 @@ clumsy:
 
 ====== BUGS AND ISSUES ===============================================
 MAJOR:
-- sniffing starts after closing dialog windows even if it was paused
 - check is suggestion working for melodies (after 5 correct answers) - fix its storing
 
 
diff --git a/changes b/changes
index d17ac83a1..22fa6015c 100644
--- a/changes
+++ b/changes
@@ -4,6 +4,8 @@
      - new, quick, click-less way for adding notes to a score
      - improved pop-up for selecting note name over score
      - a note from played exam melody can be selected to start playing from it
+     - improved look of sound meters widgets
+     - intonation accuracy can be set from intonation view
      - first run wizard comes back improved  - it is a plugin now
      - updated Windows installer
     BUGS FIXES
diff --git a/src/libs/core/nootkaconfig.h b/src/libs/core/nootkaconfig.h
index a6e22d9dc..a3e076790 100644
--- a/src/libs/core/nootkaconfig.h
+++ b/src/libs/core/nootkaconfig.h
@@ -1,3 +1,3 @@
 
-#define NOOTKA_VERSION "1.1.5-alpha"
+#define NOOTKA_VERSION "1.1.5-beta"
 
diff --git a/src/libs/sound/widgets/tintonationview.cpp b/src/libs/sound/widgets/tintonationview.cpp
index af923d3ed..4d4129d5e 100644
--- a/src/libs/sound/widgets/tintonationview.cpp
+++ b/src/libs/sound/widgets/tintonationview.cpp
@@ -154,7 +154,7 @@ void TintonationView::paintEvent(QPaintEvent* ) {
 	if (m_entered)
 			painter.setPen(m_overNote ? palette().highlight().color() : palette().highlightedText().color());
   else if (m_pitchDiff == 0.0)
-			painter.setPen(tc);
+			painter.setPen(m_enableAccurChange ? tc : disabledColor);
   else
 			painter.setPen(m_tickColors[lastColorThick]);
   painter.drawText(0, 0, width(), height(), Qt::AlignCenter, nSymbol);
diff --git a/src/libs/sound/widgets/tpitchview.cpp b/src/libs/sound/widgets/tpitchview.cpp
index 1615c6597..e5bb3a961 100644
--- a/src/libs/sound/widgets/tpitchview.cpp
+++ b/src/libs/sound/widgets/tpitchview.cpp
@@ -121,7 +121,8 @@ void TpitchView::setDisabled(bool isDisabled) {
   else
     watchInput();
   m_volumeView->setDisabled(isDisabled);
-  m_intoView->setDisabled(isDisabled);
+	if (isDisabled) // it can be only disabled here, watchInput() enables it if it is possible
+		m_intoView->setDisabled(isDisabled);
 }
 
 
@@ -203,7 +204,7 @@ void TpitchView::pauseClicked() {
 	if (m_audioIN) {
 		if (m_volumeView->isPaused()) {
 			m_audioIN->stopListening();
-			m_audioIN->setStoppedByUser(false);
+			m_audioIN->setStoppedByUser(true);
 		} else {
 			m_audioIN->setStoppedByUser(false);
 			m_audioIN->startListening();
diff --git a/src/libs/sound/widgets/tvolumeview.cpp b/src/libs/sound/widgets/tvolumeview.cpp
index 7e1ca792b..2ab7132a4 100755
--- a/src/libs/sound/widgets/tvolumeview.cpp
+++ b/src/libs/sound/widgets/tvolumeview.cpp
@@ -66,7 +66,7 @@ void TvolumeView::setPauseActive(bool active) {
 
 
 void TvolumeView::setDisabled(bool isDisabled) {
-	QWidget::setDisabled(isDisabled);
+	TabstractSoundView::setDisabled(isDisabled);
 	if (m_activePause) {
 		if (isDisabled)
 			m_paused = isDisabled;
@@ -89,19 +89,21 @@ void TvolumeView::paintEvent(QPaintEvent* ) {
       noteColor = palette().highlightedText().color();
 			painter.drawRoundedRect(painter.viewport(), 4, 4);
   }
-	if (m_drawPaused) { // Stop/start button
-    painter.setBrush(Qt::red);
-    painter.drawRoundedRect(width() - height() - 1 , 1, height() - 2, height() - 2, 50, 50, Qt::RelativeSize);
-    painter.setBrush(m_overNote ? palette().base().color() : Qt::black);
-    if (m_paused)
-      painter.drawEllipse(width() - height() + 2, 4, height() - 8, height() - 8);
-    else
-      painter.drawRect(width() - height() * 0.5 - 5, 3, 6, height() - 6);
-  } else { // or note symbol
-    painter.setPen(isEnabled() ? noteColor : disabledColor);
-    painter.setFont(nootFont);
-    painter.drawText(1, Y_OFF, width() - 5, height(), Qt::AlignRight, m_activePause && m_paused ? "o" : "n");
+  painter.setFont(nootFont);
+  QString nSymbol = (m_activePause && m_paused) ? "o" : "n";
+	QRect nRect = painter.fontMetrics().boundingRect(nSymbol);
+	if (m_drawPaused) { // Stop/start highlight
+		painter.setBrush(m_overNote ? palette().highlightedText().color() : palette().highlight().color());
+		painter.drawRoundedRect(width() - nRect.width() * 1.8, 0, nRect.width() * 1.8, height(), 50, 50, Qt::RelativeSize);
   }
+	if (m_drawPaused) // and note symbol
+		painter.setPen(m_overNote ? palette().highlight().color() : palette().highlightedText().color());
+  else if (m_alpha)
+		painter.setPen(noteColor);
+  else
+		painter.setPen(tc);
+	painter.drawText(0, 0, width() - nRect.width() * 0.3, height(), Qt::AlignRight, nSymbol);
+
   qreal tickWidth = TICK_WIDTH - 1.0;
   for (int i = 1; i < m_ticksCount - 2; i++) { // volume ticks
     if (i >= m_ticksCount * m_minVolume)
@@ -125,7 +127,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) {
 		painter.setBrush(shade);
 		float xPos = (float)(width() - m_noteWidth) * m_minVolume; 
 		painter.drawEllipse(QRectF(xPos - height() * 0.5, height() * 0.1, height() * 0.9, height() * 0.9)); // shade
-		QLinearGradient lg(xPos/* - height() * 0.5*/, 0, xPos/* + height() * 0.5*/, height());
+		QLinearGradient lg(xPos, 0, xPos, height());
 		lg.setColorAt(0, knobBrush);
 		lg.setColorAt(0.3, knobBrush);
 		lg.setColorAt(0.8, knobBrush.darker());
@@ -168,7 +170,7 @@ void TvolumeView::mouseMoveEvent(QMouseEvent* event) {
     return;
   if (isPauseActive())
       m_drawPaused = true;
-  if (event->x() >= width() - m_noteWidth) {
+  if (event->x() >= width() - m_noteWidth * 1.5) {
     m_overNote = true;
   } else {
     m_overNote = false;
@@ -184,7 +186,7 @@ void TvolumeView::mouseMoveEvent(QMouseEvent* event) {
       }
     }
   }
-update();
+	update();
 }
 
 
@@ -217,12 +219,7 @@ void TvolumeView::leaveEvent(QEvent* ) {
 
 
 void TvolumeView::enterEvent(QEvent* ) {
-// 	if (!m_paused)
-// 		setToolTip(QString("%1 %").arg((int)(m_minVolume * 100)));
-//   if (!isPaused() && !m_overNote)
-//     m_drawKnob = true;
-// 	if (isPauseActive() && m_overNote)
-// 		m_drawPaused = true;
+
 }
 
 
diff --git a/src/plugins/settings/audioinsettings.cpp b/src/plugins/settings/audioinsettings.cpp
index 94e4856b2..9ad46d2dd 100755
--- a/src/plugins/settings/audioinsettings.cpp
+++ b/src/plugins/settings/audioinsettings.cpp
@@ -210,20 +210,19 @@ AudioInSettings::AudioInSettings(TaudioParams* params, Ttune* tune, QWidget* par
 		pitchView->setFixedHeight(fontMetrics().boundingRect("A").height() * 5);
 		pitchView->setPitchColor(Qt::darkGreen);
 		pitchView->setMinimalVolume(m_glParams->minimalVol);
+    pitchView->enableAccuracyChange(false);
 	
 	QFont labFont = font();
 	labFont.setPixelSize(fontMetrics().boundingRect("A").height() * 2);
   pitchLab = new TroundedLabel("--", this);
 		pitchLab->setFont(labFont);
 		pitchLab->setFixedWidth(fontMetrics().boundingRect("w").width() * 10);
-// 		pitchLab->setStyleSheet(styleTxt);
 		pitchLab->setStatusTip(tr("Detected pitch"));
 		pitchLab->setAlignment(Qt::AlignCenter);
   
   freqLab = new TroundedLabel("--", this);
 		freqLab->setFixedWidth(pitchLab->width() * 2);
 		freqLab->setFont(labFont);
-// 		freqLab->setStyleSheet(styleTxt);
 		freqLab->setAlignment(Qt::AlignCenter);
   getFreqStatusTip();
   
-- 
GitLab