[MPlayer-cvslog] r36987 - in trunk: Changelog gui/skin/skin.c gui/win32/skinload.c help/help_mp-de.h help/help_mp-en.h

ib subversion at mplayerhq.hu
Mon Mar 10 18:15:24 CET 2014


Author: ib
Date: Mon Mar 10 18:15:24 2014
New Revision: 36987

Log:
Print an information on deprecated skin config file entries.

There are several skin config file entries which oughtn't be used
any more, although they are still being supported.

Inform the user about these without being too annoying.

Modified:
   trunk/Changelog
   trunk/gui/skin/skin.c
   trunk/gui/win32/skinload.c

Changes in other areas also in this revision:
Modified:
   trunk/help/help_mp-de.h
   trunk/help/help_mp-en.h

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Sat Mar  8 20:17:43 2014	(r36986)
+++ trunk/Changelog	Mon Mar 10 18:15:24 2014	(r36987)
@@ -37,6 +37,8 @@ MPlayer
 
     GUI:
     * Support for TV/DVB
+    * Console message with information on deprecated (but still supported)
+      entries in the skin configuration file
 
   1.1: "We gave up on 1.0"
 

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Sat Mar  8 20:17:43 2014	(r36986)
+++ trunk/gui/skin/skin.c	Mon Mar 10 18:15:24 2014	(r36987)
@@ -57,6 +57,33 @@ static int *currWinItemIdx;
 static guiItem *currWinItems;
 
 /**
+ * @brief Print a legacy information on an entry.
+ *
+ * @param old identifier (and deprecated entry)
+ * @param data pointer to additional data necessary for checking and
+ *             to print the information on @a old
+ */
+static void skin_legacy(const char *old, const char *data)
+{
+    const char *p;
+
+    if (strcmp(old, "fontid") == 0) {
+        p = strchr(data, ',');
+
+        if (p)
+            mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, p, "font = fontfile");
+    } else if (strcmp(old, "$l") == 0) {
+        p = strstr(old, data);
+
+        if (p && (p == data || p[-1] != '$'))
+            mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, "$p");
+    } else if (strcmp(old, "evSetURL") == 0 && strcmp(data, old) == 0)
+        mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, "evLoadURL");
+    else if (strcmp(old, "sub") == 0)
+        mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, data);
+}
+
+/**
  * @brief Display a skin error message.
  *
  * @param format format string
@@ -231,8 +258,11 @@ static int item_window(char *in)
 
     strlower(in);
 
-    if (strcmp(in, "sub") == 0)
-        strcpy(in, "video");                           // legacy
+    // legacy
+    if (strcmp(in, "sub") == 0) {
+        strcpy(in, "video");
+        skin_legacy("sub", in);
+    }
 
     if (strcmp(in, "main") == 0) {
         currWin = &skin->main;
@@ -415,6 +445,9 @@ static int item_button(char *in)
         skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, msg);
         return 1;
     }
+    // legacy
+    else
+        skin_legacy("evSetURL", msg);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    button image: %s %d,%d\n", fname, x, y);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", msg, message);
@@ -531,6 +564,9 @@ static int item_menu(char *in)
         skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, msg);
         return 1;
     }
+    // legacy
+    else
+        skin_legacy("evSetURL", msg);
 
     item = next_item();
 
@@ -595,6 +631,9 @@ static int item_hpotmeter(char *in)
         skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, buf);
         return 1;
     }
+    // legacy
+    else
+        skin_legacy("evSetURL", buf);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    h/v potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     button image: %s %dx%d\n", pfname, pwidth, pheight);
@@ -708,6 +747,9 @@ static int item_potmeter(char *in)
         skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, buf);
         return 1;
     }
+    // legacy
+    else
+        skin_legacy("evSetURL", buf);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", ph, d);
@@ -765,6 +807,9 @@ static int item_font(char *in)
 
     cutItem(in, fnt, ',', 0);   // Note: This seems needless but isn't for compatibility
                                 // reasons with a meanwhile deprecated second parameter.
+    // legacy
+    skin_legacy("fontid", in);
+
     switch (fntRead(path, fnt)) {
     case -1:
         skin_error(MSGTR_GUI_MSG_SkinMemoryError);
@@ -883,6 +928,9 @@ static int item_dlabel(char *in)
     cutItem(in, txt, ',', 5);
     cutItem(txt, txt, '"', 1);
 
+    // legacy
+    skin_legacy("$l", txt);
+
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    dlabel: \"%s\"\n", txt);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     pos: %d,%d\n", x, y);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     width: %d, align: %d\n", w, a);

Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c	Sat Mar  8 20:17:43 2014	(r36986)
+++ trunk/gui/win32/skinload.c	Mon Mar 10 18:15:24 2014	(r36987)
@@ -28,6 +28,7 @@
 #include <windows.h>
 
 #include "mp_msg.h"
+#include "help_mp.h"
 #include "cpudetect.h"
 #include "libswscale/swscale.h"
 #include "libavutil/imgutils.h"
@@ -95,6 +96,35 @@ static const int evBoxs = sizeof(evNames
 
 static int linenumber;
 
+/**
+ * @brief Print a legacy information on an entry.
+ *
+ * @param old identifier (and deprecated entry)
+ * @param data pointer to additional data necessary for checking and
+ *             to print the information on @a old
+ */
+static void skin_legacy (const char *old, const char *data)
+{
+    const char *p;
+
+    if (strcmp(old, "fontid") == 0)
+    {
+        p = strchr(data, ',');
+
+        if (p) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, p, "font = fontfile");
+    }
+    else if (strcmp(old, "$l") == 0)
+    {
+        p = strstr(old, data);
+
+        if (p && (p == data || p[-1] != '$')) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, "$p");
+    }
+    else if (strcmp(old, "evSetURL") == 0 && strcmp(data, old) == 0)
+        mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, "evLoadURL");
+    else if (strcmp(old, "sub") == 0)
+        mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, data);
+}
+
 static char *geteventname(int event)
 {
     int i;
@@ -322,6 +352,9 @@ static void addwidget(skin_t *skin, wind
         {
             if(!strcmp(temp, evNames[i].name))
             {
+                // legacy
+                skin_legacy("evSetURL", temp);
+
                 mywidget->msg = evNames[i].msg;
                 break;
             }
@@ -354,6 +387,9 @@ static void addwidget(skin_t *skin, wind
         {
             if(!strcmp(temp, evNames[i].name))
             {
+                // legacy
+                skin_legacy("evSetURL", temp);
+
                 mywidget->msg = evNames[i].msg;
                 break;
             }
@@ -386,6 +422,9 @@ static void addwidget(skin_t *skin, wind
         {
             if(!strcmp(temp, evNames[i].name))
             {
+                // legacy
+                skin_legacy("evSetURL", temp);
+
                 mywidget->msg=evNames[i].msg;
                 break;
             }
@@ -413,6 +452,9 @@ static void addwidget(skin_t *skin, wind
         {
             if(!strcmp(temp, evNames[i].name))
             {
+                // legacy
+                skin_legacy("evSetURL", temp);
+
                 mywidget->msg = evNames[i].msg;
                 break;
             }
@@ -466,6 +508,10 @@ static void addwidget(skin_t *skin, wind
             }
         }
         mywidget->label=strdup(findnextstring(temp, desc, &base));
+
+        // legacy
+        skin_legacy("$l", mywidget->label);
+
         mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n",
                mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label);
     }
@@ -623,6 +669,8 @@ skin_t* loadskin(char* skindir, int desk
             {
                 mywindow->type = wiVideo;
                 mywindow->decoration = TRUE;
+                // legacy
+                if (desc[7] == 's') skin_legacy("sub", "video");
             }
             else if(!strncmp(desc + 7, "menu", 4)) mywindow->type = wiMenu;
             else if(!strncmp(desc + 7, "playbar", 7)) mywindow->type = wiPlaybar;
@@ -668,6 +716,10 @@ skin_t* loadskin(char* skindir, int desk
             skin->fonts = realloc(skin->fonts, sizeof(font_t *) * skin->fontcount);
             skin->fonts[id]=calloc(1, sizeof(font_t));
             skin->fonts[id]->name = strdup(temp);
+
+            // legacy
+            skin_legacy("fontid", desc);
+
             mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [FONT] name \"%s\"\n", skin->fonts[id]->name);
         }
         else


More information about the MPlayer-cvslog mailing list