aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp12
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp5
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.ui46
-rw-r--r--qmidiplayer-desktop/qmpplistwindow.cpp5
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp46
5 files changed, 82 insertions, 32 deletions
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index a692852..ed522a0 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -67,12 +67,12 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
((QDCLabel*)ui->twChannels->cellWidget(i,5))->setID(i);
connect(ui->twChannels->cellWidget(i,5),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
}
- ui->twChannels->setColumnWidth(0,24);
- ui->twChannels->setColumnWidth(1,24);
- ui->twChannels->setColumnWidth(2,24);
- ui->twChannels->setColumnWidth(3,192);
- ui->twChannels->setColumnWidth(4,208);
- ui->twChannels->setColumnWidth(5,32);
+ ui->twChannels->setColumnWidth(0,24*(logicalDpiX()/96.));
+ ui->twChannels->setColumnWidth(1,24*(logicalDpiX()/96.));
+ ui->twChannels->setColumnWidth(2,24*(logicalDpiX()/96.));
+ ui->twChannels->setColumnWidth(3,192*(logicalDpiX()/96.));
+ ui->twChannels->setColumnWidth(4,208*(logicalDpiX()/96.));
+ ui->twChannels->setColumnWidth(5,32*(logicalDpiX()/96.));
}
void qmpChannelsWindow::showEvent(QShowEvent *event)
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index c81816c..de15412 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -11,6 +11,7 @@
#include "qmpmainwindow.hpp"
#include "ui_qmpmainwindow.h"
#include "../core/qmpmidiplay.hpp"
+#define setButtonHeight(x,h) {x->setMaximumHeight(h*(logicalDpiY()/96.));x->setMinimumHeight(h*(logicalDpiY()/96.));}
#ifdef _WIN32
#include <Windows.h>
char* wcsto8bit(const wchar_t* s)
@@ -55,6 +56,10 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
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);
+ setButtonHeight(ui->pbNext,34);setButtonHeight(ui->pbPlayPause,34);
+ setButtonHeight(ui->pbPrev,34);setButtonHeight(ui->pbSettings,34);setButtonHeight(ui->pbStop,34);
+ setButtonHeight(ui->pbChannels,36);setButtonHeight(ui->pbPList,36);
+ setButtonHeight(ui->pbEfx,36);setButtonHeight(ui->pbVisualization,36);
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 9b4f3c3..10ead67 100644
--- a/qmidiplayer-desktop/qmpmainwindow.ui
+++ b/qmidiplayer-desktop/qmpmainwindow.ui
@@ -185,7 +185,7 @@
<item>
<widget class="QPushButton" name="pbPlayPause">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -219,6 +219,12 @@
</item>
<item>
<widget class="QPushButton" name="pbStop">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -248,6 +254,12 @@
</item>
<item>
<widget class="QPushButton" name="pbPrev">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -277,6 +289,12 @@
</item>
<item>
<widget class="QPushButton" name="pbNext">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -323,7 +341,7 @@
<item>
<widget class="QPushButton" name="pbSettings">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -364,6 +382,12 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pbChannels">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
<width>16777215</width>
@@ -393,6 +417,12 @@
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbPList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
<width>16777215</width>
@@ -428,6 +458,12 @@
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pbEfx">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
<width>16777215</width>
@@ -457,6 +493,12 @@
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pbVisualization">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
<width>16777215</width>
diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp
index d315d80..e8fc9d8 100644
--- a/qmidiplayer-desktop/qmpplistwindow.cpp
+++ b/qmidiplayer-desktop/qmpplistwindow.cpp
@@ -9,6 +9,7 @@
#include "qmpplistwindow.hpp"
#include "ui_qmpplistwindow.h"
#include "qmpmainwindow.hpp"
+#define setButtonHeight(x,h) {x->setMaximumHeight(h*(logicalDpiY()/96.));x->setMinimumHeight(h*(logicalDpiY()/96.));}
qmpPlistWindow::qmpPlistWindow(QWidget *parent) :
QDialog(parent),
@@ -17,6 +18,10 @@ qmpPlistWindow::qmpPlistWindow(QWidget *parent) :
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);
+ setButtonHeight(ui->pbAdd,36);setButtonHeight(ui->pbAddFolder,36);
+ setButtonHeight(ui->pbClear,36);setButtonHeight(ui->pbLoad,36);
+ setButtonHeight(ui->pbRemove,36);setButtonHeight(ui->pbRepeat,36);
+ setButtonHeight(ui->pbSave,36);setButtonHeight(ui->pbShuffle,36);
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 7dfb01f..565bdf1 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -2,10 +2,10 @@
#include <windows.h>
#else
#include <dlfcn.h>
-#include <dirent.h>
#endif
#include <cstdio>
#include <cstring>
+#include <QDirIterator>
#include "qmpplugin.hpp"
#include "qmpmainwindow.hpp"
#include "qmpsettingswindow.hpp"
@@ -15,52 +15,50 @@ qmpSettingsWindow* qsw;
#ifdef _WIN32
void qmpPluginManager::scanPlugins()
{
- HANDLE dir;
+ QDirIterator *dir;
std::vector<std::string> cpluginpaths;
- //FindFirstFile, FindNextFile, FindClose
- LPWIN32_FIND_DATAA file;
- dir=FindFirstFileA(".\\plugins\\*.dll",file);
- if(dir!=INVALID_HANDLE_VALUE)
+ dir=new QDirIterator(".\\plugins\\");
+ while(dir->hasNext())
{
- cpluginpaths.push_back(std::string(file->cFileName));
- while(FindNextFileA(dir,file))
- cpluginpaths.push_back(std::string(file->cFileName));
+ dir->next();
+ if(dir->fileInfo().suffix()=="dll")
+ cpluginpaths.push_back(std::string(".\\plugins\\")+dir->fileName().toStdString());
}
- FindClose(dir);
+ delete dir;
for(unsigned i=0;i<cpluginpaths.size();++i)
{
- HMODULE hso=LoadLibraryA((std::string(".\\plugins\\")+cpluginpaths[i]).c_str());
+ HMODULE hso=LoadLibraryA(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;}
qmpPluginEntry e=(qmpPluginEntry)hndi;
qmpPluginIntf* intf=e(pluginAPI);
- //!!FIXME: Windows version crashes if intf->pluginGetVersion is called. Reason is still unknown.
plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf));
}
}
#else
void qmpPluginManager::scanPlugins()
{
- DIR *dir;
- struct dirent *file;
+ QDirIterator *dir;
std::vector<std::string> cpluginpaths;
#ifdef QMP_BUILD_UNIX_PACKAGE
- if((dir=opendir("/usr/lib/qmidiplayer/")))
+ dir=new QDirIterator("/usr/lib/qmidiplayer/");
+ while(dir->hasNext())
{
- while((file=readdir(dir)))
- if(strcmp(file->d_name+strlen(file->d_name)-3,".so")==0)
- cpluginpaths.push_back(std::string("/usr/lib/qmidiplayer/")+std::string(file->d_name));
- closedir(dir);
+ dir->next();
+ if(dir->fileInfo().suffix()=="so")
+ cpluginpaths.push_back(std::string("/usr/lib/qmidiplayer/")+dir->fileName().toStdString());
}
+ delete dir;
#endif
- if((dir=opendir("./")))
+ dir=new QDirIterator("./");
+ while(dir->hasNext())
{
- while((file=readdir(dir)))
- if(strcmp(file->d_name+strlen(file->d_name)-3,".so")==0)
- cpluginpaths.push_back(std::string("./")+std::string(file->d_name));
- closedir(dir);
+ dir->next();
+ if(dir->fileInfo().suffix()=="so")
+ cpluginpaths.push_back(std::string("./")+dir->fileName().toStdString());
}
+ delete dir;
for(unsigned i=0;i<cpluginpaths.size();++i)
{
void* hso=dlopen(cpluginpaths[i].c_str(),RTLD_LAZY);