summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog6
-rw-r--r--muse2/muse/arranger/alayout.cpp11
-rw-r--r--muse2/muse/arranger/alayout.h5
-rw-r--r--muse2/muse/arranger/arranger.cpp138
-rw-r--r--muse2/muse/arranger/arranger.h37
-rw-r--r--muse2/muse/arranger/tlist.cpp128
-rw-r--r--muse2/muse/arranger/tlist.h41
-rw-r--r--muse2/muse/help.cpp16
-rw-r--r--muse2/muse/midiedit/drumedit.cpp95
-rw-r--r--muse2/muse/track.cpp3
-rw-r--r--muse2/muse/track.h3
-rw-r--r--muse2/muse/widgets/header.cpp19
-rw-r--r--muse2/muse/widgets/header.h6
13 files changed, 226 insertions, 282 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index b223783f..0c91a94c 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,9 @@
+02.12.2010
+ - Ported alayout, tlist, arranger (Orcan)
+ - Minor tweak in the HeaderNew API to set column widths easier. Also commented out the
+ old Header class. We can probably remove it soon. (Orcan)
+ - Ported help.cpp as is. But maybe we should use QDesktopServices to open user's default browser
+ instead of the browser specified in a config option. (Orcan)
01.12.2010
- Ported listedit. (Orcan)
- I missed to port one action call in drumedit. Now it's (hopefully) done. (Orcan)
diff --git a/muse2/muse/arranger/alayout.cpp b/muse2/muse/arranger/alayout.cpp
index 5f6ec0d1..b5374754 100644
--- a/muse2/muse/arranger/alayout.cpp
+++ b/muse2/muse/arranger/alayout.cpp
@@ -6,13 +6,10 @@
//=========================================================
#include "alayout.h"
-#include <QScrollBar>
-#include <QList>
-//Added by qt3to4:
-//#include <Q3PtrList>
-
#include "arranger.h"
+#include <QScrollBar>
+
//---------------------------------------------------------
// wadd
//---------------------------------------------------------
@@ -35,10 +32,10 @@ void TLLayout::wadd(int idx, QWidget* w)
class TLLayoutIterator // : public QGLayoutIterator ddskrjo
{
int idx;
- Q3PtrList<QLayoutItem> *list;
+ QList<QLayoutItem*> list;
public:
- TLLayoutIterator(Q3PtrList<QLayoutItem> *l) : idx(0), list(l) {}
+ TLLayoutIterator(QList<QLayoutItem*> l) : idx(0), list(l) {}
QLayoutItem *current() { return idx < int(list->count()) ? list->at(idx) : 0; }
QLayoutItem *next() { idx++; return current(); }
QLayoutItem *takeCurrent() { return list->take( idx ); }
diff --git a/muse2/muse/arranger/alayout.h b/muse2/muse/arranger/alayout.h
index 05d418b5..b85b5e9a 100644
--- a/muse2/muse/arranger/alayout.h
+++ b/muse2/muse/arranger/alayout.h
@@ -9,12 +9,12 @@
#define __ALAYOUT_H__
#include <QLayout>
-//#include <Q3PtrList>
#include <QList>
+class QLayoutItem;
class QScrollBar;
+
class WidgetStack;
-class QLayoutItem;
//---------------------------------------------------------
// TLLayout
@@ -25,7 +25,6 @@ class TLLayout : public QLayout
{
Q_OBJECT
- //Q3PtrList<QLayoutItem> ilist;
QList<QLayoutItem*> ilist;
QLayoutItem* li[6];
QScrollBar* sb;
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp
index cf9bdac4..c15492ae 100644
--- a/muse2/muse/arranger/arranger.cpp
+++ b/muse2/muse/arranger/arranger.cpp
@@ -8,33 +8,17 @@
#include "config.h"
#include <stdio.h>
-
#include <values.h>
-#include <QLayout>
-//#include <qcombobox.h>
-#include <QToolButton>
-#include <QButtonGroup>
-#include <QLabel>
-//#include <q3accel.h>
+
#include <QComboBox>
-//#include <q3whatsthis.h>
-//#include <q3toolbar.h>
-#include <QToolBar>
-//#include <QToolTip>
-#include <q3hbox.h>
-#include <QStringList>
-#include <q3filedialog.h>
-#include <QCheckBox>
-#include <QPushButton>
-//#include <q3mainwindow.h>
+#include <QGridLayout>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QList>
#include <QMainWindow>
-#include <q3widgetstack.h>
#include <QScrollBar>
-//Added by qt3to4:
-#include <QKeyEvent>
-#include <Q3ValueList>
-#include <QGridLayout>
-#include <QPixmap>
+#include <QToolBar>
+#include <QToolButton>
#include <QVBoxLayout>
#include <QWheelEvent>
@@ -64,27 +48,40 @@
#include "gconfig.h"
#include "mixer/astrip.h"
#include "spinbox.h"
+
//---------------------------------------------------------
-// TWhatsThis::text
+// Arranger::setHeaderToolTips
//---------------------------------------------------------
-QString TWhatsThis::text(const QPoint& pos)
+void Arranger::setHeaderToolTips()
{
- int section = header->sectionAt(pos.x());
- if (section == -1)
- return QString::null;
- switch(section) {
- case COL_RECORD: return Q3Header::tr("Enable recording. Click to toggle."); break;
- case COL_MUTE: return Q3Header::tr("Mute indicator. Click to toggle.\nRight-click to toggle track on/off.\nMute is designed for rapid, repeated action.\nOn/Off is not!"); break;
- case COL_SOLO: return Q3Header::tr("Solo indicator. Click to toggle.\nConnected tracks are also 'phantom' soloed,\n indicated by a dark square."); break;
- case COL_CLASS: return Q3Header::tr("Track type. Right-click to change\n midi and drum track types."); break;
- case COL_NAME: return Q3Header::tr("Track name. Double-click to edit.\nRight-click for more options."); break;
- case COL_OCHANNEL: return Q3Header::tr("Midi/drum track: Output channel number.\nAudio track: Channels.\nMid/right-click to change."); break;
- case COL_OPORT: return Q3Header::tr("Midi/drum track: Output port.\nSynth track: Assigned midi port.\nLeft-click to change.\nRight-click to show GUI."); break;
- case COL_TIMELOCK: return Q3Header::tr("Time lock"); break;
- default: break;
- }
- return QString::null;
+ header->setToolTip(COL_RECORD, tr("Enable Recording"));
+ header->setToolTip(COL_MUTE, tr("Mute/Off Indicator"));
+ header->setToolTip(COL_SOLO, tr("Solo Indicator"));
+ header->setToolTip(COL_CLASS, tr("Track Type"));
+ header->setToolTip(COL_NAME, tr("Track Name"));
+ header->setToolTip(COL_OCHANNEL, tr("Midi output channel number or audio channels"));
+ header->setToolTip(COL_OPORT, tr("Midi output port or synth midi port"));
+ header->setToolTip(COL_TIMELOCK, tr("Time Lock"));
+ //header->setToolTip(COL_AUTOMATION, tr("Automation parameter selection"));
+ }
+
+
+
+//---------------------------------------------------------
+// Arranger::setHeaderWhatsThis
+//---------------------------------------------------------
+
+void Arranger::setHeaderWhatsThis()
+ {
+ header->setWhatsThis(COL_RECORD, tr("Enable recording. Click to toggle."));
+ header->setWhatsThis(COL_MUTE, tr("Mute indicator. Click to toggle.\nRight-click to toggle track on/off.\nMute is designed for rapid, repeated action.\nOn/Off is not!"));
+ header->setWhatsThis(COL_SOLO, tr("Solo indicator. Click to toggle.\nConnected tracks are also 'phantom' soloed,\n indicated by a dark square."));
+ header->setWhatsThis(COL_CLASS, tr("Track type. Right-click to change\n midi and drum track types."));
+ header->setWhatsThis(COL_NAME, tr("Track name. Double-click to edit.\nRight-click for more options."));
+ header->setWhatsThis(COL_OCHANNEL, tr("Midi/drum track: Output channel number.\nAudio track: Channels.\nMid/right-click to change."));
+ header->setWhatsThis(COL_OPORT, tr("Midi/drum track: Output port.\nSynth track: Assigned midi port.\nLeft-click to change.\nRight-click to show GUI."));
+ header->setWhatsThis(COL_TIMELOCK, tr("Time lock"));
}
//---------------------------------------------------------
@@ -150,7 +147,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
lenEntry = new SpinBox(1, 10000, 1);
lenEntry->setValue(song->len());
lenEntry->setToolTip(tr("song length - bars"));
- Q3WhatsThis::add(lenEntry, tr("song length - bars"));
+ lenEntry->setWhatsThis(tr("song length - bars"));
toolbar->addWidget(lenEntry);
connect(lenEntry, SIGNAL(valueChanged(int)), SLOT(songlenChanged(int)));
@@ -252,44 +249,41 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
ib->setOn(showTrackinfoFlag);
connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool)));
- header = new Header(tracklist, "header");
+ header = new HeaderNew(tracklist);
header->setFixedHeight(30);
QFontMetrics fm1(header->font());
int fw = 8;
- header->addLabel(tr("R"), fm1.width('R')+fw);
- header->addLabel(tr("M"), fm1.width('M')+fw);
- header->addLabel(tr("S"), fm1.width('S')+fw);
- header->addLabel(tr("C"), fm1.width('C')+fw);
- header->addLabel(tr("Track"), 100);
- //header->addLabel(tr("O-Port"), 60);
- header->addLabel(tr("Port"), 60);
- header->addLabel(tr("Ch"), 30);
- header->addLabel(tr("T"), fm1.width('T')+fw);
- //header->addLabel(tr("Automation"),30);
- header->setResizeEnabled(false, COL_RECORD);
- header->setResizeEnabled(false, COL_MUTE);
- header->setResizeEnabled(false, COL_SOLO);
- header->setResizeEnabled(false, COL_CLASS);
- header->setResizeEnabled(false, COL_OCHANNEL);
- header->setResizeEnabled(false, COL_TIMELOCK);
- //header->setResizeEnabled(true, COL_AUTOMATION);
- header->setResizeEnabled(true, COL_NAME);
- header->setResizeEnabled(true, COL_OPORT);
-
- header->setTracking(true);
-
- new THeaderTip(header);
- new TWhatsThis(header, header);
-
+ header->setColumnLabel(tr("R"), COL_RECORD, fm1.width('R')+fw);
+ header->setColumnLabel(tr("M"), COL_MUTE, fm1.width('M')+fw);
+ header->setColumnLabel(tr("S"), COL_SOLO, fm1.width('S')+fw);
+ header->setColumnLabel(tr("C"), COL_CLASS, fm1.width('C')+fw);
+ header->setColumnLabel(tr("Track"), COL_NAME, 100);
+ header->setColumnLabel(tr("Port"), COL_OPORT, 60);
+ header->setColumnLabel(tr("Ch"), COL_OCHANNEL, 30);
+ header->setColumnLabel(tr("T"), COL_TIMELOCK, fm1.width('T')+fw);
+ //header->setColumnLabel(tr("Automation"), COL_AUTOMATION, 30);
+ header->setResizeMode(COL_RECORD, QHeaderView::Fixed);
+ header->setResizeMode(COL_MUTE, QHeaderView::Fixed);
+ header->setResizeMode(COL_SOLO, QHeaderView::Fixed);
+ header->setResizeMode(COL_CLASS, QHeaderView::Fixed);
+ header->setResizeMode(COL_NAME, QHeaderView::Interactive);
+ header->setResizeMode(COL_OPORT, QHeaderView::Interactive);
+ header->setResizeMode(COL_OCHANNEL, QHeaderView::Fixed);
+ header->setResizeMode(COL_TIMELOCK, QHeaderView::Fixed);
+ //header->setResizeMode(COL_AUTOMATION, QHeaderView::Interactive);
+
+ setHeaderToolTips();
+ setHeaderWhatsThis();
+ header->setMovable (true );
list = new TList(header, tracklist, "tracklist");
connect(list, SIGNAL(selectionChanged()), SLOT(trackSelectionChanged()));
- connect(header, SIGNAL(sizeChange(int,int,int)), list, SLOT(redraw()));
- connect(header, SIGNAL(moved(int,int)), list, SLOT(redraw()));
- connect(header, SIGNAL(moved(int,int)), this, SLOT(headerMoved()));
+ connect(header, SIGNAL(sectionResized(int,int,int)), list, SLOT(redraw()));
+ connect(header, SIGNAL(sectionMoved(int,int,int)), list, SLOT(redraw()));
+ connect(header, SIGNAL(sectionMoved(int,int,int)), this, SLOT(headerMoved()));
// tracklist:
//
@@ -327,7 +321,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
list->setScroll(vscroll);
- Q3ValueList<int> vallist;
+ QList<int> vallist;
vallist.append(tgrid->maximumSize().width());
split->setSizes(vallist);
@@ -417,7 +411,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
void Arranger::headerMoved()
{
- header->setStretchEnabled(true, COL_NAME);
+ //header->setResizeMode(COL_NAME, QHeaderView::Stretch);
}
//---------------------------------------------------------
diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h
index b95b9379..f8c0bd3b 100644
--- a/muse2/muse/arranger/arranger.h
+++ b/muse2/muse/arranger/arranger.h
@@ -10,52 +10,33 @@
#include <vector>
-#include <QWidget>
-#include <q3header.h>
-#include <q3whatsthis.h>
-//Added by qt3to4:
-#include <QWheelEvent>
-#include <QMenu>
-
#include "midieditor.h"
#include "pcanvas.h"
#include "ui_mtrackinfobase.h"
#include "trackautomationview.h"
+class QAction;
+class QCheckBox;
class QMainWindow;
+class QMenu;
+class QScrollBar;
class QToolButton;
-class Header;
+class QWheelEvent;
+
+class HeaderNew;
class TList;
class ScrollScale;
-class QScrollBar;
class MTScale;
class Track;
class Xml;
class Splitter;
class LabelCombo;
class PosLabel;
-class QCheckBox;
class MidiTrackInfoBase;
class TLLayout;
class WidgetStack;
class AudioStrip;
class SpinBox;
-class QAction;
-//class QModelIndex;
-
-//---------------------------------------------------------
-// TWhatsThis
-//---------------------------------------------------------
-
-class TWhatsThis : public Q3WhatsThis {
- Header* header;
- protected:
- QString text(const QPoint&);
- public:
- TWhatsThis(QWidget* parent, Header* h) : Q3WhatsThis(parent) {
- header = h;
- }
- };
//---------------------------------------------------------
// WidgetStack
@@ -99,7 +80,7 @@ class Arranger : public QWidget {
ScrollScale* hscroll;
QScrollBar* vscroll;
TList* list;
- Header* header;
+ HeaderNew* header;
MTScale* time;
SpinBox* lenEntry;
bool showTrackinfoFlag;
@@ -130,6 +111,8 @@ class Arranger : public QWidget {
void genWaveTrackInfo();
void updateMidiTrackInfo(int flags);
void switchInfo(int);
+ void setHeaderToolTips();
+ void setHeaderWhatsThis();
private slots:
void _setRaster(int);
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index 15a1cdf9..f2a3677e 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -9,19 +9,15 @@
#include <cmath>
-#include <qpainter.h>
-#include <qlineedit.h>
-#include <QMenu>
-#include <qmessagebox.h>
-#include <qscrollbar.h>
-#include <qtimer.h>
-#include <qfileinfo.h>
-//Added by qt3to4:
#include <QKeyEvent>
-#include <QPixmap>
-#include <QResizeEvent>
+#include <QLineEdit>
+#include <QMenu>
+#include <QMessageBox>
#include <QMouseEvent>
+#include <QPainter>
#include <QPaintEvent>
+#include <QPixmap>
+#include <QResizeEvent>
#include <QWheelEvent>
#include "globals.h"
@@ -56,41 +52,10 @@ static const int MIN_TRACKHEIGHT = 20;
static const int WHEEL_DELTA = 120;
//---------------------------------------------------------
-// THeaderTip::maybeTip
-//---------------------------------------------------------
-
-void THeaderTip::maybeTip(const QPoint &pos)
- {
-#if 0 //ddskrjo
- Header* w = (Header*)parentWidget();
- int section = w->sectionAt(pos.x());
- if (section == -1)
- return;
- QRect r(w->sectionPos(section), 0, w->sectionSize(section),
- w->height());
- QString p;
- switch (section) {
- case COL_RECORD: p = Q3Header::tr("Enable Recording"); break;
- case COL_MUTE: p = Q3Header::tr("Mute/Off Indicator"); break;
- case COL_SOLO: p = Q3Header::tr("Solo Indicator"); break;
- case COL_CLASS: p = Q3Header::tr("Track Type"); break;
- case COL_NAME: p = Q3Header::tr("Track Name"); break;
- case COL_OCHANNEL: p = Q3Header::tr("Midi output channel number or audio channels"); break;
- //case COL_OPORT: p = QHeader::tr("Output Port"); break;
- case COL_OPORT: p = Q3Header::tr("Midi output port or synth midi port"); break;
- case COL_TIMELOCK: p = Q3Header::tr("Time Lock"); break;
-// case COL_AUTOMATION: p = QHeader::tr("Automation parameter selection"); break;
- default: return;
- }
- tip(r, p);
-#endif
- }
-
-//---------------------------------------------------------
// TList
//---------------------------------------------------------
-TList::TList(Header* hdr, QWidget* parent, const char* name)
+TList::TList(HeaderNew* hdr, QWidget* parent, const char* name)
: QWidget(parent, name, Qt::WNoAutoErase | Qt::WResizeNoErase)
{
ypos = 0;
@@ -250,7 +215,7 @@ void TList::paint(const QRect& r)
int x = 0;
for (int index = 0; index < header->count(); ++index) {
- int section = header->mapToSection(index);
+ int section = header->visualIndex(index);
int w = header->sectionSize(section);
QRect r = p.xForm(QRect(x+2, yy, w-4, trackHeight));
@@ -398,7 +363,7 @@ void TList::paint(const QRect& r)
int xpos = 0;
p.setPen(Qt::gray);
for (int index = 0; index < n; index++) {
- int section = header->mapToSection(index);
+ int section = header->visualIndex(index);
xpos += header->sectionSize(section);
p.drawLine(xpos, 0, xpos, height());
}
@@ -474,14 +439,14 @@ Track* TList::y2Track(int y) const
void TList::mouseDoubleClickEvent(QMouseEvent* ev)
{
int x = ev->x();
- int section = header->sectionAt(x);
+ int section = header->logicalIndexAt(x);
if (section == -1)
return;
Track* t = y2Track(ev->y() + ypos);
if (t) {
- int colx = header->sectionPos(section);
+ int colx = header->sectionPosition(section);
int colw = header->sectionSize(section);
int coly = t->y() - ypos;
int colh = t->height();
@@ -489,7 +454,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev)
if (section == COL_NAME) {
editTrack = t;
if (editor == 0) {
- editor = new QLineEdit(this);
+ editor = new QLineEdit(this);
/*connect(editor, SIGNAL(returnPressed()),
SLOT(returnPressed()));*/
editor->setFrame(true);
@@ -615,12 +580,12 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y)
{
SynthI* synth = (SynthI*)t;
- Q3PopupMenu* p = new Q3PopupMenu(this);
- p->setCheckable(true);
- p->insertItem(tr("Show Gui"), 0);
+ QMenu* p = new QMenu;
+ QAction* act = p->addAction(tr("Show Gui"));
+ act->setCheckable(true);
printf("synth hasgui %d, gui visible %d\n",synth->hasGui(), synth->guiVisible());
- p->setItemEnabled(0, synth->hasGui());
- p->setItemChecked(0, synth->guiVisible());
+ act->setEnabled(synth->hasGui());
+ act->setChecked(synth->guiVisible());
#ifndef OSC_SUPPORT
#ifdef DSSI_SUPPORT
@@ -633,8 +598,8 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y)
#endif
#endif
- int n = p->exec(mapToGlobal(QPoint(x, y)), 0);
- if (n == 0) {
+ act = p->exec(mapToGlobal(QPoint(x, y)), 0);
+ if (act) {
bool show = !synth->guiVisible();
audio->msgShowInstrumentGui(synth, show);
}
@@ -648,26 +613,26 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y)
int oPort = ((MidiTrack*)t)->outPort();
MidiPort* port = &midiPorts[oPort];
- Q3PopupMenu* p = new Q3PopupMenu(this);
- p->setCheckable(true);
- p->insertItem(tr("Show Gui"), 0);
-
- p->setItemEnabled(0, port->hasGui());
- p->setItemChecked(0, port->guiVisible());
+ QMenu* p = new QMenu;
+ QAction* act = p->addAction(tr("Show Gui"));
+ act->setCheckable(true);
+ printf("synth hasgui %d, gui visible %d\n",port->hasGui(), port->guiVisible());
+ act->setEnabled(port->hasGui());
+ act->setChecked(port->guiVisible());
#ifndef OSC_SUPPORT
#ifdef DSSI_SUPPORT
MidiDevice* dev = port->device();
if(dev && dev->isSynti() && (dynamic_cast<DssiSynthIF*>(((SynthI*)dev)->sif())))
{
- p->setItemChecked(0, false);
- p->setItemEnabled(0, false);
+ act->setChecked(false);
+ act->setEnabled(false);
}
#endif
#endif
- int n = p->exec(mapToGlobal(QPoint(x, y)), 0);
- if (n == 0) {
+ act = p->exec(mapToGlobal(QPoint(x, y)), 0);
+ if (act) {
bool show = !port->guiVisible();
audio->msgShowInstrumentGui(port->instrument(), show);
}
@@ -690,8 +655,9 @@ void TList::tracklistChanged()
void TList::keyPressEvent(QKeyEvent* e)
{
- if (editMode) {
+ if (editMode && ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter)) {
// First time we get a keypress event when lineedit is open is on the return key:
+ // -- Not true for Qt4. Modifier keys also send key events - Orcan
returnPressed();
return;
}
@@ -793,10 +759,10 @@ void TList::mousePressEvent(QMouseEvent* ev)
Track* t = y2Track(y + ypos);
- TrackColumn col = TrackColumn(header->sectionAt(x));
+ TrackColumn col = TrackColumn(header->logicalIndexAt(x));
if (t == 0) {
if (button == Qt::RightButton) {
- QMenu* p = new QMenu(this);
+ QMenu* p = new QMenu;
p->clear();
QAction* midi = p->addAction(*addtrack_addmiditrackIcon,
tr("Add Midi Track"));
@@ -826,7 +792,7 @@ void TList::mousePressEvent(QMouseEvent* ev)
synp->setTitle(QT_TR_NOOP("Add Synth"));
// Add the 'Add Synth' sub-menu to the menu.
- p->addMenu(synp);
+ p->addMenu(synp);
// Show the menu
QAction* act = p->exec(ev->globalPos(), 0);
@@ -1007,12 +973,13 @@ void TList::mousePressEvent(QMouseEvent* ev)
}
else if (button == Qt::RightButton) {
mode = NORMAL;
- Q3PopupMenu* p = new Q3PopupMenu(this);
+ QMenu* p = new QMenu;
p->clear();
- p->insertItem(QIcon(*automation_clear_dataIcon), tr("Delete Track"), 0); // ddskrjo
- p->insertItem(QIcon(*track_commentIcon), tr("Track Comment"), 1);
- int n = p->exec(ev->globalPos(), 0);
- if (n != -1) {
+ p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(0); // ddskrjo
+ p->addAction(QIcon(*track_commentIcon), tr("Track Comment"))->setData(1);
+ QAction* act = p->exec(ev->globalPos(), 0);
+ if (act) {
+ int n = act->data().toInt();
switch (n) {
case 0: // delete track
song->removeTrack0(t);
@@ -1208,7 +1175,7 @@ void TList::mouseMoveEvent(QMouseEvent* ev)
break;
case RESIZE:
{
- if(sTrack >= 0 && sTrack < song->tracks()->size())
+ if(sTrack >= 0 && (unsigned) sTrack < song->tracks()->size())
{
Track* t = song->tracks()->index(sTrack);
if(t)
@@ -1262,7 +1229,7 @@ void TList::wheelEvent(QWheelEvent* ev)
emit redirectWheelEvent(ev);
return;
}
- TrackColumn col = TrackColumn(header->sectionAt(x));
+ TrackColumn col = TrackColumn(header->logicalIndexAt(x));
int delta = ev->delta() / WHEEL_DELTA;
ev->accept();
@@ -1463,15 +1430,16 @@ void TList::resizeEvent(QResizeEvent* ev)
void TList::classesPopupMenu(Track* t, int x, int y)
{
- Q3PopupMenu p(this);
+ QMenu p;
p.clear();
- p.insertItem(QIcon(*addtrack_addmiditrackIcon), tr("Midi"), Track::MIDI);
- p.insertItem(QIcon(*addtrack_drumtrackIcon), tr("Drum"), Track::DRUM);
- int n = p.exec(mapToGlobal(QPoint(x, y)), 0);
+ p.addAction(QIcon(*addtrack_addmiditrackIcon), tr("Midi"))->setData(Track::MIDI);
+ p.addAction(QIcon(*addtrack_drumtrackIcon), tr("Drum"))->setData(Track::DRUM);
+ QAction* act = p.exec(mapToGlobal(QPoint(x, y)), 0);
- if (n == -1)
+ if (!act)
return;
+ int n = act->data().toInt();
if (Track::TrackType(n) == Track::MIDI && t->type() == Track::DRUM) {
//
// Drum -> Midi
diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h
index 147a61e2..4e911711 100644
--- a/muse2/muse/arranger/tlist.h
+++ b/muse2/muse/arranger/tlist.h
@@ -8,25 +8,20 @@
#ifndef __TLIST_H__
#define __TLIST_H__
-#include <qtooltip.h>
-#include <q3whatsthis.h>
-#include <q3header.h>
-//Added by qt3to4:
-#include <QPixmap>
-#include <QResizeEvent>
-#include <QWheelEvent>
-#include <QMouseEvent>
-#include <QKeyEvent>
-#include <QPaintEvent>
#include "track.h"
-class QPainter;
-class ScrollScale;
-class QScrollBar;
+class QKeyEvent;
class QLineEdit;
+class QMouseEvent;
+class QPaintEvent;
+class QResizeEvent;
+class QScrollBar;
+class QWheelEvent;
+
+class ScrollScale;
class Track;
class Xml;
-class Header;
+class HeaderNew;
enum TrackColumn {
COL_RECORD = 0,
@@ -41,19 +36,6 @@ enum TrackColumn {
};
// COL_AUTOMATION, -- not enabled
-//----------------------------------------------------------
-// THeaderTip
-//----------------------------------------------------------
-
-class THeaderTip { //: public QToolTip { ddskrjo
-
- public:
- THeaderTip(QWidget * parent) {} //: QToolTip(parent) {} ddskrjo
- virtual ~THeaderTip() {}
- protected:
- void maybeTip(const QPoint &);
- };
-
//---------------------------------------------------------
// TList
//---------------------------------------------------------
@@ -70,7 +52,7 @@ class TList : public QWidget {
bool resizeFlag; // true if resize cursor is shown
- Header* header;
+ HeaderNew* header;
QScrollBar* scroll;
QLineEdit* editor;
Track* editTrack;
@@ -101,6 +83,7 @@ class TList : public QWidget {
Track* y2Track(int) const;
void classesPopupMenu(Track*, int x, int y);
TrackList getRecEnabledTracks();
+ void setHeaderToolTips();
private slots:
void returnPressed();
@@ -120,7 +103,7 @@ class TList : public QWidget {
void selectTrackBelow();
public:
- TList(Header*, QWidget* parent, const char* name);
+ TList(HeaderNew*, QWidget* parent, const char* name);
void setScroll(QScrollBar* s) { scroll = s; }
Track* track() const { return editTrack; }
void writeStatus(int level, Xml&, const char* name) const;
diff --git a/muse2/muse/help.cpp b/muse2/muse/help.cpp
index 82d900f1..f0d7b666 100644
--- a/muse2/muse/help.cpp
+++ b/muse2/muse/help.cpp
@@ -8,8 +8,9 @@
#include <unistd.h>
#include <stdlib.h>
-#include <qmessagebox.h>
-#include <q3process.h>
+
+#include <QMessageBox>
+#include <QProcess>
#include "app.h"
#include "globals.h"
@@ -98,11 +99,12 @@ void MusE::launchBrowser(QString &whereTo)
QString exe = QString("/bin/sh");
if(QFile::exists(exe))
{
- Q3Process helper(this);
- helper.addArgument(exe);
- helper.addArgument("-c");
- helper.addArgument(config.helpBrowser + " " + whereTo);
- helper.start();
+ // Orcan: Shall we use this instead? Opens the default browser of the user:
+ // QDesktopServices::openUrl(QUrl(whereTo));
+ QStringList arguments;
+ arguments << "-c" << config.helpBrowser << whereTo;
+ QProcess helper;
+ helper.start(exe, arguments);
}
else
{
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index e06f6800..b623f56f 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -65,25 +65,42 @@ static const int xscale = -10;
static const int yscale = 1;
static const int drumeditTools = PointerTool | PencilTool | RubberTool;
+enum DrumColumn {
+ COL_MUTE = 0,
+ COL_NAME,
+ COL_VOLUME,
+ COL_QUANT,
+ COL_INPUTTRIGGER,
+ COL_NOTELENGTH,
+ COL_NOTE,
+ COL_OUTCHANNEL,
+ COL_OUTPORT,
+ COL_LEVEL1,
+ COL_LEVEL2,
+ COL_LEVEL3,
+ COL_LEVEL4,
+ COL_NONE = -1
+};
+
//---------------------------------------------------------
// setHeaderWhatsThis
//---------------------------------------------------------
void DrumEdit::setHeaderWhatsThis()
{
- header->setWhatsThis(0, tr("mute instrument"));
- header->setWhatsThis(1, tr("sound name"));
- header->setWhatsThis(2, tr("volume percent"));
- header->setWhatsThis(3, tr("quantisation"));
- header->setWhatsThis(4, tr("this input note triggers the sound"));
- header->setWhatsThis(5, tr("note length"));
- header->setWhatsThis(6, tr("this is the note which is played"));
- header->setWhatsThis(7, tr("output channel (hold ctl to affect all rows)"));
- header->setWhatsThis(8, tr("output port"));
- header->setWhatsThis(9, tr("shift + control key: draw velocity level 1"));
- header->setWhatsThis(10, tr("control key: draw velocity level 2"));
- header->setWhatsThis(11, tr("shift key: draw velocity level 3"));
- header->setWhatsThis(12, tr("draw velocity level 4"));
+ header->setWhatsThis(COL_MUTE, tr("mute instrument"));
+ header->setWhatsThis(COL_NAME, tr("sound name"));
+ header->setWhatsThis(COL_VOLUME, tr("volume percent"));
+ header->setWhatsThis(COL_QUANT, tr("quantisation"));
+ header->setWhatsThis(COL_INPUTTRIGGER, tr("this input note triggers the sound"));
+ header->setWhatsThis(COL_NOTELENGTH, tr("note length"));
+ header->setWhatsThis(COL_NOTE, tr("this is the note which is played"));
+ header->setWhatsThis(COL_OUTCHANNEL, tr("output channel (hold ctl to affect all rows)"));
+ header->setWhatsThis(COL_OUTPORT, tr("output port"));
+ header->setWhatsThis(COL_LEVEL1, tr("shift + control key: draw velocity level 1"));
+ header->setWhatsThis(COL_LEVEL2, tr("control key: draw velocity level 2"));
+ header->setWhatsThis(COL_LEVEL3, tr("shift key: draw velocity level 3"));
+ header->setWhatsThis(COL_LEVEL4, tr("draw velocity level 4"));
}
//---------------------------------------------------------
@@ -92,19 +109,19 @@ void DrumEdit::setHeaderWhatsThis()
void DrumEdit::setHeaderToolTips()
{
- header->setToolTip(0, tr("mute instrument"));
- header->setToolTip(1, tr("sound name"));
- header->setToolTip(2, tr("volume percent"));
- header->setToolTip(3, tr("quantisation"));
- header->setToolTip(4, tr("this input note triggers the sound"));
- header->setToolTip(5, tr("note length"));
- header->setToolTip(6, tr("this is the note which is played"));
- header->setToolTip(7, tr("output channel (ctl: affect all rows)"));
- header->setToolTip(8, tr("output port"));
- header->setToolTip(9, tr("shift + control key: draw velocity level 1"));
- header->setToolTip(10, tr("control key: draw velocity level 2"));
- header->setToolTip(11, tr("shift key: draw velocity level 3"));
- header->setToolTip(12, tr("draw velocity level 4"));
+ header->setToolTip(COL_MUTE, tr("mute instrument"));
+ header->setToolTip(COL_NAME, tr("sound name"));
+ header->setToolTip(COL_VOLUME, tr("volume percent"));
+ header->setToolTip(COL_QUANT, tr("quantisation"));
+ header->setToolTip(COL_INPUTTRIGGER, tr("this input note triggers the sound"));
+ header->setToolTip(COL_NOTELENGTH, tr("note length"));
+ header->setToolTip(COL_NOTE, tr("this is the note which is played"));
+ header->setToolTip(COL_OUTCHANNEL, tr("output channel (ctl: affect all rows)"));
+ header->setToolTip(COL_OUTPORT, tr("output port"));
+ header->setToolTip(COL_LEVEL1, tr("shift + control key: draw velocity level 1"));
+ header->setToolTip(COL_LEVEL2, tr("control key: draw velocity level 2"));
+ header->setToolTip(COL_LEVEL3, tr("shift key: draw velocity level 3"));
+ header->setToolTip(COL_LEVEL4, tr("draw velocity level 4"));
}
//---------------------------------------------------------
@@ -342,19 +359,19 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
//
header = new HeaderNew(split1w1, "header");
header->setFixedHeight(31);
- header->addLabel(tr("M"), 20);
- header->addLabel(tr("Sound"), 120);
- header->addLabel(tr("Vol"));
- header->addLabel(tr("QNT"), 30);
- header->addLabel(tr("E-Note"), 50);
- header->addLabel(tr("Len"));
- header->addLabel(tr("A-Note"), 50);
- header->addLabel(tr("Ch"));
- header->addLabel(tr("Port"), 70);
- header->addLabel(tr("LV1"));
- header->addLabel(tr("LV2"));
- header->addLabel(tr("LV3"));
- header->addLabel(tr("LV4"));
+ header->setColumnLabel(tr("M"), COL_MUTE, 20);
+ header->setColumnLabel(tr("Sound"), COL_NAME, 120);
+ header->setColumnLabel(tr("Vol"), COL_VOLUME);
+ header->setColumnLabel(tr("QNT"), COL_QUANT, 30);
+ header->setColumnLabel(tr("E-Note"), COL_INPUTTRIGGER, 50);
+ header->setColumnLabel(tr("Len"), COL_NOTELENGTH);
+ header->setColumnLabel(tr("A-Note"), COL_NOTE, 50);
+ header->setColumnLabel(tr("Ch"), COL_OUTCHANNEL);
+ header->setColumnLabel(tr("Port"), COL_OUTPORT, 70);
+ header->setColumnLabel(tr("LV1"), COL_LEVEL1);
+ header->setColumnLabel(tr("LV2"), COL_LEVEL2);
+ header->setColumnLabel(tr("LV3"), COL_LEVEL3);
+ header->setColumnLabel(tr("LV4"), COL_LEVEL4);
setHeaderToolTips();
setHeaderWhatsThis();
diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp
index 866fa21f..0267763a 100644
--- a/muse2/muse/track.cpp
+++ b/muse2/muse/track.cpp
@@ -6,9 +6,6 @@
// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
//=========================================================
-//#include <qt.h>
-#include <qstring.h>
-
#include "track.h"
#include "event.h"
#include "mididev.h"
diff --git a/muse2/muse/track.h b/muse2/muse/track.h
index 0d9c3f6e..eb5db071 100644
--- a/muse2/muse/track.h
+++ b/muse2/muse/track.h
@@ -9,7 +9,8 @@
#ifndef __TRACK_H__
#define __TRACK_H__
-#include <qstring.h>
+#include <QString>
+
#include <vector>
#include <algorithm>
diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp
index fe53b16e..f82c7c22 100644
--- a/muse2/muse/widgets/header.cpp
+++ b/muse2/muse/widgets/header.cpp
@@ -11,7 +11,7 @@
#include <QStandardItemModel>
-
+/*
//---------------------------------------------------------
// readStatus
//---------------------------------------------------------
@@ -62,7 +62,7 @@ void Header::writeStatus(int level, Xml& xml) const
//xml.put("</%s>", name());
xml.put("</%s>", Xml::xmlString(name()).latin1());
}
-
+*/
//---------------------------------------------------------
@@ -117,7 +117,7 @@ void HeaderNew::writeStatus(int level, Xml& xml) const
}
//---------------------------------------------------------
-// writeStatus
+// HeaderNew
//---------------------------------------------------------
HeaderNew::HeaderNew(QWidget* parent, const char* name)
@@ -126,23 +126,20 @@ HeaderNew::HeaderNew(QWidget* parent, const char* name)
setObjectName(name);
itemModel = new QStandardItemModel;
setModel(itemModel);
- columncount = 0;
//setResizeMode(QHeaderView::ResizeToContents);
setDefaultSectionSize(30);
}
//---------------------------------------------------------
-// addLabel
+// setColumnLabel
//---------------------------------------------------------
-int HeaderNew::addLabel(const QString & text, int size )
+void HeaderNew::setColumnLabel(const QString & text, int col, int width )
{
QStandardItem *sitem = new QStandardItem(text );
- itemModel->setHorizontalHeaderItem(columncount, sitem);
- if (size > -1)
- resizeSection(columncount, size);
-
- return columncount++;
+ itemModel->setHorizontalHeaderItem(col, sitem);
+ if (width > -1)
+ resizeSection(col, width);
}
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h
index 850b6676..2c2c00f5 100644
--- a/muse2/muse/widgets/header.h
+++ b/muse2/muse/widgets/header.h
@@ -15,6 +15,7 @@ class QStandardItemModel;
class Xml;
+/*
//---------------------------------------------------------
// Header
//---------------------------------------------------------
@@ -30,7 +31,7 @@ class Header : public Q3Header {
void writeStatus(int level, Xml&) const;
void readStatus(Xml&);
};
-
+*/
// ORCAN - TODO: Once everything is ported to use the new class below, we
// can remove the above Qt3 based class.
@@ -39,13 +40,12 @@ class HeaderNew : public QHeaderView {
Q_OBJECT
QStandardItemModel *itemModel;
- int columncount;
public:
HeaderNew(QWidget* parent=0, const char* name=0);
void writeStatus(int level, Xml&) const;
void readStatus(Xml&);
- int addLabel ( const QString & s, int size = -1 );
+ void setColumnLabel( const QString & s, int col, int width = -1 );
void setToolTip(int col, const QString &text);
void setWhatsThis(int col, const QString &text);
};