diff gui/skin/skin.c @ 36891:c5ee0fc2ec75

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.
author ib
date Mon, 10 Mar 2014 17:15:24 +0000
parents 27b48ba4fe15
children f50427ad9ff6
line wrap: on
line diff
--- a/gui/skin/skin.c	Sat Mar 08 19:17:43 2014 +0000
+++ b/gui/skin/skin.c	Mon Mar 10 17:15:24 2014 +0000
@@ -57,6 +57,33 @@
 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 @@
 
     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 @@
         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 @@
         skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, msg);
         return 1;
     }
+    // legacy
+    else
+        skin_legacy("evSetURL", msg);
 
     item = next_item();
 
@@ -595,6 +631,9 @@
         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 @@
         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 @@
 
     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 @@
     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);