void Control::processMessage(Message* m)
{
- // FIXME - a slight modification - how if messagereceivers were to register
- // themselves as receivers to avoid the calling-a-deleted-object problem
- // then only deliver/register/unregister would have to be protected
-
logger->debug(TAG, "processing message {}", m->message);
-
- if ((m->p_to == Message::CONTROL) || (m->to == this)) // Maybe don't check m->to here? Always use predefined?
+ if (m->p_to == Message::CONTROL)
{
switch(m->message)
{
irun = false;
break;
}
- // << FIXME OBSELETE
case Message::STOP_PLAYBACK:
{
handleCommand(Input::STOP); // an odd way of doing it, but so simple
break;
}
- // Also connection_lost comes from player - anywhere else?
- // FIXME OBSELETE >>
-
-
case Message::VDR_CONNECTED:
{
- doJustConnected(static_cast<VConnect*>(m->from)); // FIXME delete from here?
+ doJustConnected(static_cast<VConnect*>(m->from));
break;
}
case Message::SCREENSHOT:
}
case Message::NEW_PICTURE:
{
+ // FIXME MQSUB
+
//Log::getInstance()->log("Control", Log::DEBUG, "TVMedia NEW_PICTURE");
OsdVector* osdv = dynamic_cast<OsdVector*>(Osd::getInstance());
if (osdv) osdv->informPicture(m->tag, reinterpret_cast<ImageIndex>(m->data));
#ifdef DEV
Message* m = new Message(); // break into master mutex
m->message = Message::SCREENSHOT;
- m->to = this;
+ m->p_to = Message::CONTROL;
postMessage(m);
#endif
}
#include <stdio.h>
-//class Message;
#include "defines.h"
-// Usage of messages is more dubious now that the single master mutex lock
-// protects all gui actions. Reason(s) for usage:
-// 1. View A wants something to be done by View B *after* View A has been deleted
-// 2. A thread wants its object/view deleting *after* the thread has exited
-
-// Put a justification line after call to Message* m = new Message() line
-// So that the sources can be grepped for proper message usage
-
class Message
{
public:
+ // Not using a pre-defined target if one is available is deprecated, and is now essential for CONTROL
+
enum PreDefinedTarget
{
NA = 0,
void* from{};
PreDefinedTarget p_to{NA}; // If this is set 'to' is ignored
void* to{};
- ULONG message{};
+ int message{};
ULONG parameter{};
ULONG tag{}; // use this for identifying which object / question is being replied to
void* data{}; // Use this for anything. Int, pointer, pointer to memory to be freed by the recipient, etc.
- const static ULONG QUESTION_YES = 1;
- const static ULONG CLOSE_ME = 2;
- const static ULONG PLAY_SELECTED_RECORDING = 3;
- const static ULONG DELETE_SELECTED_RECORDING = 4;
- const static ULONG SCREENSHOT = 5;
- const static ULONG CHANNEL_CHANGE = 6;
- const static ULONG RESUME_SELECTED_RECORDING = 7;
- const static ULONG INPUT_EVENT = 8;
- const static ULONG STOP_PLAYBACK = 9;
- const static ULONG SERVER_SELECTED = 10;
- const static ULONG VDR_CONNECTED = 11;
- const static ULONG ADD_VIEW = 12;
- const static ULONG REDRAW_LANG = 14;
- const static ULONG EPG = 16;
- const static ULONG CHANGED_OPTIONS = 18;
- const static ULONG CONNECTION_LOST = 19;
- const static ULONG MOVE_RECORDING = 20;
- const static ULONG PLAYER_EVENT = 22;
- const static ULONG AUDIO_CHANGE_CHANNEL = 23;
- const static ULONG CHILD_CLOSE = 24;
- const static ULONG MOUSE_MOVE = 25;
- const static ULONG MOUSE_LBDOWN = 26;
- const static ULONG CHANGE_LANGUAGE = 27;
- const static ULONG LAST_VIEW_CLOSE = 28;
- const static ULONG CHANGED_REMOTECONTROL = 29;
- const static ULONG DELETE_SELECTED_TIMER = 30;
- const static ULONG CHANGED_DEVICEOPTIONS = 31;
- const static ULONG TELETEXTUPDATE = 32;
- const static ULONG TELETEXTUPDATEFIRSTLINE = 33;
- const static ULONG SUBTITLE_CHANGE_CHANNEL = 34;
- const static ULONG MOUSE_SCROLL = 35;
- const static ULONG NEW_PICTURE = 36;
- const static ULONG NEW_PICTURE_STATIC = 37;
- const static ULONG REDRAW = 38;
- const static ULONG SHUTDOWN = 39;
+ // Never use the values, only the names
+ const static int INVALID = 0;
+ const static int QUESTION_YES = 1;
+ const static int CLOSE_ME = 2;
+ const static int PLAY_SELECTED_RECORDING = 3;
+ const static int DELETE_SELECTED_RECORDING = 4;
+ const static int SCREENSHOT = 5;
+ const static int CHANNEL_CHANGE = 6;
+ const static int RESUME_SELECTED_RECORDING = 7;
+ const static int INPUT_EVENT = 8;
+ const static int STOP_PLAYBACK = 9;
+ const static int SERVER_SELECTED = 10;
+ const static int VDR_CONNECTED = 11;
+ const static int ADD_VIEW = 12;
+ const static int REDRAW_LANG = 14;
+ const static int EPG = 16;
+ const static int CHANGED_OPTIONS = 18;
+ const static int CONNECTION_LOST = 19;
+ const static int MOVE_RECORDING = 20;
+ const static int PLAYER_EVENT = 22;
+ const static int AUDIO_CHANGE_CHANNEL = 23;
+ const static int CHILD_CLOSE = 24;
+ const static int MOUSE_MOVE = 25;
+ const static int MOUSE_LBDOWN = 26;
+ const static int CHANGE_LANGUAGE = 27;
+ const static int LAST_VIEW_CLOSE = 28;
+ const static int CHANGED_REMOTECONTROL = 29;
+ const static int DELETE_SELECTED_TIMER = 30;
+ const static int CHANGED_DEVICEOPTIONS = 31;
+ const static int TELETEXTUPDATE = 32;
+ const static int TELETEXTUPDATEFIRSTLINE = 33;
+ const static int SUBTITLE_CHANGE_CHANNEL = 34;
+ const static int MOUSE_SCROLL = 35;
+ const static int NEW_PICTURE = 36;
+ const static int NEW_PICTURE_STATIC = 37;
+ const static int REDRAW = 38;
+ const static int SHUTDOWN = 39;
};