summaryrefslogtreecommitdiffstats
path: root/src/gui/rulers/TempoRuler.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-02 22:38:52 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-02 22:38:52 +0000
commit458efa7b0c935cbaafa2791021a5f8f7241aa876 (patch)
tree624583f2873febe23770bee3fa94b5c24bd59f4f /src/gui/rulers/TempoRuler.cpp
parent747037b72944ae2c02962b7c5c96e0a7f8852e38 (diff)
downloadrosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.tar.gz
rosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.zip
Initial TQt4 port of Rosegarden
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1230242 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/rulers/TempoRuler.cpp')
-rw-r--r--src/gui/rulers/TempoRuler.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/gui/rulers/TempoRuler.cpp b/src/gui/rulers/TempoRuler.cpp
index 554d4b2..f5f600a 100644
--- a/src/gui/rulers/TempoRuler.cpp
+++ b/src/gui/rulers/TempoRuler.cpp
@@ -66,13 +66,13 @@ namespace Rosegarden
TempoRuler::TempoRuler(RulerScale *rulerScale,
RosegardenGUIDoc *doc,
- KMainWindow *parentMainWindow,
+ KMainWindow *tqparentMainWindow,
double xorigin,
int height,
bool small,
- TQWidget *parent,
+ TQWidget *tqparent,
const char *name) :
- TQWidget(parent, name),
+ TQWidget(tqparent, name),
m_xorigin(xorigin),
m_height(height),
m_currentXOffset(0),
@@ -96,7 +96,7 @@ TempoRuler::TempoRuler(RulerScale *rulerScale,
m_composition(&doc->getComposition()),
m_rulerScale(rulerScale),
m_menu(0),
- m_parentMainWindow(parentMainWindow),
+ m_tqparentMainWindow(tqparentMainWindow),
m_fontMetrics(m_boldFont)
{
// m_font.setPointSize(m_small ? 9 : 11);
@@ -114,7 +114,7 @@ TempoRuler::TempoRuler(RulerScale *rulerScale,
m_textFloat->hide();
// setBackgroundColor(GUIPalette::getColour(GUIPalette::TextRulerBackground));
- setBackgroundMode(Qt::NoBackground);
+ setBackgroundMode(TQt::NoBackground);
TQObject::connect
(doc->getCommandHistory(), TQT_SIGNAL(commandExecuted()),
@@ -124,37 +124,37 @@ TempoRuler::TempoRuler(RulerScale *rulerScale,
TQIconSet icon;
icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/event-insert-tempo.png"));
- new KAction(i18n("Insert Tempo Change"), icon, 0, this,
+ new KAction(i18n("Insert Tempo Change"), icon, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotInsertTempoHere()), actionCollection(),
"insert_tempo_here");
- new KAction(i18n("Insert Tempo Change at Playback Position"), 0, 0, this,
+ new KAction(i18n("Insert Tempo Change at Playback Position"), 0, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotInsertTempoAtPointer()), actionCollection(),
"insert_tempo_at_pointer");
icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/event-delete.png"));
- new KAction(i18n("Delete Tempo Change"), icon, 0, this,
+ new KAction(i18n("Delete Tempo Change"), icon, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotDeleteTempoChange()), actionCollection(),
"delete_tempo");
- new KAction(i18n("Ramp Tempo to Next Tempo"), 0, 0, this,
+ new KAction(i18n("Ramp Tempo to Next Tempo"), 0, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotRampToNext()), actionCollection(),
"ramp_to_next");
- new KAction(i18n("Un-Ramp Tempo"), 0, 0, this,
+ new KAction(i18n("Un-Ramp Tempo"), 0, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotUnramp()), actionCollection(),
"unramp");
icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/event-edit.png"));
- new KAction(i18n("Edit Tempo..."), icon, 0, this,
+ new KAction(i18n("Edit Tempo..."), icon, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotEditTempo()), actionCollection(),
"edit_tempo");
- new KAction(i18n("Edit Time Signature..."), 0, 0, this,
+ new KAction(i18n("Edit Time Signature..."), 0, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotEditTimeSignature()), actionCollection(),
"edit_time_signature");
- new KAction(i18n("Open Tempo and Time Signature Editor"), 0, 0, this,
+ new KAction(i18n("Open Tempo and Time Signature Editor"), 0, 0, TQT_TQOBJECT(this),
TQT_SLOT(slotEditTempos()), actionCollection(),
"edit_tempos");
@@ -165,7 +165,7 @@ TempoRuler::~TempoRuler()
{
// we have to do this so that the menu is re-created properly
// when the main window is itself recreated (on a File->New for instance)
- KXMLGUIFactory* factory = m_parentMainWindow->factory();
+ KXMLGUIFactory* factory = m_tqparentMainWindow->factory();
if (factory)
factory->removeClient(this);
}
@@ -231,17 +231,17 @@ TempoRuler::slotScrollHoriz(int x)
if (dx > 0) { // moving right, so the existing stuff moves left
bitBlt(this, 0, 0, this, dx, 0, w - dx, h);
- repaint(w - dx, 0, dx, h);
+ tqrepaint(w - dx, 0, dx, h);
} else { // moving left, so the existing stuff moves right
bitBlt(this, -dx, 0, this, 0, 0, w + dx, h);
- repaint(0, 0, -dx, h);
+ tqrepaint(0, 0, -dx, h);
}
}
void
TempoRuler::mousePressEvent(TQMouseEvent *e)
{
- if (e->button() == LeftButton) {
+ if (e->button() == Qt::LeftButton) {
if (e->type() == TQEvent::MouseButtonDblClick) {
timeT t = m_rulerScale->getTimeForX
@@ -269,13 +269,13 @@ TempoRuler::mousePressEvent(TQMouseEvent *e)
m_dragStartTarget = tr.first ? tr.second : -1;
m_dragOriginalTempo = m_dragStartTempo;
m_dragOriginalTarget = m_dragStartTarget;
- m_dragFine = ((e->state() & Qt::ShiftButton) != 0);
+ m_dragFine = ((e->state() & TQt::ShiftButton) != 0);
int px = m_rulerScale->getXForTime(tc.first) + m_currentXOffset + m_xorigin;
if (x >= px && x < px + 5) {
m_dragHoriz = true;
m_dragVert = false;
- setCursor(Qt::SplitHCursor);
+ setCursor(TQt::SplitHCursor);
} else {
timeT nt = m_composition->getEndMarker();
if (tcn < m_composition->getTempoChangeCount() - 1) {
@@ -284,16 +284,16 @@ TempoRuler::mousePressEvent(TQMouseEvent *e)
int nx = m_rulerScale->getXForTime(nt) + m_currentXOffset + m_xorigin;
if (x > px + 5 && x > nx - 5) {
m_dragTarget = true;
- setCursor(Qt::SizeVerCursor);
+ setCursor(TQt::SizeVerCursor);
} else {
m_dragTarget = false;
- setCursor(Qt::SplitVCursor);
+ setCursor(TQt::SplitVCursor);
}
m_dragVert = true;
m_dragHoriz = false;
}
- } else if (e->button() == RightButton) {
+ } else if (e->button() == Qt::RightButton) {
m_clickX = e->x();
if (!m_menu)
@@ -371,7 +371,7 @@ TempoRuler::mouseReleaseEvent(TQMouseEvent *e)
void
TempoRuler::mouseMoveEvent(TQMouseEvent *e)
{
- bool shiftPressed = ((e->state() & Qt::ShiftButton) != 0);
+ bool shiftPressed = ((e->state() & TQt::ShiftButton) != 0);
if (m_dragVert) {
@@ -555,20 +555,20 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target,
// blargh -- duplicated with TempoView::makeTimeString
timeText = TQString("%1%2%3-%4%5-%6%7-%8%9")
- .arg(bar / 100)
- .arg((bar % 100) / 10)
- .arg(bar % 10)
- .arg(beat / 10)
- .arg(beat % 10)
- .arg(fraction / 10)
- .arg(fraction % 10)
- .arg(remainder / 10)
- .arg(remainder % 10);
+ .tqarg(bar / 100)
+ .tqarg((bar % 100) / 10)
+ .tqarg(bar % 10)
+ .tqarg(beat / 10)
+ .tqarg(beat % 10)
+ .tqarg(fraction / 10)
+ .tqarg(fraction % 10)
+ .tqarg(remainder / 10)
+ .tqarg(remainder % 10);
timeText = TQString("%1\n%2")
- .arg(timeText)
- // .arg(rt.toString().c_str());
- .arg(rt.toText(true).c_str());
+ .tqarg(timeText)
+ // .tqarg(rt.toString().c_str());
+ .tqarg(rt.toText(true).c_str());
}
TimeSignature sig =
@@ -586,14 +586,14 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target,
int b00 = int(bpm * 100 + 0.0001) % 10;
tempoText = i18n("%1.%2%3 (%4.%5%6 bpm)")
- .arg(qi).arg(q0).arg(q00)
- .arg(bi).arg(b0).arg(b00);
+ .tqarg(qi).tqarg(q0).tqarg(q00)
+ .tqarg(bi).tqarg(b0).tqarg(b00);
haveSet = true;
}
}
if (!haveSet) {
- tempoText = i18n("%1.%2%3 bpm").arg(qi).arg(q0).arg(q00);
+ tempoText = i18n("%1.%2%3 bpm").tqarg(qi).tqarg(q0).tqarg(q00);
}
if (target > 0 && target != tempo) {
@@ -601,11 +601,11 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target,
int tqi = int(tq + 0.0001);
int tq0 = int(tq * 10 + 0.0001) % 10;
int tq00 = int(tq * 100 + 0.0001) % 10;
- tempoText = i18n("%1 - %2.%3%4").arg(tempoText).arg(tqi).arg(tq0).arg(tq00);
+ tempoText = i18n("%1 - %2.%3%4").tqarg(tempoText).tqarg(tqi).tqarg(tq0).tqarg(tq00);
}
if (showTime && time >= 0) {
- m_textFloat->setText(TQString("%1\n%2").arg(timeText).arg(tempoText));
+ m_textFloat->setText(TQString("%1\n%2").tqarg(timeText).tqarg(tempoText));
} else {
m_textFloat->setText(tempoText);
}
@@ -614,12 +614,12 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target,
// std::cerr << "cp = " << cp.x() << "," << cp.y() << ", tempo = " << qpm << std::endl;
TQPoint mp = cp + pos();
- TQWidget *parent = parentWidget();
- while (parent->parentWidget() &&
- !parent->isTopLevel() &&
- !parent->isDialog()) {
- mp += parent->pos();
- parent = parent->parentWidget();
+ TQWidget *tqparent = tqparentWidget();
+ while (tqparent->tqparentWidget() &&
+ !tqparent->isTopLevel() &&
+ !tqparent->isDialog()) {
+ mp += tqparent->pos();
+ tqparent = tqparent->tqparentWidget();
}
int yoff = cp.y() + m_textFloat->height() + 3;
@@ -629,8 +629,8 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target,
m_textFloat->show();
}
-QSize
-TempoRuler::sizeHint() const
+TQSize
+TempoRuler::tqsizeHint() const
{
double width =
m_rulerScale->getBarPosition(m_rulerScale->getLastVisibleBar()) +
@@ -642,8 +642,8 @@ TempoRuler::sizeHint() const
return res;
}
-QSize
-TempoRuler::minimumSizeHint() const
+TQSize
+TempoRuler::tqminimumSizeHint() const
{
double firstBarWidth = m_rulerScale->getBarWidth(0) + m_xorigin;
TQSize res = TQSize(int(firstBarWidth), m_height);
@@ -829,7 +829,7 @@ TempoRuler::paintEvent(TQPaintEvent* e)
bool illuminateLine = (illuminate &&
!m_illuminatePoint && !m_illuminateTarget);
- paint.setPen(illuminateLine ? Qt::white : Qt::black);
+ paint.setPen(illuminateLine ? TQt::white : TQt::black);
if (ramping.first) {
ry = getYForTempo(ramping.second);
@@ -846,7 +846,7 @@ TempoRuler::paintEvent(TQPaintEvent* e)
if (!illuminateLine && illuminate && m_illuminateTarget) {
if (x > lastx) {
- paint.setPen(Qt::white);
+ paint.setPen(TQt::white);
paint.drawLine(x - 6, ry - ((ry - lasty) * 6) / (x - lastx),
x - 2, ry);
}
@@ -858,10 +858,10 @@ TempoRuler::paintEvent(TQPaintEvent* e)
bool illuminatePoint = (illuminate && m_illuminatePoint);
- paint.setPen(illuminatePoint ? Qt::white : Qt::black);
+ paint.setPen(illuminatePoint ? TQt::white : TQt::black);
paint.drawRect(x - 1, y - 1, 3, 3);
- paint.setPen(illuminatePoint ? Qt::black : Qt::white);
+ paint.setPen(illuminatePoint ? TQt::black : TQt::white);
paint.drawPoint(x, y);
}
@@ -883,7 +883,7 @@ TempoRuler::paintEvent(TQPaintEvent* e)
if (haveSome) {
bool illuminateLine = (illuminate && !m_illuminatePoint);
- paint.setPen(illuminateLine ? Qt::white : Qt::black);
+ paint.setPen(illuminateLine ? TQt::white : TQt::black);
paint.drawLine(lastx + 1, lasty, width(), lasty);
} else if (!m_refreshLinesOnly) {
tempoT tempo = m_composition->getTempoAtTime(from);
@@ -893,8 +893,8 @@ TempoRuler::paintEvent(TQPaintEvent* e)
paint.drawRect(e->rect());
}
- paint.setPen(Qt::black);
- paint.setBrush(Qt::black);
+ paint.setPen(TQt::black);
+ paint.setBrush(TQt::black);
paint.drawLine(0, 0, width(), 0);
for (TimePoints::iterator i = timePoints.begin();
@@ -917,8 +917,8 @@ TempoRuler::paintEvent(TQPaintEvent* e)
m_composition->getTimeSignatureAt(time);
TQString str = TQString("%1/%2")
- .arg(sig.getNumerator())
- .arg(sig.getDenominator());
+ .tqarg(sig.getNumerator())
+ .tqarg(sig.getDenominator());
paint.setFont(m_boldFont);
paint.drawText(static_cast<int>(x) + 2, m_height - 2, str);
@@ -930,7 +930,7 @@ TempoRuler::paintEvent(TQPaintEvent* e)
long bpm = long(tempo);
// long frac = long(tempo * 100 + 0.001) - 100 * bpm;
- TQString tempoString = TQString("%1").arg(bpm);
+ TQString tempoString = TQString("%1").tqarg(bpm);
if (tempo == prevTempo) {
if (m_small)
@@ -1074,7 +1074,7 @@ TempoRuler::createMenu()
{
setXMLFile("temporuler.rc");
- KXMLGUIFactory* factory = m_parentMainWindow->factory();
+ KXMLGUIFactory* factory = m_tqparentMainWindow->factory();
factory->addClient(this);
TQWidget* tmp = factory->container("tempo_ruler_menu", this);