Ignore:
Timestamp:
May 15, 2014, 7:53:54 PM (11 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: update vendor to 0.8.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified smplayer/vendor/current/src/smplayer.cpp

    r154 r163  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
     2    Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    2020#include "defaultgui.h"
    2121#include "minigui.h"
    22 #include "mpcgui.h"
    2322#include "global.h"
    2423#include "paths.h"
     
    3029#include "myapplication.h"
    3130
     31#ifdef MPCGUI
     32#include "mpcgui.h"
     33#endif
     34
    3235#ifdef SKINS
    3336#include "skingui.h"
     
    5962{
    6063#ifdef LOG_SMPLAYER
     64        #if QT_VERSION >= 0x050000
     65        qInstallMessageHandler( SMPlayer::myMessageOutput );
     66        #else
    6167        qInstallMsgHandler( SMPlayer::myMessageOutput );
     68        #endif
    6269        allow_to_send_log_to_gui = true;
    6370#endif
     
    8188        translator->load( pref->language );
    8289        showInfo();
     90
     91#ifdef Q_OS_WIN
     92        createFontFile();
     93#endif
    8394}
    8495
     
    145156        if (gui_name.toLower() == "minigui")
    146157                gui = new MiniGui(0);
    147         else
     158        else
     159#ifdef MPCGUI
    148160        if (gui_name.toLower() == "mpcgui")
    149161                gui = new MpcGui(0);
    150162        else
     163#endif
    151164                gui = new DefaultGui(0);
    152165
     
    439452                }
    440453                #endif
     454        }
     455}
     456#endif
     457
     458#ifdef Q_OS_WIN
     459void SMPlayer::createFontFile() {
     460        qDebug("SMPlayer::createFontFile");
     461        QString output = Paths::configPath() + "/fonts.conf";
     462
     463        // Check if the file already exists with the modified path
     464        if (QFile::exists(output)) {
     465                QFile i(output);
     466                if (i.open(QIODevice::ReadOnly | QIODevice::Text)) {
     467                        QString text = i.readAll();
     468                        if (text.contains("<dir>" + Paths::fontPath() + "</dir>")) {
     469                                qDebug("SMPlayer::createFontFile: file %s already exists with font path. Doing nothing.", output.toUtf8().constData());
     470                                return;
     471                        }
     472                }
     473        }
     474
     475        QString input = Paths::appPath() + "/mplayer/fonts/fonts.conf";
     476        qDebug("SMPlayer::createFontFile: input: %s", input.toLatin1().constData());
     477        QFile infile(input);
     478        if (infile.open(QIODevice::ReadOnly | QIODevice::Text)) {
     479                QString text = infile.readAll();
     480                text = text.replace("<dir>WINDOWSFONTDIR</dir>", "<dir>" + Paths::fontPath() + "</dir>");
     481                //qDebug("SMPlayer::createFontFile: %s", text.toUtf8().constData());
     482
     483                qDebug("SMPlayer::createFontFile: saving %s", output.toUtf8().constData());
     484                QFile outfile(output);
     485                if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
     486                        outfile.write(text.toUtf8());
     487                        outfile.close();
     488                }
    441489        }
    442490}
     
    492540        qDebug(" * file for subtitles' styles: '%s'", Paths::subtitleStyleFile().toUtf8().data());
    493541        qDebug(" * current path: '%s'", QDir::currentPath().toUtf8().data());
     542#ifdef Q_OS_WIN
     543        qDebug(" * font path: '%s'", Paths::fontPath().toUtf8().data());
     544#endif
    494545}
    495546
     
    498549bool SMPlayer::allow_to_send_log_to_gui = false;
    499550
     551#if QT_VERSION >= 0x050000
     552void SMPlayer::myMessageOutput( QtMsgType type, const QMessageLogContext &, const QString & msg ) {
     553#else
    500554void SMPlayer::myMessageOutput( QtMsgType type, const char *msg ) {
     555#endif
    501556        static QStringList saved_lines;
    502557        static QString orig_line;
     
    513568        line2.clear();
    514569
     570#if QT_VERSION >= 0x050000
     571        orig_line = msg;
     572#else
    515573        orig_line = QString::fromUtf8(msg);
     574#endif
    516575
    517576        switch ( type ) {
Note: See TracChangeset for help on using the changeset viewer.