Changeset 163 for smplayer/vendor/current/src/smplayer.cpp
- Timestamp:
- May 15, 2014, 7:53:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified smplayer/vendor/current/src/smplayer.cpp ¶
r154 r163 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 3Ricardo Villalba <rvm@users.sourceforge.net>2 Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 20 20 #include "defaultgui.h" 21 21 #include "minigui.h" 22 #include "mpcgui.h"23 22 #include "global.h" 24 23 #include "paths.h" … … 30 29 #include "myapplication.h" 31 30 31 #ifdef MPCGUI 32 #include "mpcgui.h" 33 #endif 34 32 35 #ifdef SKINS 33 36 #include "skingui.h" … … 59 62 { 60 63 #ifdef LOG_SMPLAYER 64 #if QT_VERSION >= 0x050000 65 qInstallMessageHandler( SMPlayer::myMessageOutput ); 66 #else 61 67 qInstallMsgHandler( SMPlayer::myMessageOutput ); 68 #endif 62 69 allow_to_send_log_to_gui = true; 63 70 #endif … … 81 88 translator->load( pref->language ); 82 89 showInfo(); 90 91 #ifdef Q_OS_WIN 92 createFontFile(); 93 #endif 83 94 } 84 95 … … 145 156 if (gui_name.toLower() == "minigui") 146 157 gui = new MiniGui(0); 147 else 158 else 159 #ifdef MPCGUI 148 160 if (gui_name.toLower() == "mpcgui") 149 161 gui = new MpcGui(0); 150 162 else 163 #endif 151 164 gui = new DefaultGui(0); 152 165 … … 439 452 } 440 453 #endif 454 } 455 } 456 #endif 457 458 #ifdef Q_OS_WIN 459 void 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 } 441 489 } 442 490 } … … 492 540 qDebug(" * file for subtitles' styles: '%s'", Paths::subtitleStyleFile().toUtf8().data()); 493 541 qDebug(" * current path: '%s'", QDir::currentPath().toUtf8().data()); 542 #ifdef Q_OS_WIN 543 qDebug(" * font path: '%s'", Paths::fontPath().toUtf8().data()); 544 #endif 494 545 } 495 546 … … 498 549 bool SMPlayer::allow_to_send_log_to_gui = false; 499 550 551 #if QT_VERSION >= 0x050000 552 void SMPlayer::myMessageOutput( QtMsgType type, const QMessageLogContext &, const QString & msg ) { 553 #else 500 554 void SMPlayer::myMessageOutput( QtMsgType type, const char *msg ) { 555 #endif 501 556 static QStringList saved_lines; 502 557 static QString orig_line; … … 513 568 line2.clear(); 514 569 570 #if QT_VERSION >= 0x050000 571 orig_line = msg; 572 #else 515 573 orig_line = QString::fromUtf8(msg); 574 #endif 516 575 517 576 switch ( type ) {
Note:
See TracChangeset
for help on using the changeset viewer.