aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/main.cpp1
-rw-r--r--qmidiplayer-desktop/qdialskulpturestyle.cpp80
-rw-r--r--qmidiplayer-desktop/qmpchanneleditor.cpp2
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp14
-rw-r--r--qmidiplayer-desktop/qmpcustomizewindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpefxwindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmphelpwindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpinfowindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpplistwindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmppresetselect.cpp14
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp16
12 files changed, 68 insertions, 71 deletions
diff --git a/qmidiplayer-desktop/main.cpp b/qmidiplayer-desktop/main.cpp
index 740d7a5..a2375ca 100644
--- a/qmidiplayer-desktop/main.cpp
+++ b/qmidiplayer-desktop/main.cpp
@@ -23,7 +23,6 @@
int main(int argc,char **argv)
{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication a(argc,argv);
QTranslator qtTranslator;
diff --git a/qmidiplayer-desktop/qdialskulpturestyle.cpp b/qmidiplayer-desktop/qdialskulpturestyle.cpp
index 7c181a0..ba9e03f 100644
--- a/qmidiplayer-desktop/qdialskulpturestyle.cpp
+++ b/qmidiplayer-desktop/qdialskulpturestyle.cpp
@@ -20,9 +20,12 @@
*****************************************************************************/
#include <cmath>
+#include <functional>
#include <QStyleOptionSlider>
#include <QPixmapCache>
#include <QPainter>
+#include <QPointF>
+#include <QRectF>
#include "qdialskulpturestyle.hpp"
@@ -33,41 +36,41 @@
static const bool UsePixmapCache = true;
static void
-paintIndicatorCached(QPainter *painter, const QStyleOption *option, void (*paintIndicator)(QPainter *painter, const QStyleOption *option), bool useCache, const QString &pixmapName)
+paintIndicatorCached(QPainter *painter, const QStyleOption *option, std::function<void(QPainter*,const QStyleOption*)> paintFunc, bool useCache, const QString &pixmapName)
{
- QPixmap pixmap;
-
- if (!useCache || !QPixmapCache::find(pixmapName, pixmap)) {
- pixmap = QPixmap(option->rect.size());
-#if 1
- pixmap.fill(Qt::transparent);
- // pixmap.fill(Qt::red);
-#else
- pixmap.fill(option->palette.color(QPalette::Window));
-#endif
- QPainter p(&pixmap);
- QStyleOption opt = *option;
- opt.rect = QRect(QPoint(0, 0), option->rect.size());
- // p.setCompositionMode(QPainter::CompositionMode_Clear);
- // p.setCompositionMode(QPainter::CompositionMode_Source);
- // p.fillRect(opt.rect, Qt::transparent);
- // p.setCompositionMode(QPainter::CompositionMode_SourceOver);
- p.setFont(painter->font());
- p.setRenderHint(QPainter::Antialiasing, true);
- paintIndicator(&p, &opt);
- p.end();
- if (useCache) {
- QPixmapCache::insert(pixmapName, pixmap);
- // qDebug() << "inserted into cache:" << pixmapName;
+ QRect rect = option->rect;
+ QPixmap internalPixmapCache;
+ QImage imageCache;
+ QPainter *p = painter;
+ int txType = painter->deviceTransform().type() | painter->worldTransform().type();
+ bool doPixmapCache = useCache && (!option->rect.isEmpty())
+ && ((txType <= QTransform::TxTranslate) || (painter->deviceTransform().type() == QTransform::TxScale));
+ if (doPixmapCache && QPixmapCache::find(pixmapName, &internalPixmapCache)) {
+ painter->drawPixmap(option->rect.topLeft(), internalPixmapCache);
+ } else {
+ if (doPixmapCache) {
+ rect.setRect(0, 0, option->rect.width(), option->rect.height());
+ qreal pixelRatio=painter->device()->devicePixelRatioF();
+ imageCache = QImage(option->rect.size() * pixelRatio, QImage::Format_ARGB32_Premultiplied);
+ imageCache.setDevicePixelRatio(pixelRatio);
+ imageCache.fill(0);
+ p = new QPainter(&imageCache);
+ }
+ paintFunc(p,option);
+ if (doPixmapCache) {
+ p->end();
+ delete p;
+ internalPixmapCache = QPixmap::fromImage(imageCache);
+ painter->drawPixmap(option->rect.topLeft(), internalPixmapCache);
+ QPixmapCache::insert(pixmapName, internalPixmapCache);
}
}
- painter->drawPixmap(option->rect, pixmap);
}
void
paintDialBase(QPainter *painter, const QStyleOption *option)
{
-// painter->fillRect(option->rect, Qt::red);
+// painter->fillRect(option->rect, Qt::red);
// painter->save();
// painter->setRenderHint(QPainter::Antialiasing, true);
int d = qMin(option->rect.width(), option->rect.height());
@@ -79,6 +82,7 @@ paintDialBase(QPainter *painter, const QStyleOption *option)
// const qreal angle = 90;
painter->setPen(Qt::NoPen);
+ painter->setRenderHint(QPainter::Antialiasing);
QColor border_color = option->palette.color(QPalette::Window);
#if 0
{
@@ -268,7 +272,7 @@ shaded_color(const QColor &color, int shade)
static void
paintGrip(QPainter *painter, const QStyleOption *option)
{
-// painter->fillRect(option->rect, Qt::red);
+ //painter->fillRect(option->rect, Qt::red);
int d = qMin(option->rect.width(), option->rect.height());
// good values are 3 (very small), 4 (small), 5 (good), 7 (large), 9 (huge)
// int d = 5;
@@ -279,6 +283,7 @@ paintGrip(QPainter *painter, const QStyleOption *option)
qreal opacity = 0.9;
painter->save();
+ painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
if (option->state & QStyle::State_Enabled) {
if (option->state & QStyle::State_Sunken) {
@@ -342,7 +347,7 @@ paintGrip(QPainter *painter, const QStyleOption *option)
}
void
-paintCachedGrip(QPainter *painter, const QStyleOption *option, QPalette::ColorRole /*bgrole*/)
+paintCachedGrip(QPainter *painter, const QStyleOption *option)
{
bool useCache = UsePixmapCache;
QString pixmapName;
@@ -359,7 +364,13 @@ paintCachedGrip(QPainter *painter, const QStyleOption *option, QPalette::ColorRo
QByteArray colorName = option->palette.color(QPalette::Button).name().toLatin1();
pixmapName.sprintf("scp-isg-%x-%x-%s-%x-%x", state, option->direction, colorName.constData(), option->rect.width(), option->rect.height());
}
- paintIndicatorCached(painter, option, paintGrip, useCache, pixmapName);
+ paintIndicatorCached(painter,option,
+ [=](QPainter *painter,const QStyleOption *option){
+ QStyleOption opt(*option);
+ opt.rect.moveTo(0,0);
+ paintGrip(painter,&opt);
+ },
+ useCache,pixmapName);
}
void
@@ -394,7 +405,7 @@ QDialSkulptureStyle::drawComplexControl( ComplexControl cc,
opt.state &= ~QStyle::State_HasFocus;
opt.rect.setWidth(opt.rect.width() & ~1);
opt.rect.setHeight(opt.rect.height() & ~1);
- //((QCommonStyle *) this)->
+ opt.rect.moveCenter(option->rect.center());
QCommonStyle::drawComplexControl(QStyle::CC_Dial, &opt, painter, widget);
// focus rectangle
@@ -409,7 +420,10 @@ QDialSkulptureStyle::drawComplexControl( ComplexControl cc,
// dial base
if (d <= 256) {
- paintIndicatorDial(painter, &opt);
+ QStyleOptionSlider topt(opt);
+ topt.rect.adjust(2,2,-2,-2);
+ topt.rect.moveCenter(option->rect.center());
+ paintIndicatorDial(painter, &topt);
} else {
// large dials are slow to render, do not render them
}
@@ -433,5 +447,5 @@ QDialSkulptureStyle::drawComplexControl( ComplexControl cc,
qreal rr = d / 2.0 - gripSize - 2;
opt.rect.translate(int(0.5 + rr * cos(angle)), int(0.5 - rr * sin(angle)));
- paintCachedGrip(painter, &opt, option->state & QStyle::State_Enabled ? QPalette::Button : QPalette::Window);
+ paintCachedGrip(painter, &opt);
}
diff --git a/qmidiplayer-desktop/qmpchanneleditor.cpp b/qmidiplayer-desktop/qmpchanneleditor.cpp
index 2c58793..206a2fa 100644
--- a/qmidiplayer-desktop/qmpchanneleditor.cpp
+++ b/qmidiplayer-desktop/qmpchanneleditor.cpp
@@ -8,8 +8,6 @@ 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<QDial*> dials=findChildren<QDial*>();
for(int i=0;i<dials.count();++i)
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 87eae10..6b1b8b4 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -11,8 +11,6 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
ui(new Ui::qmpChannelsWindow)
{
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);
pselectw=new qmpPresetSelector(this);
ceditw=new qmpChannelEditor(this);
cha=new QIcon(":/img/ledon.svg");chi=new QIcon(":/img/ledoff.svg");
@@ -67,12 +65,12 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
connect(ui->twChannels->cellWidget(i,5),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
}
connect(ui->twChannels,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(showPresetWindow(int,int)));
- 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.));
+ 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);
qmpMainWindow::getInstance()->registerFunctionality(
chnlf=new qmpChannelFunc(this),
std::string("Channel"),
diff --git a/qmidiplayer-desktop/qmpcustomizewindow.cpp b/qmidiplayer-desktop/qmpcustomizewindow.cpp
index 5ac9bd0..b7017b7 100644
--- a/qmidiplayer-desktop/qmpcustomizewindow.cpp
+++ b/qmidiplayer-desktop/qmpcustomizewindow.cpp
@@ -13,8 +13,6 @@ qmpCustomizeWindow::qmpCustomizeWindow(QWidget *parent) :
ui(new Ui::qmpCustomizeWindow)
{
ui->setupUi(this);
- int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.);
- setMinimumWidth(w);setMinimumHeight(h);
QSettings *s=qmpMainWindow::getInstance()->getSettingsWindow()->getSettingsIntf();
QList<QVariant> defa={"FileInfo","Render","Panic","ReloadSynth"};
QList<QVariant> defb={"Channel","Playlist","Effects","Visualization"};
diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp
index 5602dd4..631ccdb 100644
--- a/qmidiplayer-desktop/qmpefxwindow.cpp
+++ b/qmidiplayer-desktop/qmpefxwindow.cpp
@@ -12,8 +12,6 @@ qmpEfxWindow::qmpEfxWindow(QWidget *parent) :
QList<QDial*> dials=findChildren<QDial*>();
for(int i=0;i<dials.count();++i)
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);
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/qmphelpwindow.cpp b/qmidiplayer-desktop/qmphelpwindow.cpp
index b2346dd..2faed61 100644
--- a/qmidiplayer-desktop/qmphelpwindow.cpp
+++ b/qmidiplayer-desktop/qmphelpwindow.cpp
@@ -18,8 +18,6 @@ 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 d0f386c..d1485be 100644
--- a/qmidiplayer-desktop/qmpinfowindow.cpp
+++ b/qmidiplayer-desktop/qmpinfowindow.cpp
@@ -13,8 +13,6 @@ 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.);
- setMinimumWidth(w);setMinimumHeight(h);
qmpMainWindow::getInstance()->registerFunctionality(
infof=new qmpInfoFunc(this),
std::string("FileInfo"),
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index adbd6d5..335a3c5 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -35,8 +35,6 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
ui->setupUi(this);
ui->lbCurPoly->setText("00000");ui->lbMaxPoly->setText("00000");
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,36);setButtonHeight(ui->pbPlayPause,36);setButtonHeight(ui->pbAdd,36);
setButtonHeight(ui->pbPrev,36);setButtonHeight(ui->pbSettings,36);setButtonHeight(ui->pbStop,36);
playing=false;stopped=true;dragging=false;fin=false;
diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp
index c455232..ca6e8fc 100644
--- a/qmidiplayer-desktop/qmpplistwindow.cpp
+++ b/qmidiplayer-desktop/qmpplistwindow.cpp
@@ -16,8 +16,6 @@ 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);
setButtonHeight(ui->pbAdd,36);setButtonHeight(ui->pbAddFolder,36);
setButtonHeight(ui->pbClear,36);setButtonHeight(ui->pbLoad,36);
setButtonHeight(ui->pbRemove,36);setButtonHeight(ui->pbRepeat,36);
diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp
index 87071f4..8afea2b 100644
--- a/qmidiplayer-desktop/qmppresetselect.cpp
+++ b/qmidiplayer-desktop/qmppresetselect.cpp
@@ -8,8 +8,6 @@ qmpPresetSelector::qmpPresetSelector(QWidget *parent) :
ui(new Ui::qmpPresetSelector)
{
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);
}
qmpPresetSelector::~qmpPresetSelector()
@@ -88,13 +86,17 @@ void qmpPresetSelector::on_pbOk_clicked()
CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
if(plyr->getChannelOutput(ch)){
plyr->setChannelPreset(ch,(ui->spCustomMSB->value()<<7)|ui->spCustomLSB->value(),ui->spCustomPC->value());
- //plyr->setCC(ch,0,ui->spCustomMSB->value());
- //plyr->setCC(ch,32,ui->spCustomLSB->value());
}
else{
if(!ui->lwBankSelect->currentItem()||!ui->lwPresetSelect->currentItem())return (void)close();
- int b,p;sscanf(ui->lwBankSelect->currentItem()->text().toStdString().c_str(),"%d",&b);
- sscanf(ui->lwPresetSelect->currentItem()->text().toStdString().c_str(),"%d",&p);
+ int b,p;
+ b=ui->lwBankSelect->currentItem()->text().toInt();
+ p=ui->lwPresetSelect->currentItem()->text().split(' ').first().toInt();
+ QString s=qmpSettingsWindow::getSettingsIntf()->value("Audio/BankSelect","CC#0").toString();
+ if(s=="CC#32"){
+ if(b==128)b=127<<7;
+ }
+ else if(s=="CC#0")b<<=7;
plyr->setChannelPreset(ch,b,p);
}
close();
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index 613a5db..9d8b4cf 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -22,8 +22,6 @@ 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;
@@ -161,7 +159,7 @@ void qmpSettingsWindow::settingsInit()
selected=-1;
for(int i=0;i<ui->cbBSMode->count();++i)
- if(ui->cbBSMode->itemText(i)==settings->value("Audio/BankSelect","GS").toString())
+ if(ui->cbBSMode->itemText(i)==settings->value("Audio/BankSelect","CC#0").toString())
{selected=i;break;}
if(~selected)ui->cbBSMode->setCurrentIndex(selected);
settings->setValue("Audio/BankSelect",ui->cbBSMode->currentText());
@@ -175,8 +173,8 @@ void qmpSettingsWindow::settingsInit()
ui->twSoundfont->setCellWidget(i-1,0,new QCheckBox(""));
((QCheckBox*)ui->twSoundfont->cellWidget(i-1,0))->setChecked(settings->value("SoundFonts/SF"+QString::number(i)+"Enabled",1).toInt());
}
- ui->twSoundfont->setColumnWidth(0,22*logicalDpiX()/96.);
- ui->twSoundfont->setColumnWidth(1,400*logicalDpiX()/96.);
+ ui->twSoundfont->setColumnWidth(0,22);
+ ui->twSoundfont->setColumnWidth(1,400);
QStringList qs;qs.push_back("E");qs.push_back("Path");
ui->twSoundfont->setHorizontalHeaderLabels(qs);
settings->setValue("SoundFonts/SFCount",sfc);
@@ -370,10 +368,10 @@ void qmpSettingsWindow::updatePluginList(qmpPluginManager *pmgr)
for(int j=1;j<=3;++j)
ui->twPluginList->item(i,j)->setFlags(ui->twPluginList->item(i,j)->flags()^Qt::ItemIsEditable);
}
- ui->twPluginList->setColumnWidth(0,22*logicalDpiX()/96.);
- ui->twPluginList->setColumnWidth(1,192*logicalDpiX()/96.);
- ui->twPluginList->setColumnWidth(2,64*logicalDpiX()/96.);
- ui->twPluginList->setColumnWidth(3,128*logicalDpiX()/96.);
+ ui->twPluginList->setColumnWidth(0,22);
+ ui->twPluginList->setColumnWidth(1,192);
+ ui->twPluginList->setColumnWidth(2,64);
+ ui->twPluginList->setColumnWidth(3,128);
}
void qmpSettingsWindow::verifySF()