aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-10-02 23:08:08 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-10-02 23:08:08 +0800
commit11bda15b5ecb608686718a8180ff33ff37c673f3 (patch)
treeceb11877bb33b3d3fc7a68c1bfc678c3aa50949f /qmidiplayer-desktop
parenta25823bbc28bfb93f1330d7421bd2589c01386c1 (diff)
downloadQMidiPlayer-0.8.6_fluidsynth-1.x_final.tar.xz
Fixed layout with Qt 5.11.0.8.6_fluidsynth-1.x_final
Minor code cleanups in qmpchannelswindow. Documentation update.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp18
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.hpp19
2 files changed, 14 insertions, 23 deletions
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 77560dc..c154383 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -45,6 +45,7 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
ui->twChannels->setCellWidget(i,3,new QDCComboBox());
QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,3);
cb->setID(i);
+ cb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
for(size_t j=0;j<devc;++j)
{
cb->addItem(devs[j].c_str());
@@ -59,13 +60,13 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
if(qmpSettingsWindow::getSettingsIntf()->value("Midi/DisableMapping",0).toInt())
cb->setEnabled(false);
connect(cb,SIGNAL(onChange(int,int)),this,SLOT(changeMidiMapping(int,int)));
- ui->twChannels->setCellWidget(i,4,new QDCLabel(""));
- ((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i);
- connect(ui->twChannels->cellWidget(i,4),SIGNAL(onDoubleClick(int)),this,SLOT(showPresetWindow(int)));
+ ui->twChannels->setItem(i,4,new QTableWidgetItem(""));
+ ui->twChannels->item(i,4)->setFlags(Qt::ItemIsEnabled);
ui->twChannels->setCellWidget(i,5,new QDCPushButton("..."));
- ((QDCLabel*)ui->twChannels->cellWidget(i,5))->setID(i);
+ ((QDCPushButton*)ui->twChannels->cellWidget(i,5))->setID(i);
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.));
@@ -130,7 +131,7 @@ void qmpChannelsWindow::channelWindowsUpdate()
if(qmpMainWindow::getInstance()->getPlayer()->isFinished())
{
for(int i=0;i<16;++i)
- ((QLabel*)ui->twChannels->cellWidget(i,4))->setText("");
+ ui->twChannels->item(i,4)->setText("");
connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
fused=0;return;
}
@@ -153,14 +154,14 @@ void qmpChannelsWindow::channelWindowsUpdate()
sprintf(data,"%03d:%03d %s",b,p,nm);
if(fused)
{
- if(strcmp(((QLabel*)ui->twChannels->cellWidget(i,4))->
+ if(strcmp((ui->twChannels->item(i,4))->
text().toStdString().c_str(),data))
{
connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
fused=0;
}
}
- ((QLabel*)ui->twChannels->cellWidget(i,4))->setText(data);
+ ui->twChannels->item(i,4)->setText(data);
ui->twChannels->item(i,0)->setIcon(
qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]?*cha:*chi);
if(qmpMainWindow::getInstance()->getPlayer()->getChstates()[i])
@@ -207,8 +208,9 @@ void qmpChannelsWindow::on_pbUnsolo_clicked()
}
}
-void qmpChannelsWindow::showPresetWindow(int chid)
+void qmpChannelsWindow::showPresetWindow(int chid,int col)
{
+ if(col!=4)return;
pselectw->show();
pselectw->setupWindow(chid);
}
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp
index 008598c..9ff0cd0 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.hpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.hpp
@@ -17,20 +17,6 @@ namespace Ui {
class qmpChannelsWindow;
}
-class QDCLabel:public QLabel
-{
- Q_OBJECT
- private:
- int id;
- protected:
- void mouseDoubleClickEvent(QMouseEvent *event){event->accept();emit onDoubleClick(id);}
- public:
- QDCLabel(QString s):QLabel(s){id=-1;}
- void setID(int _id){id=_id;}
- signals:
- void onDoubleClick(int id);
-};
-
class QDCPushButton:public QPushButton
{
Q_OBJECT
@@ -41,6 +27,7 @@ class QDCPushButton:public QPushButton
public:
QDCPushButton(QString s):QPushButton(s){id=-1;}
void setID(int _id){id=_id;}
+ QSize sizeHint()const{return QSize();}
signals:
void onClick(int id);
};
@@ -53,6 +40,8 @@ class QDCComboBox:public QComboBox
public:
QDCComboBox():QComboBox(){id=-1;connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(indexChangedSlot(int)));}
void setID(int _id){id=_id;}
+ QSize sizeHint()const{return QSize();}
+ QSize minimumSizeHint()const{return QSize();}
signals:
void onChange(int id,int idx);
public slots:
@@ -95,7 +84,7 @@ class qmpChannelsWindow:public QWidget
void channelWindowsUpdate();
void updateChannelActivity();
void channelMSChanged();
- void showPresetWindow(int chid);
+ void showPresetWindow(int chid,int col);
void showChannelEditorWindow(int chid);
void changeMidiMapping(int chid,int idx);
void on_pbUnmute_clicked();