Changeset 176 for smplayer/trunk/src/preferences.cpp
- Timestamp:
- May 3, 2016, 5:25:45 PM (9 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 175
- Property svn:mergeinfo changed
-
smplayer/trunk/src/preferences.cpp
r170 r176 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 4Ricardo Villalba <rvm@users.sourceforge.net>2 Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 25 25 #include "filters.h" 26 26 #include "autohidewidget.h" 27 #include "helper.h" 27 28 28 29 #include <QSettings> … … 31 32 #include <QDir> 32 33 #include <QLocale> 34 #include <QNetworkProxy> 33 35 34 36 #if QT_VERSION >= 0x050000 … … 87 89 88 90 use_screenshot = true; 91 #ifdef MPV_SUPPORT 92 screenshot_template = "cap_%F_%p_%02n"; 93 screenshot_format = "jpg"; 94 #endif 89 95 screenshot_directory=""; 90 96 #ifdef PORTABLE_APP … … 99 105 #endif 100 106 107 #ifdef CAPTURE_STREAM 108 capture_directory = ""; 109 #endif 110 101 111 dont_remember_media_settings = false; 102 112 dont_remember_time_pos = false; … … 133 143 #endif 134 144 145 #ifdef Q_OS_WIN 146 use_soft_vol = false; 147 #else 135 148 use_soft_vol = true; 149 #endif 136 150 softvol_max = 110; // 110 = default value in mplayer 137 151 use_scaletempo = Detect; … … 156 170 157 171 osd = None; 172 osd_scale = 1; 173 subfont_osd_scale = 3; 158 174 osd_delay = 2200; 159 175 … … 199 215 HD_height = 720; 200 216 217 #ifdef OBSOLETE_FAST_AUDIO_CHANGE 201 218 // MPlayer 1.0rc1 require restart, new versions don't 202 219 fast_audio_change = Detect; 220 #endif 221 203 222 #if !SMART_DVD_CHAPTERS 204 223 fast_chapter_change = false; … … 206 225 207 226 threads = 1; 227 hwdec = "no"; 208 228 209 229 cache_for_files = 2048; … … 214 234 cache_for_tv = 3000; 215 235 216 #ifdef YOUTUBE_SUPPORT217 yt_quality = RetrieveYoutubeUrl::MP4_720p;218 //yt_user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1";219 yt_user_agent = "";220 yt_use_https_main = false;221 yt_use_https_vi = false;222 #endif223 224 236 225 237 /* ********* … … 227 239 ********* */ 228 240 229 font_file = "";230 font_name = "";231 use_fontconfig = false;232 241 subcp = "ISO-8859-1"; 233 242 use_enca = false; 234 243 enca_lang = QString(QLocale::system().name()).section("_",0,0); 235 font_autoscale = 1;236 244 subfuzziness = 1; 237 245 autoload_sub = true; 238 246 239 247 use_ass_subtitles = true; 248 enable_ass_styles = true; 240 249 ass_line_spacing = 0; 241 250 … … 246 255 subtitles_on_screenshots = false; 247 256 248 use_new_sub_commands = Detect;249 257 change_sub_scale_should_restart = Detect; 250 258 … … 259 267 260 268 freetype_support = true; 261 #ifdef Q_OS_WIN269 #ifdef FONTS_HACK 262 270 use_windowsfontdir = false; 263 271 #endif … … 284 292 285 293 mplayer_additional_options=""; 286 #if def PORTABLE_APP294 #if defined(PORTABLE_APP) && defined(FONTS_HACK) 287 295 mplayer_additional_options="-nofontconfig"; 288 296 #endif … … 313 321 use_edl_files = true; 314 322 323 #ifdef MPLAYER_SUPPORT 324 use_playlist_option = false; 325 #endif 326 315 327 prefer_ipv4 = true; 316 328 … … 328 340 329 341 time_to_kill_mplayer = 1000; 342 343 #ifdef MPRIS2 344 use_mpris2 = true; 345 #endif 330 346 331 347 … … 346 362 #endif 347 363 348 move_when_dragging= false;349 364 center_window = false; 365 center_window_if_outside = true; 350 366 351 367 #if DVDNAV_SUPPORT … … 363 379 wheel_function_seeking_reverse = false; 364 380 381 drag_function = DragDisabled; 382 365 383 seeking1 = 10; 366 384 seeking2 = 60; … … 404 422 allow_video_movement = false; 405 423 406 #ifdef SKINS407 gui = "SkinGUI";408 iconset = "Gonzo";409 #else410 424 gui = "DefaultGUI"; 411 iconset = " ";412 #endif 425 iconset = "H2O"; 426 413 427 414 428 #if USE_MINIMUMSIZE … … 443 457 last_dvb_channel = ""; 444 458 last_tv_channel = ""; 459 460 461 /* ******** 462 Network 463 ******** */ 464 465 #ifdef MPV_SUPPORT 466 streaming_type = StreamingAuto; 467 #else 468 streaming_type = StreamingYT; 469 #endif 470 #ifdef YOUTUBE_SUPPORT 471 yt_quality = RetrieveYoutubeUrl::MP4_720p; 472 //yt_user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1"; 473 yt_user_agent = ""; 474 yt_use_https_main = false; 475 yt_use_https_vi = false; 476 #endif 477 478 // Proxy 479 use_proxy = false; 480 proxy_type = QNetworkProxy::HttpProxy; 481 proxy_host = ""; 482 proxy_port = 0; 483 proxy_username = ""; 484 proxy_password = ""; 445 485 446 486 … … 489 529 mplayer_detected_version = -1; //None version parsed yet 490 530 mplayer_user_supplied_version = -1; 531 #ifdef MPLAYER2_SUPPORT 491 532 mplayer_is_mplayer2 = false; 492 533 mplayer2_detected_version = QString::null; 534 #endif 493 535 494 536 … … 561 603 562 604 set->setValue("use_screenshot", use_screenshot); 605 #ifdef MPV_SUPPORT 606 set->setValue("screenshot_template", screenshot_template); 607 set->setValue("screenshot_format", screenshot_format); 608 #endif 563 609 #if QT_VERSION >= 0x040400 564 610 set->setValue("screenshot_folder", screenshot_directory); 565 611 #else 566 612 set->setValue("screenshot_directory", screenshot_directory); 613 #endif 614 615 #ifdef CAPTURE_STREAM 616 set->setValue("capture_directory", capture_directory); 567 617 #endif 568 618 … … 623 673 624 674 set->setValue("osd", osd); 675 set->setValue("osd_scale", osd_scale); 676 set->setValue("subfont_osd_scale", subfont_osd_scale); 625 677 set->setValue("osd_delay", osd_delay); 626 678 … … 668 720 set->setValue("HD_height", HD_height); 669 721 722 #ifdef OBSOLETE_FAST_AUDIO_CHANGE 670 723 set->setValue("fast_audio_change", fast_audio_change); 724 #endif 725 671 726 #if !SMART_DVD_CHAPTERS 672 727 set->setValue("fast_chapter_change", fast_chapter_change); … … 674 729 675 730 set->setValue("threads", threads); 731 set->setValue("hwdec", hwdec); 676 732 677 733 set->setValue("cache_for_files", cache_for_files); … … 684 740 set->endGroup(); // performance 685 741 686 #ifdef YOUTUBE_SUPPORT687 set->beginGroup("youtube");688 set->setValue("quality", yt_quality);689 set->setValue("user_agent", yt_user_agent);690 set->setValue("yt_use_https_main", yt_use_https_main);691 set->setValue("yt_use_https_vi", yt_use_https_vi);692 set->endGroup();693 #endif694 695 742 696 743 /* ********* … … 700 747 set->beginGroup("subtitles"); 701 748 702 set->setValue("font_file", font_file);703 set->setValue("font_name", font_name);704 705 set->setValue("use_fontconfig", use_fontconfig);706 749 set->setValue("subcp", subcp); 707 750 set->setValue("use_enca", use_enca); 708 751 set->setValue("enca_lang", enca_lang); 709 set->setValue("font_autoscale", font_autoscale);710 752 set->setValue("subfuzziness", subfuzziness); 711 753 set->setValue("autoload_sub", autoload_sub); 712 754 713 755 set->setValue("use_ass_subtitles", use_ass_subtitles); 756 set->setValue("enable_ass_styles", enable_ass_styles); 714 757 set->setValue("ass_line_spacing", ass_line_spacing); 715 758 set->setValue("use_forced_subs_only", use_forced_subs_only); … … 719 762 set->setValue("subtitles_on_screenshots", subtitles_on_screenshots); 720 763 721 set->setValue("use_new_sub_commands", use_new_sub_commands);722 764 set->setValue("change_sub_scale_should_restart", change_sub_scale_should_restart); 723 765 … … 730 772 731 773 set->setValue("freetype_support", freetype_support); 732 #ifdef Q_OS_WIN774 #ifdef FONTS_HACK 733 775 set->setValue("use_windowsfontdir", use_windowsfontdir); 734 776 #endif … … 780 822 set->setValue("use_edl_files", use_edl_files); 781 823 824 #ifdef MPLAYER_SUPPORT 825 set->setValue("use_playlist_option", use_playlist_option); 826 #endif 827 782 828 set->setValue("prefer_ipv4", prefer_ipv4); 783 829 … … 795 841 796 842 set->setValue("time_to_kill_mplayer", time_to_kill_mplayer); 843 844 #ifdef MPRIS2 845 set->setValue("use_mpris2", use_mpris2); 846 #endif 797 847 798 848 set->endGroup(); // advanced … … 817 867 #endif 818 868 819 set->setValue("move_when_dragging", move_when_dragging); 869 set->setValue("center_window", center_window); 870 set->setValue("center_window_if_outside", center_window_if_outside); 820 871 821 872 set->setValue("mouse_left_click_function", mouse_left_click_function); … … 829 880 set->setValue("wheel_function_seeking_reverse", wheel_function_seeking_reverse); 830 881 882 set->setValue("drag_function", drag_function); 883 831 884 set->setValue("seeking1", seeking1); 832 885 set->setValue("seeking2", seeking2); … … 903 956 set->setValue("last_tv_channel", last_tv_channel); 904 957 set->endGroup(); // tv 958 959 960 /* ******** 961 Network 962 ******** */ 963 964 set->beginGroup("streaming"); 965 set->setValue("streaming_type", streaming_type); 966 967 #ifdef YOUTUBE_SUPPORT 968 set->beginGroup("streaming/youtube"); 969 set->setValue("quality", yt_quality); 970 set->setValue("user_agent", yt_user_agent); 971 set->setValue("yt_use_https_main", yt_use_https_main); 972 set->setValue("yt_use_https_vi", yt_use_https_vi); 973 set->endGroup(); 974 #endif 975 set->endGroup(); // streaming 976 977 set->beginGroup("proxy"); 978 set->setValue("use_proxy", use_proxy); 979 set->setValue("type", proxy_type); 980 set->setValue("host", proxy_host); 981 set->setValue("port", proxy_port); 982 set->setValue("username", proxy_username); 983 set->setValue("password", proxy_password); 984 set->endGroup(); // proxy 985 905 986 906 987 /* *********** … … 961 1042 set->setValue("mplayer_detected_version", mplayer_detected_version); 962 1043 set->setValue("mplayer_user_supplied_version", mplayer_user_supplied_version); 1044 #ifdef MPLAYER2_SUPPORT 963 1045 set->setValue("is_mplayer2", mplayer_is_mplayer2); 964 1046 set->setValue("mplayer2_detected_version", mplayer2_detected_version); 1047 #endif 965 1048 set->endGroup(); // mplayer_info 966 1049 … … 1054 1137 1055 1138 use_screenshot = set->value("use_screenshot", use_screenshot).toBool(); 1139 #ifdef MPV_SUPPORT 1140 screenshot_template = set->value("screenshot_template", screenshot_template).toString(); 1141 screenshot_format = set->value("screenshot_format", screenshot_format).toString(); 1142 #endif 1056 1143 #if QT_VERSION >= 0x040400 1057 1144 screenshot_directory = set->value("screenshot_folder", screenshot_directory).toString(); … … 1059 1146 #else 1060 1147 screenshot_directory = set->value("screenshot_directory", screenshot_directory).toString(); 1148 #endif 1149 1150 #ifdef CAPTURE_STREAM 1151 capture_directory = set->value("capture_directory", capture_directory).toString(); 1061 1152 #endif 1062 1153 … … 1118 1209 1119 1210 osd = set->value("osd", osd).toInt(); 1211 osd_scale = set->value("osd_scale", osd_scale).toDouble(); 1212 subfont_osd_scale = set->value("subfont_osd_scale", subfont_osd_scale).toDouble(); 1120 1213 osd_delay = set->value("osd_delay", osd_delay).toInt(); 1121 1214 … … 1163 1256 HD_height = set->value("HD_height", HD_height).toInt(); 1164 1257 1258 #ifdef OBSOLETE_FAST_AUDIO_CHANGE 1165 1259 fast_audio_change = (OptionState) set->value("fast_audio_change", fast_audio_change).toInt(); 1260 #endif 1261 1166 1262 #if !SMART_DVD_CHAPTERS 1167 1263 fast_chapter_change = set->value("fast_chapter_change", fast_chapter_change).toBool(); … … 1169 1265 1170 1266 threads = set->value("threads", threads).toInt(); 1267 hwdec = set->value("hwdec", hwdec).toString(); 1171 1268 1172 1269 cache_for_files = set->value("cache_for_files", cache_for_files).toInt(); … … 1179 1276 set->endGroup(); // performance 1180 1277 1181 #ifdef YOUTUBE_SUPPORT1182 set->beginGroup("youtube");1183 yt_quality = set->value("quality", yt_quality).toInt();1184 yt_user_agent = set->value("user_agent", yt_user_agent).toString();1185 yt_use_https_main = set->value("yt_use_https_main", yt_use_https_main).toBool();1186 yt_use_https_vi = set->value("yt_use_https_vi", yt_use_https_vi).toBool();1187 set->endGroup();1188 #endif1189 1190 1278 1191 1279 /* ********* … … 1195 1283 set->beginGroup("subtitles"); 1196 1284 1197 font_file = set->value("font_file", font_file).toString();1198 font_name = set->value("font_name", font_name).toString();1199 1200 use_fontconfig = set->value("use_fontconfig", use_fontconfig).toBool();1201 1285 subcp = set->value("subcp", subcp).toString(); 1202 1286 use_enca = set->value("use_enca", use_enca).toBool(); 1203 1287 enca_lang = set->value("enca_lang", enca_lang).toString(); 1204 font_autoscale = set->value("font_autoscale", font_autoscale).toInt();1205 1288 subfuzziness = set->value("subfuzziness", subfuzziness).toInt(); 1206 1289 autoload_sub = set->value("autoload_sub", autoload_sub).toBool(); 1207 1290 1208 1291 use_ass_subtitles = set->value("use_ass_subtitles", use_ass_subtitles).toBool(); 1292 enable_ass_styles = set->value("enable_ass_styles", enable_ass_styles).toBool(); 1209 1293 ass_line_spacing = set->value("ass_line_spacing", ass_line_spacing).toInt(); 1210 1294 … … 1215 1299 subtitles_on_screenshots = set->value("subtitles_on_screenshots", subtitles_on_screenshots).toBool(); 1216 1300 1217 use_new_sub_commands = (OptionState) set->value("use_new_sub_commands", use_new_sub_commands).toInt();1218 1301 change_sub_scale_should_restart = (OptionState) set->value("change_sub_scale_should_restart", change_sub_scale_should_restart).toInt(); 1219 1302 … … 1226 1309 1227 1310 freetype_support = set->value("freetype_support", freetype_support).toBool(); 1228 #ifdef Q_OS_WIN1311 #ifdef FONTS_HACK 1229 1312 use_windowsfontdir = set->value("use_windowsfontdir", use_windowsfontdir).toBool(); 1230 1313 #endif … … 1281 1364 use_edl_files = set->value("use_edl_files", use_edl_files).toBool(); 1282 1365 1366 #ifdef MPLAYER_SUPPORT 1367 use_playlist_option = set->value("use_playlist_option", use_playlist_option).toBool(); 1368 #endif 1369 1283 1370 prefer_ipv4 = set->value("prefer_ipv4", prefer_ipv4).toBool(); 1284 1371 … … 1294 1381 1295 1382 time_to_kill_mplayer = set->value("time_to_kill_mplayer", time_to_kill_mplayer).toInt(); 1383 1384 #ifdef MPRIS2 1385 use_mpris2 = set->value("use_mpris2", use_mpris2).toBool(); 1386 #endif 1296 1387 1297 1388 set->endGroup(); // advanced … … 1316 1407 #endif 1317 1408 1318 move_when_dragging = set->value("move_when_dragging", move_when_dragging).toBool(); 1409 center_window = set->value("center_window", center_window).toBool(); 1410 center_window_if_outside = set->value("center_window_if_outside", center_window_if_outside).toBool(); 1319 1411 1320 1412 mouse_left_click_function = set->value("mouse_left_click_function", mouse_left_click_function).toString(); … … 1331 1423 wheel_function_seeking_reverse = set->value("wheel_function_seeking_reverse", wheel_function_seeking_reverse).toBool(); 1332 1424 1425 drag_function = set->value("drag_function", drag_function).toInt(); 1426 1333 1427 seeking1 = set->value("seeking1", seeking1).toInt(); 1334 1428 seeking2 = set->value("seeking2", seeking2).toInt(); … … 1405 1499 last_tv_channel = set->value("last_tv_channel", last_tv_channel).toString(); 1406 1500 set->endGroup(); // tv 1501 1502 1503 /* ******** 1504 Network 1505 ******** */ 1506 1507 set->beginGroup("streaming"); 1508 streaming_type = set->value("streaming_type", streaming_type).toInt(); 1509 1510 #ifdef YOUTUBE_SUPPORT 1511 set->beginGroup("streaming/youtube"); 1512 yt_quality = set->value("quality", yt_quality).toInt(); 1513 yt_user_agent = set->value("user_agent", yt_user_agent).toString(); 1514 yt_use_https_main = set->value("yt_use_https_main", yt_use_https_main).toBool(); 1515 yt_use_https_vi = set->value("yt_use_https_vi", yt_use_https_vi).toBool(); 1516 set->endGroup(); 1517 #endif 1518 set->endGroup(); // streaming 1519 1520 set->beginGroup("proxy"); 1521 use_proxy = set->value("use_proxy", use_proxy).toBool(); 1522 proxy_type = set->value("type", proxy_type).toInt(); 1523 proxy_host = set->value("host", proxy_host).toString(); 1524 proxy_port = set->value("port", proxy_port).toInt(); 1525 proxy_username = set->value("username", proxy_username).toString(); 1526 proxy_password = set->value("password", proxy_password).toString(); 1527 set->endGroup(); // proxy 1407 1528 1408 1529 … … 1461 1582 mplayer_detected_version = set->value("mplayer_detected_version", mplayer_detected_version).toInt(); 1462 1583 mplayer_user_supplied_version = set->value("mplayer_user_supplied_version", mplayer_user_supplied_version).toInt(); 1584 #ifdef MPLAYER2_SUPPORT 1463 1585 mplayer_is_mplayer2 = set->value("is_mplayer2", mplayer_is_mplayer2).toBool(); 1464 1586 mplayer2_detected_version = set->value("mplayer2_detected_version", mplayer2_detected_version).toString(); 1465 1587 #endif 1466 1588 set->endGroup(); // mplayer_info 1467 1589 … … 1517 1639 ********* */ 1518 1640 1641 set->beginGroup("smplayer"); 1519 1642 #ifdef CHECK_UPGRADED 1520 set->beginGroup("smplayer");1521 1643 smplayer_stable_version = set->value("stable_version", smplayer_stable_version).toString(); 1522 1644 check_if_upgraded = set->value("check_if_upgraded", check_if_upgraded).toBool(); … … 1562 1684 1563 1685 resize_method = Never; 1564 move_when_dragging = false;1686 //move_when_dragging = false; 1565 1687 } 1566 1688 config_version = CURRENT_CONFIG_VERSION; … … 1570 1692 // Check if the mplayer binary exists and try to fix it 1571 1693 if (!QFile::exists(mplayer_bin)) { 1572 qWarning("mplayer_bin '%s' doesn' exist", mplayer_bin.toLatin1().constData());1694 qWarning("mplayer_bin '%s' doesn't exist", mplayer_bin.toLatin1().constData()); 1573 1695 bool fixed = false; 1574 1696 if (QFile::exists("mplayer/mplayer.exe")) { 1575 1697 mplayer_bin = "mplayer/mplayer.exe"; 1576 1698 fixed = true; 1577 } else 1699 } 1700 else 1578 1701 if (QFile::exists("mplayer/mplayer2.exe")) { 1579 1702 mplayer_bin = "mplayer/mplayer2.exe"; 1580 1703 fixed = true; 1581 1704 } 1705 else 1706 if (QFile::exists("mpv/mpv.exe")) { 1707 mplayer_bin = "mpv/mpv.exe"; 1708 fixed = true; 1709 } 1582 1710 if (fixed) { 1583 1711 qWarning("mplayer_bin changed to '%s'", mplayer_bin.toLatin1().constData()); 1712 } 1713 } 1714 #endif 1715 #ifdef Q_OS_LINUX 1716 if (!QFile::exists(mplayer_bin)) { 1717 QString app_path = Helper::findExecutable(mplayer_bin); 1718 //qDebug("Preferences::load: app_path: %s", app_path.toUtf8().constData()); 1719 if (!app_path.isEmpty()) { 1720 mplayer_bin = app_path; 1721 } else { 1722 // Executable not found, try to find an alternative 1723 if (mplayer_bin.startsWith("mplayer")) { 1724 app_path = Helper::findExecutable("mpv"); 1725 if (!app_path.isEmpty()) mplayer_bin = app_path; 1726 } 1727 else 1728 if (mplayer_bin.startsWith("mpv")) { 1729 app_path = Helper::findExecutable("mplayer"); 1730 if (!app_path.isEmpty()) mplayer_bin = app_path; 1731 } 1584 1732 } 1585 1733 } … … 1629 1777 pdir = "/tmp"; 1630 1778 } 1631 QString default_screenshot_path = pdir + "/smplayer_screenshots";1779 QString default_screenshot_path = QDir::toNativeSeparators(pdir + "/smplayer_screenshots"); 1632 1780 if (!QFile::exists(default_screenshot_path)) { 1633 1781 qDebug("Preferences::setupScreenshotFolder: creating '%s'", default_screenshot_path.toUtf8().constData()); … … 1640 1788 } 1641 1789 } 1790 else { 1791 screenshot_directory = QDir::toNativeSeparators(screenshot_directory); 1792 } 1642 1793 #endif 1643 1794 }
Note:
See TracChangeset
for help on using the changeset viewer.