diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-05-24 21:06:14 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-05-24 21:06:14 +0800 |
commit | 35a1a8ed05ba7def37fa849d23de0f65cc03b0d0 (patch) | |
tree | 848b8ae706515524b281044738225d5e5022c067 /qmidiplayer-desktop/qmpmainwindow.cpp | |
parent | ded6dd1c8f7cbe2991e90f69f95730b39eaa95cf (diff) | |
download | QMidiPlayer-35a1a8ed05ba7def37fa849d23de0f65cc03b0d0.tar.xz |
Correct return result of API functions when text encoding is set to Unicode.
Use QPointer to store pointer to dialogs to avoid crashes.
(However crashes related to dbus are still not resolved.)
Diffstat (limited to 'qmidiplayer-desktop/qmpmainwindow.cpp')
-rw-r--r-- | qmidiplayer-desktop/qmpmainwindow.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index 73724ec..633489c 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -308,6 +308,8 @@ QString qmpMainWindow::getFileName(){return ui->lbFileName->text();} std::string qmpMainWindow::getTitle() { if(!qmpSettingsWindow::getSettingsIntf())return ""; + if(qmpSettingsWindow::getSettingsIntf()->value("Midi/TextEncoding","").toString() + =="Unicode")return std::string(player->getTitle()); return QTextCodec::codecForName( qmpSettingsWindow::getSettingsIntf()->value("Midi/TextEncoding",""). toString().toStdString().c_str())-> @@ -316,6 +318,8 @@ std::string qmpMainWindow::getTitle() std::wstring qmpMainWindow::getWTitle() { if(!qmpSettingsWindow::getSettingsIntf())return L""; + if(qmpSettingsWindow::getSettingsIntf()->value("Midi/TextEncoding","").toString() + =="Unicode")return QString(player->getTitle()).toStdWString(); return QTextCodec::codecForName( qmpSettingsWindow::getSettingsIntf()->value("Midi/TextEncoding",""). toString().toStdString().c_str())-> |