]> git.sesse.net Git - nageru/blobdiff - nageru/theme.cpp
Make it possible to call set_channel_name() for live and preview.
[nageru] / nageru / theme.cpp
index ce3d2d6d55c917f6fdc0afba77c1cec348428ca2..c6cf4515805ad83be506f783d26df92b30ebc103 100644 (file)
@@ -1295,6 +1295,10 @@ int Nageru_set_supports_wb(lua_State *L)
 Theme::Theme(const string &filename, const vector<string> &search_dirs, ResourcePool *resource_pool, unsigned num_cards)
        : resource_pool(resource_pool), num_cards(num_cards), signal_to_card_mapping(global_flags.default_stream_mapping)
 {
+       // Defaults.
+       channel_names[0] = "Live";
+       channel_names[1] = "Preview";
+
        L = luaL_newstate();
         luaL_openlibs(L);
 
@@ -1569,6 +1573,12 @@ string Theme::get_channel_name(unsigned channel)
 {
        lock_guard<mutex> lock(m);
 
+       // We never ask the legacy channel_name() about live and preview.
+       // The defaults are set in our constructor.
+       if (channel == 0 || channel == 1) {
+               return channel_names[channel];
+       }
+
        lua_getglobal(L, "channel_name");
        if (lua_isnil(L, -1)) {
                lua_pop(L, 1);