@@ -28,7 +28,7 @@ namespace MediaConch {
2828// SQLLiteUi
2929// ***************************************************************************
3030
31- int SQLLiteUi::ui_current_version = 15 ;
31+ int SQLLiteUi::ui_current_version = 16 ;
3232
3333// ***************************************************************************
3434// Constructor/Destructor
@@ -115,6 +115,7 @@ int SQLLiteUi::ui_update_table()
115115 UPDATE_UI_TABLE_FOR_VERSION (12 );
116116 // UPDATE_UI_TABLE_FOR_VERSION(13); nothing to do
117117 UPDATE_UI_TABLE_FOR_VERSION (14 );
118+ // UPDATE_UI_TABLE_FOR_VERSION(15); nothing to do
118119
119120#undef UPDATE_UI_TABLE_FOR_VERSION
120121
@@ -911,6 +912,7 @@ int SQLLiteUi::ui_settings_update_table()
911912 // UPDATE_UI_SETTINGS_TABLE_FOR_VERSION(12); nothing to do
912913 UPDATE_UI_SETTINGS_TABLE_FOR_VERSION (13 );
913914 // UPDATE_UI_SETTINGS_TABLE_FOR_VERSION(14); nothing to do
915+ UPDATE_UI_SETTINGS_TABLE_FOR_VERSION (15 );
914916#undef UPDATE_UI_SETTINGS_TABLE_FOR_VERSION
915917
916918 return 0 ;
@@ -2120,6 +2122,63 @@ int SQLLiteUi::ui_settings_get_last_save_display_path(std::string& save_path, in
21202122 return 0 ;
21212123}
21222124
2125+ // ---------------------------------------------------------------------------
2126+ int SQLLiteUi::ui_settings_save_displaycaptions_option (const std::string& option, int user_id)
2127+ {
2128+ if (ui_settings_check_user_id (user_id))
2129+ return -1 ;
2130+
2131+ std::stringstream create;
2132+
2133+ reports.clear ();
2134+ create << " UPDATE UI_SETTINGS " ;
2135+ create << " SET DISPLAYCAPTIONS_OPTION = ? " ;
2136+ create << " WHERE USER_ID = ?;" ;
2137+
2138+ query = create.str ();
2139+
2140+ const char * end = NULL ;
2141+ int ret = sqlite3_prepare_v2 (db, query.c_str (), query.length () + 1 , &stmt, &end);
2142+ if (ret != SQLITE_OK || !stmt || (end && *end))
2143+ return -1 ;
2144+
2145+ ret = sqlite3_bind_blob (stmt, 1 , option.c_str (), option.length (), SQLITE_STATIC );
2146+ if (ret != SQLITE_OK )
2147+ return -1 ;
2148+
2149+ ret = sqlite3_bind_int (stmt, 2 , user_id);
2150+ if (ret != SQLITE_OK )
2151+ return -1 ;
2152+
2153+ return execute ();
2154+ }
2155+
2156+ // ---------------------------------------------------------------------------
2157+ int SQLLiteUi::ui_settings_get_displaycaptions_option (std::string& option, int user_id)
2158+ {
2159+ if (ui_settings_check_user_id (user_id))
2160+ return -1 ;
2161+
2162+ reports.clear ();
2163+ query = " SELECT DISPLAYCAPTIONS_OPTION FROM UI_SETTINGS WHERE USER_ID = ?;" ;
2164+
2165+ const char * end = NULL ;
2166+ int ret = sqlite3_prepare_v2 (db, query.c_str (), query.length () + 1 , &stmt, &end);
2167+ if (ret != SQLITE_OK || !stmt || (end && *end))
2168+ return -1 ;
2169+
2170+ ret = sqlite3_bind_int (stmt, 1 , user_id);
2171+ if (ret != SQLITE_OK )
2172+ return -1 ;
2173+
2174+ if (execute () || reports.size () != 1 )
2175+ return -1 ;
2176+
2177+ if (reports[0 ].find (" DISPLAYCAPTIONS_OPTION" ) != reports[0 ].end ())
2178+ option = reports[0 ][" DISPLAYCAPTIONS_OPTION" ];
2179+ return 0 ;
2180+ }
2181+
21232182// ---------------------------------------------------------------------------
21242183int SQLLiteUi::ui_settings_save_mco_token (const std::string& token, int user_id)
21252184{
0 commit comments