Ignore:
Timestamp:
May 3, 2016, 5:25:45 PM (9 years ago)
Author:
Silvan Scherrer
Message:

smplayer: update trunk to version 16.4

Location:
smplayer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • smplayer/trunk

  • smplayer/trunk/src/smplayer.cpp

    r170 r176  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
     2    Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    1818
    1919#include "smplayer.h"
    20 #include "defaultgui.h"
    21 #include "minigui.h"
    2220#include "global.h"
    2321#include "paths.h"
     
    2826#include "cleanconfig.h"
    2927#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
    3137
    3238#ifdef MPCGUI
     
    9096        showInfo();
    9197
    92 #ifdef Q_OS_WIN
     98#ifdef FONTS_HACK
    9399        createFontFile();
    94100#endif
     
    121127                        qDebug("SMPlayer::gui: user_theme_dir: %s", user_theme_dir.toUtf8().constData());
    122128                        qDebug("SMPlayer::gui: theme_dir: %s", theme_dir.toUtf8().constData());
    123                         #ifdef USE_RESOURCES
    124                         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                         #else
    130129                        if ((QDir(theme_dir).exists()) || (QDir(user_theme_dir).exists())) {
    131                         #endif
    132130                                if (pref->iconset.isEmpty()) pref->iconset = theme;
    133131                        } else {
    134                                 #ifdef USE_RESOURCES
    135                                 qDebug("SMPlayer::gui: skin resource file doesn't exist. Falling back to default gui.");
    136                                 #else
    137132                                qDebug("SMPlayer::gui: skin folder doesn't exist. Falling back to default gui.");
    138                                 #endif
    139133                                gui_to_use = "DefaultGUI";
    140134                                pref->iconset = "";
     
    167161        else
    168162#endif
     163#ifdef MINIGUI
    169164        if (gui_name.toLower() == "minigui")
    170165                gui = new MiniGui(0);
    171166        else
     167#endif
    172168#ifdef MPCGUI
    173169        if (gui_name.toLower() == "mpcgui")
     
    175171        else
    176172#endif
     173#ifdef DEFAULTGUI
     174        if (gui_name.toLower() == "defaultgui")
    177175                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        }
    178183
    179184        gui->setForceCloseOnFinish(close_at_end);
     
    227232
    228233
    229     QString action; // Action to be passed to running instance
     234        QString action; // Action to be passed to running instance
    230235        bool show_help = false;
    231236
     
    291296                }
    292297                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
    293305                if (argument == "-pos") {
    294306                        if (n+2 < args.count()) {
     
    356368                        gui_to_use = "DefaultGUI";
    357369                }
     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                }
    358378#ifdef SKINS
    359379                else
     
    400420                                if (!subtitle_file.isEmpty()) {
    401421                                        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);
    402426                                }
    403427
     
    438462        if (!files_to_play.isEmpty()) {
    439463                if (!subtitle_file.isEmpty()) gui()->setInitialSubtitle(subtitle_file);
     464                if (!media_title.isEmpty()) gui()->getCore()->addForcedTitle(files_to_play[0], media_title);
    440465                gui()->openFiles(files_to_play);
    441466        }
     
    469494#endif
    470495
    471 #ifdef Q_OS_WIN
     496#ifdef FONTS_HACK
    472497void SMPlayer::createFontFile() {
    473498        qDebug("SMPlayer::createFontFile");
     
    487512
    488513        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());
    490524        QFile infile(input);
    491525        if (infile.open(QIODevice::ReadOnly | QIODevice::Text)) {
    492526                QString text = infile.readAll();
     527                text = text.replace("<!-- <dir>WINDOWSFONTDIR</dir> -->", "<dir>WINDOWSFONTDIR</dir>");
    493528                text = text.replace("<dir>WINDOWSFONTDIR</dir>", "<dir>" + Paths::fontPath() + "</dir>");
    494529                //qDebug("SMPlayer::createFontFile: %s", text.toUtf8().constData());
     
    518553                case QSysInfo::WV_WINDOWS8: win_ver = "Windows 8/Server 2012"; break;
    519554                #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
    520561                case QSysInfo::WV_NT_based: win_ver = "NT-based Windows"; break;
    521562                default: win_ver = QString("Unknown/Unsupported Windows OS"); break;
     
    553594        qDebug(" * file for subtitles' styles: '%s'", Paths::subtitleStyleFile().toUtf8().data());
    554595        qDebug(" * current path: '%s'", QDir::currentPath().toUtf8().data());
    555 #ifdef Q_OS_WIN
     596#ifdef FONTS_HACK
    556597        qDebug(" * font path: '%s'", Paths::fontPath().toUtf8().data());
    557598#endif
     
    584625        orig_line = msg;
    585626#else
     627        #ifdef Q_OS_WIN
     628        orig_line = QString::fromLocal8Bit(msg);
     629        #else
    586630        orig_line = QString::fromUtf8(msg);
     631        #endif
    587632#endif
    588633
Note: See TracChangeset for help on using the changeset viewer.