From 756f51ca14832d8d3534da2e9ff77fc0362d5045 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 3 Sep 2016 17:05:31 +0000 Subject: skinned: fixed issue with UTF-16 encoded pledit.txt (#880) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6704 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Ui/skinned/skin.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Ui/skinned/skin.cpp b/src/plugins/Ui/skinned/skin.cpp index 773421f7b..c2f716587 100644 --- a/src/plugins/Ui/skinned/skin.cpp +++ b/src/plugins/Ui/skinned/skin.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2015 by Ilya Kotov * + * Copyright (C) 2007-2016 by Ilya Kotov * * forkotov02@hotmail.ru * * * * Based on Promoe, an XMMS2 Client * @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include "actionmanager.h" #include "skin.h" @@ -431,22 +433,27 @@ void Skin::loadPLEdit() QFile file(path); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { qFatal("Skin: unable to open %s", qPrintable(path)); + return; + } - while (!file.atEnd ()) + QTextStream stream(&file); + + while (!stream.atEnd ()) { - QByteArray line = file.readLine (); + QString line = stream.readLine (); line = line.trimmed (); line.replace("\"",""); if(line.contains("//")) line.truncate (line.indexOf ("//")); - QList l = line.split ('='); + QStringList l = line.split ('='); if (l.count () == 2) { - key = l[0].toLower (); - value = l[1].trimmed(); + key = l[0].toLower().toLatin1(); + value = l[1].trimmed().toLatin1(); if(!value.startsWith("#") && key != "font") value.prepend("#"); //add # for color if needed -- cgit v1.2.3-13-gbd6f