Browse Source

Show microphone timeout errors in call and radio controls

master
evgeny 2 days ago
parent
commit
91357ebf90
  1. 9
      tools/chatgui/src/callwindow.cpp
  2. 4
      tools/chatgui/src/radiopanel.cpp

9
tools/chatgui/src/callwindow.cpp

@ -205,6 +205,12 @@ CallWindow::CallWindow(QWidget* parent)
m_statusLabel = new QLabel(this);
m_statusLabel->setAlignment(Qt::AlignCenter);
m_statusLabel->setStyleSheet("color: gray; font-size: 13px;");
m_statusLabel->setWordWrap(true);
connect(CallAudioEngine::instance(), &CallAudioEngine::captureErrorChanged, this, [this] {
auto* audio = CallAudioEngine::instance();
if (m_state == Active && audio->callId() == m_callId)
m_statusLabel->setText(audio->captureError().isEmpty() ? callText("In call") : audio->captureError());
});
m_durationLabel = new QLabel(QStringLiteral("00:00"), this);
m_durationLabel->setAlignment(Qt::AlignCenter);
@ -393,7 +399,8 @@ void CallWindow::setState(State s) {
m_durationLabel->hide();
break;
case Active:
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "In call"));
m_statusLabel->setText(CallAudioEngine::instance()->captureError().isEmpty()
? callText("In call") : CallAudioEngine::instance()->captureError());
m_durationLabel->setText(QStringLiteral("00:00"));
m_durationLabel->show();
m_startMs = QDateTime::currentMSecsSinceEpoch();

4
tools/chatgui/src/radiopanel.cpp

@ -67,6 +67,7 @@ RadioPanel::RadioPanel(QWidget* parent) : QWidget(parent) {
m_status = new QLabel(this);
m_status->setObjectName(QStringLiteral("radioStatus"));
m_status->setMinimumWidth(0);
m_status->setWordWrap(true);
m_status->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
row->addWidget(m_status, 1);
m_auto = new RadioAutoButton(this);
@ -220,7 +221,8 @@ void RadioPanel::updateState() {
m_ptt->update();
}
QString state;
if (!engine->settingsError().isEmpty()) state = QCoreApplication::translate("ChatGui", "Settings error");
if (!engine->captureError().isEmpty()) state = engine->captureError();
else if (!engine->settingsError().isEmpty()) state = QCoreApplication::translate("ChatGui", "Settings error");
else if (engine->settingsBusy()) state = QCoreApplication::translate("ChatGui", "Applying settings…");
else if (!engine->captureAvailable()) state = QCoreApplication::translate("ChatGui", "Microphone unavailable");
else if (engine->autoEnabled() && !engine->autoAvailable()) state = QCoreApplication::translate("ChatGui", "Automatic transmission unavailable");

Loading…
Cancel
Save