fix: mic test level bar dynamic color too
This commit is contained in:
1 parent
f08b63466c
commit
da953c6c7a
1 file changed
+4
-4
@@ -60,10 +60,6 @@ AudioDeviceSettingsPage::AudioDeviceSettingsPage(DbManager* db, AudioRecorder* r
|
||||
m_micLevelBar->setValue(0);
|
||||
m_micLevelBar->setTextVisible(false);
|
||||
m_micLevelBar->setFixedHeight(16);
|
||||
m_micLevelBar->setStyleSheet(
|
||||
"QProgressBar { border: 1px solid palette(mid); border-radius: 4px; background: #333; }"
|
||||
"QProgressBar::chunk { background: qlineargradient(x1:0, y1:0, x2:1, y2:0,"
|
||||
" stop:0 #27ae60, stop:0.6 #f1c40f, stop:1 #e74c3c); border-radius: 3px; }");
|
||||
micRow->addWidget(m_micLevelBar, 1);
|
||||
|
||||
m_testMicBtn = new QPushButton("Test Microphone", this);
|
||||
@@ -295,6 +291,10 @@ void AudioDeviceSettingsPage::onLevelTimer() {
|
||||
if (pct < 0) pct = 0;
|
||||
if (pct > 100) pct = 100;
|
||||
m_micLevelBar->setValue(pct);
|
||||
const char* color = pct < 60 ? "#27ae60" : pct < 85 ? "#f1c40f" : "#e74c3c";
|
||||
m_micLevelBar->setStyleSheet(QString(
|
||||
"QProgressBar { border: 1px solid palette(mid); border-radius: 4px; background: #333; }"
|
||||
"QProgressBar::chunk { background: %1; border-radius: 3px; }").arg(color));
|
||||
}
|
||||
|
||||
void AudioDeviceSettingsPage::onTestSpeaker() {
|
||||
|
||||
Reference in new issue
Block a user