[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [simon] simonlib/simonsound: Fixing 085714a89ff99afb33c94bcf88995fa75be2fa24
From: Peter Grasch <me () bedahr ! org>
Date: 2013-06-30 18:37:34
Message-ID: E1UtMVC-00049d-Nt () scm ! kde ! org
[Download RAW message or body]
Git commit 470da7a036f4b0716cbe489face5366033c70fb6 by Peter Grasch.
Committed on 30/06/2013 at 18:35.
Pushed by grasch into branch 'master'.
Fixing 085714a89ff99afb33c94bcf88995fa75be2fa24
Fixes:
* Some references to the labelUpdater were not removed
* Initially, the system would unconditionally assume a low SNR
* Pause / resume of audio stream was not handled
* No wordwrap and very long message caused the Simon mainwindow to
to resize
M +12 -11 simonlib/simonsound/devicevolumewidget.cpp
M +3 -13 simonlib/simonsound/devicevolumewidget.ui
http://commits.kde.org/simon/470da7a036f4b0716cbe489face5366033c70fb6
diff --git a/simonlib/simonsound/devicevolumewidget.cpp \
b/simonlib/simonsound/devicevolumewidget.cpp index 54823bf..2db60e5 100644
--- a/simonlib/simonsound/devicevolumewidget.cpp
+++ b/simonlib/simonsound/devicevolumewidget.cpp
@@ -60,18 +60,22 @@ void DeviceVolumeWidget::deviceReportedLevel(qint64 time, float \
level)
* So, I'd say around 10 seconds would be reasonable so that the above condition \
(10 or more data samples) is satisfied.
* So let's remove all records that are older than 10 seconds.
*/
- if( listOfLevels.last().first - listOfLevels.first().first >= 10000 )
+ qint64 measuredTimeDist = listOfLevels.last().first - listOfLevels.first().first;
+ if( measuredTimeDist >= 10000 ) {
listOfLevels.takeFirst();
+ highLevel = lowLevel = listOfLevels[0].second;
- highLevel = lowLevel = listOfLevels[0].second;
-
- for(int i=1; i<listOfLevels.length(); i++){
- highLevel = qMax<float>(listOfLevels[i].second,highLevel);
- lowLevel = qMin<float>(listOfLevels[i].second,lowLevel);
+ for(int i=1; i<listOfLevels.length(); i++){
+ highLevel = qMax<float>(listOfLevels[i].second,highLevel);
+ lowLevel = qMin<float>(listOfLevels[i].second,lowLevel);
+ }
+ } else {
+ //not measured long enough; assume good SNR
+ highLevel = 1;
+ lowLevel = 0;
}
updateLabel();
-
}
void DeviceVolumeWidget::completed()
@@ -148,10 +152,9 @@ void DeviceVolumeWidget::tooLow()
void DeviceVolumeWidget::start()
{
+ listOfLevels.clear();
if (!rec->start())
KMessageBox::error(this, i18nc("%1 is device name", "Recording could not be \
started for device: %1.", m_deviceName));
- else
- labelUpdater.start(1000);
}
@@ -159,8 +162,6 @@ void DeviceVolumeWidget::stop()
{
if (!rec->finish())
KMessageBox::error(this, i18nc("%1 is device name", "Recording could not be \
stopped for device: %1.", m_deviceName));
- else
- labelUpdater.stop();
}
diff --git a/simonlib/simonsound/devicevolumewidget.ui \
b/simonlib/simonsound/devicevolumewidget.ui index b38b250..2cc47d4 100644
--- a/simonlib/simonsound/devicevolumewidget.ui
+++ b/simonlib/simonsound/devicevolumewidget.ui
@@ -37,19 +37,6 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="QLabel" name="lbIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -73,6 +60,9 @@
<property name="text">
<string/>
</property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
</widget>
</item>
</layout>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic