aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-24 21:06:14 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-24 21:06:14 +0800
commit35a1a8ed05ba7def37fa849d23de0f65cc03b0d0 (patch)
tree848b8ae706515524b281044738225d5e5022c067
parentded6dd1c8f7cbe2991e90f69f95730b39eaa95cf (diff)
downloadQMidiPlayer-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.)
-rw-r--r--ChangeLog3
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp4
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.hpp15
-rw-r--r--visualization/qmpvisualization.cpp2
4 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 62d2389..168d178 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-05-24 0.8.1 alpha
Add seeking with arrow buttons in visualization.
+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.)
2016-05-23 0.8.1 alpha
Add horizontal visualization mode.
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())->
diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp
index ef07798..73bd109 100644
--- a/qmidiplayer-desktop/qmpmainwindow.hpp
+++ b/qmidiplayer-desktop/qmpmainwindow.hpp
@@ -10,8 +10,9 @@
#include <QMouseEvent>
#include <QAction>
#include <QMenu>
-#include <QApplication>
#include <QSlider>
+#include <QPointer>
+#include <QApplication>
#include <thread>
#include <chrono>
#include "../core/qmpmidiplay.hpp"
@@ -106,12 +107,12 @@ class qmpMainWindow:public QMainWindow
double offset;
CMidiPlayer *player;
qmpPluginManager *pmgr;
- qmpPlistWindow *plistw;
- qmpChannelsWindow *chnlw;
- qmpEfxWindow *efxw;
- qmpInfoWindow *infow;
- qmpSettingsWindow *settingsw;
- qmpHelpWindow *helpw;
+ QPointer<qmpPlistWindow> plistw;
+ QPointer<qmpChannelsWindow> chnlw;
+ QPointer<qmpEfxWindow> efxw;
+ QPointer<qmpInfoWindow> infow;
+ QPointer<qmpSettingsWindow> settingsw;
+ QPointer<qmpHelpWindow> helpw;
qmpVisualizationIntf* VIs[16];
QAction *fnA1,*fnA2,*fnA3;
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index e9d1977..aebf24b 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -10,7 +10,7 @@ int notestretch=100;//length of quarter note
int minnotelength=100;
int noteappearance=1,showpiano=1,stairpiano=1,savevp=1,showlabel=1;
int wwidth=800,wheight=600,wsupersample=1,wmultisample=1,showparticle=1;
-int horizontal=1;
+int horizontal=1,flat=0;
int fov=60,vsync=1,tfps=60;
DWORD chkrtint=0xFF999999;
DWORD iccolors[]={0XFFFF0000,0XFFFF8000,0XFFFFBF00,0XFFFFFF00,