Changeset 176 for smplayer/trunk/src/smplayer.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/smplayer.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 … … 18 18 19 19 #include "smplayer.h" 20 #include "defaultgui.h"21 #include "minigui.h"22 20 #include "global.h" 23 21 #include "paths.h" … … 28 26 #include "cleanconfig.h" 29 27 #include "myapplication.h" 30 #include "images.h" 28 #include "baseguiplus.h" 29 30 #ifdef DEFAULTGUI 31 #include "defaultgui.h" 32 #endif 33 34 #ifdef MINIGUI 35 #include "minigui.h" 36 #endif 31 37 32 38 #ifdef MPCGUI … … 90 96 showInfo(); 91 97 92 #ifdef Q_OS_WIN98 #ifdef FONTS_HACK 93 99 createFontFile(); 94 100 #endif … … 121 127 qDebug("SMPlayer::gui: user_theme_dir: %s", user_theme_dir.toUtf8().constData()); 122 128 qDebug("SMPlayer::gui: theme_dir: %s", theme_dir.toUtf8().constData()); 123 #ifdef USE_RESOURCES124 QString user_theme_resource = user_theme_dir +"/"+ theme +".rcc";125 QString theme_resource = theme_dir +"/"+ theme +".rcc";126 qDebug("SMPlayer::gui: user_theme_resource: %s", user_theme_resource.toUtf8().constData());127 qDebug("SMPlayer::gui: theme_resource: %s", theme_resource.toUtf8().constData());128 if ((QFile::exists(user_theme_resource)) || (QFile::exists(theme_resource))) {129 #else130 129 if ((QDir(theme_dir).exists()) || (QDir(user_theme_dir).exists())) { 131 #endif132 130 if (pref->iconset.isEmpty()) pref->iconset = theme; 133 131 } else { 134 #ifdef USE_RESOURCES135 qDebug("SMPlayer::gui: skin resource file doesn't exist. Falling back to default gui.");136 #else137 132 qDebug("SMPlayer::gui: skin folder doesn't exist. Falling back to default gui."); 138 #endif139 133 gui_to_use = "DefaultGUI"; 140 134 pref->iconset = ""; … … 167 161 else 168 162 #endif 163 #ifdef MINIGUI 169 164 if (gui_name.toLower() == "minigui") 170 165 gui = new MiniGui(0); 171 166 else 167 #endif 172 168 #ifdef MPCGUI 173 169 if (gui_name.toLower() == "mpcgui") … … 175 171 else 176 172 #endif 173 #ifdef DEFAULTGUI 174 if (gui_name.toLower() == "defaultgui") 177 175 gui = new DefaultGui(0); 176 else 177 #endif 178 { 179 // No GUI 180 qWarning() << "SMPlayer::createGUI: there's no GUI available!"; 181 gui = new BaseGuiPlus(0); 182 } 178 183 179 184 gui->setForceCloseOnFinish(close_at_end); … … 227 232 228 233 229 234 QString action; // Action to be passed to running instance 230 235 bool show_help = false; 231 236 … … 291 296 } 292 297 else 298 if (argument == "-media-title") { 299 if (n+1 < args.count()) { 300 n++; 301 if (media_title.isEmpty()) media_title = args[n]; 302 } 303 } 304 else 293 305 if (argument == "-pos") { 294 306 if (n+2 < args.count()) { … … 356 368 gui_to_use = "DefaultGUI"; 357 369 } 370 else 371 if (argument == "-ontop") { 372 pref->stay_on_top = Preferences::AlwaysOnTop; 373 } 374 else 375 if (argument == "-no-ontop") { 376 pref->stay_on_top = Preferences::NeverOnTop; 377 } 358 378 #ifdef SKINS 359 379 else … … 400 420 if (!subtitle_file.isEmpty()) { 401 421 a->sendMessage("load_sub " + subtitle_file); 422 } 423 424 if (!media_title.isEmpty()) { 425 a->sendMessage("media_title " + files_to_play[0] + " <<sep>> " + media_title); 402 426 } 403 427 … … 438 462 if (!files_to_play.isEmpty()) { 439 463 if (!subtitle_file.isEmpty()) gui()->setInitialSubtitle(subtitle_file); 464 if (!media_title.isEmpty()) gui()->getCore()->addForcedTitle(files_to_play[0], media_title); 440 465 gui()->openFiles(files_to_play); 441 466 } … … 469 494 #endif 470 495 471 #ifdef Q_OS_WIN496 #ifdef FONTS_HACK 472 497 void SMPlayer::createFontFile() { 473 498 qDebug("SMPlayer::createFontFile"); … … 487 512 488 513 QString input = Paths::appPath() + "/mplayer/fonts/fonts.conf"; 489 qDebug("SMPlayer::createFontFile: input: %s", input.toLatin1().constData()); 514 if (!QFile::exists(input)) { 515 qDebug("SMPlayer::createFontFile: %s doesn't exist", input.toUtf8().constData()); 516 input = Paths::appPath() + "/mplayer/mpv/fonts.conf"; 517 if (!QFile::exists(input)) { 518 qDebug("SMPlayer::createFontFile: %s doesn't exist", input.toUtf8().constData()); 519 qWarning("SMPlayer::createFontFile: failed to create fonts.conf"); 520 return; 521 } 522 } 523 qDebug("SMPlayer::createFontFile: input: %s", input.toUtf8().constData()); 490 524 QFile infile(input); 491 525 if (infile.open(QIODevice::ReadOnly | QIODevice::Text)) { 492 526 QString text = infile.readAll(); 527 text = text.replace("<!-- <dir>WINDOWSFONTDIR</dir> -->", "<dir>WINDOWSFONTDIR</dir>"); 493 528 text = text.replace("<dir>WINDOWSFONTDIR</dir>", "<dir>" + Paths::fontPath() + "</dir>"); 494 529 //qDebug("SMPlayer::createFontFile: %s", text.toUtf8().constData()); … … 518 553 case QSysInfo::WV_WINDOWS8: win_ver = "Windows 8/Server 2012"; break; 519 554 #endif 555 #if ((QT_VERSION >= 0x040806 && QT_VERSION < 0x050000) || (QT_VERSION >= 0x050200)) 556 case QSysInfo::WV_WINDOWS8_1: win_ver = "Windows 8.1/Server 2012 R2"; break; 557 #endif 558 #if ((QT_VERSION >= 0x040807 && QT_VERSION < 0x050000) || (QT_VERSION >= 0x050500)) 559 case QSysInfo::WV_WINDOWS10: win_ver = "Windows 10"; break; 560 #endif 520 561 case QSysInfo::WV_NT_based: win_ver = "NT-based Windows"; break; 521 562 default: win_ver = QString("Unknown/Unsupported Windows OS"); break; … … 553 594 qDebug(" * file for subtitles' styles: '%s'", Paths::subtitleStyleFile().toUtf8().data()); 554 595 qDebug(" * current path: '%s'", QDir::currentPath().toUtf8().data()); 555 #ifdef Q_OS_WIN596 #ifdef FONTS_HACK 556 597 qDebug(" * font path: '%s'", Paths::fontPath().toUtf8().data()); 557 598 #endif … … 584 625 orig_line = msg; 585 626 #else 627 #ifdef Q_OS_WIN 628 orig_line = QString::fromLocal8Bit(msg); 629 #else 586 630 orig_line = QString::fromUtf8(msg); 631 #endif 587 632 #endif 588 633
Note:
See TracChangeset
for help on using the changeset viewer.