diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-06 20:59:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-06 20:59:29 +0000 |
commit | 11f31c37e5fa4889d9989f10272f44845449cb7b (patch) | |
tree | 4383da04a76c497950d957fc6120b0fd0d9082c2 /src/gui/rulers/TempoRuler.cpp | |
parent | 832eb69d571e8e518db45d0c0e6fbc0f00690209 (diff) | |
download | rosegarden-11f31c37e5fa4889d9989f10272f44845449cb7b.tar.gz rosegarden-11f31c37e5fa4889d9989f10272f44845449cb7b.zip |
Initial TQt conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1172292 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/rulers/TempoRuler.cpp')
-rw-r--r-- | src/gui/rulers/TempoRuler.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/src/gui/rulers/TempoRuler.cpp b/src/gui/rulers/TempoRuler.cpp index 270b224..554d4b2 100644 --- a/src/gui/rulers/TempoRuler.cpp +++ b/src/gui/rulers/TempoRuler.cpp @@ -44,21 +44,21 @@ #include <kglobal.h> #include <kxmlguiclient.h> #include <kxmlguifactory.h> -#include <qcolor.h> -#include <qcursor.h> -#include <qevent.h> -#include <qfont.h> -#include <qfontmetrics.h> -#include <qiconset.h> -#include <qobject.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qpoint.h> -#include <qpopupmenu.h> -#include <qrect.h> -#include <qsize.h> -#include <qstring.h> -#include <qwidget.h> +#include <tqcolor.h> +#include <tqcursor.h> +#include <tqevent.h> +#include <tqfont.h> +#include <tqfontmetrics.h> +#include <tqiconset.h> +#include <tqobject.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqpoint.h> +#include <tqpopupmenu.h> +#include <tqrect.h> +#include <tqsize.h> +#include <tqstring.h> +#include <tqwidget.h> namespace Rosegarden @@ -70,9 +70,9 @@ TempoRuler::TempoRuler(RulerScale *rulerScale, double xorigin, int height, bool small, - QWidget *parent, + TQWidget *parent, const char *name) : - QWidget(parent, name), + TQWidget(parent, name), m_xorigin(xorigin), m_height(height), m_currentXOffset(0), @@ -108,7 +108,7 @@ TempoRuler::TempoRuler(RulerScale *rulerScale, m_font.setPixelSize(m_height / 3); m_boldFont.setPixelSize(m_height * 2 / 5); m_boldFont.setBold(true); - m_fontMetrics = QFontMetrics(m_boldFont); + m_fontMetrics = TQFontMetrics(m_boldFont); m_textFloat = new TextFloat(this); m_textFloat->hide(); @@ -116,46 +116,46 @@ TempoRuler::TempoRuler(RulerScale *rulerScale, // setBackgroundColor(GUIPalette::getColour(GUIPalette::TextRulerBackground)); setBackgroundMode(Qt::NoBackground); - QObject::connect - (doc->getCommandHistory(), SIGNAL(commandExecuted()), - this, SLOT(update())); + TQObject::connect + (doc->getCommandHistory(), TQT_SIGNAL(commandExecuted()), + this, TQT_SLOT(update())); - QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/"); - QIconSet icon; + TQString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/"); + TQIconSet icon; - icon = QIconSet(QPixmap(pixmapDir + "/toolbar/event-insert-tempo.png")); + icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/event-insert-tempo.png")); new KAction(i18n("Insert Tempo Change"), icon, 0, this, - SLOT(slotInsertTempoHere()), actionCollection(), + TQT_SLOT(slotInsertTempoHere()), actionCollection(), "insert_tempo_here"); new KAction(i18n("Insert Tempo Change at Playback Position"), 0, 0, this, - SLOT(slotInsertTempoAtPointer()), actionCollection(), + TQT_SLOT(slotInsertTempoAtPointer()), actionCollection(), "insert_tempo_at_pointer"); - icon = QIconSet(QPixmap(pixmapDir + "/toolbar/event-delete.png")); + icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/event-delete.png")); new KAction(i18n("Delete Tempo Change"), icon, 0, this, - SLOT(slotDeleteTempoChange()), actionCollection(), + TQT_SLOT(slotDeleteTempoChange()), actionCollection(), "delete_tempo"); new KAction(i18n("Ramp Tempo to Next Tempo"), 0, 0, this, - SLOT(slotRampToNext()), actionCollection(), + TQT_SLOT(slotRampToNext()), actionCollection(), "ramp_to_next"); new KAction(i18n("Un-Ramp Tempo"), 0, 0, this, - SLOT(slotUnramp()), actionCollection(), + TQT_SLOT(slotUnramp()), actionCollection(), "unramp"); - icon = QIconSet(QPixmap(pixmapDir + "/toolbar/event-edit.png")); + icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/event-edit.png")); new KAction(i18n("Edit Tempo..."), icon, 0, this, - SLOT(slotEditTempo()), actionCollection(), + TQT_SLOT(slotEditTempo()), actionCollection(), "edit_tempo"); new KAction(i18n("Edit Time Signature..."), 0, 0, this, - SLOT(slotEditTimeSignature()), actionCollection(), + TQT_SLOT(slotEditTimeSignature()), actionCollection(), "edit_time_signature"); new KAction(i18n("Open Tempo and Time Signature Editor"), 0, 0, this, - SLOT(slotEditTempos()), actionCollection(), + TQT_SLOT(slotEditTempos()), actionCollection(), "edit_tempos"); setMouseTracking(false); @@ -174,47 +174,47 @@ void TempoRuler::connectSignals() { connect(this, - SIGNAL(doubleClicked(timeT)), + TQT_SIGNAL(doubleClicked(timeT)), RosegardenGUIApp::self(), - SLOT(slotEditTempos(timeT))); + TQT_SLOT(slotEditTempos(timeT))); connect(this, - SIGNAL(changeTempo(timeT, + TQT_SIGNAL(changeTempo(timeT, tempoT, tempoT, TempoDialog::TempoDialogAction)), RosegardenGUIApp::self(), - SLOT(slotChangeTempo(timeT, + TQT_SLOT(slotChangeTempo(timeT, tempoT, tempoT, TempoDialog::TempoDialogAction))); connect(this, - SIGNAL(moveTempo(timeT, + TQT_SIGNAL(moveTempo(timeT, timeT)), RosegardenGUIApp::self(), - SLOT(slotMoveTempo(timeT, + TQT_SLOT(slotMoveTempo(timeT, timeT))); connect(this, - SIGNAL(deleteTempo(timeT)), + TQT_SIGNAL(deleteTempo(timeT)), RosegardenGUIApp::self(), - SLOT(slotDeleteTempo(timeT))); + TQT_SLOT(slotDeleteTempo(timeT))); connect(this, - SIGNAL(editTempo(timeT)), + TQT_SIGNAL(editTempo(timeT)), RosegardenGUIApp::self(), - SLOT(slotEditTempo(timeT))); + TQT_SLOT(slotEditTempo(timeT))); connect(this, - SIGNAL(editTimeSignature(timeT)), + TQT_SIGNAL(editTimeSignature(timeT)), RosegardenGUIApp::self(), - SLOT(slotEditTimeSignature(timeT))); + TQT_SLOT(slotEditTimeSignature(timeT))); connect(this, - SIGNAL(editTempos(timeT)), + TQT_SIGNAL(editTempos(timeT)), RosegardenGUIApp::self(), - SLOT(slotEditTempos(timeT))); + TQT_SLOT(slotEditTempos(timeT))); } void @@ -239,11 +239,11 @@ TempoRuler::slotScrollHoriz(int x) } void -TempoRuler::mousePressEvent(QMouseEvent *e) +TempoRuler::mousePressEvent(TQMouseEvent *e) { if (e->button() == LeftButton) { - if (e->type() == QEvent::MouseButtonDblClick) { + if (e->type() == TQEvent::MouseButtonDblClick) { timeT t = m_rulerScale->getTimeForX (e->x() - m_currentXOffset - m_xorigin); emit doubleClicked(t); @@ -301,14 +301,14 @@ TempoRuler::mousePressEvent(QMouseEvent *e) if (m_menu) { // enable 'delete' action only if cursor is actually over a tempo change actionCollection()->action("delete_tempo")->setEnabled(m_illuminatePoint); - m_menu->exec(QCursor::pos()); + m_menu->exec(TQCursor::pos()); } } } void -TempoRuler::mouseReleaseEvent(QMouseEvent *e) +TempoRuler::mouseReleaseEvent(TQMouseEvent *e) { if (m_dragVert) { @@ -369,7 +369,7 @@ TempoRuler::mouseReleaseEvent(QMouseEvent *e) } void -TempoRuler::mouseMoveEvent(QMouseEvent *e) +TempoRuler::mouseMoveEvent(TQMouseEvent *e) { bool shiftPressed = ((e->state() & Qt::ShiftButton) != 0); @@ -510,17 +510,17 @@ TempoRuler::mouseMoveEvent(QMouseEvent *e) } void -TempoRuler::wheelEvent(QWheelEvent *e) +TempoRuler::wheelEvent(TQWheelEvent *e) {} void -TempoRuler::enterEvent(QEvent *) +TempoRuler::enterEvent(TQEvent *) { setMouseTracking(true); } void -TempoRuler::leaveEvent(QEvent *) +TempoRuler::leaveEvent(TQEvent *) { if (!m_dragVert && !m_dragHoriz) { setMouseTracking(false); @@ -543,7 +543,7 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target, bool haveSet = false; - QString tempoText, timeText; + TQString tempoText, timeText; if (time >= 0) { @@ -554,7 +554,7 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target, RealTime rt = m_composition->getElapsedRealTime(time); // blargh -- duplicated with TempoView::makeTimeString - timeText = QString("%1%2%3-%4%5-%6%7-%8%9") + timeText = TQString("%1%2%3-%4%5-%6%7-%8%9") .arg(bar / 100) .arg((bar % 100) / 10) .arg(bar % 10) @@ -565,7 +565,7 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target, .arg(remainder / 10) .arg(remainder % 10); - timeText = QString("%1\n%2") + timeText = TQString("%1\n%2") .arg(timeText) // .arg(rt.toString().c_str()); .arg(rt.toText(true).c_str()); @@ -605,16 +605,16 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target, } if (showTime && time >= 0) { - m_textFloat->setText(QString("%1\n%2").arg(timeText).arg(tempoText)); + m_textFloat->setText(TQString("%1\n%2").arg(timeText).arg(tempoText)); } else { m_textFloat->setText(tempoText); } - QPoint cp = mapFromGlobal(QPoint(QCursor::pos())); + TQPoint cp = mapFromGlobal(TQPoint(TQCursor::pos())); // std::cerr << "cp = " << cp.x() << "," << cp.y() << ", tempo = " << qpm << std::endl; - QPoint mp = cp + pos(); + TQPoint mp = cp + pos(); - QWidget *parent = parentWidget(); + TQWidget *parent = parentWidget(); while (parent->parentWidget() && !parent->isTopLevel() && !parent->isDialog()) { @@ -623,7 +623,7 @@ TempoRuler::showTextFloat(tempoT tempo, tempoT target, } int yoff = cp.y() + m_textFloat->height() + 3; - mp = QPoint(mp.x() + 10, mp.y() > yoff ? mp.y() - yoff : 0); + mp = TQPoint(mp.x() + 10, mp.y() > yoff ? mp.y() - yoff : 0); m_textFloat->move(mp); m_textFloat->show(); @@ -637,7 +637,7 @@ TempoRuler::sizeHint() const m_rulerScale->getBarWidth(m_rulerScale->getLastVisibleBar()) + m_xorigin; - QSize res(std::max(int(width), m_width), m_height); + TQSize res(std::max(int(width), m_width), m_height); return res; } @@ -646,7 +646,7 @@ QSize TempoRuler::minimumSizeHint() const { double firstBarWidth = m_rulerScale->getBarWidth(0) + m_xorigin; - QSize res = QSize(int(firstBarWidth), m_height); + TQSize res = TQSize(int(firstBarWidth), m_height); return res; } @@ -687,18 +687,18 @@ TempoRuler::getTempoForY(int y) } void -TempoRuler::paintEvent(QPaintEvent* e) +TempoRuler::paintEvent(TQPaintEvent* e) { - QRect clipRect = e->rect(); + TQRect clipRect = e->rect(); if (m_buffer.width() < width() || m_buffer.height() < height()) { - m_buffer = QPixmap(width(), height()); + m_buffer = TQPixmap(width(), height()); } m_buffer.fill(GUIPalette::getColour (GUIPalette::TextRulerBackground)); - QPainter paint(&m_buffer); + TQPainter paint(&m_buffer); paint.setPen(GUIPalette::getColour (GUIPalette::TextRulerForeground)); @@ -714,7 +714,7 @@ TempoRuler::paintEvent(QPaintEvent* e) timeT to = m_rulerScale->getTimeForX (clipRect.x() + clipRect.width() - m_currentXOffset + 100 - m_xorigin); - QRect boundsForHeight = m_fontMetrics.boundingRect("019"); + TQRect boundsForHeight = m_fontMetrics.boundingRect("019"); int fontHeight = boundsForHeight.height(); int textY = fontHeight + 2; @@ -800,7 +800,7 @@ TempoRuler::paintEvent(QPaintEvent* e) paletteBackgroundColor()); } */ - QColor colour = TempoColour::getColour(m_composition->getTempoQpm(tempo)); + TQColor colour = TempoColour::getColour(m_composition->getTempoQpm(tempo)); paint.setPen(colour); paint.setBrush(colour); @@ -887,7 +887,7 @@ TempoRuler::paintEvent(QPaintEvent* e) paint.drawLine(lastx + 1, lasty, width(), lasty); } else if (!m_refreshLinesOnly) { tempoT tempo = m_composition->getTempoAtTime(from); - QColor colour = TempoColour::getColour(m_composition->getTempoQpm(tempo)); + TQColor colour = TempoColour::getColour(m_composition->getTempoQpm(tempo)); paint.setPen(colour); paint.setBrush(colour); paint.drawRect(e->rect()); @@ -916,7 +916,7 @@ TempoRuler::paintEvent(QPaintEvent* e) TimeSignature sig = m_composition->getTimeSignatureAt(time); - QString str = QString("%1/%2") + TQString str = TQString("%1/%2") .arg(sig.getNumerator()) .arg(sig.getDenominator()); @@ -930,7 +930,7 @@ TempoRuler::paintEvent(QPaintEvent* e) long bpm = long(tempo); // long frac = long(tempo * 100 + 0.001) - 100 * bpm; - QString tempoString = QString("%1").arg(bpm); + TQString tempoString = TQString("%1").arg(bpm); if (tempo == prevTempo) { if (m_small) @@ -949,7 +949,7 @@ TempoRuler::paintEvent(QPaintEvent* e) prevTempo = tempo; prevBpm = bpm; - QRect bounds = m_fontMetrics.boundingRect(tempoString); + TQRect bounds = m_fontMetrics.boundingRect(tempoString); paint.setFont(m_font); if (time > 0) @@ -964,7 +964,7 @@ TempoRuler::paintEvent(QPaintEvent* e) paint.end(); - QPainter dbpaint(this); + TQPainter dbpaint(this); // dbpaint.drawPixmap(0, 0, m_buffer); dbpaint.drawPixmap(clipRect.x(), clipRect.y(), m_buffer, @@ -1077,9 +1077,9 @@ TempoRuler::createMenu() KXMLGUIFactory* factory = m_parentMainWindow->factory(); factory->addClient(this); - QWidget* tmp = factory->container("tempo_ruler_menu", this); + TQWidget* tmp = factory->container("tempo_ruler_menu", this); - m_menu = dynamic_cast<QPopupMenu*>(tmp); + m_menu = dynamic_cast<TQPopupMenu*>(tmp); if (!m_menu) { RG_DEBUG << "MarkerRuler::createMenu() failed\n"; |