From 54acf4fc190b3b24e9f4f747d974acb62e425bdc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 14 Sep 2024 22:47:28 +0200 Subject: [PATCH] player_command: use Interface::Alert() --- src/player_command.cxx | 9 +++++---- src/player_command.hxx | 9 ++++----- src/screen.cxx | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/player_command.cxx b/src/player_command.cxx index a167dbfa..87e92709 100644 --- a/src/player_command.cxx +++ b/src/player_command.cxx @@ -7,11 +7,12 @@ #include "Options.hxx" #include "i18n.h" #include "screen_client.hxx" -#include "screen_status.hxx" +#include "Interface.hxx" #include "client/mpdclient.hxx" bool -handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd) +handle_player_command(Interface &interface, + struct mpdclient &c, DelayedSeek &seek, Command cmd) { if (!c.IsReady() || c.status == nullptr) return false; @@ -59,7 +60,7 @@ handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd) case Command::SHUFFLE: if (auto *connection = c.GetConnection()) { if (mpd_run_shuffle(connection)) - screen_status_message(_("Shuffled queue")); + interface.Alert(_("Shuffled queue")); else c.HandleError(); } @@ -67,7 +68,7 @@ handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd) break; case Command::CLEAR: if (c.RunClearQueue()) - screen_status_message(_("Cleared queue")); + interface.Alert(_("Cleared queue")); break; case Command::REPEAT: if (auto *connection = c.GetConnection(); diff --git a/src/player_command.hxx b/src/player_command.hxx index c2565681..b14e235c 100644 --- a/src/player_command.hxx +++ b/src/player_command.hxx @@ -1,14 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef NCMPC_PLAYER_COMMAND_H -#define NCMPC_PLAYER_COMMAND_H +#pragma once enum class Command : unsigned; struct mpdclient; +class Interface; class DelayedSeek; bool -handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd); - -#endif +handle_player_command(Interface &interface, + struct mpdclient &c, DelayedSeek &seek, Command cmd); diff --git a/src/screen.cxx b/src/screen.cxx index 4aed9909..92f9a30b 100644 --- a/src/screen.cxx +++ b/src/screen.cxx @@ -227,7 +227,7 @@ ScreenManager::OnCommand(struct mpdclient &c, DelayedSeek &seek, Command cmd) if (GetCurrentPage().OnCommand(c, cmd)) return; - if (handle_player_command(c, seek, cmd)) + if (handle_player_command(*this, c, seek, cmd)) return; switch(cmd) {