@@ -26,12 +26,24 @@ QStringList MixersList::mimeTypes () const
|
|||||||
{
|
{
|
||||||
QStringList types;
|
QStringList types;
|
||||||
if (expo) types << "application/x-companion-expo-item";
|
if (expo) types << "application/x-companion-expo-item";
|
||||||
else types << "application/x-companion-mix-item";
|
else types << "application/x-companion-mix-item";
|
||||||
return types;
|
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 )
|
bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction action )
|
||||||
{
|
{
|
||||||
// qDebug() << "MixersList::dropMimeData() index:" << index << "formats" << data->formats();
|
// qDebug() << "MixersList::dropMimeData() index:" << index << "formats" << data->formats();
|
||||||
QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
|
QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
|
||||||
if (dropData.isNull() ) return false;
|
if (dropData.isNull() ) return false;
|
||||||
@@ -52,7 +64,7 @@ bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction
|
|||||||
QMimeData *mimeData = new QMimeData;
|
QMimeData *mimeData = new QMimeData;
|
||||||
mimeData->setData(expo ? "application/x-companion-expo" : "application/x-companion-mix", qba);
|
mimeData->setData(expo ? "application/x-companion-expo" : "application/x-companion-mix", qba);
|
||||||
emit mimeDropped(index, mimeData, action);
|
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;
|
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);
|
//qDebug() << "MixersDelegate::sizeHint() UserRole-> " << index.model()->data(index, Qt::UserRole + 2);
|
||||||
int height = doc.size().height();
|
int height = doc.size().height();
|
||||||
if ( index.model()->data(index, Qt::UserRole + 2).toInt() > 0 ) {
|
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;
|
height = doc.size().height() + MIX_ROW_HEIGHT_INCREASE;
|
||||||
}
|
}
|
||||||
//qDebug() << "MixersDelegate::sizeHint() options.rect " << options.rect;
|
//qDebug() << "MixersDelegate::sizeHint() options.rect " << options.rect;
|
||||||
@@ -121,7 +133,7 @@ void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewIt
|
|||||||
|
|
||||||
//minimize margins (default margins look ugly)
|
//minimize margins (default margins look ugly)
|
||||||
QTextFrame *tf = doc.rootFrame();
|
QTextFrame *tf = doc.rootFrame();
|
||||||
QTextFrameFormat tff = tf->frameFormat();
|
QTextFrameFormat tff = tf->frameFormat();
|
||||||
tff.setMargin(0);
|
tff.setMargin(0);
|
||||||
tf->setFrameFormat(tff);
|
tf->setFrameFormat(tff);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class MixersList : public QListWidget
|
|||||||
public:
|
public:
|
||||||
explicit MixersList(QWidget *parent, bool expo);
|
explicit MixersList(QWidget *parent, bool expo);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
void dropEvent(QDropEvent *event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mimeDropped(int index, const QMimeData *data, Qt::DropAction action);
|
void mimeDropped(int index, const QMimeData *data, Qt::DropAction action);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||||
ModelPanel(parent, model, generalSettings, firmware),
|
ModelPanel(parent, model, generalSettings, firmware),
|
||||||
mixInserted(false),
|
mixInserted(false),
|
||||||
highlightedSource(0),
|
highlightedSource(0),
|
||||||
modelPrinter(firmware, generalSettings, model)
|
modelPrinter(firmware, generalSettings, model)
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ void MixesPanel::update()
|
|||||||
|
|
||||||
@note Mixer lines are now HTML formated in order to support bold text.
|
@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 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])
|
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];
|
MixData *md = &model->mixData[dest];
|
||||||
qba.append((const char*)md, sizeof(MixData));
|
qba.append((const char*)md, sizeof(MixData));
|
||||||
}
|
}
|
||||||
itm->setData(Qt::UserRole, qba);
|
itm->setData(Qt::UserRole, qba);
|
||||||
#if MIX_ROW_HEIGHT_INCREASE > 0
|
#if MIX_ROW_HEIGHT_INCREASE > 0
|
||||||
if (new_ch && !firstLine) {
|
if (new_ch && !firstLine) {
|
||||||
//increase size of this row
|
//increase size of this row
|
||||||
itm->setData(GroupHeaderRole, 1);
|
itm->setData(GroupHeaderRole, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
MixerlistWidget->addItem(itm);
|
MixerlistWidget->addItem(itm);
|
||||||
@@ -110,11 +110,11 @@ bool MixesPanel::AddMixerLine(int dest)
|
|||||||
/**
|
/**
|
||||||
@brief Returns HTML formated mixer representation
|
@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 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])
|
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)
|
QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||||
{
|
{
|
||||||
@@ -187,7 +187,7 @@ void MixesPanel::gm_openMix(int index)
|
|||||||
model->mixData[index] = mixd;
|
model->mixData[index] = mixd;
|
||||||
emit modified();
|
emit modified();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (mixInserted) {
|
if (mixInserted) {
|
||||||
gm_deleteMix(index);
|
gm_deleteMix(index);
|
||||||
@@ -215,7 +215,7 @@ void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
|||||||
if (!gm_insertMix(idx)) return;
|
if (!gm_insertMix(idx)) return;
|
||||||
model->mixData[idx].destCh = i;
|
model->mixData[idx].destCh = i;
|
||||||
mixInserted = true;
|
mixInserted = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mixInserted = false;
|
mixInserted = false;
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,7 @@ void MixesPanel::mixerOpen()
|
|||||||
if (!gm_insertMix(idx)) return;
|
if (!gm_insertMix(idx)) return;
|
||||||
model->mixData[idx].destCh = i;
|
model->mixData[idx].destCh = i;
|
||||||
mixInserted = true;
|
mixInserted = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mixInserted = false;
|
mixInserted = false;
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@ void MixesPanel::mixerAdd()
|
|||||||
if (!gm_insertMix(index)) return;
|
if (!gm_insertMix(index)) return;
|
||||||
model->mixData[index].destCh = i;
|
model->mixData[index].destCh = i;
|
||||||
mixInserted = true;
|
mixInserted = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
index++;
|
index++;
|
||||||
if (!gm_insertMix(index)) return;
|
if (!gm_insertMix(index)) return;
|
||||||
@@ -428,11 +428,18 @@ void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
|||||||
contextMenu.exec(globalPos);
|
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);
|
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
//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()
|
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) {
|
if (idx == 0 && !dir) {
|
||||||
//special case: topmost mixer moving up
|
//special case: topmost mixer moving up
|
||||||
if (src.destCh > 1) src.destCh--;
|
if (src.destCh > 1) src.destCh--;
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdx = dir ? idx+1 : idx-1;
|
int tdx = dir ? idx+1 : idx-1;
|
||||||
|
|||||||
Reference in New Issue
Block a user