diff options
author | Chris Xiong <chirs241097@gmail.com> | 2017-08-10 00:14:44 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2017-08-10 00:14:44 +0800 |
commit | ab33532da11672ee435e2b566cdba81b2e79e874 (patch) | |
tree | b4c9aa59459f5586831384835ced28951e874967 | |
parent | b03133b80b268c74d1dd5c92e2af6907b51c91b2 (diff) | |
download | QMidiPlayer-ab33532da11672ee435e2b566cdba81b2e79e874.tar.xz |
Windows of several main functionalities are no longer
QDialogs. Fixed unexpected behavior.
Now visualization window can be closed by sending it
a close signal.
Trying a solution to address the problem that prevents
plugins from being loaded correctly in Windows if the
path contains Chinese characters. Not even tried to
build in Windows though.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.cpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.hpp | 6 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.ui | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpefxwindow.cpp | 3 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpefxwindow.hpp | 4 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpefxwindow.ui | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpinfowindow.cpp | 6 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpinfowindow.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplistwindow.cpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplistwindow.hpp | 4 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplistwindow.ui | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 21 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 6 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-lite/main.qml | 7 | ||||
-rw-r--r-- | visualization/qmpvisualization.hpp | 8 |
17 files changed, 67 insertions, 22 deletions
@@ -1,3 +1,13 @@ +2017-08-10 0.8.6 indev +Windows of several main functionalities are no longer +QDialogs. Fixed unexpected behavior. +Now visualization window can be closed by sending it +a close signal. +Trying a solution to address the problem that prevents +plugins from being loaded correctly in Windows if the +path contains Chinese characters. Not even tried to +build in Windows though. + 2017-06-22 0.8.6 indev Minor bug fixes. SMF reader finally takes chunk length into account. diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index cdbb607..925d632 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -7,7 +7,7 @@ #include "qmpmainwindow.hpp" qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : - QDialog(parent), + QWidget(parent,Qt::Window), ui(new Ui::qmpChannelsWindow) { ui->setupUi(this); diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp index 3d0444b..c7630fe 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.hpp +++ b/qmidiplayer-desktop/qmpchannelswindow.hpp @@ -3,7 +3,7 @@ #include <QLabel> #include <QPushButton> -#include <QDialog> +#include <QWidget> #include <QComboBox> #include <QShowEvent> #include <QCloseEvent> @@ -81,12 +81,12 @@ class qmpChannelFunc:public qmpFuncBaseIntf void close(); }; -class qmpChannelsWindow:public QDialog +class qmpChannelsWindow:public QWidget { Q_OBJECT public: - explicit qmpChannelsWindow(QWidget *parent = 0); + explicit qmpChannelsWindow(QWidget *parent=0); ~qmpChannelsWindow(); void showEvent(QShowEvent *event); void closeEvent(QCloseEvent *event); diff --git a/qmidiplayer-desktop/qmpchannelswindow.ui b/qmidiplayer-desktop/qmpchannelswindow.ui index 2d85ab0..2a63d21 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.ui +++ b/qmidiplayer-desktop/qmpchannelswindow.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>qmpChannelsWindow</class> - <widget class="QDialog" name="qmpChannelsWindow"> + <widget class="QWidget" name="qmpChannelsWindow"> <property name="geometry"> <rect> <x>0</x> diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp index e9f19bd..5bbf0e4 100644 --- a/qmidiplayer-desktop/qmpefxwindow.cpp +++ b/qmidiplayer-desktop/qmpefxwindow.cpp @@ -4,7 +4,7 @@ #include "qmpmainwindow.hpp" qmpEfxWindow::qmpEfxWindow(QWidget *parent) : - QDialog(parent), + QWidget(parent,Qt::Window), ui(new Ui::qmpEfxWindow) { ui->setupUi(this);initialized=false; @@ -14,7 +14,6 @@ qmpEfxWindow::qmpEfxWindow(QWidget *parent) : dials.at(i)->setStyle(styl); int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); - //stub. read these from settings after the setting module is implemented QSettings *settings=qmpSettingsWindow::getSettingsIntf(); ui->cbEnabledC->setChecked(settings->value("Effects/ChorusEnabled",1).toInt()); ui->cbEnabledR->setChecked(settings->value("Effects/ReverbEnabled",1).toInt()); diff --git a/qmidiplayer-desktop/qmpefxwindow.hpp b/qmidiplayer-desktop/qmpefxwindow.hpp index 3bc8e40..8b5319d 100644 --- a/qmidiplayer-desktop/qmpefxwindow.hpp +++ b/qmidiplayer-desktop/qmpefxwindow.hpp @@ -1,7 +1,7 @@ #ifndef QMPEFXWINDOW_HPP #define QMPEFXWINDOW_HPP -#include <QDialog> +#include <QWidget> #include <QCloseEvent> #include <QShowEvent> #include <QMoveEvent> @@ -25,7 +25,7 @@ class qmpEfxFunc:public qmpFuncBaseIntf void close(); }; -class qmpEfxWindow : public QDialog +class qmpEfxWindow:public QWidget { Q_OBJECT diff --git a/qmidiplayer-desktop/qmpefxwindow.ui b/qmidiplayer-desktop/qmpefxwindow.ui index 97a0d58..35795e3 100644 --- a/qmidiplayer-desktop/qmpefxwindow.ui +++ b/qmidiplayer-desktop/qmpefxwindow.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>qmpEfxWindow</class> - <widget class="QDialog" name="qmpEfxWindow"> + <widget class="QWidget" name="qmpEfxWindow"> <property name="geometry"> <rect> <x>0</x> diff --git a/qmidiplayer-desktop/qmpinfowindow.cpp b/qmidiplayer-desktop/qmpinfowindow.cpp index de853aa..d0f386c 100644 --- a/qmidiplayer-desktop/qmpinfowindow.cpp +++ b/qmidiplayer-desktop/qmpinfowindow.cpp @@ -38,6 +38,12 @@ void qmpInfoWindow::closeEvent(QCloseEvent *e) qmpMainWindow::getInstance()->setFuncState("FileInfo",false); e->accept(); } +void qmpInfoWindow::hideEvent(QHideEvent *e) +{ + qmpMainWindow::getInstance()->setFuncState("FileInfo",false); + e->accept(); +} + void qmpInfoWindow::updateInfo() { diff --git a/qmidiplayer-desktop/qmpinfowindow.hpp b/qmidiplayer-desktop/qmpinfowindow.hpp index 87ac2c0..6a179af 100644 --- a/qmidiplayer-desktop/qmpinfowindow.hpp +++ b/qmidiplayer-desktop/qmpinfowindow.hpp @@ -7,6 +7,7 @@ #include <QApplication> #include <QClipboard> #include <QCloseEvent> +#include <QHideEvent> #include "../include/qmpcorepublic.hpp" namespace Ui { @@ -46,6 +47,7 @@ class qmpInfoWindow : public QDialog explicit qmpInfoWindow(QWidget *parent = 0); ~qmpInfoWindow(); void closeEvent(QCloseEvent *e); + void hideEvent(QHideEvent *e); public slots: void updateInfo(); diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp index 4fa9f50..70b2e75 100644 --- a/qmidiplayer-desktop/qmpplistwindow.cpp +++ b/qmidiplayer-desktop/qmpplistwindow.cpp @@ -12,7 +12,7 @@ #define setButtonHeight(x,h) {x->setMaximumHeight(h*(logicalDpiY()/96.));x->setMinimumHeight(h*(logicalDpiY()/96.));} qmpPlistWindow::qmpPlistWindow(QWidget *parent) : - QDialog(parent), + QWidget(parent,Qt::Window), ui(new Ui::qmpPlistWindow) { ui->setupUi(this); diff --git a/qmidiplayer-desktop/qmpplistwindow.hpp b/qmidiplayer-desktop/qmpplistwindow.hpp index 05dcee9..4fe0b50 100644 --- a/qmidiplayer-desktop/qmpplistwindow.hpp +++ b/qmidiplayer-desktop/qmpplistwindow.hpp @@ -1,7 +1,7 @@ #ifndef QMPPLISTWINDOW_H #define QMPPLISTWINDOW_H -#include <QDialog> +#include <QWidget> #include <QShowEvent> #include <QCloseEvent> #include <QMoveEvent> @@ -26,7 +26,7 @@ class qmpPlistFunc:public qmpFuncBaseIntf void close(); }; -class qmpPlistWindow : public QDialog +class qmpPlistWindow:public QWidget { Q_OBJECT diff --git a/qmidiplayer-desktop/qmpplistwindow.ui b/qmidiplayer-desktop/qmpplistwindow.ui index 4c4c786..0152f82 100644 --- a/qmidiplayer-desktop/qmpplistwindow.ui +++ b/qmidiplayer-desktop/qmpplistwindow.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>qmpPlistWindow</class> - <widget class="QDialog" name="qmpPlistWindow"> + <widget class="QWidget" name="qmpPlistWindow"> <property name="geometry"> <rect> <x>0</x> diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 2cafa7f..6eca257 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -13,32 +13,39 @@ qmpPluginAPI* pluginAPI; qmpMainWindow* qmw; qmpSettingsWindow* qsw; #ifdef _WIN32 +#include <codecvt> +#include <locale> +std::string wstr2str(std::wstring s) +{ + std::wstring_convert<std::codecvt_utf8<wchar_t>,wchat_t> wsc; + return wsc.to_bytes(s); +} void qmpPluginManager::scanPlugins() { QDirIterator *dir; - std::vector<std::string> cpluginpaths; + std::vector<std::wstring> cpluginpaths; dir=new QDirIterator(QCoreApplication::applicationDirPath()+"/plugins/"); while(dir->hasNext()) { dir->next(); if(dir->fileInfo().suffix()=="dll") - cpluginpaths.push_back(QCoreApplication::applicationDirPath().toStdString()+std::string("/plugins/")+dir->fileName().toStdString()); + cpluginpaths.push_back(QCoreApplication::applicationDirPath().toStdWString()+std::wstring(L"/plugins/")+dir->fileName().toStdWString()); } delete dir; for(unsigned i=0;i<cpluginpaths.size();++i) { - HMODULE hso=LoadLibraryA(cpluginpaths[i].c_str()); + HMODULE hso=LoadLibraryW(cpluginpaths[i].c_str()); if(!hso){fprintf(stderr,"Error while loading library: %d\n",GetLastError());continue;} FARPROC hndi=GetProcAddress(hso,"qmpPluginGetInterface"); - if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;} + if(!hndi){fprintf(stderr,"plugin %s doesn't seem to be a qmidiplayer plugin.\n",wstr2str(cpluginpaths[i]).c_str());continue;} FARPROC hndiv=GetProcAddress(hso,"qmpPluginGetAPIRev"); - if(!hndiv){fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;} + if(!hndiv){fprintf(stderr,"plugin %s is incompatible with this version of qmidiplayer.\n",wstr2str(cpluginpaths[i]).c_str());continue;} qmpPluginAPIRevEntry getv=(qmpPluginAPIRevEntry)hndiv; if(strcmp(getv(),QMP_PLUGIN_API_REV)) - {fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;} + {fprintf(stderr,"plugin %s is incompatible with this version of qmidiplayer.\n",wstr2str(cpluginpaths[i]).c_str());continue;} qmpPluginEntry e=(qmpPluginEntry)hndi; qmpPluginIntf* intf=e(pluginAPI); - plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); + plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),wstr2str(cpluginpaths[i]),intf)); } } #else diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index 4249161..d40b789 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -47,6 +47,12 @@ void qmpSettingsWindow::closeEvent(QCloseEvent *event) emit dialogClosing(); event->accept(); } +void qmpSettingsWindow::hideEvent(QHideEvent *event) +{ + emit dialogClosing(); + event->accept(); +} + QTableWidget* qmpSettingsWindow::getSFWidget(){return ui->twSoundfont;} QComboBox* qmpSettingsWindow::getDefaultOutWidget(){return outwidget;} diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp index a7d5cbb..5636f54 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.hpp +++ b/qmidiplayer-desktop/qmpsettingswindow.hpp @@ -6,6 +6,7 @@ #include <vector> #include <QDialog> #include <QCloseEvent> +#include <QHideEvent> #include <QSettings> #include <QTableWidget> #include <QComboBox> @@ -85,6 +86,7 @@ class qmpSettingsWindow:public QDialog explicit qmpSettingsWindow(QWidget *parent=0); ~qmpSettingsWindow(); void closeEvent(QCloseEvent *event); + void hideEvent(QHideEvent *event); void settingsInit(); QTableWidget *getSFWidget(); void updatePluginList(qmpPluginManager *pmgr); diff --git a/qmidiplayer-lite/main.qml b/qmidiplayer-lite/main.qml index ace1427..2fcd1ea 100644 --- a/qmidiplayer-lite/main.qml +++ b/qmidiplayer-lite/main.qml @@ -14,6 +14,12 @@ Window { playing: false property string soundfont soundfont: "" + SystemPalette + { + id: palette + colorGroup: SystemPalette.Active + } + color: palette.window MouseArea { id: mouseArea1 @@ -126,6 +132,7 @@ Window { Text { id: fileName text: qsTr("...") + color: palette.text anchors.top: parent.top anchors.topMargin: 100 anchors.horizontalCenter: parent.horizontalCenter diff --git a/visualization/qmpvisualization.hpp b/visualization/qmpvisualization.hpp index b52fa3d..f9e6062 100644 --- a/visualization/qmpvisualization.hpp +++ b/visualization/qmpvisualization.hpp @@ -113,7 +113,13 @@ class CloseHandler:public smHandler public: CloseHandler(qmpVisualization* par){p=par;} public: - bool handlerFunc(){return true;} + bool handlerFunc() + { + std::thread ([this]{ + p->api->setFuncState("Visualization",false); + p->close();}).detach(); + return false; + } }; class CDemoVisualization:public qmpVisualizationIntf |