summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog3
-rw-r--r--muse2/muse/ctrl/ctrlcanvas.cpp20
-rw-r--r--muse2/muse/ctrl/ctrlcanvas.h8
-rw-r--r--muse2/muse/ctrl/ctrledit.cpp3
-rw-r--r--muse2/muse/ctrl/ctrlpanel.cpp5
-rw-r--r--muse2/muse/dssihost.cpp8
-rw-r--r--muse2/muse/master/lmaster.cpp24
-rw-r--r--muse2/muse/master/lmaster.h2
-rw-r--r--muse2/muse/master/master.cpp4
-rw-r--r--muse2/muse/master/masteredit.cpp8
-rw-r--r--muse2/muse/mixer/amixer.cpp4
-rw-r--r--muse2/muse/mixer/astrip.cpp2
-rw-r--r--muse2/muse/mixer/astrip.h2
-rw-r--r--muse2/muse/mixer/meter.cpp9
-rw-r--r--muse2/muse/mixer/rack.cpp268
-rw-r--r--muse2/muse/mixer/rack.h25
-rw-r--r--muse2/muse/osc.cpp4
-rw-r--r--muse2/muse/synth.h6
-rw-r--r--muse2/muse/widgets/dentry.cpp7
-rw-r--r--muse2/muse/widgets/mtscale.cpp8
-rw-r--r--muse2/muse/widgets/nentry.cpp12
-rw-r--r--muse2/muse/widgets/sigscale.cpp2
-rw-r--r--muse2/muse/widgets/tb1.cpp2
-rw-r--r--muse2/muse/widgets/utils.cpp4
24 files changed, 238 insertions, 202 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 0ddf4bb9..c911e1d4 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+07.12.2010:
+ - Ported rack. TODO: Drag and drop needs a hand. It's not working. (Orcan)
+ - Converted various Qt3 support methods to Qt4 in many files. (Orcan)
06.12.2010
- Built Awl::posedit and Awl::sigedit, and replaced /widget versions and all usages. (Tim)
TODO: Awl::sigedit has no returnPressed signal, for lmaster.
diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp
index 6a7e0720..bf943173 100644
--- a/muse2/muse/ctrl/ctrlcanvas.cpp
+++ b/muse2/muse/ctrl/ctrlcanvas.cpp
@@ -8,15 +8,9 @@
#include <stdio.h>
#include <values.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qtoolbutton.h>
-#include <q3popupmenu.h>
-#include <qlabel.h>
-#include <qcursor.h>
-//Added by qt3to4:
+#include <QPainter>
+#include <QCursor>
#include <QMouseEvent>
-#include <QEvent>
#include "globals.h"
#include "ctrledit.h"
@@ -611,7 +605,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event)
{
start = event->pos();
Tool activeTool = tool;
- bool shift = event->state() & Qt::ShiftButton;
+ bool shift = event->modifiers() & Qt::ShiftModifier;
int xpos = start.x();
int ypos = start.y();
@@ -905,7 +899,7 @@ void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event)
void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event)
{
- bool shift = event->state() & Qt::ShiftButton;
+ bool shift = event->modifiers() & Qt::ShiftModifier;
switch (drag) {
case DRAG_RESIZE:
@@ -920,7 +914,7 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event)
case DRAG_LASSO:
if (!shift)
deselectAll();
- lasso = lasso.normalize();
+ lasso = lasso.normalized();
for (iCEvent i = items.begin(); i != items.end(); ++i) {
#if 0
if ((*i)->intersects(lasso)) {
@@ -1231,7 +1225,7 @@ void CtrlCanvas::setTool(int t)
drawLineMode = false;
break;
default:
- setCursor(QCursor(Qt::arrowCursor));
+ setCursor(QCursor(Qt::ArrowCursor));
break;
}
}
@@ -1483,7 +1477,7 @@ QRect CtrlCanvas::overlayRect() const
{
QFontMetrics fm(config.fonts[3]);
QRect r(fm.boundingRect(_controller ? _controller->name() : QString("")));
- r.moveBy(2, 2); // top/left margin
+ r.translate(2, 2); // top/left margin
return r;
}
diff --git a/muse2/muse/ctrl/ctrlcanvas.h b/muse2/muse/ctrl/ctrlcanvas.h
index bb17fafb..e76bf71c 100644
--- a/muse2/muse/ctrl/ctrlcanvas.h
+++ b/muse2/muse/ctrl/ctrlcanvas.h
@@ -15,16 +15,16 @@
#include "tools.h"
#include "midictrl.h"
#include "event.h"
-//Added by qt3to4:
-#include <QMouseEvent>
-#include <QEvent>
+
+class QMouseEvent;
+class QEvent;
+class QWidget;
class Event;
class MidiPart;
class PartList;
class MidiTrack;
class MidiEditor;
-class QWidget;
class CtrlPanel;
//---------------------------------------------------------
diff --git a/muse2/muse/ctrl/ctrledit.cpp b/muse2/muse/ctrl/ctrledit.cpp
index fd9f108f..f55fe8ef 100644
--- a/muse2/muse/ctrl/ctrledit.cpp
+++ b/muse2/muse/ctrl/ctrledit.cpp
@@ -36,6 +36,7 @@ CtrlEdit::CtrlEdit(QWidget* parent, MidiEditor* e, int xmag,
bool expand, const char* name) : QWidget(parent)
{
setObjectName(name);
+ setAttribute(Qt::WA_DeleteOnClose);
QHBoxLayout* hbox = new QHBoxLayout;
panel = new CtrlPanel(0, e, "panel");
canvas = new CtrlCanvas(e, 0, xmag, "ctrlcanvas", panel);
@@ -117,7 +118,7 @@ void CtrlEdit::readStatus(Xml& xml)
void CtrlEdit::destroy()
{
emit destroyedCtrl(this);
- close(true); // close and destroy widget
+ close(); // close and destroy widget
}
//---------------------------------------------------------
diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp
index e04ecc1d..8e044510 100644
--- a/muse2/muse/ctrl/ctrlpanel.cpp
+++ b/muse2/muse/ctrl/ctrlpanel.cpp
@@ -42,8 +42,9 @@
//---------------------------------------------------------
CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name)
- : QWidget(parent, name)
+ : QWidget(parent)
{
+ setObjectName(name);
inHeartBeat = true;
editor = e;
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
@@ -604,7 +605,7 @@ void CtrlPanel::ctrlPopup()
// add new controller
//
QMenu* pop1 = new QMenu(this);
- pop1->setCheckable(false);
+ //pop1->setCheckable(false); // Qt4 doc says not needed.
//
// populate popup with all controllers available for
// current instrument
diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp
index 93ede9bd..dfedacaa 100644
--- a/muse2/muse/dssihost.cpp
+++ b/muse2/muse/dssihost.cpp
@@ -367,7 +367,7 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument
// label.latin1(), s->name().latin1(), fi.baseName(true).latin1(), s->baseName().latin1());
//#endif
- if(s->name() == label && s->baseName() == fi.baseName(true))
+ if(s->name() == label && s->baseName() == fi.completeBaseName())
break;
}
if(is != synthis.end())
@@ -378,7 +378,7 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument
if(debugMsg)
{
fprintf(stderr, "scanDSSILib: name:%s listname:%s lib:%s listlib:%s\n",
- label.latin1(), s->name().latin1(), fi.baseName(true).latin1(), s->baseName().latin1());
+ label.latin1(), s->name().latin1(), fi.completeBaseName().latin1(), s->baseName().latin1());
int ai = 0, ao = 0, ci = 0, co = 0;
for(unsigned long pt = 0; pt < descr->LADSPA_Plugin->PortCount; ++pt)
{
@@ -548,7 +548,7 @@ DssiSynth::DssiSynth(QFileInfo& fi, const DSSI_Descriptor* d) : // ddskrjo remov
_inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(descr->Properties);
// Blacklist vst plugins in-place configurable for now.
- if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
+ if ((_inports != _outports) || (fi.completeBaseName() == QString("dssi-vst") && !config.vstInPlace))
_inPlaceCapable = false;
}
@@ -673,7 +673,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti)
_inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(descr->Properties);
// Blacklist vst plugins in-place configurable for now.
- if((_inports != _outports) || (info.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
+ if((_inports != _outports) || (info.completeBaseName() == QString("dssi-vst") && !config.vstInPlace))
_inPlaceCapable = false;
}
}
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 06f816ba..cb969428 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -64,7 +64,7 @@ LMaster::LMaster()
sig_editor = 0;
editedItem = 0;
editingNewItem = false;
- setCaption(tr("MusE: Mastertrack"));
+ setWindowTitle(tr("MusE: Mastertrack"));
setMinimumHeight(100);
setFixedWidth(400);
@@ -73,12 +73,12 @@ LMaster::LMaster()
QSignalMapper *signalMapper = new QSignalMapper(this);
menuBar()->addMenu(menuEdit);
menuEdit->addActions(undoRedo->actions());
- menuEdit->insertSeparator();
- QAction *tempoAction = menuEdit->addAction(tr("Insert Tempo"));
- QAction *signAction = menuEdit->addAction(tr("Insert Signature"));
- QAction *posAction = menuEdit->addAction(tr("Edit Positon"));
- QAction *valAction = menuEdit->addAction(tr("Edit Value"));
- QAction *delAction = menuEdit->addAction(tr("Delete Event"));
+ menuEdit->addSeparator();
+ tempoAction = menuEdit->addAction(tr("Insert Tempo"));
+ signAction = menuEdit->addAction(tr("Insert Signature"));
+ posAction = menuEdit->addAction(tr("Edit Positon"));
+ valAction = menuEdit->addAction(tr("Edit Value"));
+ delAction = menuEdit->addAction(tr("Delete Event"));
delAction->setShortcut(Qt::Key_Delete);
connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
@@ -139,7 +139,7 @@ LMaster::LMaster()
// QSizeGrip* corner = new QSizeGrip(mainw);
mainGrid->setRowStretch(0, 100);
- mainGrid->setColStretch(0, 100);
+ mainGrid->setColumnStretch(0, 100);
mainGrid->addWidget(view, 0, 0);
// mainGrid->addWidget(corner, 1, 1, AlignBottom | AlignRight);
@@ -737,8 +737,8 @@ void LMaster::configChanged()
*/
void LMaster::initShortcuts()
{
- menuEdit->setAccel(shortcuts[SHRT_LM_INS_TEMPO].key, CMD_INSERT_TEMPO);
- menuEdit->setAccel(shortcuts[SHRT_LM_INS_SIG].key, CMD_INSERT_SIG);
- menuEdit->setAccel(shortcuts[SHRT_LM_EDIT_BEAT].key, CMD_EDIT_BEAT);
- menuEdit->setAccel(shortcuts[SHRT_LM_EDIT_VALUE].key, CMD_EDIT_VALUE);
+ tempoAction->setShortcut(shortcuts[SHRT_LM_INS_TEMPO].key);
+ signAction->setShortcut(shortcuts[SHRT_LM_INS_SIG].key);
+ posAction->setShortcut(shortcuts[SHRT_LM_EDIT_BEAT].key);
+ valAction->setShortcut(shortcuts[SHRT_LM_EDIT_VALUE].key);
}
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index cdad4c77..cd687e45 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -115,6 +115,8 @@ class LMaster : public MidiEditor {
int editorColumn;
bool editingNewItem;
+ QAction *tempoAction, *signAction, *posAction, *valAction, *delAction;
+
private slots:
void select(QTreeWidgetItem*, QTreeWidgetItem*);
void itemDoubleClicked(QTreeWidgetItem* item);
diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp
index 3b593fee..aaf73398 100644
--- a/muse2/muse/master/master.cpp
+++ b/muse2/muse/master/master.cpp
@@ -129,7 +129,7 @@ void Master::leaveEvent(QEvent*)
void Master::pdraw(QPainter& p, const QRect& rect)
{
View::pdraw(p, rect); // calls draw()
- p.resetXForm();
+ p.resetTransform();
int x = rect.x();
int y = rect.y();
@@ -312,7 +312,7 @@ void Master::setTool(int t)
setCursor(QCursor(*pencilIcon, 4, 15));
break;
default:
- setCursor(QCursor(Qt::arrowCursor));
+ setCursor(QCursor(Qt::ArrowCursor));
break;
}
}
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index d4fd3e0d..4ed76c22 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -65,7 +65,7 @@ void MasterEdit::songChanged(int type)
}
if (type & SC_MASTER) {
enableButton->blockSignals(true);
- enableButton->setOn(song->masterFlag());
+ enableButton->setChecked(song->masterFlag());
enableButton->blockSignals(false);
}
}
@@ -77,7 +77,7 @@ void MasterEdit::songChanged(int type)
MasterEdit::MasterEdit()
: MidiEditor(0, _rasterInit, 0)
{
- setCaption(tr("MusE: Mastertrack"));
+ setWindowTitle(tr("MusE: Mastertrack"));
_raster = 0; // measure
setMinimumSize(400, 300);
resize(500, 350);
@@ -99,7 +99,7 @@ MasterEdit::MasterEdit()
enableButton->setCheckable(true);
enableButton->setText(tr("Enable"));
enableButton->setToolTip(tr("Enable usage of master track"));
- enableButton->setOn(song->masterFlag());
+ enableButton->setChecked(song->masterFlag());
enableMaster->addWidget(enableButton);
connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool)));
@@ -171,7 +171,7 @@ MasterEdit::MasterEdit()
// QSizeGrip* corner = new QSizeGrip(mainw);
mainGrid->setRowStretch(5, 100);
- mainGrid->setColStretch(1, 100);
+ mainGrid->setColumnStretch(1, 100);
mainGrid->addWidget(hLine(mainw), 0, 1);
mainGrid->addWidget(time1, 1, 1);
diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp
index fe72136d..1848b9fd 100644
--- a/muse2/muse/mixer/amixer.cpp
+++ b/muse2/muse/mixer/amixer.cpp
@@ -169,7 +169,9 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c)
showDrumTracksId = new QAction(tr("Show Drum Tracks"), actionItems);
showWaveTracksId = new QAction(tr("Show Wave Tracks"), actionItems);
- actionItems->addSeparator();
+ QAction *separator = new QAction(this);
+ separator->setSeparator(true);
+ actionItems->addAction(separator);
showInputTracksId = new QAction(tr("Show Inputs"), actionItems);
showOutputTracksId = new QAction(tr("Show Outputs"), actionItems);
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
index 88d8f945..9c2e14f5 100644
--- a/muse2/muse/mixer/astrip.cpp
+++ b/muse2/muse/mixer/astrip.cpp
@@ -702,7 +702,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
// plugin rack
//---------------------------------------------------
- EffectRack* rack = new EffectRack(this, t);
+ rack = new EffectRack(this, t);
rack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
grid->addWidget(rack, _curGridRow++, 0, 1, 2);
diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h
index 88cef89b..10d75305 100644
--- a/muse2/muse/mixer/astrip.h
+++ b/muse2/muse/mixer/astrip.h
@@ -25,6 +25,7 @@ class QButton;
class TransparentToolButton;
class AudioTrack;
class DoubleLabel;
+class EffectRack;
//---------------------------------------------------------
// AudioStrip
@@ -36,6 +37,7 @@ class AudioStrip : public Strip {
int channel;
Slider* slider;
DoubleLabel* sl;
+ EffectRack* rack;
Knob* pan;
DoubleLabel* panl;
diff --git a/muse2/muse/mixer/meter.cpp b/muse2/muse/mixer/meter.cpp
index 993a15ff..aae380f3 100644
--- a/muse2/muse/mixer/meter.cpp
+++ b/muse2/muse/mixer/meter.cpp
@@ -23,7 +23,7 @@
//---------------------------------------------------------
Meter::Meter(QWidget* parent, MeterType type)
- : QFrame(parent, Qt::WNoAutoErase)
+ : QFrame(parent) //Qt::WNoAutoErase
{
mtype = type;
overflow = false;
@@ -138,9 +138,10 @@ void Meter::drawVU(int w, int h)
int fw = frameWidth();
w -= 2*fw;
h -= 2*fw;
- bgPm.resize(w, h);
- fgPm.resize(w, h);
-
+
+ bgPm = QPixmap(QSize(w, h));
+ fgPm = QPixmap(QSize(w, h));
+
QPainter p1(&fgPm);
QPainter p2(&bgPm);
diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp
index ead97ae1..16e76258 100644
--- a/muse2/muse/mixer/rack.cpp
+++ b/muse2/muse/mixer/rack.cpp
@@ -6,19 +6,17 @@
// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
//=========================================================
-#include <qapplication.h>
-#include <qtooltip.h>
-#include <qpalette.h>
-#include <qpainter.h>
-#include <q3popupmenu.h>
-#include <qmessagebox.h>
-
#include <QByteArray>
-#include <QMimeData>
#include <QDrag>
+#include <QDragEnterEvent>
#include <QDropEvent>
+#include <QMenu>
+#include <QMessageBox>
+#include <QMimeData>
#include <QMouseEvent>
-#include <QDragEnterEvent>
+#include <QPainter>
+#include <QPalette>
+
#include <errno.h>
#include "xml.h"
@@ -35,16 +33,14 @@
// class RackSlot
//---------------------------------------------------------
-class RackSlot : public Q3ListBoxItem {
+class RackSlot : public QListWidgetItem {
int idx;
AudioTrack* node;
- virtual void paint(QPainter*);
- virtual int height(const Q3ListBox*) const { return 18; }
-
public:
- RackSlot(Q3ListBox* lb, AudioTrack* t, int);
+ RackSlot(QListWidget* lb, AudioTrack* t, int i);
~RackSlot();
+ void setBackgroundColor(const QBrush& brush) {setBackground(brush);};
};
RackSlot::~RackSlot()
@@ -56,31 +52,12 @@ RackSlot::~RackSlot()
// RackSlot
//---------------------------------------------------------
-RackSlot::RackSlot(Q3ListBox* b, AudioTrack* t, int i)
- : Q3ListBoxItem(b)
+RackSlot::RackSlot(QListWidget* b, AudioTrack* t, int i)
+ : QListWidgetItem(b)
{
node = t;
idx = i;
- }
-
-//---------------------------------------------------------
-// paint
-//---------------------------------------------------------
-
-void RackSlot::paint(QPainter* painter)
- {
- if (node == 0)
- return;
- painter->save();
- if (node == 0 || !node->efxPipe()->isOn(idx)) {
- const QColorGroup& g = listBox()->colorGroup();
- painter->fillRect(0,0,listBox()->width(),height(listBox()), g.dark());
- painter->setPen(g.light());
- }
- QFontMetrics fm = painter->fontMetrics();
- QString s(node->efxPipe()->name(idx));
- painter->drawText(3, fm.ascent() + fm.leading()/2, s);
- painter->restore();
+ setSizeHint(QSize(10,17));
}
//---------------------------------------------------------
@@ -88,27 +65,42 @@ void RackSlot::paint(QPainter* painter)
//---------------------------------------------------------
EffectRack::EffectRack(QWidget* parent, AudioTrack* t)
- : Q3ListBox(parent, "Rack")
+ : QListWidget(parent)
{
+ setObjectName("Rack");
setAttribute(Qt::WA_DeleteOnClose);
track = t;
setFont(config.fonts[1]);
- setHScrollBarMode(AlwaysOff);
- setVScrollBarMode(AlwaysOff);
- setSelectionMode(Single);
- setMaximumHeight(18 * PipelineDepth);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setSelectionMode(QAbstractItemView::SingleSelection);
+ setMaximumHeight(19 * PipelineDepth);
for (int i = 0; i < PipelineDepth; ++i)
new RackSlot(this, track, i);
- connect(this, SIGNAL(contextMenuRequested(Q3ListBoxItem*, const QPoint&)),
- this, SLOT(menuRequested(Q3ListBoxItem*, const QPoint&)));
- connect(this, SIGNAL(doubleClicked(Q3ListBoxItem*)),
- this, SLOT(doubleClicked(Q3ListBoxItem*)));
+ updateContents();
+
+ connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
+ this, SLOT(doubleClicked(QListWidgetItem*)));
connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
- QToolTip::add(this, tr("effect rack"));
+
+ setToolTip(tr("effect rack"));
+ setSpacing(0);
+ QPalette qpal;
+ qpal.setColor(QPalette::Base, QColor(palette().midlight().color()));
+ setPalette(qpal);
+
setAcceptDrops(true);
}
+void EffectRack::updateContents()
+ {
+ for (int i = 0; i < PipelineDepth; ++i) {
+ item(i)->setText(track->efxPipe()->name(i));
+ item(i)->setBackground(track->efxPipe()->isOn(i) ? palette().mid() : palette().dark());
+ }
+ }
+
//---------------------------------------------------------
// EffectRack
//---------------------------------------------------------
@@ -124,9 +116,8 @@ EffectRack::~EffectRack()
void EffectRack::songChanged(int typ)
{
if (typ & (SC_ROUTE | SC_RACK)) {
- for (int i = 0; i < PipelineDepth; ++i)
- updateItem(i);
- }
+ updateContents();
+ }
}
//---------------------------------------------------------
@@ -135,7 +126,7 @@ void EffectRack::songChanged(int typ)
QSize EffectRack::minimumSizeHint() const
{
- return QSize(10, 18 * PipelineDepth);
+ return QSize(10, 19 * PipelineDepth);
}
//---------------------------------------------------------
@@ -147,16 +138,36 @@ QSize EffectRack::sizeHint() const
return minimumSizeHint();
}
+
+void EffectRack::choosePlugin(QListWidgetItem* it, bool replace)
+ {
+ Plugin* plugin = PluginDialog::getPlugin(this);
+ if (plugin) {
+ PluginI* plugi = new PluginI();
+ if (plugi->initPluginInstance(plugin, track->channels())) {
+ printf("cannot instantiate plugin <%s>\n",
+ plugin->name().latin1());
+ delete plugi;
+ return;
+ }
+ int idx = row(it);
+ if (replace)
+ audio->msgAddPlugin(track, idx, 0);
+ audio->msgAddPlugin(track, idx, plugi);
+ updateContents();
+ }
+ }
+
//---------------------------------------------------------
// menuRequested
//---------------------------------------------------------
-void EffectRack::menuRequested(Q3ListBoxItem* it, const QPoint& pt)
+void EffectRack::menuRequested(QListWidgetItem* it)
{
if (it == 0 || track == 0)
return;
RackSlot* curitem = (RackSlot*)it;
- int idx = index(curitem);
+ int idx = row(curitem);
QString name;
bool mute;
Pipeline* pipe = track->efxPipe();
@@ -167,78 +178,75 @@ void EffectRack::menuRequested(Q3ListBoxItem* it, const QPoint& pt)
//enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SAVE };
enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SHOW_NATIVE, SAVE };
- Q3PopupMenu* menu = new Q3PopupMenu;
- menu->insertItem(QIcon(*upIcon), tr("move up"), UP, UP);
- menu->insertItem(QIcon(*downIcon), tr("move down"), DOWN, DOWN);
- menu->insertItem(tr("remove"), REMOVE, REMOVE);
- menu->insertItem(tr("bypass"), BYPASS, BYPASS);
- menu->insertItem(tr("show gui"), SHOW, SHOW);
- menu->insertItem(tr("show native gui"), SHOW_NATIVE, SHOW_NATIVE);
-
- menu->setItemChecked(BYPASS, !pipe->isOn(idx));
- menu->setItemChecked(SHOW, pipe->guiVisible(idx));
- menu->setItemChecked(SHOW_NATIVE, pipe->nativeGuiVisible(idx));
+ QMenu* menu = new QMenu;
+ QAction* newAction = menu->addAction(tr("new"));
+ QAction* changeAction = menu->addAction(tr("change"));
+ QAction* upAction = menu->addAction(QIcon(*upIcon), tr("move up"));//, UP, UP);
+ QAction* downAction = menu->addAction(QIcon(*downIcon), tr("move down"));//, DOWN, DOWN);
+ QAction* removeAction = menu->addAction(tr("remove"));//, REMOVE, REMOVE);
+ QAction* bypassAction = menu->addAction(tr("bypass"));//, BYPASS, BYPASS);
+ QAction* showGuiAction = menu->addAction(tr("show gui"));//, SHOW, SHOW);
+ QAction* showNativeGuiAction = menu->addAction(tr("show native gui"));//, SHOW_NATIVE, SHOW_NATIVE);
+ QAction* saveAction = menu->addAction(tr("save preset"));
+
+ newAction->setData(NEW);
+ changeAction->setData(CHANGE);
+ upAction->setData(UP);
+ downAction->setData(DOWN);
+ removeAction->setData(REMOVE);
+ bypassAction->setData(BYPASS);
+ showGuiAction->setData(SHOW);
+ showNativeGuiAction->setData(SHOW_NATIVE);
+ saveAction->setData(SAVE);
+
+ bypassAction->setCheckable(true);
+ showGuiAction->setCheckable(true);
+ showNativeGuiAction->setCheckable(true);
+
+ bypassAction->setChecked(!pipe->isOn(idx));
+ showGuiAction->setChecked(pipe->guiVisible(idx));
+ showNativeGuiAction->setChecked(pipe->nativeGuiVisible(idx));
if (pipe->empty(idx)) {
- menu->insertItem(tr("new"), NEW, NEW);
- menu->setItemEnabled(UP, false);
- menu->setItemEnabled(DOWN, false);
- menu->setItemEnabled(REMOVE, false);
- menu->setItemEnabled(BYPASS, false);
- menu->setItemEnabled(SHOW, false);
- menu->setItemEnabled(SHOW_NATIVE, false);
- menu->setItemEnabled(SAVE, false);
+ menu->removeAction(changeAction);
+ menu->removeAction(saveAction);
+ upAction->setEnabled(false);
+ downAction->setEnabled(false);
+ removeAction->setEnabled(false);
+ bypassAction->setEnabled(false);
+ showGuiAction->setEnabled(false);
+ showNativeGuiAction->setEnabled(false);
}
else {
- menu->insertItem(tr("change"), CHANGE, CHANGE);
- menu->insertItem(tr("save preset"), SAVE, SAVE);
+ menu->removeAction(newAction);
if (idx == 0)
- menu->setItemEnabled(UP, false);
+ upAction->setEnabled(true);
if (idx == (PipelineDepth-1))
- menu->setItemEnabled(DOWN, false);
+ downAction->setEnabled(false);
if(!pipe->isDssiPlugin(idx))
- menu->setItemEnabled(SHOW_NATIVE, false);
+ showNativeGuiAction->setEnabled(false);
}
#ifndef OSC_SUPPORT
- menu->setItemEnabled(SHOW_NATIVE, false);
+ showNativeGuiAction->setEnabled(false);
#endif
-
- int sel = menu->exec(pt, 1);
- delete menu;
- if (sel == -1)
- return;
+ QPoint pt = QCursor::pos();
+ QAction* act = menu->exec(pt, 0);
+
+ //delete menu;
+ if (!act)
+ return;
+ int sel = act->data().toInt();
switch(sel) {
case NEW:
{
- Plugin* plugin = PluginDialog::getPlugin(this);
- if (plugin) {
- PluginI* plugi = new PluginI();
- if (plugi->initPluginInstance(plugin, track->channels())) {
- printf("cannot instantiate plugin <%s>\n",
- plugin->name().latin1());
- delete plugi;
- break;
- }
- audio->msgAddPlugin(track, idx, plugi);
- }
+ choosePlugin(it);
break;
}
case CHANGE:
{
- Plugin* plugin = PluginDialog::getPlugin(this);
- if (plugin) {
- PluginI* plugi = new PluginI();
- if (plugi->initPluginInstance(plugin, track->channels())) {
- printf("cannot instantiate plugin <%s>\n",
- plugin->name().latin1());
- delete plugi;
- break;
- }
- audio->msgAddPlugin(track, idx, 0);
- audio->msgAddPlugin(track, idx, plugi);
- }
+ choosePlugin(it, true);
break;
}
case REMOVE:
@@ -264,13 +272,13 @@ void EffectRack::menuRequested(Q3ListBoxItem* it, const QPoint& pt)
}
case UP:
if (idx > 0) {
- setCurrentItem(idx-1);
+ setCurrentItem(item(idx-1));
pipe->move(idx, true);
}
break;
case DOWN:
if (idx < (PipelineDepth-1)) {
- setCurrentItem(idx+1);
+ setCurrentItem(item(idx+1));
pipe->move(idx, false);
}
break;
@@ -278,6 +286,7 @@ void EffectRack::menuRequested(Q3ListBoxItem* it, const QPoint& pt)
savePreset(idx);
break;
}
+ updateContents();
song->update(SC_RACK);
}
@@ -286,13 +295,19 @@ void EffectRack::menuRequested(Q3ListBoxItem* it, const QPoint& pt)
// toggle gui
//---------------------------------------------------------
-void EffectRack::doubleClicked(Q3ListBoxItem* it)
+void EffectRack::doubleClicked(QListWidgetItem* it)
{
if (it == 0 || track == 0)
return;
+
RackSlot* item = (RackSlot*)it;
- int idx = index(item);
+ int idx = row(item);
Pipeline* pipe = track->efxPipe();
+
+ if (pipe->name(idx) == QString("empty")) {
+ choosePlugin(it);
+ return;
+ }
if (pipe) {
bool flag = !pipe->guiVisible(idx);
pipe->showGui(idx, flag);
@@ -399,8 +414,9 @@ void EffectRack::contentsDropEvent(QDropEvent * /*event*/)// prevent of compiler
void EffectRack::dropEvent(QDropEvent *event)
{
QString text;
- Q3ListBoxItem *i = itemAt( contentsToViewport(event->pos()) );
- int idx = index(i);
+ //orcan-check//QListWidgetItem *i = itemAt( contentsToViewport(event->pos()) );
+ QListWidgetItem *i = itemAt( event->pos() );
+ int idx = row(i);
Pipeline* pipe = track->efxPipe();
if (pipe)
@@ -409,14 +425,15 @@ void EffectRack::dropEvent(QDropEvent *event)
QWidget *sw = event->source();
if(sw)
{
- if(strcmp(sw->className(), "EffectRack") == 0)
+ if(strcmp(sw->metaObject()->className(), "EffectRack") == 0)
{
EffectRack *ser = (EffectRack*)sw;
Pipeline* spipe = ser->getTrack()->efxPipe();
if(!spipe)
return;
- Q3ListBoxItem *i = ser->itemAt(contentsToViewport(ser->getDragPos()));
- int idx0 = ser->index(i);
+ //orcan-check//QListWidgetItem *i = ser->itemAt(contentsToViewport(ser->getDragPos()));
+ QListWidgetItem *i = ser->itemAt(ser->getDragPos());
+ int idx0 = ser->row(i);
if (!(*spipe)[idx0] ||
(idx == idx0 && (ser == this || ser->getTrack()->name() == track->name())))
return;
@@ -478,33 +495,40 @@ void EffectRack::contentsDragEnterEvent(QDragEnterEvent * /*event*/)// prevent o
{
}
-void EffectRack::contentsMousePressEvent(QMouseEvent *event)
+void EffectRack::mousePressEvent(QMouseEvent *event)
{
if(event->button() & Qt::LeftButton) {
dragPos = event->pos();
}
- Q3ListBox::contentsMousePressEvent(event);
+ else if(event->button() & Qt::RightButton) {
+ menuRequested(itemAt(event->pos()));
+ return;
+ }
+
+ QListWidget::mousePressEvent(event);
}
-void EffectRack::contentsMouseMoveEvent(QMouseEvent *event)
+void EffectRack::mouseMoveEvent(QMouseEvent *event)
{
if (event->state() & Qt::LeftButton) {
Pipeline* pipe = track->efxPipe();
if(!pipe)
return;
- Q3ListBoxItem *i = itemAt(contentsToViewport(dragPos));
- int idx0 = index(i);
+ //orcan-check//QListWidgetItem *i = itemAt(contentsToViewport(dragPos));
+ QListWidgetItem *i = itemAt(dragPos);
+ int idx0 = row(i);
if (!(*pipe)[idx0])
return;
int distance = (dragPos-event->pos()).manhattanLength();
if (distance > QApplication::startDragDistance()) {
- Q3ListBoxItem *i = itemAt( contentsToViewport(event->pos()) );
- int idx = index(i);
+ //orcan-check//QListWidgetItem *i = itemAt( contentsToViewport(event->pos()) );
+ QListWidgetItem *i = itemAt( event->pos() );
+ int idx = row(i);
startDrag(idx);
}
}
- Q3ListBox::contentsMouseMoveEvent(event);
+ QListWidget::mouseMoveEvent(event);
}
diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h
index f04ce2ed..fd3057d7 100644
--- a/muse2/muse/mixer/rack.h
+++ b/muse2/muse/mixer/rack.h
@@ -9,21 +9,22 @@
#ifndef __RACK_H__
#define __RACK_H__
-#include <q3listbox.h>
-#include <QDragLeaveEvent>
-//Added by qt3to4:
-#include <QMouseEvent>
-#include <QDropEvent>
-#include <QDragEnterEvent>
#include "xml.h"
+#include <QListWidget>
+
+class QDragEnterEvent;
+class QDragLeaveEvent;
+class QDropEvent;
+class QMouseEvent;
+
class AudioTrack;
//---------------------------------------------------------
// EffectRack
//---------------------------------------------------------
-class EffectRack : public Q3ListBox {
+class EffectRack : public QListWidget {
AudioTrack* track;
Q_OBJECT
@@ -34,19 +35,21 @@ class EffectRack : public Q3ListBox {
void initPlugin(Xml xml, int idx);
QPoint dragPos;
void savePreset(int idx);
+ void choosePlugin(QListWidgetItem* item, bool replace = false);
private slots:
- void menuRequested(Q3ListBoxItem*, const QPoint&);
- void doubleClicked(Q3ListBoxItem*);
+ void menuRequested(QListWidgetItem*);
+ void doubleClicked(QListWidgetItem*);
void songChanged(int);
+ void updateContents();
protected:
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void contentsDropEvent(QDropEvent *event);
void contentsDragEnterEvent(QDragEnterEvent *event);
- void contentsMousePressEvent(QMouseEvent *event);
- void contentsMouseMoveEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
public:
EffectRack(QWidget*, AudioTrack* t);
diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp
index bb65f695..6001b151 100644
--- a/muse2/muse/osc.cpp
+++ b/muse2/muse/osc.cpp
@@ -1297,9 +1297,9 @@ bool OscDssiIF::oscInitGui()
if(!_oscSynthIF)
return false;
- return OscIF::oscInitGui(QT_TR_NOOP("dssi_synth"), _oscSynthIF->dssiSynth()->baseName(false),
+ return OscIF::oscInitGui(QT_TR_NOOP("dssi_synth"), _oscSynthIF->dssiSynth()->baseName(),
_oscSynthIF->dssiSynth()->name(), _oscSynthIF->dssiSynthI()->name(),
- _oscSynthIF->dssiSynth()->filePath(), _oscSynthIF->dssiSynth()->dirPath(false));
+ _oscSynthIF->dssiSynth()->filePath(), _oscSynthIF->dssiSynth()->path());
}
#endif // DSSI_SUPPORT
diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h
index f2f06978..aa3fc375 100644
--- a/muse2/muse/synth.h
+++ b/muse2/muse/synth.h
@@ -56,9 +56,11 @@ class Synth {
int instances() const { return _instances; }
virtual void incInstances(int val) { _instances += val; }
- QString baseName(bool complete = true) /*const*/ { return info.baseName(complete); } // ddskrjo
+ QString completeBaseName() /*const*/ { return info.completeBaseName(); } // ddskrjo
+ QString baseName() /*const*/ { return info.baseName(); } // ddskrjo
QString name() const { return _name; }
- QString dirPath(bool complete = true) const { return info.dirPath(complete); }
+ QString absolutePath() const { return info.absolutePath(); }
+ QString path() const { return info.path(); }
QString filePath() const { return info.filePath(); }
QString description() const { return _description; }
QString version() const { return _version; }
diff --git a/muse2/muse/widgets/dentry.cpp b/muse2/muse/widgets/dentry.cpp
index 61c0d096..4c16a50d 100644
--- a/muse2/muse/widgets/dentry.cpp
+++ b/muse2/muse/widgets/dentry.cpp
@@ -27,8 +27,9 @@
// lineedit double values
//---------------------------------------------------------
-Dentry::Dentry(QWidget* parent, const char* name) : QLineEdit(parent, name)
+Dentry::Dentry(QWidget* parent, const char* name) : QLineEdit(parent)
{
+ setObjectName(name);
_slider = 0;
_id = -1;
drawFrame = false;
@@ -37,7 +38,7 @@ Dentry::Dentry(QWidget* parent, const char* name) : QLineEdit(parent, name)
connect(timer, SIGNAL(timeout()), SLOT(repeat()));
val = 0.01;
connect(this, SIGNAL(returnPressed()), SLOT(endEdit()));
- setCursor(QCursor(Qt::arrowCursor));
+ setCursor(QCursor(Qt::ArrowCursor));
evx = 1.0;
}
@@ -67,7 +68,7 @@ void Dentry::setFrame(bool flag)
void Dentry::endEdit()
{
- if (edited()) {
+ if (isModified()) {
if (setSValue(text())) {
setString(val);
return;
diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp
index 0472384c..59d3b63b 100644
--- a/muse2/muse/widgets/mtscale.cpp
+++ b/muse2/muse/widgets/mtscale.cpp
@@ -32,7 +32,7 @@ MTScale::MTScale(int* r, QWidget* parent, int xs, bool _mode)
: View(parent, xs, 1)
{
waveMode = _mode;
- QToolTip::add(this, tr("bar scale"));
+ setToolTip(tr("bar scale"));
barLocator = false;
raster = r;
if (waveMode) {
@@ -144,7 +144,7 @@ void MTScale::viewMouseReleaseEvent(QMouseEvent*)
void MTScale::viewMouseMoveEvent(QMouseEvent* event)
{
- if (event->state() & Qt::ShiftModifier )
+ if (event->modifiers() & Qt::ShiftModifier )
setCursor(QCursor(Qt::PointingHandCursor));
else
setCursor(QCursor(Qt::ArrowCursor));
@@ -173,7 +173,7 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event)
}
Pos p(x, true);
- if(i== 0 && (event->state() & Qt::ShiftModifier )) { // If shift +LMB we add a marker
+ if(i== 0 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +LMB we add a marker
Marker *alreadyExists = song->getMarkerAt(x);
if (!alreadyExists) {
song->addMarker(QString(""), x, false);
@@ -182,7 +182,7 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event)
//emit addMarker(x);
}
}
- else if (i== 2 && (event->state() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker
+ else if (i== 2 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker
Marker *toRemove = song->getMarkerAt(x);
if (toRemove)
song->removeMarker(toRemove);
diff --git a/muse2/muse/widgets/nentry.cpp b/muse2/muse/widgets/nentry.cpp
index 89c051df..708836e1 100644
--- a/muse2/muse/widgets/nentry.cpp
+++ b/muse2/muse/widgets/nentry.cpp
@@ -94,7 +94,7 @@ Nentry::Nentry(QWidget* parent, const QString& txt,
connect(timer, SIGNAL(timeout()), SLOT(repeat()));
connect(edit, SIGNAL(returnPressed()), SLOT(endEdit()));
- edit->setCursor(QCursor(Qt::arrowCursor));
+ edit->setCursor(QCursor(Qt::ArrowCursor));
// edit->setFont(font3);
val = 0;
layout = new QHBoxLayout(this);
@@ -172,12 +172,12 @@ void Nentry::setFrame(bool flag)
void Nentry::endEdit()
{
- if (edit->edited()) {
+ if (edit->isModified()) {
if (setSValue(edit->text())) {
setString(val, false);
return;
}
- edit->setEdited(false);
+ edit->setModified(false);
}
if (focusW)
focusW->setFocus();
@@ -342,8 +342,8 @@ void Nentry::setValue(int v)
bool Nentry::keyPress(QKeyEvent* event)
{
- bool shift = event->state() & Qt::ShiftModifier;
- bool ctrl = event->state() & Qt::ControlModifier;
+ bool shift = event->modifiers() & Qt::ShiftModifier;
+ bool ctrl = event->modifiers() & Qt::ControlModifier;
int key = event->key();
if (shift) {
@@ -375,7 +375,7 @@ bool Nentry::keyPress(QKeyEvent* event)
}
return true;
}
- if (event->state())
+ if (event->modifiers())
return true;
switch (key) {
case Qt::Key_Up: incValue(0); return true;
diff --git a/muse2/muse/widgets/sigscale.cpp b/muse2/muse/widgets/sigscale.cpp
index bbc6cf85..2594fecb 100644
--- a/muse2/muse/widgets/sigscale.cpp
+++ b/muse2/muse/widgets/sigscale.cpp
@@ -28,7 +28,7 @@
SigScale::SigScale(int* r, QWidget* parent, int xs)
: View(parent, xs, 1)
{
- QToolTip::add(this, tr("signature scale"));
+ setToolTip(tr("signature scale"));
raster = r;
pos[0] = song->cpos();
pos[1] = song->lpos();
diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp
index 41f2ed41..778dad94 100644
--- a/muse2/muse/widgets/tb1.cpp
+++ b/muse2/muse/widgets/tb1.cpp
@@ -250,7 +250,7 @@ void Toolbar1::setQuant(int val)
void Toolbar1::setSolo(bool flag)
{
solo->blockSignals(true);
- solo->setOn(flag);
+ solo->setChecked(flag);
solo->blockSignals(false);
}
diff --git a/muse2/muse/widgets/utils.cpp b/muse2/muse/widgets/utils.cpp
index 453459cc..3a4fbb67 100644
--- a/muse2/muse/widgets/utils.cpp
+++ b/muse2/muse/widgets/utils.cpp
@@ -179,7 +179,7 @@ QString u32bitmap2String(unsigned int bm)
int string2bitmap(const QString& str)
{
int val = 0;
- QString ss = str.simplifyWhiteSpace();
+ QString ss = str.simplified();
const char* s = ss.latin1();
//printf("string2bitmap <%s>\n", s);
@@ -237,7 +237,7 @@ unsigned int string2u32bitmap(const QString& str)
{
//int val = 0;
unsigned int val = 0;
- QString ss = str.simplifyWhiteSpace();
+ QString ss = str.simplified();
const char* s = ss.latin1();
//printf("string2bitmap <%s>\n", s);