From a25d40528a72a01bfff6d4fa0190f18af06b196d Mon Sep 17 00:00:00 2001 From: ZHANGYANG Date: Sat, 10 Oct 2026 13:03:58 +0800 Subject: [PATCH 1/2] feat: show battery information after tray quick connect --- Assets/TrayQuickConnect/Connecting-Dark.png | Bin 0 -> 8300 bytes Assets/TrayQuickConnect/Connecting-Light.png | Bin 0 -> 7818 bytes Assets/TrayQuickConnect/Settings-zh-CN.png | Bin 0 -> 15930 bytes CMakeLists.txt | 1 + Source/Core/Settings.h | 5 +- Source/Gui/NotificationWindow.cpp | 173 +++++++++++++++++ Source/Gui/NotificationWindow.h | 44 +++++ Source/Gui/TrayActivation.h | 66 ++----- Source/Gui/TrayIcon.cpp | 42 ++-- Source/Gui/TrayIcon.h | 13 +- Source/Resource/Translation/apd_bg_BG.ts | 4 +- Source/Resource/Translation/apd_de_DE.ts | 4 +- Source/Resource/Translation/apd_fr_FR.ts | 4 +- Source/Resource/Translation/apd_it_IT.ts | 4 +- Source/Resource/Translation/apd_ja_JP.ts | 4 +- Source/Resource/Translation/apd_ko_KR.ts | 4 +- Source/Resource/Translation/apd_pt_BR.ts | 4 +- Source/Resource/Translation/apd_pt_PT.ts | 4 +- Source/Resource/Translation/apd_ru_RU.ts | 4 +- Source/Resource/Translation/apd_tr_TR.ts | 4 +- Source/Resource/Translation/apd_uk_UA.ts | 4 +- Source/Resource/Translation/apd_zh_CN.ts | 4 +- Source/Resource/Translation/apd_zh_TW.ts | 4 +- Tests/QuickConnectTests.cpp | 69 +++---- Tests/UiRenderingTests.cpp | 192 ++++++++++++++++++- 25 files changed, 495 insertions(+), 162 deletions(-) create mode 100644 Assets/TrayQuickConnect/Connecting-Dark.png create mode 100644 Assets/TrayQuickConnect/Connecting-Light.png create mode 100644 Assets/TrayQuickConnect/Settings-zh-CN.png create mode 100644 Source/Gui/NotificationWindow.cpp create mode 100644 Source/Gui/NotificationWindow.h diff --git a/Assets/TrayQuickConnect/Connecting-Dark.png b/Assets/TrayQuickConnect/Connecting-Dark.png new file mode 100644 index 0000000000000000000000000000000000000000..75d4febd91a43e4169df32fa90edb864ab2a24fd GIT binary patch literal 8300 zcmb_?1y>wR(C!l4-7UDgEE-^Of)gBqyR$gK0>LFX1PugR+#$FH0*kx51$T#U-|zl` zd+xb&&h*sj>YlEu>8k0jr=!$WH7P@*pEf$FND z4+a3R`v1G(QrWP`0f6@aMH#72KG`R$zD6^%uY(u!-r;7X8F07+R$4r|D|Z31^$nvl zu&YkIJj;5r!;5XiaBbQB%&9hS)v>nSKqqZ$cEwvoivU3&bpX>c)ieCz_0_Z+4jIQx zJ#+l(V&lTJb6MD8I_pY&ANs&5q__RYEY3sZ3ZT9mx5Om`yY%x*sz>Lrvn;u8{TA-82LgOI_6iRNR_gn@+$n1}sp z*gq;OKVzypTx~TH1#=iS@e>hbSnIR@!;t;yVHpMi{SKD_DjYfHxN{s zus#+_3?yo4FR#5fR*`~U00ssIsSD*f4k*$vsbFHz^!&q*oE%aM@2-wGDJdxqDRA)C z02<5|I%!4B_PYL82q&ZPGtAL@VEX4UoSRVGl%j>dZRLUp$jEBRiesS2M;YxyVhRee z#^+n!=I*&~m|KZww`er~@;=3d>!6~d9x{**Hv$Ce6VLHMGirfE==Dy(lqP^-lcODU zoJ%Z}-HsuwlqOD2s$_a|Yb#o=Fn`ikod8i=yH<}~kDb*TOv9Lr8dIb*FI1`I7uYFp zYj1BPxS$+*am_D=xuTsefD4-8B8x-9#>T$(Q}Ym^G^i}*e+Cc~31KuEV2b2m0fFB9 zWSFwDvZeMp2tOlKbv;Vpo^Y%IW|Nceyn05~o zIa6W(g8aj%@a`fD-q_f1u8Zx!+45^`ZQVRP)L)t^=akhrzr5@ptyCrYVNZ;QH$|vq z82m%gQv-ri@H%1&(nwzX^df|>DPV%jZe>2vSwy9un`*rjSa2AW^^hS(j(t+3jFxV z252^s2jJ<*;^?Rh1HZ+@EK6dRo=_S@;}m?JI;2?E-9PA*l>M25G&6_AA&a8H)!HId ze4`600UzIJYdclK6{Sjlgjw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snt(N`Fi42lJShpU7p~Eg2SK|~<3n4b03ImvcRus5 zO)#2Zc~490ArU+&5TXfdiad37xk8-Y&WzcO&!lPzN4@f$6_rM2_5QtpK$QnvhWinm z!5Z>lAW#p5#`!x8g}ZYC+B%t7T3PM-`jcx(wYE7Q!NAV=BIbX|Fd(yS#IYWn%_t;f zSq_=1j{gT^VHGhSD<~_Ipy)X^FB{^mzx&7kzFgHFreA!j)hPeR2THFz)TE3IA5CrF zh0R$!5DK!EwlyOoV{SvUnu80Sq?ea?!$#&F z2ne*U|Xnjx1?v;O#}dDtqztcwo=I90S$y#cOE`(9Ypw2@>erM1Es|BC~X8zN=hpv6V@-7cjd) yluoAmRbdAN@cugs5W8qpbMyRg#S+i{{04WCbNNd%L4y&-1t`j@%2a_&zy1&S2JTt_ literal 0 HcmV?d00001 diff --git a/Assets/TrayQuickConnect/Connecting-Light.png b/Assets/TrayQuickConnect/Connecting-Light.png new file mode 100644 index 0000000000000000000000000000000000000000..fa43f90882f03d40ff273cbf6b9514bab643be35 GIT binary patch literal 7818 zcmb`MRa6{Xu=fYc0KwfgNP-i527(hHXfn744G`Rd6J&5r7#spY0t9!r4DRl3!3NiX z%Q@%qd->K~_o1t6{j0lo?OMBcSFc~Vx~c*$HWfAi0KipzE2{|rph!OXshH26?5uRW z_R|T=@vW{40D#y1&w=ut1CJU2paUz)N`3H5KV14^Fa>$&Ihna)+9$=3Gf>C!AR%O| z+H{bPASyGe}>Z$8D?GxA|n0i?& zm+z2BCmzqhfmh@qcV8svz;suBFc&;_hv6&lVR2)O=kFm?w3z5#0K-7;0P0b6$7gn2 zOV1d)eTxCTsQiH>t2B;eB3Rw*5easE{om)g)gcfJOaL5J1|@60R0h*jP!+Hc_=s8& zkyBWs>-ifayQoMd;8(kOdsA&csWfKpM7y)euN?N28jV#$;8SoYV6R=EeXCUeMKA%W zGLQ_7Fd}EMIqjg$A?Y?3`9jm7vEX0jUD&kf~h(t5ybI3SgtR5Rl<*JPO#3scj1MNjm^%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J;jCAx~;&=OtfmAHoZ(?fTI=YG(w&z9?*!F+)uqjCZ0r27e83PL{S>k^vhaAjvc#$RmlDj z#WAq-8GPFP-v>{lj(l%DwkjIOsQUn^K@&plsF~$u3@-o4Zt^pS{f3nG!=6iEG)5Hq zLs=3PYcN65xp5JJpZXtQF7BW`KKr9H>o5D^O$4^B?F{nu>!&BngPxW{~ z+-2?1fJV1HX+7q<0q*$TYyOF`yQPjiS!ekJEaJl+QN4hfTu?xtq>V~Hfpl2YH`I5X z2&`BeDE(wP&{_!s(Kcy3QBE2slGf3q3jJQpq~u>)*JyLt-~zuuH%2#-)Jh_go@||< zfYT?Xa({9Ywn28J!M84ufliVHqgA#01kyUu#(dy*Yc2xq>I9e171xPS2;_6%nxCmh zHpeJNmsgMqZ`6wg-A3G}WuYYz7h*~xj3ELwRT+QZZZD@{uTy#Y2uxBVBlK@`A$x+$ O07W@f*-~kfum1!8WfjB# literal 0 HcmV?d00001 diff --git a/Assets/TrayQuickConnect/Settings-zh-CN.png b/Assets/TrayQuickConnect/Settings-zh-CN.png new file mode 100644 index 0000000000000000000000000000000000000000..3bbfd700ef5b05a8e3921660663fd3a5e22f75b5 GIT binary patch literal 15930 zcmcJ0WmKF&v*zF~!JQC7@BqPGgF6IwcXuZQcXtc!&IEUNcXyY;btn1m-9LBt*Pfko zW~NV{x4Y}@u70Y!s-94JSuqqu0z?1+fFdC-q6h#$`hm+%@UY-tY=rnijTNOn3 zNEH&MQX}4gQ`XSfpt7Q|lKob?w?NaNQE%`=o)*4XPyo8=lPiaV00-o+&jOH5Y)eMb zFK>%7wM~E0;L|RiZ--A3Gc(=qQd3P$+Ce-MJUg*5lO0(&JUl#;W?0HJXtNfqG>HU> z!+CpFLhxk2(6?c??G|g6P8ZKyj!%det?t+kX6iF?s1S8@bY|z~Ammk5gM0J`w#=|8 z5y6iOg%E~F7Kr94o*vJO{eORQZddW&zSvg11{PJpwRaVu% zZfRl5PF_=U#Rl>}a<-H-FH3v3!G-+>9_hy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87cb0069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -350,6 +350,7 @@ set( "Source/Gui/AnimationPlayback.cpp" "Source/Gui/TrayIcon.cpp" + "Source/Gui/NotificationWindow.cpp" "Source/Gui/TaskbarStatus.cpp" "Source/Gui/MainWindow.cpp" "Source/Gui/SelectWindow.cpp" diff --git a/Source/Core/Settings.h b/Source/Core/Settings.h index 8aeecd56..bdb0a7da 100644 --- a/Source/Core/Settings.h +++ b/Source/Core/Settings.h @@ -85,7 +85,10 @@ void SetRepository(std::unique_ptr repository); Impl::OnApply(&OnApply_tray_icon_battery)) \ callback(bool, tray_quick_connect_enabled, {false}, \ Impl::OnApply(&OnApply_tray_quick_connect_enabled), \ - Impl::Desc{QT_TRANSLATE_NOOP("QObject", "A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it.")}) \ + Impl::Desc{QT_TRANSLATE_NOOP("QObject", \ + "Single-click the tray icon to connect the selected device when disconnected, " \ + "or show battery information when connected. Battery information opens automatically " \ + "after a successful connection.")}) \ callback(QString, tray_quick_connect_device_id, {}, \ Impl::OnApply(&OnApply_tray_quick_connect_device_id), \ Impl::Sensitive{}) \ diff --git a/Source/Gui/NotificationWindow.cpp b/Source/Gui/NotificationWindow.cpp new file mode 100644 index 00000000..9ed55541 --- /dev/null +++ b/Source/Gui/NotificationWindow.cpp @@ -0,0 +1,173 @@ +#include "NotificationWindow.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "MainWindow.h" +#include "MainWindowPresentation.h" +#include "Theme.h" + +namespace Gui { + +NotificationWindow::NotificationWindow(QWidget *parent) + : QWidget{ + parent, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | + Qt::WindowDoesNotAcceptFocus}, + _title{new QLabel{this}}, _message{new QLabel{this}}, _progress{new QProgressBar{this}}, + _close{new QPushButton{QString::fromUtf8("\xC3\x97"), this}} +{ + setObjectName("connectionNotification"); + setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_ShowWithoutActivating); + setProperty(Theme::Manager::kSkipDwmProperty, true); + setFixedWidth(320); + + _title->setObjectName("notificationTitle"); + _message->setObjectName("notificationMessage"); + for (auto *label : {_title, _message}) { + label->setTextFormat(Qt::PlainText); + label->setWordWrap(true); + label->setAlignment(Qt::AlignCenter); + } + auto titleFont = _title->font(); + titleFont.setPointSize(15); + titleFont.setWeight(QFont::DemiBold); + _title->setFont(titleFont); + _title->setProperty("fontRole", "display"); + _close->setObjectName("notificationClose"); + _close->setFixedSize(25, 25); + _close->setFocusPolicy(Qt::NoFocus); + _close->setCursor(Qt::PointingHandCursor); + _close->setAccessibleName(QCoreApplication::translate("Gui::SettingsWindow", "Close")); + connect(_close, &QPushButton::clicked, this, &QWidget::hide); + + _progress->setRange(0, 0); + _progress->setTextVisible(false); + _progress->setFixedHeight(4); + auto *layout = new QVBoxLayout{this}; + layout->setContentsMargins(24, 16, 24, 24); + layout->setSpacing(12); + layout->addWidget(_close, 0, Qt::AlignRight); + layout->addWidget(_title); + layout->addWidget(_message); + layout->addWidget(_progress); + _autoHide.setSingleShot(true); + connect(&_autoHide, &QTimer::timeout, this, &QWidget::hide); + _placementTimer.setInterval(100); + connect(&_placementTimer, &QTimer::timeout, this, &NotificationWindow::Place); + connect( + &Theme::Manager::Instance(), &Theme::Manager::Changed, this, + &NotificationWindow::ApplyTheme); + ApplyTheme(); +} + +void NotificationWindow::Show( + const QString &title, const QString &message, bool warning, bool pending, + const QRect &trayGeometry) +{ + _autoHide.stop(); + // Resolve the cursor fallback once, so overflow-tray notifications do not follow the mouse. + if (!trayGeometry.isEmpty() || !isVisible() || _targetScreen == nullptr) { + _targetScreen = QGuiApplication::screenAt( + trayGeometry.isEmpty() ? QCursor::pos() : trayGeometry.center()); + } + if (_targetScreen == nullptr) { + _targetScreen = screen(); + } + _warning = warning; + _title->setText(title); + _message->setText(message); + _progress->setVisible(pending); + ApplyTheme(); + layout()->activate(); + adjustSize(); + Place(); + show(); + _placementTimer.start(); + if (!pending) { + _autoHide.start(warning ? 8000 : 3500); + } +} + +void NotificationWindow::Place() +{ + auto *targetScreen = _targetScreen.data(); + if (targetScreen == nullptr) { + targetScreen = QGuiApplication::primaryScreen(); + } + const auto available = targetScreen->availableGeometry(); + auto target = PopupPosition(available, size(), {24, 24}); + QRect card{target, size()}; + for (auto *window : QApplication::topLevelWidgets()) { + if (qobject_cast(window) == nullptr || !window->isVisible()) { + continue; + } + const auto battery = window->frameGeometry(); + // Also avoid the battery card's destination while its slide-in is running. + const auto batteryTarget = PopupPosition(available, window->size(), {24, 24}); + if (window->screen() != targetScreen || + (!card.intersects(battery) && !card.intersects(QRect{batteryTarget, window->size()}))) + { + continue; + } + target.setY(batteryTarget.y() - height() - 12); + if (target.y() < available.top()) { + target = + QPoint{batteryTarget.x() - width() - 12, available.bottom() + 1 - height() - 24}; + } + target.setX(qMax(available.left(), target.x())); + target.setY(qMax(available.top(), target.y())); + break; + } + if (pos() != target) { + move(target); + } +} + +void NotificationWindow::ApplyTheme() +{ + const auto &colors = Theme::Manager::Instance().Colors(); + _title->setStyleSheet( + QString{"color: %1; background: transparent;"}.arg(colors.mainText.name())); + _message->setStyleSheet( + QString{"color: %1; background: transparent;"}.arg( + (_warning ? colors.errorText : colors.mainTextSecondary).name())); + _close->setStyleSheet( + QString{"QPushButton { background: %1; color: %2; border: none; border-radius: 12px; " + "padding: 0; font-size: 20px; } QPushButton:hover { background: %3; } " + "QPushButton:pressed { background: %4; }"} + .arg( + colors.mainCloseBg.name(), colors.mainCloseGlyph.name(), + colors.mainCloseHover.name(), colors.mainClosePressed.name())); + _progress->setStyleSheet( + QString{"QProgressBar { border: none; background: %1; border-radius: 2px; } " + "QProgressBar::chunk { background: %2; border-radius: 2px; }"} + .arg(colors.mainCloseBg.name(), colors.accent.name())); + update(); +} + +void NotificationWindow::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + QPainter painter{this}; + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::NoPen); + painter.setBrush(Theme::Manager::Instance().Colors().mainSurface); + painter.drawRoundedRect(QRectF{rect()}, 32, 32); +} + +void NotificationWindow::hideEvent(QHideEvent *event) +{ + _autoHide.stop(); + _placementTimer.stop(); + QWidget::hideEvent(event); +} + +} // namespace Gui diff --git a/Source/Gui/NotificationWindow.h b/Source/Gui/NotificationWindow.h new file mode 100644 index 00000000..20246adb --- /dev/null +++ b/Source/Gui/NotificationWindow.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include +#include + +class QLabel; +class QProgressBar; +class QPushButton; +class QScreen; + +namespace Gui { + +// A single non-activating card whose content is replaced as a connection progresses. +class NotificationWindow : public QWidget +{ + Q_OBJECT + +public: + explicit NotificationWindow(QWidget *parent = nullptr); + void Show( + const QString &title, const QString &message, bool warning, bool pending, + const QRect &trayGeometry); + +protected: + void paintEvent(QPaintEvent *event) override; + void hideEvent(QHideEvent *event) override; + +private: + QLabel *_title; + QLabel *_message; + QProgressBar *_progress; + QPushButton *_close; + QTimer _autoHide{this}; + QTimer _placementTimer{this}; + QPointer _targetScreen; + bool _warning{false}; + + void ApplyTheme(); + void Place(); +}; + +} // namespace Gui diff --git a/Source/Gui/TrayActivation.h b/Source/Gui/TrayActivation.h index 2bcfec01..aa76d331 100644 --- a/Source/Gui/TrayActivation.h +++ b/Source/Gui/TrayActivation.h @@ -24,61 +24,19 @@ namespace Gui { enum class TrayActivationAction { None, ShowMainWindow, QuickConnect }; -enum class SingleClickTimer { Unchanged, Start, Stop }; - -struct TrayActivationResult { - TrayActivationAction action{TrayActivationAction::None}; - SingleClickTimer timer{SingleClickTimer::Unchanged}; - - bool operator==(const TrayActivationResult &rhs) const = default; -}; - -// Decides what a tray-icon activation means, including what should happen to the timer that -// separates a single click from the first click of a double click. `TrayIcon` does exactly what -// this returns and derives nothing on its own, so there is one place to read and one place to test. -class TrayActivationState final +// A single click acts immediately. Other left-button activation events do not open another window. +inline TrayActivationAction +GetTrayActivationAction(QSystemTrayIcon::ActivationReason reason, bool quickConnectEnabled) { -public: - TrayActivationResult - OnActivation(QSystemTrayIcon::ActivationReason reason, bool quickConnectEnabled) - { - switch (reason) { - case QSystemTrayIcon::Trigger: - if (!quickConnectEnabled) { - return {TrayActivationAction::ShowMainWindow, SingleClickTimer::Stop}; - } - // Wait out the double-click interval: Windows reports the first click of a double - // click as a Trigger too, and that one must open the window instead of connecting. - _singleClickPending = true; - return {TrayActivationAction::None, SingleClickTimer::Start}; - - case QSystemTrayIcon::DoubleClick: - case QSystemTrayIcon::MiddleClick: - _singleClickPending = false; - return {TrayActivationAction::ShowMainWindow, SingleClickTimer::Stop}; - - case QSystemTrayIcon::Context: - // The menu is opening; a quick connect fired behind it would be unexplainable. - _singleClickPending = false; - return {TrayActivationAction::None, SingleClickTimer::Stop}; - - default: - return {}; - } + switch (reason) { + case QSystemTrayIcon::Trigger: + return quickConnectEnabled ? TrayActivationAction::QuickConnect + : TrayActivationAction::ShowMainWindow; + case QSystemTrayIcon::MiddleClick: + return TrayActivationAction::ShowMainWindow; + default: + return TrayActivationAction::None; } - - TrayActivationAction OnSingleClickTimeout() - { - if (!_singleClickPending) { - return TrayActivationAction::None; - } - - _singleClickPending = false; - return TrayActivationAction::QuickConnect; - } - -private: - bool _singleClickPending{}; -}; +} } // namespace Gui diff --git a/Source/Gui/TrayIcon.cpp b/Source/Gui/TrayIcon.cpp index d33e120e..f6d77a05 100644 --- a/Source/Gui/TrayIcon.cpp +++ b/Source/Gui/TrayIcon.cpp @@ -32,10 +32,6 @@ TrayIcon::TrayIcon( : _quickConnect{quickConnect}, _settingsWindow{std::move(getCurrentLocaleIndex), quickConnect} { Theme::ConfigurePopupSurface(_menu); - _singleClickTimer.setSingleShot(true); - connect(&_singleClickTimer, &QTimer::timeout, this, [this] { - ExecuteTrayActivation(_trayActivationState.OnSingleClickTimeout()); - }); connect(_actionNewVersion, &QAction::triggered, this, &TrayIcon::OnNewVersionClicked); connect(_actionLowAudioLatency, &QAction::triggered, this, [](bool enabled) { @@ -45,7 +41,6 @@ TrayIcon::TrayIcon( connect(_actionAbout, &QAction::triggered, this, &TrayIcon::OnAboutClicked); connect(_actionQuit, &QAction::triggered, qApp, &QApplication::quit, Qt::QueuedConnection); connect(_tray, &QSystemTrayIcon::activated, this, &TrayIcon::OnIconClicked); - connect(_tray, &QSystemTrayIcon::messageClicked, this, &TrayIcon::ShowMainWindowRequested); connect( &_quickConnect, &Core::QuickConnect::Controller::OutcomeChanged, this, &TrayIcon::OnQuickConnectOutcome); @@ -377,21 +372,7 @@ void TrayIcon::OnAboutClicked() void TrayIcon::OnIconClicked(QSystemTrayIcon::ActivationReason reason) { - const auto result = _trayActivationState.OnActivation(reason, _quickConnect.IsEnabled()); - - switch (result.timer) { - case SingleClickTimer::Start: - // Read the interval each time; the user can change it in Windows while we are running. - _singleClickTimer.start(QApplication::doubleClickInterval()); - break; - case SingleClickTimer::Stop: - _singleClickTimer.stop(); - break; - case SingleClickTimer::Unchanged: - break; - } - - ExecuteTrayActivation(result.action); + ExecuteTrayActivation(GetTrayActivationAction(reason, _quickConnect.IsEnabled())); } void TrayIcon::ExecuteTrayActivation(TrayActivationAction action) @@ -424,14 +405,13 @@ void TrayIcon::OnQuickConnectOutcome(Core::QuickConnect::Outcome outcome, const icon = QSystemTrayIcon::Warning; break; case Core::QuickConnect::Outcome::AlreadyConnected: - text = tr("%1 is already connected.").arg(deviceName); - break; + case Core::QuickConnect::Outcome::Connected: + _notification->hide(); + ShowMainWindow(); + return; case Core::QuickConnect::Outcome::RequestStarted: text = tr("Connecting to %1...").arg(deviceName); break; - case Core::QuickConnect::Outcome::Connected: - text = tr("%1 connected.").arg(deviceName); - break; case Core::QuickConnect::Outcome::TimedOut: text = tr("Connection to %1 timed out.").arg(deviceName); icon = QSystemTrayIcon::Warning; @@ -444,7 +424,17 @@ void TrayIcon::OnQuickConnectOutcome(Core::QuickConnect::Outcome outcome, const return; } - ShowMessage(tr("Quick connect"), text, icon); + _notification->Show( + tr("Quick connect"), text, icon == QSystemTrayIcon::Warning, + outcome == Core::QuickConnect::Outcome::RequestStarted, _tray->geometry()); +} + +void TrayIcon::ShowMessage( + const QString &title, const QString &text, QSystemTrayIcon::MessageIcon icon) +{ + _notification->Show( + title, text, icon == QSystemTrayIcon::Warning || icon == QSystemTrayIcon::Critical, false, + _tray->geometry()); } void TrayIcon::OnTrayIconBatteryChanged(Core::Settings::TrayIconBatteryBehavior value) diff --git a/Source/Gui/TrayIcon.h b/Source/Gui/TrayIcon.h index cd1a9b4e..ab18ec06 100644 --- a/Source/Gui/TrayIcon.h +++ b/Source/Gui/TrayIcon.h @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -31,6 +30,7 @@ #include "Base.h" #include "TrayActivation.h" #include "SettingsWindow.h" +#include "NotificationWindow.h" namespace Gui { @@ -42,11 +42,9 @@ class TrayIcon : public QWidget explicit TrayIcon( std::function getCurrentLocaleIndex, Core::QuickConnect::Controller &quickConnect); - template - inline void ShowMessage(ArgsT &&...args) - { - _tray->showMessage(std::forward(args)...); - } + void ShowMessage( + const QString &title, const QString &text, + QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information); void UpdateState(const Core::AirPods::State &state); void Unavailable(); @@ -85,8 +83,7 @@ class TrayIcon : public QWidget std::optional _updateReleaseInfo; std::optional _lastIconRenderState; Core::QuickConnect::Controller &_quickConnect; - TrayActivationState _trayActivationState; - QTimer _singleClickTimer{this}; + NotificationWindow *_notification = new NotificationWindow{this}; void ShowMainWindow(); void Repaint(); diff --git a/Source/Resource/Translation/apd_bg_BG.ts b/Source/Resource/Translation/apd_bg_BG.ts index 39810e40..52696589 100644 --- a/Source/Resource/Translation/apd_bg_BG.ts +++ b/Source/Resource/Translation/apd_bg_BG.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Поддържа аудиоустройството активно, докато AirPods са свързани, така че кратките звуци да започват веднага. Това може да причини доловим шум и да изразходва повече батерия. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Щракването върху иконата в системната област свързва избраното устройство, вместо да отваря главния прозорец. Двукратното щракване продължава да го отваря. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Щракнете веднъж върху иконата в системната област, за да свържете избраното устройство, ако не е свързано, или да покажете информацията за батерията, ако е свързано. След успешно свързване информацията за батерията се показва автоматично. diff --git a/Source/Resource/Translation/apd_de_DE.ts b/Source/Resource/Translation/apd_de_DE.ts index c8b246a1..7b18d736 100644 --- a/Source/Resource/Translation/apd_de_DE.ts +++ b/Source/Resource/Translation/apd_de_DE.ts @@ -266,8 +266,8 @@ Kopple deine AirPods zuerst in den Windows Bluetooth-Einstellungen.Hält das Audiogerät aktiv, während deine AirPods verbunden sind, damit kurze Töne sofort wiedergegeben werden. Dies kann hörbares Rauschen verursachen und den Akkuverbrauch erhöhen. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Ein Klick auf das Symbol im Infobereich verbindet das ausgewählte Gerät, anstatt das Hauptfenster zu öffnen. Ein Doppelklick öffnet es weiterhin. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Klicken Sie einmal auf das Symbol im Infobereich, um das ausgewählte Gerät zu verbinden, wenn es nicht verbunden ist, oder den Akkustand anzuzeigen, wenn es verbunden ist. Nach erfolgreicher Verbindung wird der Akkustand automatisch angezeigt. diff --git a/Source/Resource/Translation/apd_fr_FR.ts b/Source/Resource/Translation/apd_fr_FR.ts index 91e94bfb..1963cd45 100644 --- a/Source/Resource/Translation/apd_fr_FR.ts +++ b/Source/Resource/Translation/apd_fr_FR.ts @@ -266,8 +266,8 @@ Vous devez d'abord appairer vos AirPods dans les paramètres Bluetooth de W Maintient le périphérique audio actif pendant que vos AirPods sont connectés afin que les sons courts démarrent immédiatement. Cela peut produire un souffle audible et augmenter la consommation de la batterie. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Un clic sur l'icône de la zone de notification connecte l'appareil sélectionné au lieu d'ouvrir la fenêtre principale. Un double-clic continue de l'ouvrir. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Cliquez une fois sur l’icône de la zone de notification pour connecter l’appareil sélectionné s’il est déconnecté, ou afficher le niveau de batterie s’il est connecté. Le niveau de batterie s’affiche automatiquement après une connexion réussie. diff --git a/Source/Resource/Translation/apd_it_IT.ts b/Source/Resource/Translation/apd_it_IT.ts index 15de00f4..dbd08589 100644 --- a/Source/Resource/Translation/apd_it_IT.ts +++ b/Source/Resource/Translation/apd_it_IT.ts @@ -267,8 +267,8 @@ Devi prima abbinare le tue AirPods nelle impostazioni Bluetooth di Windows.Mantiene attivo il dispositivo audio mentre gli AirPods sono connessi, così i suoni brevi iniziano subito. Potrebbe produrre un fruscio udibile e consumare più batteria. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Un clic sull'icona nell'area di notifica connette il dispositivo selezionato invece di aprire la finestra principale. Un doppio clic continua ad aprirla. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Fai clic sull’icona nell’area di notifica per connettere il dispositivo selezionato se è disconnesso o visualizzare il livello della batteria se è connesso. Il livello della batteria viene visualizzato automaticamente dopo una connessione riuscita. diff --git a/Source/Resource/Translation/apd_ja_JP.ts b/Source/Resource/Translation/apd_ja_JP.ts index 76d36660..a8b15cf9 100644 --- a/Source/Resource/Translation/apd_ja_JP.ts +++ b/Source/Resource/Translation/apd_ja_JP.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. AirPodsが接続されている間、オーディオデバイスを起動状態に保ち、短い音声をすぐに再生できるようにします。聞こえる程度のノイズが発生したり、バッテリー消費が増えたりする場合があります。 - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - 通知領域のアイコンをクリックすると、メインウィンドウを開かずに選択したデバイスへ接続します。ダブルクリックすると、引き続きメインウィンドウが開きます。 + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + トレイアイコンをシングルクリックすると、未接続の場合は選択したデバイスに接続し、接続済みの場合はバッテリー情報を表示します。接続に成功すると、バッテリー情報が自動的に表示されます。 diff --git a/Source/Resource/Translation/apd_ko_KR.ts b/Source/Resource/Translation/apd_ko_KR.ts index f64e74e6..814d7a7d 100644 --- a/Source/Resource/Translation/apd_ko_KR.ts +++ b/Source/Resource/Translation/apd_ko_KR.ts @@ -266,8 +266,8 @@ Windows의 Bluetooth 설정에서 AirPods을 페어링해야 합니다.AirPods이 연결된 동안 오디오 기기를 활성 상태로 유지하여 짧은 소리가 즉시 재생되도록 합니다. 잡음이 들리거나 배터리 사용량이 증가할 수 있습니다. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - 트레이 아이콘을 클릭하면 기본 창을 여는 대신 선택한 기기에 연결합니다. 두 번 클릭하면 기본 창이 열립니다. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + 트레이 아이콘을 한 번 클릭하면 연결되지 않은 경우 선택한 기기에 연결하고, 연결된 경우 배터리 정보를 표시합니다. 연결에 성공하면 배터리 정보가 자동으로 표시됩니다. diff --git a/Source/Resource/Translation/apd_pt_BR.ts b/Source/Resource/Translation/apd_pt_BR.ts index ce4e374f..8f144925 100644 --- a/Source/Resource/Translation/apd_pt_BR.ts +++ b/Source/Resource/Translation/apd_pt_BR.ts @@ -266,8 +266,8 @@ Você precisa emparelhar seus AirPods nas Configurações de Bluetooth do Window Mantém o dispositivo de áudio ativo enquanto os AirPods estão conectados para que sons curtos sejam reproduzidos imediatamente. Isso pode causar chiado audível e aumentar o consumo da bateria. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Um clique no ícone da bandeja conecta o dispositivo selecionado em vez de abrir a janela principal. Um clique duplo continua abrindo-a. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Clique uma vez no ícone da bandeja para conectar o dispositivo selecionado quando estiver desconectado ou mostrar as informações da bateria quando estiver conectado. As informações da bateria aparecem automaticamente após uma conexão bem-sucedida. diff --git a/Source/Resource/Translation/apd_pt_PT.ts b/Source/Resource/Translation/apd_pt_PT.ts index f7ec79c8..195833c7 100644 --- a/Source/Resource/Translation/apd_pt_PT.ts +++ b/Source/Resource/Translation/apd_pt_PT.ts @@ -266,8 +266,8 @@ Precisa primeiro de emparelhar os seus AirPods nas definições de Bluetooth do Mantém o dispositivo de áudio ativo enquanto os AirPods estão ligados, para que os sons curtos sejam reproduzidos imediatamente. Isto pode produzir ruído audível e consumir mais bateria. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Um clique no ícone da área de notificação liga o dispositivo selecionado em vez de abrir a janela principal. Um duplo clique continua a abri-la. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Clique uma vez no ícone da área de notificação para ligar o dispositivo selecionado quando estiver desligado ou mostrar as informações da bateria quando estiver ligado. As informações da bateria aparecem automaticamente após uma ligação bem-sucedida. diff --git a/Source/Resource/Translation/apd_ru_RU.ts b/Source/Resource/Translation/apd_ru_RU.ts index 9482752d..9a3e60e4 100644 --- a/Source/Resource/Translation/apd_ru_RU.ts +++ b/Source/Resource/Translation/apd_ru_RU.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Поддерживает аудиоустройство активным, пока AirPods подключены, чтобы короткие звуки воспроизводились сразу. Это может вызвать слышимое шипение и увеличить расход заряда. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Щелчок по значку в области уведомлений подключает выбранное устройство вместо открытия главного окна. Двойной щелчок по-прежнему открывает его. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Один щелчок по значку в области уведомлений подключает выбранное устройство, если оно отключено, или показывает уровень заряда, если оно подключено. После успешного подключения информация о заряде открывается автоматически. diff --git a/Source/Resource/Translation/apd_tr_TR.ts b/Source/Resource/Translation/apd_tr_TR.ts index 407914e0..508e0058 100644 --- a/Source/Resource/Translation/apd_tr_TR.ts +++ b/Source/Resource/Translation/apd_tr_TR.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. AirPods'unuz bağlıyken ses cihazını etkin tutar; böylece kısa sesler hemen çalar. Bu, duyulabilir dip sese ve daha fazla pil tüketimine neden olabilir. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Tepsi simgesine tıklamak ana pencereyi açmak yerine seçili cihaza bağlanır. Çift tıklamak pencereyi açmaya devam eder. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Seçili cihaz bağlı değilse bağlanmak, bağlıysa pil bilgilerini göstermek için tepsi simgesine bir kez tıklayın. Başarılı bir bağlantıdan sonra pil bilgileri otomatik olarak açılır. diff --git a/Source/Resource/Translation/apd_uk_UA.ts b/Source/Resource/Translation/apd_uk_UA.ts index 43fafe58..332aeeb2 100644 --- a/Source/Resource/Translation/apd_uk_UA.ts +++ b/Source/Resource/Translation/apd_uk_UA.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Підтримує аудіопристрій активним, поки AirPods підключені, щоб короткі звуки відтворювалися негайно. Це може спричинити чутне шипіння та збільшити споживання заряду. - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - Клацання піктограми в області сповіщень підключає вибраний пристрій замість відкриття головного вікна. Подвійне клацання, як і раніше, відкриває його. + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + Одне натискання на значок в області сповіщень підключає вибраний пристрій, якщо його відключено, або показує рівень заряду, якщо його підключено. Після успішного підключення інформація про заряд відкривається автоматично. diff --git a/Source/Resource/Translation/apd_zh_CN.ts b/Source/Resource/Translation/apd_zh_CN.ts index 46c5ad46..418d2b1c 100644 --- a/Source/Resource/Translation/apd_zh_CN.ts +++ b/Source/Resource/Translation/apd_zh_CN.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. 在 AirPods 连接期间保持音频设备唤醒,使短促提示音能够立即播放。这可能会产生可听见的嘶嘶声,并增加电池消耗。 - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - 单击系统托盘图标会连接选定的设备,而不是打开主窗口;双击仍会打开主窗口。 + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + 单击托盘图标:未连接时连接选定的设备,已连接时显示电量信息。连接成功后自动显示电量信息。 diff --git a/Source/Resource/Translation/apd_zh_TW.ts b/Source/Resource/Translation/apd_zh_TW.ts index 59204f4f..2353b7c2 100644 --- a/Source/Resource/Translation/apd_zh_TW.ts +++ b/Source/Resource/Translation/apd_zh_TW.ts @@ -266,8 +266,8 @@ You need to pair your AirPods in Windows Bluetooth Settings first. 在 AirPods 連線期間保持音訊裝置喚醒,讓短促提示音能立即播放。這可能會產生可聽見的嘶嘶聲,並增加電池消耗。 - A click on the tray icon connects the selected device instead of opening the main window. Double-click still opens it. - 按一下系統匣圖示會連線選取的裝置,而不是開啟主視窗;連按兩下仍會開啟主視窗。 + Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. + 按一下系統匣圖示:未連線時連線選取的裝置,已連線時顯示電量資訊。連線成功後自動顯示電量資訊。 diff --git a/Tests/QuickConnectTests.cpp b/Tests/QuickConnectTests.cpp index 392136f0..15882fb9 100644 --- a/Tests/QuickConnectTests.cpp +++ b/Tests/QuickConnectTests.cpp @@ -147,9 +147,9 @@ private slots: // Tray activation void singleClickOpensMainWindowWhenQuickConnectIsDisabled(); - void singleClickWaitsOutTheDoubleClickInterval(); - void doubleClickCancelsPendingQuickConnect(); - void contextMenuCancelsPendingQuickConnect(); + void singleClickRequestsQuickConnectImmediately(); + void doubleClickDoesNotOpenMainWindow(); + void contextMenuDoesNotRequestQuickConnect(); void unknownActivationDoesNothing(); }; @@ -401,67 +401,44 @@ void QuickConnectTests::controllerDestructionCancelsInFlightRefresh() ////////////////////////////////////////////////// // Tray activation // -// These exercise the same TrayActivationState that TrayIcon drives, including the timer decision, -// so the assertions describe what a user actually gets. +// These exercise the same activation decisions that TrayIcon drives. // void QuickConnectTests::singleClickOpensMainWindowWhenQuickConnectIsDisabled() { - Gui::TrayActivationState state; - - const auto result = state.OnActivation(QSystemTrayIcon::Trigger, false); - QCOMPARE(result.action, Gui::TrayActivationAction::ShowMainWindow); - QCOMPARE(result.timer, Gui::SingleClickTimer::Stop); - QCOMPARE(state.OnSingleClickTimeout(), Gui::TrayActivationAction::None); + QCOMPARE( + Gui::GetTrayActivationAction(QSystemTrayIcon::Trigger, false), + Gui::TrayActivationAction::ShowMainWindow); } -void QuickConnectTests::singleClickWaitsOutTheDoubleClickInterval() +void QuickConnectTests::singleClickRequestsQuickConnectImmediately() { - Gui::TrayActivationState state; - - const auto result = state.OnActivation(QSystemTrayIcon::Trigger, true); - QCOMPARE(result.action, Gui::TrayActivationAction::None); - QCOMPARE(result.timer, Gui::SingleClickTimer::Start); - QCOMPARE(state.OnSingleClickTimeout(), Gui::TrayActivationAction::QuickConnect); - - // Only the first timeout counts. - QCOMPARE(state.OnSingleClickTimeout(), Gui::TrayActivationAction::None); + QCOMPARE( + Gui::GetTrayActivationAction(QSystemTrayIcon::Trigger, true), + Gui::TrayActivationAction::QuickConnect); } -void QuickConnectTests::doubleClickCancelsPendingQuickConnect() +void QuickConnectTests::doubleClickDoesNotOpenMainWindow() { - Gui::TrayActivationState state; - - QCOMPARE( - state.OnActivation(QSystemTrayIcon::Trigger, true).action, Gui::TrayActivationAction::None); - - const auto result = state.OnActivation(QSystemTrayIcon::DoubleClick, true); - QCOMPARE(result.action, Gui::TrayActivationAction::ShowMainWindow); - QCOMPARE(result.timer, Gui::SingleClickTimer::Stop); - QCOMPARE(state.OnSingleClickTimeout(), Gui::TrayActivationAction::None); + for (const bool enabled : {false, true}) { + QCOMPARE( + Gui::GetTrayActivationAction(QSystemTrayIcon::DoubleClick, enabled), + Gui::TrayActivationAction::None); + } } -// Opening the context menu must not leave a connect request to fire behind it. -void QuickConnectTests::contextMenuCancelsPendingQuickConnect() +void QuickConnectTests::contextMenuDoesNotRequestQuickConnect() { - Gui::TrayActivationState state; - QCOMPARE( - state.OnActivation(QSystemTrayIcon::Trigger, true).timer, Gui::SingleClickTimer::Start); - - const auto result = state.OnActivation(QSystemTrayIcon::Context, true); - QCOMPARE(result.action, Gui::TrayActivationAction::None); - QCOMPARE(result.timer, Gui::SingleClickTimer::Stop); - QCOMPARE(state.OnSingleClickTimeout(), Gui::TrayActivationAction::None); + Gui::GetTrayActivationAction(QSystemTrayIcon::Context, true), + Gui::TrayActivationAction::None); } void QuickConnectTests::unknownActivationDoesNothing() { - Gui::TrayActivationState state; - - const auto result = state.OnActivation(QSystemTrayIcon::Unknown, true); - QCOMPARE(result.action, Gui::TrayActivationAction::None); - QCOMPARE(result.timer, Gui::SingleClickTimer::Unchanged); + QCOMPARE( + Gui::GetTrayActivationAction(QSystemTrayIcon::Unknown, true), + Gui::TrayActivationAction::None); } QTEST_GUILESS_MAIN(QuickConnectTests) diff --git a/Tests/UiRenderingTests.cpp b/Tests/UiRenderingTests.cpp index ecbe3ca8..37b6c365 100644 --- a/Tests/UiRenderingTests.cpp +++ b/Tests/UiRenderingTests.cpp @@ -131,6 +131,195 @@ class UiRenderingTests : public QObject Q_OBJECT private Q_SLOTS: + void ConnectionSuccessOpensBatteryWindowAndDismissesNotification() + { + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + Gui::MainWindow battery; + connect(&tray, &Gui::TrayIcon::ShowMainWindowRequested, &battery, &Gui::MainWindow::Show); + QSignalSpy opened{&tray, &Gui::TrayIcon::ShowMainWindowRequested}; + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::RequestStarted, "AirPods"); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + QVERIFY(card->isVisible()); + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::Connected, "AirPods"); + QCOMPARE(opened.count(), 1); + QVERIFY(!card->isVisible()); + QVERIFY(battery.isVisible()); + } + + void AlreadyConnectedOpensBatteryWindowWithoutNotification() + { + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + Gui::MainWindow battery; + connect(&tray, &Gui::TrayIcon::ShowMainWindowRequested, &battery, &Gui::MainWindow::Show); + QSignalSpy opened{&tray, &Gui::TrayIcon::ShowMainWindowRequested}; + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::AlreadyConnected, "AirPods"); + QCOMPARE(opened.count(), 1); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + QVERIFY(!card->isVisible()); + QVERIFY(battery.isVisible()); + } + + void TrayClicksActImmediatelyWithoutDoubleClickOpening() + { + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + quickConnect.SetEnabled(true); + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + QSignalSpy opened{&tray, &Gui::TrayIcon::ShowMainWindowRequested}; + auto *icon = tray.findChild(); + QVERIFY(icon != nullptr); + icon->activated(QSystemTrayIcon::Trigger); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + QVERIFY(card->isVisible()); + QCOMPARE(opened.count(), 0); + icon->activated(QSystemTrayIcon::DoubleClick); + QCOMPARE(opened.count(), 0); + quickConnect.SetEnabled(false); + icon->activated(QSystemTrayIcon::Trigger); + QCOMPARE(opened.count(), 1); + } + + void SettingsDescribeConnectionAndBatterySingleClickBehavior() + { + QTranslator translator; + QVERIFY(translator.load( + QLocale{"zh_CN"}, "apd", "_", + QCoreApplication::applicationDirPath() + "/translations")); + QVERIFY(QCoreApplication::installTranslator(&translator)); + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::SettingsWindow settings{[] { return 0; }, quickConnect}; + auto *description = settings.findChild("lbDescTrayQuickConnect"); + QVERIFY(description != nullptr); + QCOMPARE( + description->text(), QStringLiteral( + "单击托盘图标:未连接时连接选定的设备,已连接时显示电量信息。" + "连接成功后自动显示电量信息。")); + settings.show(); + QVERIFY(QTest::qWaitForWindowExposed(&settings)); + auto *card = settings.findChild("cardTrayQuickConnect"); + QVERIFY(card != nullptr); + auto *scroll = settings.findChild("pagesScrollArea"); + QVERIFY(scroll != nullptr); + scroll->ensureWidgetVisible(card); + QVERIFY(QDir{}.mkpath(QStringLiteral(APD_BINARY_DIR "/UiValidation"))); + QVERIFY( + card->grab().save(QStringLiteral(APD_BINARY_DIR "/UiValidation/tray-setting-zh.png"))); + QCoreApplication::removeTranslator(&translator); + } + + void NotificationUsesCurrentLanguage() + { + QVERIFY(Gui::Theme::LoadBundledFonts()); + Gui::Theme::ApplyApplicationTypography(QLocale{"zh_CN"}); + QTranslator translator; + QVERIFY(translator.load( + QLocale{"zh_CN"}, "apd", "_", + QCoreApplication::applicationDirPath() + "/translations")); + QVERIFY(QCoreApplication::installTranslator(&translator)); + auto &theme = Gui::Theme::Manager::Instance(); + const auto originalMode = theme.CurrentMode(); + theme.SetMode(Gui::Theme::Mode::Light); + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::RequestStarted, "AirPods Pro"); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + QCOMPARE( + card->findChild("notificationTitle")->text(), + translator.translate("Gui::TrayIcon", "Quick connect")); + QCOMPARE( + card->findChild("notificationMessage")->text(), + translator.translate("Gui::TrayIcon", "Connecting to %1...").arg("AirPods Pro")); + VerifySmoothPopupCorners(card, "connection-notification-zh-light.png"); + theme.SetMode(Gui::Theme::Mode::Dark); + VerifySmoothPopupCorners(card, "connection-notification-zh-dark.png"); + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::Connected, "AirPods Pro"); + QVERIFY(!card->isVisible()); + QCoreApplication::removeTranslator(&translator); + Gui::Theme::ApplyApplicationTypography(QLocale{"en_US"}); + theme.SetMode(originalMode); + } + + void TrayNotificationsUseOneApplicationCard() + { + auto &theme = Gui::Theme::Manager::Instance(); + const auto originalMode = theme.CurrentMode(); + theme.SetMode(Gui::Theme::Mode::Light); + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + tray.ShowMessage("Quick connect", "Connecting..."); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + QVERIFY(card->isVisible()); + QVERIFY(card->testAttribute(Qt::WA_ShowWithoutActivating)); + tray.ShowMessage("Quick connect", "Connected."); + QCOMPARE(tray.findChild("connectionNotification"), card); + auto *message = card->findChild("notificationMessage"); + QVERIFY(message != nullptr); + QCOMPARE(message->text(), QStringLiteral("Connected.")); + VerifySmoothPopupCorners(card, "connection-notification-light.png"); + auto *close = card->findChild("notificationClose"); + QVERIFY(close != nullptr); + QTest::mouseClick(close, Qt::LeftButton); + QVERIFY(!card->isVisible()); + theme.SetMode(originalMode); + } + + void QuickConnectCardTracksProgressAndResult() + { + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + QSignalSpy opened{&tray, &Gui::TrayIcon::ShowMainWindowRequested}; + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::RequestStarted, "AirPods"); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + QVERIFY(card->isVisible()); + auto *progress = card->findChild(); + QVERIFY(progress != nullptr); + QVERIFY(progress->isVisible()); + // The old success timer must not dismiss a newly started connection. + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::Connected, "AirPods"); + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::RequestStarted, "AirPods"); + QTest::qWait(3700); + QVERIFY(card->isVisible()); + quickConnect.OutcomeChanged(Core::QuickConnect::Outcome::Connected, "AirPods"); + QVERIFY(!card->isVisible()); + QCOMPARE(opened.count(), 2); + } + + void NotificationAvoidsBatteryCardAndSupportsDarkTheme() + { + auto &theme = Gui::Theme::Manager::Instance(); + const auto originalMode = theme.CurrentMode(); + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + Gui::MainWindow battery; + tray.ShowMessage("Quick connect", "Connected."); + auto *card = tray.findChild("connectionNotification"); + QVERIFY(card != nullptr); + battery.Show(); + QTest::qWait(700); + QVERIFY(!card->frameGeometry().intersects(battery.frameGeometry())); + theme.SetMode(Gui::Theme::Mode::Dark); + tray.ShowMessage("Quick connect", "Could not connect.", QSystemTrayIcon::Warning); + VerifySmoothPopupCorners(card, "connection-notification-dark.png"); + QTest::qWait(3700); + QVERIFY(card->isVisible()); + theme.SetMode(originalMode); + } + void MainWindowRendersAirPods5() { Core::AirPods::State state; @@ -711,7 +900,8 @@ private Q_SLOTS: }; QVERIFY(appearanceTextFits()); - for (const auto *name : { + for (const auto *name : + { "cbLowAudioLatency", "cbAutoEarDetection", "cbTrayQuickConnectEnabled", From 915995db9a846e9dce040882117a4ca1c1c85550 Mon Sep 17 00:00:00 2001 From: ZHANGYANG Date: Mon, 19 Oct 2026 16:52:10 +0800 Subject: [PATCH 2/2] feat: add playback auto-connect and improve tray reliability --- Assets/TrayQuickConnect/Settings-zh-CN.png | Bin 15930 -> 33760 bytes CMakeLists.txt | 2 + Docs/AudioAutoConnect.md | 44 ++++ Source/Application.cpp | 11 + Source/Application.h | 5 + Source/Core/AirPodsStateManager.cpp | 41 ++++ Source/Core/PlaybackMonitor.cpp | 89 ++++++++ Source/Core/PlaybackMonitor.h | 58 +++++ Source/Core/PlaybackMonitor_win.cpp | 104 +++++++++ Source/Core/QuickConnect.cpp | 57 ++++- Source/Core/QuickConnect.h | 14 +- Source/Core/Settings.cpp | 13 +- Source/Core/Settings.h | 7 + Source/Gui/SettingsWindow.cpp | 11 +- Source/Gui/SettingsWindow.h | 1 + Source/Gui/SettingsWindow.ui | 30 +++ Source/Gui/TrayIcon.cpp | 2 +- Source/Gui/Utils.h | 4 +- Source/Resource/Translation/apd_bg_BG.ts | 8 + Source/Resource/Translation/apd_de_DE.ts | 8 + Source/Resource/Translation/apd_fr_FR.ts | 8 + Source/Resource/Translation/apd_it_IT.ts | 8 + Source/Resource/Translation/apd_ja_JP.ts | 8 + Source/Resource/Translation/apd_ko_KR.ts | 8 + Source/Resource/Translation/apd_pt_BR.ts | 8 + Source/Resource/Translation/apd_pt_PT.ts | 8 + Source/Resource/Translation/apd_ru_RU.ts | 8 + Source/Resource/Translation/apd_tr_TR.ts | 8 + Source/Resource/Translation/apd_uk_UA.ts | 8 + Source/Resource/Translation/apd_zh_CN.ts | 8 + Source/Resource/Translation/apd_zh_TW.ts | 8 + Tests/AirPodsDomainTests.cpp | 107 ++++++++- .../AirPods4AncConflictingBattery.txt | 48 +++++ Tests/Fixtures/README.md | 18 ++ Tests/QuickConnectTests.cpp | 203 +++++++++++++++++- Tests/UiRenderingTests.cpp | 65 ++++++ 36 files changed, 1027 insertions(+), 11 deletions(-) create mode 100644 Docs/AudioAutoConnect.md create mode 100644 Source/Core/PlaybackMonitor.cpp create mode 100644 Source/Core/PlaybackMonitor.h create mode 100644 Source/Core/PlaybackMonitor_win.cpp create mode 100644 Tests/Fixtures/AirPods4AncConflictingBattery.txt create mode 100644 Tests/Fixtures/README.md diff --git a/Assets/TrayQuickConnect/Settings-zh-CN.png b/Assets/TrayQuickConnect/Settings-zh-CN.png index 3bbfd700ef5b05a8e3921660663fd3a5e22f75b5..143046f3d16c5f59cc340bd9f9651d389ce9e717 100644 GIT binary patch literal 33760 zcmbrlbxt03b++|4;+~zW9IcH^4xBZm0HSQ9u7+?Zq{m z006}Pe|}&|G>A9=03kr)hoG{1=INS;w({P4_f-shA0uMa=`bP87vhZO7_H*s*hQ6b zZO1V(DW{S4^b}tcV1-nqhm6gPVqIBFp@x2{;Z{ToSs?Ld;1}Yu)0NGOn6v-`l{WVi z-Ry^xy%RFCNsmdVtef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?RVA(-nbGuuPxt2HWq#*A!e#%&kqq@iRV=hg~M=`WwULOilN#)Ph}! z$bVeK_B;(({{`BI09gcpAUJhVVwgn58l1XlXfARPY3jCbKvHh^ZcO+{xItk`p8vhC zr#mno%ABF&^oc(Rh8o2A7ECE|5h48#8@xtv!1GbJgxon@FjA?>$HfEqzvbLz!Bv*z zmIzIVS0!L6`ss+0=jX@#3}vJzx;RAs*O!*q0`sNiWKB;e^b@Ae9cL9i1B{c%#v4(` zQC%D7Ra~J2|0j-W{aYF!=S_ zgC4u8Jy02ZW5rZw0cB11omA)Veax-iAeyWf=aDzBT;vocC^^3hP5pjk6Le|Yib!(e zG{L`+2fxK+&|CZz78W)#;SQz(LA6$E6}Of$y*P0Zv$E1>U&_lT6c&a5O)Db`=;|y{ zDgu)%p;*;%|-)n3OtjvdH(B@7a!N#YPAQ ztp7mC=Fw5;n90e1!^NOYGC)4$f}mm^Gkt8G%v=HhRtoKy9))O)iuUy-bRjL6L`fO% zwmie>;}~VIxL!qS6)HC#ykXPS7f@iC7{4n_p4_T&A3`Af!T5n3fWlpu4utb{!4vzvUh2L zYH8a^OZtV*&et^dZ|AmCEM8v|(kobmBKO4wY@mWWcb%)O2UcD*21C`0;sQdd~9)bch_W-`X7s# zDO`1LefM>%A24Z9($~{N#_Io9T=Wghu-{#JjPk0cxs{cb_8xUnz9x<+VZS#|PQvFb z3fkLAf_tLYYzDT9-{+a>|0)t$Wd_)^RjA~GX~>tCfSljIf6sYUWW7{tR4iJtVSNt> z4n~aZ$E;9^l-!$oY{L0B%)+P*&=AON$6-}@@3pd$aq$k(`{zp!OAEpeFc};m@m*G= JQb_OT{{ms8W_17n diff --git a/CMakeLists.txt b/CMakeLists.txt index 87cb0069..4fb190dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,6 +333,7 @@ set( "Source/Core/Update.cpp" "Source/Core/AirPods.cpp" "Source/Core/QuickConnect.cpp" + "Source/Core/PlaybackMonitor.cpp" "Source/Core/Settings.cpp" "Source/Core/SettingsRepository.cpp" "Source/Core/LowAudioLatency.cpp" @@ -373,6 +374,7 @@ if (WIN32) "Source/Core/AutoStart_win.cpp" "Source/Core/Bluetooth_win.cpp" "Source/Core/GlobalMedia_win.cpp" + "Source/Core/PlaybackMonitor_win.cpp" "Source/Core/QuickConnect_win.cpp" ) list(APPEND APD_APP_CODE_FILES diff --git a/Docs/AudioAutoConnect.md b/Docs/AudioAutoConnect.md new file mode 100644 index 00000000..9399092c --- /dev/null +++ b/Docs/AudioAutoConnect.md @@ -0,0 +1,44 @@ +# Connect automatically when audio starts playing + +In Settings, select the paired Bluetooth audio device and enable **Connect automatically when +audio starts playing**. The option is off by default and is independent of the tray-click option. +Both options use the same selected device. + +When an output audio session starts running, the application checks the selected device and requests +a connection only if it is disconnected. A device that is already connected causes no notification +or window to open. Successful automatic connections open the battery window; progress and failures +use the existing application notification card. + +Playback is checked on a background worker every 250 ms across active Windows output endpoints. +The application's own sounds are excluded. Audio session state is used rather than sound level, +so muted playback and quiet passages still count as playback. No audio is recorded. At least 1.5 +seconds without a running output session is required before another playback start is recognized. +Applications that keep their audio streams running while paused may therefore delay recognition of +a subsequent playback start. + +Each playback start can request one connection. Existing connection requests are reused. After an +automatic failure or timeout, at least 30 seconds must pass **and a new playback start must occur** +before another automatic attempt. The application does not continuously retry during playback. +Turning the option off stops playback monitoring; a connection request already submitted to Windows +is allowed to finish. + +## Validation + +- Build x64 `RelWithDebInfo` and run `ctest --test-dir Build -C RelWithDebInfo --output-on-failure`. +- Tests cover the independent setting, persistence/observer application, playback edges, duplicate + requests, already-connected behavior, cooldown, monitor shutdown and manual clicks during an + automatic check. UI tests use in-memory settings and do not write user preferences. +- An optional native Windows audio smoke test plays a quiet two-second tone in a separate process + and checks that the real playback probe detects its start and stop. Stop other playback first: + + ```powershell + $env:APD_RUN_AUDIO_SMOKE_TEST = '1' + .\Build\Binary\QuickConnectTests.exe nativePlaybackProbeDetectsExternalPlayback + Remove-Item Env:APD_RUN_AUDIO_SMOKE_TEST + ``` + +For a hardware check, enable the option, disconnect the selected headphones, and start playback +on the PC. Confirm that one connection attempt occurs and the battery window opens on success. +Repeat while already connected and with the option off; neither case should initiate another +connection. With the headphones unavailable, confirm that continuous playback does not keep +retrying, and that restarting playback after the cooldown allows another attempt. diff --git a/Source/Application.cpp b/Source/Application.cpp index 73d92577..a79cb7d8 100644 --- a/Source/Application.cpp +++ b/Source/Application.cpp @@ -37,6 +37,7 @@ #include "Core/GlobalMedia.h" #include "Core/LowAudioLatency.h" #include "Core/QuickConnect.h" +#include "Core/PlaybackMonitor.h" #if defined APD_OS_WIN #include "Core/QuickConnect_win.h" #endif @@ -203,6 +204,10 @@ bool ApdApplication::Prepare(int argc, char *argv[]) _quickConnectBackend = std::make_shared(); #endif _quickConnect = std::make_unique(_quickConnectBackend); + _playbackMonitor = std::make_unique(); + connect( + _playbackMonitor.get(), &Core::GlobalMedia::PlaybackMonitor::PlaybackChanged, + _quickConnect.get(), &Core::QuickConnect::Controller::OnPlaybackStateChanged); _trayIcon = std::make_unique( [this] { return GetCurrentLoadedLocaleIndex(); }, *_quickConnect); @@ -459,6 +464,12 @@ void ApdApplication::OnTrayQuickConnectDeviceChanged(const QString &deviceId) _quickConnect->SetDeviceId(deviceId); } +void ApdApplication::OnAudioAutoConnectEnabledChanged(bool enable) +{ + _quickConnect->SetAudioAutoConnectEnabled(enable); + _playbackMonitor->SetEnabled(enable); +} + void ApdApplication::OnTaskbarBatteryChanged(Core::Settings::TaskbarStatusBehavior behavior) { emit _taskbarStatus->OnSettingsChangedSafely(behavior); diff --git a/Source/Application.h b/Source/Application.h index 5b584be1..6f1d6dc2 100644 --- a/Source/Application.h +++ b/Source/Application.h @@ -43,6 +43,9 @@ namespace Core::QuickConnect { class Backend; class Controller; } // namespace Core::QuickConnect +namespace Core::GlobalMedia { +class PlaybackMonitor; +} namespace Gui { class MainWindow; @@ -86,6 +89,7 @@ class ApdApplication : public SingleApplication, private Core::Settings::ApplyOb // in reverse declaration order. std::shared_ptr _quickConnectBackend; std::unique_ptr _quickConnect; + std::unique_ptr _playbackMonitor; std::unique_ptr _trayIcon; std::unique_ptr _taskbarStatus; std::unique_ptr _mainWindow; @@ -111,6 +115,7 @@ class ApdApplication : public SingleApplication, private Core::Settings::ApplyOb void OnDeviceAddressChanged(uint64_t address) override; void OnTrayIconBatteryChanged(Core::Settings::TrayIconBatteryBehavior behavior) override; void OnTrayQuickConnectEnabledChanged(bool enable) override; + void OnAudioAutoConnectEnabledChanged(bool enable) override; void OnTrayQuickConnectDeviceChanged(const QString &deviceId) override; void OnTaskbarBatteryChanged(Core::Settings::TaskbarStatusBehavior behavior) override; }; diff --git a/Source/Core/AirPodsStateManager.cpp b/Source/Core/AirPodsStateManager.cpp index 0b42f7a2..56fea70f 100644 --- a/Source/Core/AirPodsStateManager.cpp +++ b/Source/Core/AirPodsStateManager.cpp @@ -26,6 +26,33 @@ using namespace std::chrono_literals; namespace Core::AirPods::Details { +namespace { + +bool HasConflictingPodBatteries(const State &lhs, const State &rhs) +{ + const auto conflicts = [](const Battery &a, const Battery &b) { + // Broadcast batteries are quantized to 10% steps. Adjacent buckets can legitimately + // differ between pods; larger discrepancies cannot be merged as one current state. + return a.Available() && b.Available() && + std::abs(static_cast(a.Value()) - static_cast(b.Value())) > 10; + }; + return conflicts(lhs.pods.left.battery, rhs.pods.left.battery) || + conflicts(lhs.pods.right.battery, rhs.pods.right.battery); +} + +bool IsStrongerCompleteReport(const Advertisement &candidate, const Advertisement &cached) +{ + const auto count = [](const State &state) { + return static_cast(state.pods.left.battery.Available()) + + static_cast(state.pods.right.battery.Available()); + }; + // Recover if the first observed packet was a weaker, single-pod report from another pair. + // Completeness alone must not let a distant pair replace the selected nearby single pod. + return count(candidate.GetAdvState()) > count(cached.GetAdvState()) && + candidate.GetRssi() >= cached.GetRssi() + 10; +} + +} // namespace StateManager::StateManager() { @@ -171,6 +198,13 @@ bool StateManager::IsPossibleDesiredAdv(const Advertisement &adv) const } if (lastAnotherAdv.has_value()) { + if (HasConflictingPodBatteries(advState, lastAnotherAdv->first.GetAdvState())) { + if (IsStrongerCompleteReport(adv, lastAnotherAdv->first)) { + return true; + } + LOG(Trace, "Ignore conflicting battery reports from another advertisement source."); + return false; + } int16_t rssiDiff = std::abs(advRssi - lastAnotherAdv->first.GetRssi()); if (rssiDiff > 50) { LOG(Warn, "IsPossibleDesiredAdv returns false. Reason: Another side rssiDiff '{}'", @@ -187,6 +221,13 @@ void StateManager::UpdateAdv(Advertisement adv) _lostTimer.Reset(); const auto &advState = adv.GetAdvState(); + auto &peer = advState.side == Side::Left ? _adv.right : _adv.left; + if (peer.has_value() && HasConflictingPodBatteries(advState, peer->first.GetAdvState()) && + IsStrongerCompleteReport(adv, peer->first)) + { + // Do not keep using the discarded source for fields missing from the replacement. + peer.reset(); + } if (advState.side == Side::Left) { _stateResetTimer.left.Reset(); _adv.left = std::make_pair(std::move(adv), Clock::now()); diff --git a/Source/Core/PlaybackMonitor.cpp b/Source/Core/PlaybackMonitor.cpp new file mode 100644 index 00000000..16c97335 --- /dev/null +++ b/Source/Core/PlaybackMonitor.cpp @@ -0,0 +1,89 @@ +// +// AirPodsDesktop - AirPods Desktop User Experience Enhancement Program. +// Copyright (C) 2021-2022 SpriteOvO +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "PlaybackMonitor.h" + +#include +#include +#include + +#include + +namespace Core::GlobalMedia { + +PlaybackMonitor::PlaybackMonitor( + PlaybackProbe probe, std::chrono::milliseconds pollInterval, + std::chrono::milliseconds silenceInterval) + : _probe{std::move(probe)}, _pollInterval{pollInterval}, _silenceInterval{silenceInterval} +{ +} + +PlaybackMonitor::~PlaybackMonitor() +{ + SetEnabled(false); +} + +void PlaybackMonitor::SetEnabled(bool enabled) +{ + if (enabled == _worker.joinable()) { + return; + } + ++_generation; + if (!enabled) { + _worker.request_stop(); + _worker.join(); + return; + } + + const auto generation = _generation; + _worker = std::jthread{[this, generation](std::stop_token stopToken) { + bool playing = false; + auto lastSound = std::chrono::steady_clock::now(); + std::mutex mutex; + std::condition_variable_any wake; + std::unique_lock lock{mutex}; + while (!stopToken.stop_requested()) { + const auto activity = _probe(); + const auto now = std::chrono::steady_clock::now(); + if (activity.has_value()) { + if (*activity) { + lastSound = now; + } + const bool next = *activity || (playing && now - lastSound < _silenceInterval); + if (playing != next) { + playing = next; + QMetaObject::invokeMethod(this, [this, generation, playing] { + if (_generation == generation) { + emit PlaybackChanged(playing); + } + }); + } + } + wake.wait_for(lock, stopToken, _pollInterval, [] { return false; }); + } + }}; +} + +#if !defined APD_OS_WIN +PlaybackProbe CreatePlaybackProbe() +{ + return [] { return std::optional{false}; }; +} +#endif + +} // namespace Core::GlobalMedia diff --git a/Source/Core/PlaybackMonitor.h b/Source/Core/PlaybackMonitor.h new file mode 100644 index 00000000..f52e029b --- /dev/null +++ b/Source/Core/PlaybackMonitor.h @@ -0,0 +1,58 @@ +// +// AirPodsDesktop - AirPods Desktop User Experience Enhancement Program. +// Copyright (C) 2021-2022 SpriteOvO +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include +#include +#include +#include + +#include + +namespace Core::GlobalMedia { + +// Reads output activity only; no audio samples are captured or retained. +using PlaybackProbe = std::function()>; +PlaybackProbe CreatePlaybackProbe(); + +class PlaybackMonitor final : public QObject +{ + Q_OBJECT + +public: + explicit PlaybackMonitor( + PlaybackProbe probe = CreatePlaybackProbe(), + std::chrono::milliseconds pollInterval = std::chrono::milliseconds{250}, + std::chrono::milliseconds silenceInterval = std::chrono::milliseconds{1500}); + ~PlaybackMonitor() override; + + void SetEnabled(bool enabled); + +signals: + void PlaybackChanged(bool playing); + +private: + PlaybackProbe _probe; + std::chrono::milliseconds _pollInterval; + std::chrono::milliseconds _silenceInterval; + std::jthread _worker; + unsigned _generation{}; +}; + +} // namespace Core::GlobalMedia diff --git a/Source/Core/PlaybackMonitor_win.cpp b/Source/Core/PlaybackMonitor_win.cpp new file mode 100644 index 00000000..40dbd916 --- /dev/null +++ b/Source/Core/PlaybackMonitor_win.cpp @@ -0,0 +1,104 @@ +// +// AirPodsDesktop - AirPods Desktop User Experience Enhancement Program. +// Copyright (C) 2021-2022 SpriteOvO +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "PlaybackMonitor.h" + +#include +#include +#include +#include + +namespace Core::GlobalMedia { +namespace { + +using Microsoft::WRL::ComPtr; + +std::optional ReadPlaybackActivity() +{ + const HRESULT initialized = CoInitializeEx(nullptr, COINIT_MULTITHREADED); + if (FAILED(initialized)) { + return std::nullopt; + } + struct Apartment { + ~Apartment() + { + CoUninitialize(); + } + } apartment; + + ComPtr enumerator; + if (FAILED(CoCreateInstance( + __uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, IID_PPV_ARGS(&enumerator)))) + { + return std::nullopt; + } + ComPtr endpoints; + if (FAILED(enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &endpoints))) { + return std::nullopt; + } + UINT count{}; + if (FAILED(endpoints->GetCount(&count))) { + return std::nullopt; + } + bool readable = count == 0; + for (UINT i = 0; i < count; ++i) { + ComPtr endpoint; + ComPtr manager; + ComPtr sessions; + if (FAILED(endpoints->Item(i, &endpoint)) || + FAILED(endpoint->Activate( + __uuidof(IAudioSessionManager2), CLSCTX_ALL, nullptr, + reinterpret_cast(manager.GetAddressOf()))) || + FAILED(manager->GetSessionEnumerator(&sessions))) + { + continue; + } + int sessionCount{}; + if (FAILED(sessions->GetCount(&sessionCount))) { + continue; + } + readable = true; + for (int j = 0; j < sessionCount; ++j) { + ComPtr session; + ComPtr details; + if (FAILED(sessions->GetSession(j, &session)) || FAILED(session.As(&details))) { + continue; + } + DWORD processId{}; + // Ignore this application's own connection sounds to avoid feedback loops. + if (FAILED(details->GetProcessId(&processId)) || processId == GetCurrentProcessId()) { + continue; + } + // Session activity tracks playback even through quiet passages or muted output. + AudioSessionState state{}; + if (SUCCEEDED(session->GetState(&state)) && state == AudioSessionStateActive) { + return true; + } + } + } + return readable ? std::optional{false} : std::nullopt; +} + +} // namespace + +PlaybackProbe CreatePlaybackProbe() +{ + return ReadPlaybackActivity; +} + +} // namespace Core::GlobalMedia diff --git a/Source/Core/QuickConnect.cpp b/Source/Core/QuickConnect.cpp index 63f66c7f..b9bc19b7 100644 --- a/Source/Core/QuickConnect.cpp +++ b/Source/Core/QuickConnect.cpp @@ -44,8 +44,10 @@ void Backend::SetController(Controller *controller) Q_UNUSED(controller) } -Controller::Controller(std::shared_ptr backend, std::chrono::milliseconds resolveTimeout) - : QObject{nullptr}, _backend{std::move(backend)} +Controller::Controller( + std::shared_ptr backend, std::chrono::milliseconds resolveTimeout, + std::chrono::milliseconds autoRetryCooldown) + : QObject{nullptr}, _backend{std::move(backend)}, _autoRetryCooldown{autoRetryCooldown} { APD_ASSERT(_backend != nullptr); @@ -109,6 +111,31 @@ bool Controller::IsEnabled() const return _enabled; } +void Controller::SetAudioAutoConnectEnabled(bool enabled) +{ + _audioAutoConnectEnabled = enabled; + if (!enabled) { + _playbackActive = false; + } +} + +bool Controller::IsBusy() const +{ + return _pending || _requestRunning; +} + +void Controller::OnPlaybackStateChanged(bool playing) +{ + const bool started = playing && !_playbackActive; + _playbackActive = playing; + if (!started || !_audioAutoConnectEnabled || _deviceId.isEmpty() || _pending || + _requestRunning || std::chrono::steady_clock::now() < _nextAutoRetry) + { + return; + } + Request(true); +} + void Controller::SetDeviceId(QString id) { _deviceId = std::move(id); @@ -154,6 +181,14 @@ void Controller::RefreshDevices() Outcome Controller::Request() { + return Request(false); +} + +Outcome Controller::Request(bool automatic) +{ + if (!automatic && IsBusy()) { + _manualRequestJoined = true; + } // A click while work is already under way always answers with the same outcome, whether that // work is the enumeration/reconnect round trip or the wait for the endpoint to come up. The // caller decides how loudly to report it. @@ -167,7 +202,7 @@ Outcome Controller::Request() return Outcome::RequestStarted; } - if (!_enabled) { + if (!automatic && !_enabled) { EmitOutcome(Outcome::Disabled, {}); return Outcome::Disabled; } @@ -178,6 +213,8 @@ Outcome Controller::Request() } _requestRunning = true; + _automaticRequest = automatic; + _manualRequestJoined = !automatic; _requestingDeviceId = _deviceId; _connectedDuringRequest = false; @@ -288,6 +325,20 @@ Outcome Controller::Complete(Outcome outcome) void Controller::EmitOutcome(Outcome outcome, const QString &deviceName) { + // An automatic check of an already connected device must not open the battery window. + const bool silent = + _automaticRequest && !_manualRequestJoined && outcome == Outcome::AlreadyConnected; + if (_automaticRequest && (outcome == Outcome::Failed || outcome == Outcome::TimedOut || + outcome == Outcome::DeviceUnavailable)) + { + _nextAutoRetry = std::chrono::steady_clock::now() + _autoRetryCooldown; + } + if (outcome != Outcome::RequestStarted) { + _automaticRequest = false; + } + if (silent) { + return; + } emit OutcomeChanged(outcome, deviceName); } diff --git a/Source/Core/QuickConnect.h b/Source/Core/QuickConnect.h index d8c24628..889c4120 100644 --- a/Source/Core/QuickConnect.h +++ b/Source/Core/QuickConnect.h @@ -89,6 +89,7 @@ class Controller final : public QObject public: // How long to wait for the endpoint to come up after Windows accepted the reconnect request. static constexpr std::chrono::milliseconds kDefaultResolveTimeout{10'000}; + static constexpr std::chrono::milliseconds kAutoRetryCooldown{30'000}; // The backend is shared rather than borrowed because a reconnect request can still be inside a // blocking driver call when the Controller goes away; that worker is detached and keeps the @@ -98,11 +99,15 @@ class Controller final : public QObject // timeout slot by hand. explicit Controller( std::shared_ptr backend, - std::chrono::milliseconds resolveTimeout = kDefaultResolveTimeout); + std::chrono::milliseconds resolveTimeout = kDefaultResolveTimeout, + std::chrono::milliseconds autoRetryCooldown = kAutoRetryCooldown); ~Controller() override; void SetEnabled(bool enabled); bool IsEnabled() const; + bool IsBusy() const; + void SetAudioAutoConnectEnabled(bool enabled); + void OnPlaybackStateChanged(bool playing); void SetDeviceId(QString id); std::vector Devices(); void RefreshDevices(); @@ -126,6 +131,12 @@ class Controller final : public QObject std::shared_ptr _backend; std::shared_ptr _link{std::make_shared()}; bool _enabled{}; + bool _audioAutoConnectEnabled{}; + bool _playbackActive{}; + bool _automaticRequest{}; + bool _manualRequestJoined{}; + std::chrono::milliseconds _autoRetryCooldown; + std::chrono::steady_clock::time_point _nextAutoRetry{}; bool _pending{}; QString _deviceId; QString _pendingDeviceId; @@ -144,6 +155,7 @@ class Controller final : public QObject PostToController(const std::shared_ptr &link, std::function work); QString DeviceNameFor(const QString &id) const; + Outcome Request(bool automatic); Outcome Complete(Outcome outcome); void EmitOutcome(Outcome outcome, const QString &deviceName); }; diff --git a/Source/Core/Settings.cpp b/Source/Core/Settings.cpp index b63e0b37..bdab65da 100644 --- a/Source/Core/Settings.cpp +++ b/Source/Core/Settings.cpp @@ -76,8 +76,9 @@ void OnApply_appearance_mode(const Fields &newFields) { LOG(Info, "OnApply_appearance_mode: {}", newFields.appearance_mode); - Impl::NotifyApplyObserver( - [&](ApplyObserver &observer) { observer.OnAppearanceModeChanged(newFields.appearance_mode); }); + Impl::NotifyApplyObserver([&](ApplyObserver &observer) { + observer.OnAppearanceModeChanged(newFields.appearance_mode); + }); } void OnApply_auto_run(const Fields &newFields) @@ -151,6 +152,14 @@ void OnApply_tray_quick_connect_device_id(const Fields &newFields) }); } +void OnApply_audio_auto_connect_enabled(const Fields &newFields) +{ + LOG(Info, "OnApply_audio_auto_connect_enabled: {}", newFields.audio_auto_connect_enabled); + Impl::NotifyApplyObserver([&](ApplyObserver &observer) { + observer.OnAudioAutoConnectEnabledChanged(newFields.audio_auto_connect_enabled); + }); +} + void OnApply_battery_on_taskbar(const Fields &newFields) { LOG(Info, "OnApply_battery_on_taskbar: {}", newFields.battery_on_taskbar); diff --git a/Source/Core/Settings.h b/Source/Core/Settings.h index bdb0a7da..8ffb4b7a 100644 --- a/Source/Core/Settings.h +++ b/Source/Core/Settings.h @@ -52,6 +52,7 @@ class ApplyObserver virtual void OnDeviceAddressChanged(uint64_t address) = 0; virtual void OnTrayIconBatteryChanged(TrayIconBatteryBehavior behavior) = 0; virtual void OnTrayQuickConnectEnabledChanged(bool enable) = 0; + virtual void OnAudioAutoConnectEnabledChanged(bool enable) = 0; virtual void OnTrayQuickConnectDeviceChanged(const QString &deviceId) = 0; virtual void OnTaskbarBatteryChanged(TaskbarStatusBehavior behavior) = 0; }; @@ -89,6 +90,11 @@ void SetRepository(std::unique_ptr repository); "Single-click the tray icon to connect the selected device when disconnected, " \ "or show battery information when connected. Battery information opens automatically " \ "after a successful connection.")}) \ + callback(bool, audio_auto_connect_enabled, {false}, \ + Impl::OnApply(&OnApply_audio_auto_connect_enabled), \ + Impl::Desc{QT_TRANSLATE_NOOP("QObject", \ + "Connect the selected device when audio starts playing and it is disconnected. " \ + "After a failure, wait at least 30 seconds and start playback again to retry.")}) \ callback(QString, tray_quick_connect_device_id, {}, \ Impl::OnApply(&OnApply_tray_quick_connect_device_id), \ Impl::Sensitive{}) \ @@ -256,6 +262,7 @@ void OnApply_rssi_min(const Fields &newFields); void OnApply_device_address(const Fields &newFields); void OnApply_tray_icon_battery(const Fields &newFields); void OnApply_tray_quick_connect_enabled(const Fields &newFields); +void OnApply_audio_auto_connect_enabled(const Fields &newFields); void OnApply_tray_quick_connect_device_id(const Fields &newFields); void OnApply_battery_on_taskbar(const Fields &newFields); diff --git a/Source/Gui/SettingsWindow.cpp b/Source/Gui/SettingsWindow.cpp index 56f26822..98d12b17 100644 --- a/Source/Gui/SettingsWindow.cpp +++ b/Source/Gui/SettingsWindow.cpp @@ -100,10 +100,12 @@ SettingsWindow::SettingsWindow( _ui.navList, &QListWidget::currentRowChanged, _ui.pages, &QStackedWidget::setCurrentIndex); _ui.navList->setCurrentRow(0); - for (const auto &[label, checkBox] : { + for (const auto &[label, checkBox] : + { std::pair{_ui.lbLowAudioLatency, _ui.cbLowAudioLatency}, std::pair{_ui.lbAutoEarDetection, _ui.cbAutoEarDetection}, std::pair{_ui.lbTrayQuickConnect, _ui.cbTrayQuickConnectEnabled}, + std::pair{_ui.lbAudioAutoConnect, _ui.cbAudioAutoConnectEnabled}, }) { label->setBuddy(checkBox); @@ -208,6 +210,11 @@ SettingsWindow::SettingsWindow( On_cbTrayQuickConnectEnabled_toggled(checked); } }); + connect(_ui.cbAudioAutoConnectEnabled, &QCheckBox::toggled, this, [this](bool checked) { + if (_trigger) { + ModifiableAccess()->audio_auto_connect_enabled = checked; + } + }); connect( _ui.cbTrayQuickConnectDevice, qOverload(&QComboBox::currentIndexChanged), this, @@ -326,6 +333,7 @@ void SettingsWindow::UpdateDescriptions() _ui.lbDescLowAudioLatency->setText(constMetaFields.low_audio_latency.Description()); _ui.lbDescAutoEarDetection->setText(constMetaFields.automatic_ear_detection.Description()); _ui.lbDescTrayQuickConnect->setText(constMetaFields.tray_quick_connect_enabled.Description()); + _ui.lbDescAudioAutoConnect->setText(constMetaFields.audio_auto_connect_enabled.Description()); // The About text carries a hard-coded link colour inside the (translated) HTML; swap it // for the theme accent so it stays readable in dark mode. @@ -463,6 +471,7 @@ void SettingsWindow::UpdateQuickConnectDevices(const Fields &fields) _ui.cbTrayQuickConnectDevice->setCurrentIndex(selectedIndex); _ui.cbTrayQuickConnectEnabled->setChecked(fields.tray_quick_connect_enabled); + _ui.cbAudioAutoConnectEnabled->setChecked(fields.audio_auto_connect_enabled); // Always leave the checkbox usable: a transient empty enumeration must never trap the user in // a state they cannot turn off. _ui.cbTrayQuickConnectEnabled->setEnabled(true); diff --git a/Source/Gui/SettingsWindow.h b/Source/Gui/SettingsWindow.h index 3f84d826..24695eac 100644 --- a/Source/Gui/SettingsWindow.h +++ b/Source/Gui/SettingsWindow.h @@ -99,6 +99,7 @@ class SettingsWindow : public QDialog _ui.cbLowAudioLatency->setAccessibleName(_ui.lbLowAudioLatency->text()); _ui.cbAutoEarDetection->setAccessibleName(_ui.lbAutoEarDetection->text()); _ui.cbTrayQuickConnectEnabled->setAccessibleName(_ui.lbTrayQuickConnect->text()); + _ui.cbAudioAutoConnectEnabled->setAccessibleName(_ui.lbAudioAutoConnect->text()); _ui.cbAppearanceMode->setAccessibleName(_ui.lbAppearance->text()); _aboutTextTemplate = _ui.label->text(); InitCreditsText(); diff --git a/Source/Gui/SettingsWindow.ui b/Source/Gui/SettingsWindow.ui index 04441a1b..706a3880 100644 --- a/Source/Gui/SettingsWindow.ui +++ b/Source/Gui/SettingsWindow.ui @@ -1036,6 +1036,36 @@ + + + 16 + + + 2 + + + Connect automatically when audio starts playing + true + cardTitle + + + + + + true + cardDescription + + + + + + + 3232 + + + + + diff --git a/Source/Gui/TrayIcon.cpp b/Source/Gui/TrayIcon.cpp index f6d77a05..1fc52d1d 100644 --- a/Source/Gui/TrayIcon.cpp +++ b/Source/Gui/TrayIcon.cpp @@ -39,7 +39,7 @@ TrayIcon::TrayIcon( }); connect(_actionSettings, &QAction::triggered, this, &TrayIcon::OnSettingsClicked); connect(_actionAbout, &QAction::triggered, this, &TrayIcon::OnAboutClicked); - connect(_actionQuit, &QAction::triggered, qApp, &QApplication::quit, Qt::QueuedConnection); + connect(_actionQuit, &QAction::triggered, qApp, [] { Utils::Qt::QuitApplicationSafely(); }); connect(_tray, &QSystemTrayIcon::activated, this, &TrayIcon::OnIconClicked); connect( &_quickConnect, &Core::QuickConnect::Controller::OutcomeChanged, this, diff --git a/Source/Gui/Utils.h b/Source/Gui/Utils.h index a594fac6..558c4397 100644 --- a/Source/Gui/Utils.h +++ b/Source/Gui/Utils.h @@ -78,7 +78,9 @@ inline void Dispatch(std::function callback) inline void QuitApplicationSafely() { - QMetaObject::invokeMethod(qApp, &QApplication::quit, ::Qt::QueuedConnection); + // Explicit application exit must not be vetoed by a window's close-to-tray handler. + // Queue exit() onto the GUI thread so normal application/object teardown still runs. + QMetaObject::invokeMethod(qApp, [] { QCoreApplication::exit(0); }, ::Qt::QueuedConnection); } } // namespace Utils::Qt diff --git a/Source/Resource/Translation/apd_bg_BG.ts b/Source/Resource/Translation/apd_bg_BG.ts index 52696589..b71779ec 100644 --- a/Source/Resource/Translation/apd_bg_BG.ts +++ b/Source/Resource/Translation/apd_bg_BG.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Щракнете веднъж върху иконата в системната област, за да свържете избраното устройство, ако не е свързано, или да покажете информацията за батерията, ако е свързано. След успешно свързване информацията за батерията се показва автоматично. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Свързва избраното устройство при започване на възпроизвеждане на звук, ако не е свързано. След неуспех изчакайте поне 30 секунди и стартирайте възпроизвеждането отново за нов опит. + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark Тъмна + + Connect automatically when audio starts playing + Автоматично свързване при започване на възпроизвеждане на звук + UpdateWindow diff --git a/Source/Resource/Translation/apd_de_DE.ts b/Source/Resource/Translation/apd_de_DE.ts index 7b18d736..97c6db43 100644 --- a/Source/Resource/Translation/apd_de_DE.ts +++ b/Source/Resource/Translation/apd_de_DE.ts @@ -269,6 +269,10 @@ Kopple deine AirPods zuerst in den Windows Bluetooth-Einstellungen.Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Klicken Sie einmal auf das Symbol im Infobereich, um das ausgewählte Gerät zu verbinden, wenn es nicht verbunden ist, oder den Akkustand anzuzeigen, wenn es verbunden ist. Nach erfolgreicher Verbindung wird der Akkustand automatisch angezeigt. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Verbindet das ausgewählte Gerät beim Start der Audiowiedergabe, wenn es nicht verbunden ist. Nach einem Fehler mindestens 30 Sekunden warten und die Wiedergabe erneut starten, um es noch einmal zu versuchen. + SelectWindow @@ -403,6 +407,10 @@ Kopple deine AirPods zuerst in den Windows Bluetooth-Einstellungen.Dark Dunkel + + Connect automatically when audio starts playing + Beim Start der Audiowiedergabe automatisch verbinden + UpdateWindow diff --git a/Source/Resource/Translation/apd_fr_FR.ts b/Source/Resource/Translation/apd_fr_FR.ts index 1963cd45..9f2cfd37 100644 --- a/Source/Resource/Translation/apd_fr_FR.ts +++ b/Source/Resource/Translation/apd_fr_FR.ts @@ -269,6 +269,10 @@ Vous devez d'abord appairer vos AirPods dans les paramètres Bluetooth de W Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Cliquez une fois sur l’icône de la zone de notification pour connecter l’appareil sélectionné s’il est déconnecté, ou afficher le niveau de batterie s’il est connecté. Le niveau de batterie s’affiche automatiquement après une connexion réussie. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Connecte l’appareil sélectionné au début de la lecture audio s’il est déconnecté. Après un échec, attendez au moins 30 secondes et relancez la lecture pour réessayer. + SelectWindow @@ -403,6 +407,10 @@ Vous devez d'abord appairer vos AirPods dans les paramètres Bluetooth de W Dark Sombre + + Connect automatically when audio starts playing + Se connecter automatiquement au début de la lecture audio + UpdateWindow diff --git a/Source/Resource/Translation/apd_it_IT.ts b/Source/Resource/Translation/apd_it_IT.ts index dbd08589..c064d5b1 100644 --- a/Source/Resource/Translation/apd_it_IT.ts +++ b/Source/Resource/Translation/apd_it_IT.ts @@ -270,6 +270,10 @@ Devi prima abbinare le tue AirPods nelle impostazioni Bluetooth di Windows.Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Fai clic sull’icona nell’area di notifica per connettere il dispositivo selezionato se è disconnesso o visualizzare il livello della batteria se è connesso. Il livello della batteria viene visualizzato automaticamente dopo una connessione riuscita. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Connette il dispositivo selezionato quando inizia la riproduzione audio, se è disconnesso. Dopo un errore, attendi almeno 30 secondi e riavvia la riproduzione per riprovare. + SelectWindow @@ -404,6 +408,10 @@ Devi prima abbinare le tue AirPods nelle impostazioni Bluetooth di Windows.Dark Scuro + + Connect automatically when audio starts playing + Connetti automaticamente all’avvio della riproduzione audio + UpdateWindow diff --git a/Source/Resource/Translation/apd_ja_JP.ts b/Source/Resource/Translation/apd_ja_JP.ts index a8b15cf9..b117399c 100644 --- a/Source/Resource/Translation/apd_ja_JP.ts +++ b/Source/Resource/Translation/apd_ja_JP.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. トレイアイコンをシングルクリックすると、未接続の場合は選択したデバイスに接続し、接続済みの場合はバッテリー情報を表示します。接続に成功すると、バッテリー情報が自動的に表示されます。 + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + 音声の再生開始時に、選択したデバイスが未接続の場合は接続します。失敗した場合は、30 秒以上待ってから再生を開始すると再試行します。 + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark ダーク + + Connect automatically when audio starts playing + 音声の再生開始時に自動接続する + UpdateWindow diff --git a/Source/Resource/Translation/apd_ko_KR.ts b/Source/Resource/Translation/apd_ko_KR.ts index 814d7a7d..652bedfd 100644 --- a/Source/Resource/Translation/apd_ko_KR.ts +++ b/Source/Resource/Translation/apd_ko_KR.ts @@ -269,6 +269,10 @@ Windows의 Bluetooth 설정에서 AirPods을 페어링해야 합니다.Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. 트레이 아이콘을 한 번 클릭하면 연결되지 않은 경우 선택한 기기에 연결하고, 연결된 경우 배터리 정보를 표시합니다. 연결에 성공하면 배터리 정보가 자동으로 표시됩니다. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + 오디오 재생이 시작될 때 선택한 장치가 연결되어 있지 않으면 연결합니다. 실패한 경우 30초 이상 기다린 후 재생을 다시 시작하면 재시도합니다. + SelectWindow @@ -403,6 +407,10 @@ Windows의 Bluetooth 설정에서 AirPods을 페어링해야 합니다.Dark 다크 + + Connect automatically when audio starts playing + 오디오 재생이 시작되면 자동 연결 + UpdateWindow diff --git a/Source/Resource/Translation/apd_pt_BR.ts b/Source/Resource/Translation/apd_pt_BR.ts index 8f144925..897ed3e8 100644 --- a/Source/Resource/Translation/apd_pt_BR.ts +++ b/Source/Resource/Translation/apd_pt_BR.ts @@ -269,6 +269,10 @@ Você precisa emparelhar seus AirPods nas Configurações de Bluetooth do Window Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Clique uma vez no ícone da bandeja para conectar o dispositivo selecionado quando estiver desconectado ou mostrar as informações da bateria quando estiver conectado. As informações da bateria aparecem automaticamente após uma conexão bem-sucedida. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Conecta o dispositivo selecionado quando o áudio começa a tocar, se estiver desconectado. Após uma falha, aguarde pelo menos 30 segundos e reinicie a reprodução para tentar novamente. + SelectWindow @@ -403,6 +407,10 @@ Você precisa emparelhar seus AirPods nas Configurações de Bluetooth do Window Dark Escuro + + Connect automatically when audio starts playing + Conectar automaticamente quando o áudio começar a tocar + UpdateWindow diff --git a/Source/Resource/Translation/apd_pt_PT.ts b/Source/Resource/Translation/apd_pt_PT.ts index 195833c7..2d598af2 100644 --- a/Source/Resource/Translation/apd_pt_PT.ts +++ b/Source/Resource/Translation/apd_pt_PT.ts @@ -269,6 +269,10 @@ Precisa primeiro de emparelhar os seus AirPods nas definições de Bluetooth do Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Clique uma vez no ícone da área de notificação para ligar o dispositivo selecionado quando estiver desligado ou mostrar as informações da bateria quando estiver ligado. As informações da bateria aparecem automaticamente após uma ligação bem-sucedida. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Liga o dispositivo selecionado ao iniciar a reprodução de áudio, se estiver desligado. Após uma falha, aguarde pelo menos 30 segundos e reinicie a reprodução para tentar novamente. + SelectWindow @@ -403,6 +407,10 @@ Precisa primeiro de emparelhar os seus AirPods nas definições de Bluetooth do Dark Escuro + + Connect automatically when audio starts playing + Ligar automaticamente ao iniciar a reprodução de áudio + UpdateWindow diff --git a/Source/Resource/Translation/apd_ru_RU.ts b/Source/Resource/Translation/apd_ru_RU.ts index 9a3e60e4..316eca95 100644 --- a/Source/Resource/Translation/apd_ru_RU.ts +++ b/Source/Resource/Translation/apd_ru_RU.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Один щелчок по значку в области уведомлений подключает выбранное устройство, если оно отключено, или показывает уровень заряда, если оно подключено. После успешного подключения информация о заряде открывается автоматически. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Подключает выбранное устройство при начале воспроизведения звука, если оно отключено. После ошибки подождите не менее 30 секунд и снова начните воспроизведение для повторной попытки. + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark Тёмная + + Connect automatically when audio starts playing + Подключать автоматически при начале воспроизведения звука + UpdateWindow diff --git a/Source/Resource/Translation/apd_tr_TR.ts b/Source/Resource/Translation/apd_tr_TR.ts index 508e0058..2781fec3 100644 --- a/Source/Resource/Translation/apd_tr_TR.ts +++ b/Source/Resource/Translation/apd_tr_TR.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Seçili cihaz bağlı değilse bağlanmak, bağlıysa pil bilgilerini göstermek için tepsi simgesine bir kez tıklayın. Başarılı bir bağlantıdan sonra pil bilgileri otomatik olarak açılır. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Ses çalmaya başladığında seçilen cihaz bağlı değilse bağlanır. Başarısız olursa yeniden denemek için en az 30 saniye bekleyin ve oynatmayı yeniden başlatın. + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark Koyu + + Connect automatically when audio starts playing + Ses çalmaya başladığında otomatik bağlan + UpdateWindow diff --git a/Source/Resource/Translation/apd_uk_UA.ts b/Source/Resource/Translation/apd_uk_UA.ts index 332aeeb2..6894f192 100644 --- a/Source/Resource/Translation/apd_uk_UA.ts +++ b/Source/Resource/Translation/apd_uk_UA.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. Одне натискання на значок в області сповіщень підключає вибраний пристрій, якщо його відключено, або показує рівень заряду, якщо його підключено. Після успішного підключення інформація про заряд відкривається автоматично. + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + Підключає вибраний пристрій на початку відтворення звуку, якщо його відключено. Після помилки зачекайте щонайменше 30 секунд і знову почніть відтворення для повторної спроби. + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark Темна + + Connect automatically when audio starts playing + Підключати автоматично на початку відтворення звуку + UpdateWindow diff --git a/Source/Resource/Translation/apd_zh_CN.ts b/Source/Resource/Translation/apd_zh_CN.ts index 418d2b1c..8fae6b4c 100644 --- a/Source/Resource/Translation/apd_zh_CN.ts +++ b/Source/Resource/Translation/apd_zh_CN.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. 单击托盘图标:未连接时连接选定的设备,已连接时显示电量信息。连接成功后自动显示电量信息。 + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + 音频开始播放时,若选定的设备未连接,则自动发起连接。失败后,至少等待 30 秒并重新开始播放才会重试。 + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark 深色 + + Connect automatically when audio starts playing + 音频开始播放时自动连接 + UpdateWindow diff --git a/Source/Resource/Translation/apd_zh_TW.ts b/Source/Resource/Translation/apd_zh_TW.ts index 2353b7c2..6db6ddf3 100644 --- a/Source/Resource/Translation/apd_zh_TW.ts +++ b/Source/Resource/Translation/apd_zh_TW.ts @@ -269,6 +269,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Single-click the tray icon to connect the selected device when disconnected, or show battery information when connected. Battery information opens automatically after a successful connection. 按一下系統匣圖示:未連線時連線選取的裝置,已連線時顯示電量資訊。連線成功後自動顯示電量資訊。 + + Connect the selected device when audio starts playing and it is disconnected. After a failure, wait at least 30 seconds and start playback again to retry. + 音訊開始播放時,若選定的裝置未連線,則自動發起連線。失敗後,至少等待 30 秒並重新開始播放才會重試。 + SelectWindow @@ -403,6 +407,10 @@ You need to pair your AirPods in Windows Bluetooth Settings first. Dark 深色 + + Connect automatically when audio starts playing + 音訊開始播放時自動連線 + UpdateWindow diff --git a/Tests/AirPodsDomainTests.cpp b/Tests/AirPodsDomainTests.cpp index 6b3a2b9d..17380eec 100644 --- a/Tests/AirPodsDomainTests.cpp +++ b/Tests/AirPodsDomainTests.cpp @@ -5,6 +5,8 @@ #include #include +#include +#include #include #include @@ -47,6 +49,11 @@ class RecordingSettingsObserver final : public Core::Settings::ApplyObserver quickConnectEnabled = enable; ++quickConnectEnabledChanges; } + void OnAudioAutoConnectEnabledChanged(bool enable) override + { + audioAutoConnectEnabled = enable; + ++audioAutoConnectChanges; + } void OnTrayQuickConnectDeviceChanged(const QString &deviceId) override { quickConnectDeviceId = deviceId; @@ -59,6 +66,8 @@ class RecordingSettingsObserver final : public Core::Settings::ApplyObserver Core::Settings::AppearanceMode appearanceMode{Core::Settings::AppearanceMode::System}; int appearanceModeChanges{0}; bool quickConnectEnabled{false}; + bool audioAutoConnectEnabled{false}; + int audioAutoConnectChanges{}; int quickConnectEnabledChanges{0}; QString quickConnectDeviceId; int quickConnectDeviceChanges{0}; @@ -159,6 +168,10 @@ private Q_SLOTS: void ParsesAdvertisementState(); void FiltersDuplicateAndWeakAdvertisements(); void MergesAdvertisementsFromBothSides(); + void RejectsConflictingPeerBatteryReports(); + void ReplacesWeakPartialReportWithStrongerCompleteReport(); + void KeepsStrongerPartialReportWhenConflictingCompleteReportIsWeaker(); + void ReplaysConflictingAirPods4AncBatteryCapture(); void RejectsAdvertisementsFromDifferentModels(); void AcceptsKnownModelAfterUnknownAdvertisement(); void PackagesCompatibleLowLatencySilence(); @@ -226,7 +239,8 @@ void AirPodsDomainTests::RecognizesAirPods5() StateManager manager; manager.OnRssiMinChanged(-80); - for (const auto &[side, address, packet] : { + for (const auto &[side, address, packet] : + { std::tuple{Side::Left, uint64_t{0x1111}, capturedLeft}, std::tuple{Side::Right, uint64_t{0x2222}, capturedRight}, }) @@ -356,6 +370,94 @@ void AirPodsDomainTests::MergesAdvertisementsFromBothSides() QCOMPARE(update->newState.caseBox.battery.Value(), 50U); } +void AirPodsDomainTests::RejectsConflictingPeerBatteryReports() +{ + StateManager manager; + manager.OnRssiMinChanged(-80); + // Live AirPods 4 ANC reports; phone confirms ~90/90, not the weaker 40/unknown source. + auto left = MakeAdvertisementData(0x1111, -72, Side::Left, 4, 15, 15, 0x201B); + left.manufacturerDataMap.at(Core::AppleCP::VendorId)[5] = 0x22; + auto right = MakeAdvertisementData(0x2222, -55, Side::Right, 9, 9, 15, 0x201B); + right.manufacturerDataMap.at(Core::AppleCP::VendorId)[5] = 0x0B; + QVERIFY(manager.OnAdvReceived(Advertisement{right}).has_value()); + QVERIFY(!manager.OnAdvReceived(Advertisement{left}).has_value()); + QCOMPARE(manager.GetCurrentState()->pods.left.battery.Value(), 90U); + QCOMPARE(manager.GetCurrentState()->pods.right.battery.Value(), 90U); + for (int i = 0; i < 5; ++i) { + QVERIFY(!manager.OnAdvReceived(Advertisement{left}).has_value()); + manager.OnAdvReceived(Advertisement{right}); + QCOMPARE(manager.GetCurrentState()->pods.left.battery.Value(), 90U); + QCOMPARE(manager.GetCurrentState()->pods.right.battery.Value(), 90U); + } + + // Genuine changes from the selected source must continue to reach the UI. + right.manufacturerDataMap.at(Core::AppleCP::VendorId)[6] = 0x89; + manager.OnAdvReceived(Advertisement{right}); + QCOMPARE(manager.GetCurrentState()->pods.left.battery.Value(), 80U); +} + +void AirPodsDomainTests::ReplacesWeakPartialReportWithStrongerCompleteReport() +{ + StateManager manager; + manager.OnRssiMinChanged(-80); + auto partial = MakeAdvertisementData(0x1111, -72, Side::Left, 4, 15, 15, 0x201B); + auto complete = MakeAdvertisementData(0x2222, -55, Side::Right, 9, 9, 15, 0x201B); + QVERIFY(manager.OnAdvReceived(Advertisement{partial}).has_value()); + auto update = manager.OnAdvReceived(Advertisement{complete}); + QVERIFY(update.has_value()); + QCOMPARE(update->newState.pods.left.battery.Value(), 90U); + QCOMPARE(update->newState.pods.right.battery.Value(), 90U); + QVERIFY(!manager.OnAdvReceived(Advertisement{partial}).has_value()); + QCOMPARE(manager.GetCurrentState()->pods.left.battery.Value(), 90U); +} + +void AirPodsDomainTests::KeepsStrongerPartialReportWhenConflictingCompleteReportIsWeaker() +{ + StateManager manager; + manager.OnRssiMinChanged(-80); + manager.OnAdvReceived( + Advertisement{MakeAdvertisementData(0x1111, -45, Side::Left, 4, 15, 15, 0x201B)}); + QVERIFY( + !manager + .OnAdvReceived( + Advertisement{MakeAdvertisementData(0x2222, -65, Side::Right, 9, 9, 15, 0x201B)}) + .has_value()); + QCOMPARE(manager.GetCurrentState()->pods.left.battery.Value(), 40U); +} + +void AirPodsDomainTests::ReplaysConflictingAirPods4AncBatteryCapture() +{ + QFile capture{ + QStringLiteral(APD_SOURCE_DIR "/Tests/Fixtures/AirPods4AncConflictingBattery.txt")}; + QVERIFY(capture.open(QIODevice::ReadOnly)); + const QRegularExpression pattern{ + R"(ms=\d+ source=(\d+) side=([LR]) left=(\d+) right=(\d+) case=(\d+) flags=(\d+) rssi=(-?\d+))"}; + StateManager manager; + manager.OnRssiMinChanged(-80); + bool selectedCompleteReport = false; + int packets{}; + while (!capture.atEnd()) { + const auto match = pattern.match(QString::fromUtf8(capture.readLine())); + QVERIFY(match.hasMatch()); + auto data = MakeAdvertisementData( + 0x1000 + match.captured(1).toUInt(), match.captured(7).toInt(), + match.captured(2) == "L" ? Side::Left : Side::Right, match.captured(3).toUInt(), + match.captured(4).toUInt(), match.captured(5).toUInt(), 0x201B); + data.manufacturerDataMap.at(Core::AppleCP::VendorId)[5] = match.captured(6).toUInt(); + manager.OnAdvReceived(Advertisement{data}); + const auto state = manager.GetCurrentState(); + QVERIFY(state.has_value()); + selectedCompleteReport |= state->pods.left.battery.Value() == 90; + if (selectedCompleteReport) { + QCOMPARE(state->pods.left.battery.Value(), 90U); + QCOMPARE(state->pods.right.battery.Value(), 90U); + } + ++packets; + } + QVERIFY(selectedCompleteReport); + QVERIFY(packets > 30); +} + void AirPodsDomainTests::RejectsAdvertisementsFromDifferentModels() { StateManager manager; @@ -461,6 +563,7 @@ void AirPodsDomainTests::PropagatesQuickConnectSettings() repository->Write("abi_version", Core::Settings::kFieldsAbiVersion); repository->Write("tray_quick_connect_enabled", true); repository->Write("tray_quick_connect_device_id", "{A}"); + repository->Write("audio_auto_connect_enabled", true); Core::Settings::SetRepository(std::move(repository)); QCOMPARE(Core::Settings::Load(), Core::Settings::LoadResult::Successful); @@ -472,6 +575,8 @@ void AirPodsDomainTests::PropagatesQuickConnectSettings() QCOMPARE(observer.quickConnectEnabledChanges, 1); QCOMPARE(observer.quickConnectDeviceId, QString{"{A}"}); QCOMPARE(observer.quickConnectDeviceChanges, 1); + QVERIFY(observer.audioAutoConnectEnabled); + QCOMPARE(observer.audioAutoConnectChanges, 1); Core::Settings::SetApplyObserver(nullptr); Core::Settings::SetRepository(Core::Settings::CreatePersistentRepository()); diff --git a/Tests/Fixtures/AirPods4AncConflictingBattery.txt b/Tests/Fixtures/AirPods4AncConflictingBattery.txt new file mode 100644 index 00000000..f0e6da95 --- /dev/null +++ b/Tests/Fixtures/AirPods4AncConflictingBattery.txt @@ -0,0 +1,48 @@ +ms=110 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-69 +ms=370 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-52 +ms=483 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-70 +ms=1775 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-70 +ms=2520 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-71 +ms=2598 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-56 +ms=2706 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-66 +ms=3531 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-48 +ms=3895 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-52 +ms=4267 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-53 +ms=6135 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-55 +ms=6987 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-61 +ms=7071 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-53 +ms=7908 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-74 +ms=8287 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-67 +ms=10035 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-56 +ms=10400 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-56 +ms=10880 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-74 +ms=11693 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-53 +ms=12279 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-70 +ms=12648 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-71 +ms=13585 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-76 +ms=13953 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-78 +ms=14286 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-57 +ms=14517 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-78 +ms=16187 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-66 +ms=17005 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-71 +ms=17732 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-52 +ms=18668 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-55 +ms=19789 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-72 +ms=19974 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-67 +ms=21845 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-81 +ms=22795 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-58 +ms=22920 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-73 +ms=22986 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-55 +ms=23541 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-58 +ms=24103 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-52 +ms=24476 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-52 +ms=25033 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-55 +ms=25412 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-55 +ms=25892 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-77 +ms=25974 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-59 +ms=26450 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-67 +ms=27191 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-67 +ms=27653 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-52 +ms=27746 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-75 +ms=29048 source=1 side=L left=4 right=15 case=15 flags=34 rssi=-72 +ms=29325 source=2 side=R left=9 right=9 case=15 flags=11 rssi=-55 diff --git a/Tests/Fixtures/README.md b/Tests/Fixtures/README.md new file mode 100644 index 00000000..18d0e7b0 --- /dev/null +++ b/Tests/Fixtures/README.md @@ -0,0 +1,18 @@ +# Battery broadcast regression capture + +`AirPods4AncConflictingBattery.txt` contains 48 observations collected over 30 seconds on +2026-10-19 while the left battery display alternated between 40% and 90%. + +- Both sources reported model `0x201B` (AirPods 4 with ANC). +- Source 1 reported left 40%, right unavailable, with generally weaker RSSI. +- Source 2 reported left/right 90%/90% with generally stronger RSSI. +- The user checked the phone: left 94%, right 89%, consistent with source 2's coarse readings. + +Source numbers replace Bluetooth addresses. Only timing, decoded battery buckets, state flags, +and RSSI are retained; no Bluetooth addresses or encrypted advertisement payloads are included. +Battery values 0–10 are ten-percent buckets; 15 denotes unavailable data in this capture. + +The replay test preserves packet order and values but does not wait between observations. It +checks source conflict handling, not the existing ten-second advertisement expiry timers. +The source-selection filter remains a heuristic: unauthenticated broadcast data alone does not +prove that two advertisements belong to the same paired headphones. diff --git a/Tests/QuickConnectTests.cpp b/Tests/QuickConnectTests.cpp index 15882fb9..9654c99f 100644 --- a/Tests/QuickConnectTests.cpp +++ b/Tests/QuickConnectTests.cpp @@ -21,10 +21,18 @@ #include #include #include +#include #include #include +#include +#include +#include +#include +#include + #include "Source/Core/QuickConnect.h" +#include "Source/Core/PlaybackMonitor.h" #include "Source/Gui/TrayActivation.h" using namespace std::chrono_literals; @@ -77,13 +85,14 @@ class BlockingBackend final : public Core::QuickConnect::Backend { public: std::promise entered; + bool connected{}; std::vector ListDevices(std::stop_token stopToken) override { std::stop_callback cancel{stopToken, [this] { Unblock(); }}; entered.set_value(); _release.wait(); - return {{"{A}", "AirPods", false}}; + return {{"{A}", "AirPods", connected}}; } bool RequestReconnect(const QString &, std::stop_token) override @@ -127,6 +136,198 @@ class QuickConnectTests : public QObject private slots: void initTestCase(); + void nativePlaybackProbeDetectsExternalPlayback() + { + if (!qEnvironmentVariableIsSet("APD_RUN_AUDIO_SMOKE_TEST")) { + QSKIP("Set APD_RUN_AUDIO_SMOKE_TEST=1 to exercise Windows audio output"); + } +#if defined APD_OS_WIN + const auto probe = Core::GlobalMedia::CreatePlaybackProbe(); + const auto read = [&] { return std::async(std::launch::async, probe).get(); }; + const auto initial = read(); + QVERIFY(initial.has_value()); + if (*initial) { + QSKIP("Existing audio sessions are running; stop playback before the audio smoke test"); + } + QTemporaryDir directory; + QVERIFY(directory.isValid()); + QFile file{directory.filePath("playback.wav")}; + QVERIFY(file.open(QIODevice::WriteOnly)); + constexpr int sampleRate = 8000; + constexpr int sampleCount = sampleRate * 2; + QDataStream wav{&file}; + wav.setByteOrder(QDataStream::LittleEndian); + wav.writeRawData("RIFF", 4); + wav << quint32(36 + sampleCount * 2); + wav.writeRawData("WAVEfmt ", 8); + wav << quint32(16) << quint16(1) << quint16(1) << quint32(sampleRate) + << quint32(sampleRate * 2) << quint16(2) << quint16(16); + wav.writeRawData("data", 4); + wav << quint32(sampleCount * 2); + for (int i = 0; i < sampleCount; ++i) { + wav << qint16(100 * std::sin(i * 2 * 3.141592653589793 * 250 / sampleRate)); + } + file.close(); + auto environment = QProcessEnvironment::systemEnvironment(); + environment.insert("APD_PLAYBACK_TEST_WAV", file.fileName()); + QProcess player; + player.setProcessEnvironment(environment); + player.start( + "powershell.exe", + {"-NoProfile", "-NonInteractive", "-Command", + "[System.Media.SoundPlayer]::new($env:APD_PLAYBACK_TEST_WAV).PlaySync()"}); + QVERIFY(player.waitForStarted()); + QTRY_VERIFY_WITH_TIMEOUT(read() == std::optional{true}, 5000); + QVERIFY(player.waitForFinished(5000)); + QCOMPARE(player.exitCode(), 0); + QTRY_VERIFY_WITH_TIMEOUT(read() == std::optional{false}, 5000); +#else + QSKIP("The native playback smoke test requires Windows"); +#endif + } + + void manualClickJoinsAutomaticConnectedCheck() + { + auto backend = std::make_shared(); + backend->connected = true; + BackendUnblockGuard guard{backend}; + Controller controller{backend, kTestResolveTimeout}; + controller.SetDeviceId("{A}"); + controller.SetEnabled(true); + controller.SetAudioAutoConnectEnabled(true); + QSignalSpy outcomes{&controller, &Controller::OutcomeChanged}; + controller.OnPlaybackStateChanged(true); + auto entered = backend->entered.get_future(); + QVERIFY(entered.wait_for(1s) == std::future_status::ready); + QCOMPARE(controller.Request(), Outcome::RequestStarted); + backend->Unblock(); + QTRY_VERIFY(!controller.IsBusy()); + QCOMPARE(outcomes.last().at(0).value(), Outcome::AlreadyConnected); + } + + void playbackConnectsIndependentlyOfTrayAndDeduplicates() + { + auto backend = std::make_shared(); + Controller controller{backend, kTestResolveTimeout}; + controller.SetDeviceId("{A}"); + controller.SetAudioAutoConnectEnabled(true); + QVERIFY(!controller.IsEnabled()); + QSignalSpy outcomes{&controller, &Controller::OutcomeChanged}; + controller.OnPlaybackStateChanged(true); + QTRY_COMPARE(outcomes.count(), 1); + QCOMPARE(outcomes.last().at(0).value(), Outcome::RequestStarted); + controller.OnPlaybackStateChanged(true); + controller.OnPlaybackStateChanged(false); + controller.OnPlaybackStateChanged(true); + QCOMPARE(backend->reconnectCalls.load(), 1); + controller.OnEndpointStateChanged("{A}", true); + QCOMPARE(outcomes.last().at(0).value(), Outcome::Connected); + controller.OnPlaybackStateChanged(true); + QCOMPARE(backend->listCalls.load(), 1); + } + + void automaticConnectedCheckIsSilent() + { + auto backend = std::make_shared(); + backend->devices.front().connected = true; + Controller controller{backend, kTestResolveTimeout}; + controller.SetDeviceId("{A}"); + controller.SetAudioAutoConnectEnabled(true); + QSignalSpy outcomes{&controller, &Controller::OutcomeChanged}; + controller.OnPlaybackStateChanged(true); + QTRY_VERIFY(!controller.IsBusy()); + QCOMPARE(backend->listCalls.load(), 1); + QCOMPARE(outcomes.count(), 0); + controller.SetEnabled(true); + QCOMPARE(controller.Request(), Outcome::RequestStarted); + QTRY_VERIFY( + !outcomes.isEmpty() && + outcomes.last().at(0).value() == Outcome::AlreadyConnected); + QCOMPARE(backend->reconnectCalls.load(), 0); + QCOMPARE(outcomes.count(), 1); + } + + void disabledOrUnconfiguredAutomaticConnectDoesNothing() + { + auto backend = std::make_shared(); + Controller controller{backend, kTestResolveTimeout}; + controller.SetEnabled(true); + controller.SetDeviceId("{A}"); + controller.OnPlaybackStateChanged(true); + controller.SetDeviceId({}); + controller.SetAudioAutoConnectEnabled(true); + controller.OnPlaybackStateChanged(false); + controller.OnPlaybackStateChanged(true); + QTest::qWait(20); + QCOMPARE(backend->listCalls.load(), 0); + } + + void automaticFailureRequiresCooldownAndNewPlayback() + { + auto backend = std::make_shared(); + backend->devices = {{"{B}", "Unavailable headphones", false}}; + Controller controller{backend, kTestResolveTimeout, 80ms}; + controller.SetDeviceId("{B}"); + controller.SetAudioAutoConnectEnabled(true); + QSignalSpy outcomes{&controller, &Controller::OutcomeChanged}; + controller.OnPlaybackStateChanged(true); + QTRY_COMPARE(outcomes.count(), 1); + QCOMPARE(outcomes.last().at(0).value(), Outcome::Failed); + controller.OnPlaybackStateChanged(false); + controller.OnPlaybackStateChanged(true); + QCOMPARE(backend->reconnectCalls.load(), 1); + QTest::qWait(100); + controller.OnPlaybackStateChanged(true); + QCOMPARE(backend->reconnectCalls.load(), 1); + controller.OnPlaybackStateChanged(false); + controller.OnPlaybackStateChanged(true); + QTRY_COMPARE(outcomes.count(), 2); + QCOMPARE(backend->reconnectCalls.load(), 2); + controller.SetAudioAutoConnectEnabled(false); + QTest::qWait(100); + controller.OnPlaybackStateChanged(false); + controller.OnPlaybackStateChanged(true); + QCOMPARE(backend->reconnectCalls.load(), 2); + } + + void playbackMonitorDebouncesSilenceAndStopsWhenDisabled() + { + std::atomic sample{1}; + std::atomic polls{}; + Core::GlobalMedia::PlaybackMonitor monitor{ + [&]() -> std::optional { + ++polls; + const int value = sample.load(); + return value < 0 ? std::nullopt : std::optional{value != 0}; + }, + 5ms, 80ms}; + QSignalSpy changed{&monitor, &Core::GlobalMedia::PlaybackMonitor::PlaybackChanged}; + QTest::qWait(10); + QCOMPARE(polls.load(), 0); + monitor.SetEnabled(true); + QTRY_COMPARE(changed.count(), 1); + QCOMPARE(changed.last().at(0).toBool(), true); + sample = 0; + QTest::qWait(20); + sample = 1; + QTest::qWait(20); + QCOMPARE(changed.count(), 1); + sample = -1; + QTest::qWait(100); + QCOMPARE(changed.count(), 1); + sample = 0; + QTRY_COMPARE(changed.count(), 2); + QCOMPARE(changed.last().at(0).toBool(), false); + monitor.SetEnabled(false); + const int stoppedPolls = polls.load(); + sample = 1; + QTest::qWait(30); + QCOMPARE(polls.load(), stoppedPolls); + QCOMPARE(changed.count(), 2); + monitor.SetEnabled(true); + QTRY_COMPARE(changed.count(), 3); + } + // Controller void disabledRequestDoesNotCallBackend(); void emptyDeviceIdReturnsNoDevice(); diff --git a/Tests/UiRenderingTests.cpp b/Tests/UiRenderingTests.cpp index 37b6c365..5145fcc7 100644 --- a/Tests/UiRenderingTests.cpp +++ b/Tests/UiRenderingTests.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include "Source/Core/QuickConnect.h" +#include "Source/Core/SettingsRepository.h" #include "Source/Gui/MainWindow.h" #include "Source/Gui/SettingsWindow.h" #include "Source/Gui/Theme.h" @@ -131,6 +133,37 @@ class UiRenderingTests : public QObject Q_OBJECT private Q_SLOTS: + void TrayQuitExitsWithBatteryWindowVisible() + { + QProcess child; + child.setProcessChannelMode(QProcess::MergedChannels); + child.start(QCoreApplication::applicationFilePath(), {"--tray-quit-probe"}); + QVERIFY(child.waitForStarted()); + if (!child.waitForFinished(5000)) { + child.kill(); + child.waitForFinished(); + QFAIL("Tray Quit left the probe process running"); + } + QCOMPARE(child.exitStatus(), QProcess::NormalExit); + QCOMPARE(child.exitCode(), 0); + } + + void AudioAutoConnectIsOptionalAndIndependent() + { + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::SettingsWindow settings{[] { return 0; }, quickConnect}; + auto *automatic = settings.findChild("cbAudioAutoConnectEnabled"); + QVERIFY2(automatic != nullptr, "Settings must expose optional audio playback auto-connect"); + QVERIFY(!automatic->isChecked()); + auto *tray = settings.findChild("cbTrayQuickConnectEnabled"); + QVERIFY(tray != nullptr); + automatic->setChecked(true); + QVERIFY(!tray->isChecked()); + QVERIFY(Core::Settings::GetCurrent().audio_auto_connect_enabled); + automatic->setChecked(false); + } + void ConnectionSuccessOpensBatteryWindowAndDismissesNotification() { Core::QuickConnect::Controller quickConnect{ @@ -188,6 +221,8 @@ private Q_SLOTS: void SettingsDescribeConnectionAndBatterySingleClickBehavior() { + QVERIFY(Gui::Theme::LoadBundledFonts()); + Gui::Theme::ApplyApplicationTypography(QLocale{"zh_CN"}); QTranslator translator; QVERIFY(translator.load( QLocale{"zh_CN"}, "apd", "_", @@ -198,6 +233,12 @@ private Q_SLOTS: Gui::SettingsWindow settings{[] { return 0; }, quickConnect}; auto *description = settings.findChild("lbDescTrayQuickConnect"); QVERIFY(description != nullptr); + auto *audioTitle = settings.findChild("lbAudioAutoConnect"); + QVERIFY(audioTitle != nullptr); + QCOMPARE(audioTitle->text(), QStringLiteral("音频开始播放时自动连接")); + auto *audioDescription = settings.findChild("lbDescAudioAutoConnect"); + QVERIFY(audioDescription != nullptr); + QVERIFY(audioDescription->text().contains(QStringLiteral("至少等待 30 秒"))); QCOMPARE( description->text(), QStringLiteral( "单击托盘图标:未连接时连接选定的设备,已连接时显示电量信息。" @@ -213,6 +254,7 @@ private Q_SLOTS: QVERIFY( card->grab().save(QStringLiteral(APD_BINARY_DIR "/UiValidation/tray-setting-zh.png"))); QCoreApplication::removeTranslator(&translator); + Gui::Theme::ApplyApplicationTypography(QLocale{"en_US"}); } void NotificationUsesCurrentLanguage() @@ -1088,6 +1130,29 @@ int main(int argc, char **argv) // Production logging installs a Qt message handler during static initialization. Restore the // default handler so QTest assertion details remain visible in CTest and CI output. qInstallMessageHandler(nullptr); + // UI interactions exercise the real settings handlers without writing the user's registry. + Core::Settings::SetRepository(std::make_unique()); + if (app.arguments().contains("--tray-quit-probe")) { + app.setQuitOnLastWindowClosed(false); + Core::QuickConnect::Controller quickConnect{ + std::make_shared()}; + Gui::TrayIcon tray{[] { return 0; }, quickConnect}; + Gui::MainWindow battery; + battery.show(); + QAction *quit = nullptr; + for (auto *action : tray.findChildren()) { + if (action->text() == "Quit") { + quit = action; + break; + } + } + if (!quit) { + return 3; + } + QTimer::singleShot(50, quit, &QAction::trigger); + QTimer::singleShot(1000, &app, [] { QCoreApplication::exit(2); }); + return app.exec(); + } Gui::Theme::ApplyApplicationTypography(QLocale{"en_US"}); UiRenderingTests tests; return QTest::qExec(&tests, argc, argv);