From 1ec23952dd7c022e11afbb93d93be1bac5c94081 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 20 May 2016 23:51:15 +0800 Subject: Scale GUI correctly on a high DPI device. Fix building for Windows. RC-bugs still exist. --- qmidiplayer-desktop/qmpchanneleditor.cpp | 2 + qmidiplayer-desktop/qmpchannelswindow.cpp | 2 + qmidiplayer-desktop/qmpefxwindow.cpp | 2 + qmidiplayer-desktop/qmphelpwindow.cpp | 2 + qmidiplayer-desktop/qmpinfowindow.cpp | 2 + qmidiplayer-desktop/qmpmainwindow.cpp | 4 +- qmidiplayer-desktop/qmpmainwindow.ui | 1035 +++++++++++++++-------------- qmidiplayer-desktop/qmpplistwindow.cpp | 2 + qmidiplayer-desktop/qmpplugin.cpp | 17 +- qmidiplayer-desktop/qmpplugin.hpp | 4 +- qmidiplayer-desktop/qmpsettingswindow.cpp | 2 + 11 files changed, 547 insertions(+), 527 deletions(-) (limited to 'qmidiplayer-desktop') diff --git a/qmidiplayer-desktop/qmpchanneleditor.cpp b/qmidiplayer-desktop/qmpchanneleditor.cpp index 206a2fa..2c58793 100644 --- a/qmidiplayer-desktop/qmpchanneleditor.cpp +++ b/qmidiplayer-desktop/qmpchanneleditor.cpp @@ -8,6 +8,8 @@ qmpChannelEditor::qmpChannelEditor(QWidget *parent) : ui(new Ui::qmpChannelEditor) { ui->setupUi(this);ch=0; + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); styl=new QDialSkulptureStyle(); QList dials=findChildren(); for(int i=0;isetupUi(this); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); pselectw=new qmpPresetSelector(this); ceditw=new qmpChannelEditor(this); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp index 7d9c08e..25e9bf4 100644 --- a/qmidiplayer-desktop/qmpefxwindow.cpp +++ b/qmidiplayer-desktop/qmpefxwindow.cpp @@ -12,6 +12,8 @@ qmpEfxWindow::qmpEfxWindow(QWidget *parent) : QList dials=findChildren(); for(int i=0;isetStyle(styl); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); //stub. read these from settings after the setting module is implemented QSettings *settings=qmpSettingsWindow::getSettingsIntf(); diff --git a/qmidiplayer-desktop/qmphelpwindow.cpp b/qmidiplayer-desktop/qmphelpwindow.cpp index 69e29d0..e3d2897 100644 --- a/qmidiplayer-desktop/qmphelpwindow.cpp +++ b/qmidiplayer-desktop/qmphelpwindow.cpp @@ -7,6 +7,8 @@ qmpHelpWindow::qmpHelpWindow(QWidget *parent) : ui(new Ui::qmpHelpWindow) { ui->setupUi(this); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); ui->textBrowser->setSearchPaths(QStringList(QString(":/doc"))+QStringList(QString(":/img"))); ui->textBrowser->setSource(QUrl("qrc:///doc/index_internal.html")); } diff --git a/qmidiplayer-desktop/qmpinfowindow.cpp b/qmidiplayer-desktop/qmpinfowindow.cpp index 95ad223..a4afd50 100644 --- a/qmidiplayer-desktop/qmpinfowindow.cpp +++ b/qmidiplayer-desktop/qmpinfowindow.cpp @@ -13,6 +13,8 @@ qmpInfoWindow::qmpInfoWindow(QWidget *parent) : ui(new Ui::qmpInfoWindow) { ui->setupUi(this); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); } qmpInfoWindow::~qmpInfoWindow() diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index f634375..c81816c 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -52,7 +52,9 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : { ui->setupUi(this); ui->lnPolyphone->display("00000-00000"); - ui->lbFileName->setText("");ref=this; + ui->lbFileName->setText("");ref=this;ui->verticalLayout->setAlignment(ui->pushButton,Qt::AlignRight); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); playing=false;stopped=true;dragging=false;memset(VIs,0,sizeof(VIs)); settingsw=new qmpSettingsWindow(this);pmgr=new qmpPluginManager(); plistw=new qmpPlistWindow(this);player=NULL;timer=NULL; diff --git a/qmidiplayer-desktop/qmpmainwindow.ui b/qmidiplayer-desktop/qmpmainwindow.ui index 69a3496..9b4f3c3 100644 --- a/qmidiplayer-desktop/qmpmainwindow.ui +++ b/qmidiplayer-desktop/qmpmainwindow.ui @@ -33,525 +33,528 @@ :/img/qmidiplyr.png:/img/qmidiplyr.png - - - - 0 - 0 - 21 - 21 - + + + 2 - - ? + + 2 - - - - - 0 - 0 - 441 - 241 - + + 2 - - - 4 - - - - - 0 - - - - - - 0 - 0 - - - - - 18 - - - - Qt::CustomContextMenu - - - somefile.mid - - - Qt::AlignCenter - - - - - - - 0 - - - - - - 0 - 0 - - - - 00:00 - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - - - - 0 - 0 - - - - <html><head/><body><p>Poly</p></body></html> - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - - 84 - 16777215 - - - - QFrame::NoFrame - - - 11 - - - QLCDNumber::Flat - - - - - - - - - - 0 - 0 - - - - 00:00 - - - Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing - - - - - - - - - - 0 - 0 - - - - 100 - - - 0 - - - Qt::Horizontal - - - - - - - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 34 - - - - - - - - :/img/play.png:/img/play.png - - - - 32 - 32 - - - - - - - - - 0 - 34 - - - - - 16777215 - 34 - - - - - - - - :/img/stop.png:/img/stop.png - - - - 32 - 32 - - - - - - - - - 0 - 34 - - - - - 16777215 - 34 - - - - - - - - :/img/prev.png:/img/prev.png - - - - 32 - 32 - - - - - - - - - 0 - 34 - - - - - 16777215 - 34 - - - - - - - - :/img/next.png:/img/next.png - - - - 32 - 32 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 32 - 32 - - - - - - - - - 0 - 0 - - - - - 0 - 34 - - - - - 16777215 - 34 - - - - - - - - :/img/settings.png:/img/settings.png - - - - 32 - 32 - - - - true - - - - - - - - - - - - 16777215 - 36 - - - - text-align:left - - - Channels - - - - :/img/channel.png:/img/channel.png - - - - 32 - 32 - - - - true - - - - - - - - 16777215 - 36 - - - - text-align:left - - - Playlist - - - - :/img/list.png:/img/list.png - - - - 32 - 32 - - - - true - - - false - - - false - - - - - - - - 16777215 - 36 - - - - text-align:left - - - Effects - - - - :/img/effects.png:/img/effects.png - - - - 32 - 32 - - - - true - - - - - - - - 16777215 - 36 - - - - text-align:left - - - Visualization - - - - :/img/visualization.png:/img/visualization.png - - - - 32 - 32 - - - - true - - - - - - - - - - - - - 0 - - - 4 - - - - - - 0 - 0 - - - - 100 - - - 50 - - - Qt::Vertical - - - - - - - - 0 - 0 - - - - Master - - - Qt::AlignCenter - - - - - - - - horizontalLayoutWidget - pushButton + + 2 + + + + + 0 + + + + + + 0 + 0 + + + + + 18 + + + + Qt::CustomContextMenu + + + somefile.mid + + + Qt::AlignCenter + + + + + + + 0 + + + + + + 0 + 0 + + + + 00:00 + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + 0 + + + + + + 0 + 0 + + + + <html><head/><body><p>Poly</p></body></html> + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + + 84 + 16777215 + + + + QFrame::NoFrame + + + 11 + + + QLCDNumber::Flat + + + + + + + + + + 0 + 0 + + + + 00:00 + + + Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing + + + + + + + + + + 0 + 0 + + + + 100 + + + 0 + + + Qt::Horizontal + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 34 + + + + + + + + :/img/play.png:/img/play.png + + + + 32 + 32 + + + + + + + + + 0 + 34 + + + + + 16777215 + 34 + + + + + + + + :/img/stop.png:/img/stop.png + + + + 32 + 32 + + + + + + + + + 0 + 34 + + + + + 16777215 + 34 + + + + + + + + :/img/prev.png:/img/prev.png + + + + 32 + 32 + + + + + + + + + 0 + 34 + + + + + 16777215 + 34 + + + + + + + + :/img/next.png:/img/next.png + + + + 32 + 32 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + + 0 + 34 + + + + + 16777215 + 34 + + + + + + + + :/img/settings.png:/img/settings.png + + + + 32 + 32 + + + + true + + + + + + + + + + + + 16777215 + 36 + + + + text-align:left + + + Channels + + + + :/img/channel.png:/img/channel.png + + + + 32 + 32 + + + + true + + + + + + + + 16777215 + 36 + + + + text-align:left + + + Playlist + + + + :/img/list.png:/img/list.png + + + + 32 + 32 + + + + true + + + false + + + false + + + + + + + + 16777215 + 36 + + + + text-align:left + + + Effects + + + + :/img/effects.png:/img/effects.png + + + + 32 + 32 + + + + true + + + + + + + + 16777215 + 36 + + + + text-align:left + + + Visualization + + + + :/img/visualization.png:/img/visualization.png + + + + 32 + 32 + + + + true + + + + + + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 21 + 21 + + + + ? + + + + + + + + 0 + 0 + + + + 100 + + + 50 + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + Master + + + Qt::AlignCenter + + + + + + diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp index 103027c..d315d80 100644 --- a/qmidiplayer-desktop/qmpplistwindow.cpp +++ b/qmidiplayer-desktop/qmpplistwindow.cpp @@ -15,6 +15,8 @@ qmpPlistWindow::qmpPlistWindow(QWidget *parent) : ui(new Ui::qmpPlistWindow) { ui->setupUi(this); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); connect(this,SIGNAL(selectionChanging()),parent,SLOT(selectionChanged())); repeat=0;shuffle=0; diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 2117bcf..7dfb01f 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -18,23 +18,24 @@ void qmpPluginManager::scanPlugins() HANDLE dir; std::vector cpluginpaths; //FindFirstFile, FindNextFile, FindClose - LPWIN32_FIND_DATA file; - dir=FindFirstFileA(L".\\plugins\\*.dll",file); + LPWIN32_FIND_DATAA file; + dir=FindFirstFileA(".\\plugins\\*.dll",file); if(dir!=INVALID_HANDLE_VALUE) { cpluginpaths.push_back(std::string(file->cFileName)); - while(FindNextFile(dir,file)) + while(FindNextFileA(dir,file)) cpluginpaths.push_back(std::string(file->cFileName)); } FindClose(dir); for(unsigned i=0;ipluginGetVersion is called. Reason is still unknown. plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); } } @@ -82,8 +83,8 @@ qmpPluginManager::~qmpPluginManager() { for(unsigned i=0;ideinit(); - delete plugins[i].interface; + if(plugins[i].initialized)plugins[i].pinterface->deinit(); + delete plugins[i].pinterface; } qmw=NULL;qsw=NULL;delete pluginAPI; } @@ -97,14 +98,14 @@ void qmpPluginManager::initPlugins() { if(!plugins[i].enabled)continue; printf("Loaded plugin: %s\n",plugins[i].path.c_str()); - plugins[i].interface->init();plugins[i].initialized=true; + plugins[i].pinterface->init();plugins[i].initialized=true; } } void qmpPluginManager::deinitPlugins() { for(unsigned i=0;ideinit(); + if(plugins[i].initialized)plugins[i].pinterface->deinit(); plugins[i].enabled=plugins[i].initialized=false; } } diff --git a/qmidiplayer-desktop/qmpplugin.hpp b/qmidiplayer-desktop/qmpplugin.hpp index f689f71..d69adeb 100644 --- a/qmidiplayer-desktop/qmpplugin.hpp +++ b/qmidiplayer-desktop/qmpplugin.hpp @@ -7,10 +7,10 @@ struct qmpPlugin { std::string name,version,path; - qmpPluginIntf* interface; + qmpPluginIntf* pinterface; bool enabled,initialized; qmpPlugin(std::string _n,std::string _v,std::string _p,qmpPluginIntf* _i) - {name=_n;version=_v;path=_p;interface=_i;enabled=initialized=false;} + {name=_n;version=_v;path=_p;pinterface=_i;enabled=initialized=false;} }; class qmpPluginManager { diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index b47c2ba..7e441e8 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -19,6 +19,8 @@ qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) : ui(new Ui::qmpSettingsWindow) { ui->setupUi(this);customOptions.clear();customOptPages.clear(); + int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); + setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); settings=new QSettings(QDir::homePath()+QString("/.config/qmprc"),QSettings::IniFormat); settingsInit();outwidget=ui->cbOutputDevice; -- cgit v1.2.3