From ab33532da11672ee435e2b566cdba81b2e79e874 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 10 Aug 2017 00:14:44 +0800 Subject: 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. --- qmidiplayer-desktop/qmpchannelswindow.cpp | 2 +- qmidiplayer-desktop/qmpchannelswindow.hpp | 6 +++--- qmidiplayer-desktop/qmpchannelswindow.ui | 2 +- qmidiplayer-desktop/qmpefxwindow.cpp | 3 +-- qmidiplayer-desktop/qmpefxwindow.hpp | 4 ++-- qmidiplayer-desktop/qmpefxwindow.ui | 2 +- qmidiplayer-desktop/qmpinfowindow.cpp | 6 ++++++ qmidiplayer-desktop/qmpinfowindow.hpp | 2 ++ qmidiplayer-desktop/qmpplistwindow.cpp | 2 +- qmidiplayer-desktop/qmpplistwindow.hpp | 4 ++-- qmidiplayer-desktop/qmpplistwindow.ui | 2 +- qmidiplayer-desktop/qmpplugin.cpp | 21 ++++++++++++++------- qmidiplayer-desktop/qmpsettingswindow.cpp | 6 ++++++ qmidiplayer-desktop/qmpsettingswindow.hpp | 2 ++ 14 files changed, 43 insertions(+), 21 deletions(-) (limited to 'qmidiplayer-desktop') 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 #include -#include +#include #include #include #include @@ -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 @@ qmpChannelsWindow - + 0 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 +#include #include #include #include @@ -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 @@ qmpEfxWindow - + 0 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 #include #include +#include #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 +#include #include #include #include @@ -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 @@ qmpPlistWindow - + 0 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 +#include +std::string wstr2str(std::wstring s) +{ + std::wstring_convert,wchat_t> wsc; + return wsc.to_bytes(s); +} void qmpPluginManager::scanPlugins() { QDirIterator *dir; - std::vector cpluginpaths; + std::vector 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;ipluginGetName()),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 #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3