summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorOrcan Ogetbil <oget.fedora@gmail.com>2010-11-25 07:24:45 +0000
committerOrcan Ogetbil <oget.fedora@gmail.com>2010-11-25 07:24:45 +0000
commitac85f48cbb90cd4ccd72a3e70d0edb2a63f0e8dd (patch)
treeb371032ed12129d8bb8ffc86016f546560e327f4 /muse2
parent4da5d9a1f93b275913019aa84fd74d06e35f6553 (diff)
Fix some issues in synth config dialog
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog5
-rw-r--r--muse2/muse/confmport.cpp106
-rw-r--r--muse2/muse/widgets/synthconfigbase.ui48
3 files changed, 60 insertions, 99 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index a4c52d0c..77423cea 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+25.11.2010
+ - Fixed column widths, alignments, device renaming and jack device creation issues in synthconfigbase.
+ Somehow the last changelog entry about this didn't get committed. That's added too. (Orcan)
24.11.2010
- Resinstated the Midi Transformer. Was left out when both TF and iTF were removed, and then I
asked for them to be put back. So yes, transformbase.ui is used now. (Tim)
@@ -12,6 +15,8 @@
- Added ENABLE_EXPERIMENTAL flag to cmake. Marked rhythmbase, s1 experimental (Orcan)
- Fixed a connection in miditransform (Orcan)
- Fixed crash in FluidSynthGui::channelItemClicked(): Use item->row() for the channel. Test OK. (Tim)
+ - Start porting synthconfigbase. It's mostly functional. TODO: Column widths and alignments,
+ renaming device name, port Q3WhatsThis bits (Orcan)
23.11.2010
- Added Track::cname(), applied to strip labels' object names, so they may be used in style sheets. (Tim)
- Added struct SysEx and some friends, to minstrument.h, prep. for the instrument editor. (Tim)
diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp
index a2fc8298..b881cda7 100644
--- a/muse2/muse/confmport.cpp
+++ b/muse2/muse/confmport.cpp
@@ -132,9 +132,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item)
//printf("MPConfig::rbClicked new cpt x:%d y:%d\n", cpt.x(), cpt.y());
//printf("MPConfig::rbClicked new mapped cpt x:%d y:%d\n", cpt.x(), cpt.y());
QPoint ppt = listView->visualItemRect(item).bottomLeft();
+ QPoint mousepos = QCursor::pos();
//printf("MPConfig::rbClicked ppt x:%d y:%d\n", ppt.x(), ppt.y());
int col = item->column();
- ppt += QPoint(listView->horizontalHeader()->sectionPosition(col), listView->horizontalHeader()->height());
+ ppt += QPoint(0, listView->horizontalHeader()->height());
//printf("MPConfig::rbClicked new ppt x:%d y:%d\n", ppt.x(), ppt.y());
ppt = listView->mapToGlobal(ppt);
//printf("MPConfig::rbClicked new mapped ppt x:%d y:%d\n", ppt.x(), ppt.y());
@@ -378,17 +379,17 @@ void MPConfig::rbClicked(QTableWidgetItem* item)
//printf("MPConfig::rbClicked DEVCOL_NAME\n");
// Did we click in the text area?
- /* ORCAN FIXME-->
- if((cpt.x() - ppt.x()) > buttondownIcon->width())
+ if((mousepos.x() - ppt.x()) > buttondownIcon->width())
{
//printf("MPConfig::rbClicked starting item rename... enabled?:%d\n", item->renameEnabled(DEVCOL_NAME));
// Start the renaming of the cell...
- if(item->renameEnabled(DEVCOL_NAME))
- item->startRename(DEVCOL_NAME);
+ QModelIndex current = item->tableWidget()->currentIndex();
+ if (item->flags() & Qt::ItemIsEditable)
+ item->tableWidget()->edit(current.sibling(current.row(), DEVCOL_NAME));
return;
}
- else <--END OF ORCAN FIXME*/
+ else
// We clicked the 'down' button.
{
QMenu* pup = new QMenu(this);
@@ -530,7 +531,6 @@ void MPConfig::rbClicked(QTableWidgetItem* item)
}
n = act->data().toInt();
-
//printf("MPConfig::rbClicked n:%d\n", n);
MidiDevice* sdev = 0;
@@ -540,6 +540,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item)
if(n <= 2) // p3.3.55
{
sdev = MidiJackDevice::createJackMidiDevice();
+
if(sdev)
{
int of = 3;
@@ -571,7 +572,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item)
if(sdev == dev)
sdev = 0;
}
-
+
midiSeq->msgSetMidiDevice(port, sdev);
muse->changeConfig(true); // save configuration file
song->update();
@@ -700,51 +701,38 @@ MPConfig::MPConfig(QWidget* parent)
{
setupUi(this);
mdevView->setRowCount(MIDI_PORTS);
- mdevView->setColumnCount(9);
-
+ mdevView->verticalHeader()->hide();
+ mdevView->setSelectionMode(QAbstractItemView::SingleSelection);
+ mdevView->setShowGrid(false);
+ mdevView->horizontalHeader()->setResizeMode(DEVCOL_NO ,QHeaderView::Fixed);
+ mdevView->horizontalHeader()->setResizeMode(DEVCOL_REC ,QHeaderView::Fixed);
+ mdevView->horizontalHeader()->setResizeMode(DEVCOL_PLAY ,QHeaderView::Fixed);
+ mdevView->horizontalHeader()->setResizeMode(DEVCOL_GUI ,QHeaderView::Fixed);
+
_mptooltip = 0;
//popup = 0;
instrPopup = 0;
_showAliases = -1; // 0: Show first aliases, if available. Nah, stick with -1: none at first.
- //ORCAN-FIXMEmdevView->setSorting(-1);
- //ORCAN-FIXMEmdevView->setAllColumnsShowFocus(true);
- mdevView->setHorizontalHeaderLabels(QStringList()
- << tr("Port")
- << tr("GUI")
- << tr("I")
- << tr("O")
- << tr("Instrument")
- << tr("Device Name")
- << tr("In routes")
- << tr("Out routes")
- << tr("State")
- );
- /* Orcan FIXME column widths
- mdevView->addColumn(tr("Port"));
- mdevView->addColumn(tr("GUI"));
- mdevView->addColumn(tr("I"));
- mdevView->addColumn(tr("O"));
- mdevView->addColumn(tr("Instrument"), 120);
- mdevView->addColumn(tr("Device Name"), 120);
- //mdevView->addColumn(tr("Routing"), 80);
- mdevView->addColumn(tr("In routes"), 80);
- mdevView->addColumn(tr("Out routes"), 80);
- mdevView->addColumn(tr("State"));
- */
+ QStringList columnnames;
+ columnnames << tr("Port")
+ << tr("GUI")
+ << tr("I")
+ << tr("O")
+ << tr("Instrument")
+ << tr("Device Name")
+ << tr("In routes")
+ << tr("Out routes")
+ << tr("State");
+
+ mdevView->setColumnCount(columnnames.size());
+ mdevView->setHorizontalHeaderLabels(columnnames);
+
mdevView->setFocusPolicy(Qt::NoFocus);
- /* Orcan FIXME
- mdevView->setColumnAlignment(DEVCOL_NO, Qt::AlignHCenter);
- mdevView->setColumnAlignment(DEVCOL_GUI, Qt::AlignCenter);
- mdevView->setColumnAlignment(DEVCOL_REC, Qt::AlignCenter);
- mdevView->setColumnAlignment(DEVCOL_PLAY, Qt::AlignCenter);
- mdevView->header()->setResizeEnabled(false, DEVCOL_NO);
- mdevView->header()->setResizeEnabled(false, DEVCOL_REC);
- mdevView->header()->setResizeEnabled(false, DEVCOL_GUI);
- mdevView->setResizeMode(QTableWidget::LastColumn);
+
- instanceList->setColumnAlignment(1, Qt::AlignHCenter);
+ /* Orcan FIXME
new MPWhatsThis(mdevView, mdevView->header());
_mptooltip = new MPHeaderTip(mdevView->header());
@@ -806,12 +794,14 @@ void MPConfig::songChanged(int flags)
mdevView->clearContents();
for (int i = MIDI_PORTS-1; i >= 0; --i)
{
+ mdevView->blockSignals(true); // otherwise itemChanged() is triggered and bad things happen.
MidiPort* port = &midiPorts[i];
MidiDevice* dev = port->device();
QString s;
s.setNum(i+1);
QTableWidgetItem* itemno = new QTableWidgetItem(s);
mdevView->setItem(i, DEVCOL_NO, itemno);
+ itemno->setTextAlignment(Qt::AlignHCenter);
QTableWidgetItem* itemstate = new QTableWidgetItem(port->state());
mdevView->setItem(i, DEVCOL_STATE, itemstate);
QTableWidgetItem* iteminstr = new QTableWidgetItem(port->instrument() ?
@@ -820,16 +810,22 @@ void MPConfig::songChanged(int flags)
mdevView->setItem(i, DEVCOL_INSTR, iteminstr);
QTableWidgetItem* itemname = new QTableWidgetItem;
mdevView->setItem(i, DEVCOL_NAME, itemname);
+ itemname->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemgui = new QTableWidgetItem;
mdevView->setItem(i, DEVCOL_GUI, itemgui);
+ itemgui->setTextAlignment(Qt::AlignHCenter);
QTableWidgetItem* itemrec = new QTableWidgetItem;
mdevView->setItem(i, DEVCOL_REC, itemrec);
+ itemrec->setTextAlignment(Qt::AlignHCenter);
QTableWidgetItem* itemplay = new QTableWidgetItem;
mdevView->setItem(i, DEVCOL_PLAY, itemplay);
+ itemplay->setTextAlignment(Qt::AlignHCenter);
QTableWidgetItem* itemout = new QTableWidgetItem;
mdevView->setItem(i, DEVCOL_OUTROUTES, itemout);
QTableWidgetItem* itemin = new QTableWidgetItem;
mdevView->setItem(i, DEVCOL_INROUTES, itemin);
+ mdevView->blockSignals(false);
+
if (dev) {
itemname->setText(dev->name());
@@ -837,18 +833,16 @@ void MPConfig::songChanged(int flags)
// Is it a Jack midi device? Allow renaming.
//if(dynamic_cast<MidiJackDevice*>(dev))
if (dev->deviceType() == MidiDevice::JACK_MIDI)
- itemname->setFlags(Qt::ItemIsEditable);
+ itemname->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
if (dev->rwFlags() & 0x2)
- itemrec->setIcon(dev->openFlags() & 2 ? QIcon(*dotIcon) : QIcon(*dothIcon));
+ itemrec->setIcon(dev->openFlags() & 2 ? QIcon(*dotIcon) : QIcon(*dothIcon));
else
- itemrec->setIcon(QIcon(QPixmap()));
+ itemrec->setIcon(QIcon(QPixmap()));
if (dev->rwFlags() & 0x1)
- itemplay->setIcon( dev->openFlags() & 1 ?
- QIcon(*dotIcon) :
- QIcon(*dothIcon));
+ itemplay->setIcon( dev->openFlags() & 1 ? QIcon(*dotIcon) : QIcon(*dothIcon));
else
- itemplay->setIcon(QIcon(QPixmap()));
+ itemplay->setIcon(QIcon(QPixmap()));
}
else {
itemname->setText(tr("<none>"));
@@ -893,10 +887,7 @@ void MPConfig::songChanged(int flags)
if(i == no) sitem = itemno;
}
if(sitem)
- {
- mdevView->setCurrentItem(sitem);
- //ORCAN-ChECKmdevView->ensureItemVisible(sitem);
- }
+ mdevView->setCurrentItem(sitem);
QString s;
synthList->clear();
@@ -910,6 +901,7 @@ void MPConfig::songChanged(int flags)
item->setText(0, QString((*i)->baseName()));
s.setNum((*i)->instances());
item->setText(1, s);
+ item->setTextAlignment(1, Qt::AlignHCenter);
//item->setText(2, QString((*i)->baseName()));
item->setText(2, QString((*i)->name()));
@@ -926,7 +918,9 @@ void MPConfig::songChanged(int flags)
else
s.setNum((*si)->midiPort() + 1);
iitem->setText(1, s);
+ iitem->setTextAlignment(1, Qt::AlignHCenter);
}
+ synthList->resizeColumnToContents(1);
mdevView->resizeColumnsToContents();
selectionChanged();
}
diff --git a/muse2/muse/widgets/synthconfigbase.ui b/muse2/muse/widgets/synthconfigbase.ui
index 00f0038c..e587aa70 100644
--- a/muse2/muse/widgets/synthconfigbase.ui
+++ b/muse2/muse/widgets/synthconfigbase.ui
@@ -29,23 +29,11 @@
<property name="text">
<string>Name</string>
</property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
</column>
<column>
<property name="text">
<string>Midi Port</string>
</property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>false</bool>
- </property>
</column>
</widget>
</item>
@@ -86,7 +74,11 @@
</property>
<layout class="QVBoxLayout">
<item>
- <widget class="QTableWidget" name="mdevView"/>
+ <widget class="QTableWidget" name="mdevView">
+ <attribute name="verticalHeaderDefaultSectionSize">
+ <number>18</number>
+ </attribute>
+ </widget>
</item>
</layout>
</widget>
@@ -142,56 +134,26 @@
<property name="text">
<string>File</string>
</property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
</column>
<column>
<property name="text">
<string>Inst</string>
</property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>false</bool>
- </property>
</column>
<column>
<property name="text">
<string>Name</string>
</property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
</column>
<column>
<property name="text">
<string>Version</string>
</property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
</column>
</widget>
</item>