@@ -26,12 +26,24 @@ QStringList MixersList::mimeTypes () const
|
||||
{
|
||||
QStringList types;
|
||||
if (expo) types << "application/x-companion-expo-item";
|
||||
else types << "application/x-companion-mix-item";
|
||||
else types << "application/x-companion-mix-item";
|
||||
return types;
|
||||
}
|
||||
|
||||
void MixersList::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QList<int> list;
|
||||
foreach(QListWidgetItem *item, selectedItems()) {
|
||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx >= 0) list << idx;
|
||||
}
|
||||
if (list.count()<1) return;
|
||||
event->acceptProposedAction();
|
||||
dropMimeData(indexAt(event->pos()).row(),event->mimeData(),event->dropAction());
|
||||
}
|
||||
|
||||
bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction action )
|
||||
{
|
||||
{
|
||||
// qDebug() << "MixersList::dropMimeData() index:" << index << "formats" << data->formats();
|
||||
QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
|
||||
if (dropData.isNull() ) return false;
|
||||
@@ -52,7 +64,7 @@ bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData(expo ? "application/x-companion-expo" : "application/x-companion-mix", qba);
|
||||
emit mimeDropped(index, mimeData, action);
|
||||
delete mimeData; //is this correct? is mimeData freed elswere??
|
||||
delete mimeData; //is this correct? is mimeData freed elswere??
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -105,7 +117,7 @@ QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QMod
|
||||
//qDebug() << "MixersDelegate::sizeHint() UserRole-> " << index.model()->data(index, Qt::UserRole + 2);
|
||||
int height = doc.size().height();
|
||||
if ( index.model()->data(index, Qt::UserRole + 2).toInt() > 0 ) {
|
||||
//qDebug() << "MixersDelegate::sizeHint() detected channel head";
|
||||
//qDebug() << "MixersDelegate::sizeHint() detected channel head";
|
||||
height = doc.size().height() + MIX_ROW_HEIGHT_INCREASE;
|
||||
}
|
||||
//qDebug() << "MixersDelegate::sizeHint() options.rect " << options.rect;
|
||||
@@ -121,7 +133,7 @@ void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewIt
|
||||
|
||||
//minimize margins (default margins look ugly)
|
||||
QTextFrame *tf = doc.rootFrame();
|
||||
QTextFrameFormat tff = tf->frameFormat();
|
||||
QTextFrameFormat tff = tf->frameFormat();
|
||||
tff.setMargin(0);
|
||||
tf->setFrameFormat(tff);
|
||||
tf->setFrameFormat(tff);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class MixersList : public QListWidget
|
||||
public:
|
||||
explicit MixersList(QWidget *parent, bool expo);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
|
||||
signals:
|
||||
void mimeDropped(int index, const QMimeData *data, Qt::DropAction action);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
mixInserted(false),
|
||||
mixInserted(false),
|
||||
highlightedSource(0),
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
@@ -76,7 +76,7 @@ void MixesPanel::update()
|
||||
|
||||
@note Mixer lines are now HTML formated in order to support bold text.
|
||||
|
||||
@param[in] dest defines which mixer line to create.
|
||||
@param[in] dest defines which mixer line to create.
|
||||
If dest < 0 then create empty channel slotr fo channel -dest ( dest=-2 -> CH2)
|
||||
if dest >=0 then create used channel based on model mix data from slot dest (dest=4 -> model mix[4])
|
||||
|
||||
@@ -94,11 +94,11 @@ bool MixesPanel::AddMixerLine(int dest)
|
||||
MixData *md = &model->mixData[dest];
|
||||
qba.append((const char*)md, sizeof(MixData));
|
||||
}
|
||||
itm->setData(Qt::UserRole, qba);
|
||||
itm->setData(Qt::UserRole, qba);
|
||||
#if MIX_ROW_HEIGHT_INCREASE > 0
|
||||
if (new_ch && !firstLine) {
|
||||
//increase size of this row
|
||||
itm->setData(GroupHeaderRole, 1);
|
||||
itm->setData(GroupHeaderRole, 1);
|
||||
}
|
||||
#endif
|
||||
MixerlistWidget->addItem(itm);
|
||||
@@ -110,11 +110,11 @@ bool MixesPanel::AddMixerLine(int dest)
|
||||
/**
|
||||
@brief Returns HTML formated mixer representation
|
||||
|
||||
@param[in] dest defines which mixer line to create.
|
||||
@param[in] dest defines which mixer line to create.
|
||||
If dest < 0 then create empty channel slot for channel -dest ( dest=-2 -> CH2)
|
||||
if dest >=0 then create used channel based on model mix data from slot dest (dest=4 -> model mix[4])
|
||||
|
||||
@retval string mixer line in HTML
|
||||
@retval string mixer line in HTML
|
||||
*/
|
||||
QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
{
|
||||
@@ -187,7 +187,7 @@ void MixesPanel::gm_openMix(int index)
|
||||
model->mixData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mixInserted) {
|
||||
gm_deleteMix(index);
|
||||
@@ -215,7 +215,7 @@ void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
||||
if (!gm_insertMix(idx)) return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mixInserted = false;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ void MixesPanel::mixerOpen()
|
||||
if (!gm_insertMix(idx)) return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mixInserted = false;
|
||||
}
|
||||
@@ -393,7 +393,7 @@ void MixesPanel::mixerAdd()
|
||||
if (!gm_insertMix(index)) return;
|
||||
model->mixData[index].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
index++;
|
||||
if (!gm_insertMix(index)) return;
|
||||
@@ -428,11 +428,18 @@ void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction /*action*/)
|
||||
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction action)
|
||||
{
|
||||
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||
pasteMixerMimeData(data, idx);
|
||||
if (action==Qt::CopyAction) {
|
||||
pasteMixerMimeData(data, idx);
|
||||
}
|
||||
else if (action==Qt::MoveAction) {
|
||||
QList<int> list = createMixListFromSelected();
|
||||
mixersDeleteList(list);
|
||||
pasteMixerMimeData(data, idx);
|
||||
}
|
||||
}
|
||||
|
||||
void MixesPanel::mixesEdited()
|
||||
@@ -469,7 +476,7 @@ int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
||||
if (idx == 0 && !dir) {
|
||||
//special case: topmost mixer moving up
|
||||
if (src.destCh > 1) src.destCh--;
|
||||
return idx;
|
||||
return idx;
|
||||
}
|
||||
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
|
||||
Reference in New Issue
Block a user