diff options
Diffstat (limited to 'src/gui/widgets/Rotary.cpp')
-rw-r--r-- | src/gui/widgets/Rotary.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/gui/widgets/Rotary.cpp b/src/gui/widgets/Rotary.cpp index 36d5817..f7cd1ec 100644 --- a/src/gui/widgets/Rotary.cpp +++ b/src/gui/widgets/Rotary.cpp @@ -31,19 +31,19 @@ #include "TextFloat.h" #include <kapplication.h> #include <klocale.h> -#include <qbrush.h> -#include <qcolor.h> -#include <qdialog.h> -#include <qimage.h> -#include <qpainter.h> -#include <qpalette.h> -#include <qpen.h> -#include <qpixmap.h> -#include <qpoint.h> -#include <qstring.h> -#include <qtimer.h> -#include <qtooltip.h> -#include <qwidget.h> +#include <tqbrush.h> +#include <tqcolor.h> +#include <tqdialog.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqpalette.h> +#include <tqpen.h> +#include <tqpixmap.h> +#include <tqpoint.h> +#include <tqstring.h> +#include <tqtimer.h> +#include <tqtooltip.h> +#include <tqwidget.h> #include <cmath> @@ -55,12 +55,12 @@ namespace Rosegarden #define ROTARY_RANGE (ROTARY_MAX - ROTARY_MIN) static TextFloat* _float = 0; -static QTimer *_floatTimer = 0; +static TQTimer *_floatTimer = 0; Rotary::PixmapCache Rotary::m_pixmaps; -Rotary::Rotary(QWidget *parent, +Rotary::Rotary(TQWidget *parent, float minValue, float maxValue, float step, @@ -71,7 +71,7 @@ Rotary::Rotary(QWidget *parent, bool snapToTicks, bool centred, bool logarithmic) : - QWidget(parent), + TQWidget(parent), m_minValue(minValue), m_maxValue(maxValue), m_step(step), @@ -95,15 +95,15 @@ Rotary::Rotary(QWidget *parent, _float = new TextFloat(this); if (!_floatTimer) { - _floatTimer = new QTimer(); + _floatTimer = new TQTimer(); } // connect timer - connect(_floatTimer, SIGNAL(timeout()), this, - SLOT(slotFloatTimeout())); + connect(_floatTimer, TQT_SIGNAL(timeout()), this, + TQT_SLOT(slotFloatTimeout())); _float->hide(); - QToolTip::add + TQToolTip::add (this, i18n("Click and drag up and down or left and right to modify.\nDouble click to edit value directly.")); setFixedSize(size, size); @@ -115,8 +115,8 @@ Rotary::~Rotary() { // Remove this connection // - disconnect(_floatTimer, SIGNAL(timeout()), this, - SLOT(slotFloatTimeout())); + disconnect(_floatTimer, TQT_SIGNAL(timeout()), this, + TQT_SLOT(slotFloatTimeout())); delete _float; _float = 0; @@ -130,16 +130,16 @@ Rotary::slotFloatTimeout() } void -Rotary::setKnobColour(const QColor &colour) +Rotary::setKnobColour(const TQColor &colour) { m_knobColour = colour; repaint(); } void -Rotary::paintEvent(QPaintEvent *) +Rotary::paintEvent(TQPaintEvent *) { - QPainter paint; + TQPainter paint; double angle = ROTARY_MIN // offset + (ROTARY_RANGE * @@ -178,12 +178,12 @@ Rotary::paintEvent(QPaintEvent *) int scale = 4; int width = m_size * scale; - QPixmap map(width, width); + TQPixmap map(width, width); map.fill(paletteBackgroundColor()); paint.begin(&map); - QPen pen; - pen.setColor(kapp->palette().color(QPalette::Active, QColorGroup::Dark)); + TQPen pen; + pen.setColor(kapp->palette().color(TQPalette::Active, TQColorGroup::Dark)); pen.setWidth(scale); paint.setPen(pen); @@ -191,10 +191,10 @@ Rotary::paintEvent(QPaintEvent *) paint.setBrush(m_knobColour); } else { paint.setBrush( - kapp->palette().color(QPalette::Active, QColorGroup::Base)); + kapp->palette().color(TQPalette::Active, TQColorGroup::Base)); } - QColor c(m_knobColour); + TQColor c(m_knobColour); pen.setColor(c); paint.setPen(pen); @@ -221,7 +221,7 @@ Rotary::paintEvent(QPaintEvent *) --darkWidth; } - paint.setBrush(QBrush::NoBrush); + paint.setBrush(TQBrush::NoBrush); pen.setColor(colorGroup().dark()); pen.setWidth(scale); @@ -296,15 +296,15 @@ Rotary::paintEvent(QPaintEvent *) paint.end(); - QImage i = map.convertToImage().smoothScale(m_size, m_size); - m_pixmaps[index] = QPixmap(i); + TQImage i = map.convertToImage().smoothScale(m_size, m_size); + m_pixmaps[index] = TQPixmap(i); paint.begin(this); paint.drawPixmap(0, 0, m_pixmaps[index]); paint.end(); } void -Rotary::drawTick(QPainter &paint, double angle, int size, bool internal) +Rotary::drawTick(TQPainter &paint, double angle, int size, bool internal) { double hyp = double(size) / 2.0; double x0 = hyp - (hyp - 1) * sin(angle); @@ -371,7 +371,7 @@ Rotary::snapPosition() } void -Rotary::mousePressEvent(QMouseEvent *e) +Rotary::mousePressEvent(TQMouseEvent *e) { if (e->button() == LeftButton) { m_buttonPressed = true; @@ -391,16 +391,16 @@ Rotary::mousePressEvent(QMouseEvent *e) emit valueChanged(m_snapPosition); } - QPoint totalPos = mapTo(topLevelWidget(), QPoint(0, 0)); + TQPoint totalPos = mapTo(topLevelWidget(), TQPoint(0, 0)); if (!_float) _float = new TextFloat(this); _float->reparent(this); - _float->move(totalPos + QPoint(width() + 2, -height() / 2)); + _float->move(totalPos + TQPoint(width() + 2, -height() / 2)); if (m_logarithmic) { - _float->setText(QString("%1").arg(powf(10, m_position))); + _float->setText(TQString("%1").arg(powf(10, m_position))); } else { - _float->setText(QString("%1").arg(m_position)); + _float->setText(TQString("%1").arg(m_position)); } _float->show(); @@ -414,7 +414,7 @@ Rotary::mousePressEvent(QMouseEvent *e) } void -Rotary::mouseDoubleClickEvent(QMouseEvent * /*e*/) +Rotary::mouseDoubleClickEvent(TQMouseEvent * /*e*/) { float minv = m_minValue; float maxv = m_maxValue; @@ -437,7 +437,7 @@ Rotary::mouseDoubleClickEvent(QMouseEvent * /*e*/) val, step); - if (dialog.exec() == QDialog::Accepted) { + if (dialog.exec() == TQDialog::Accepted) { float newval = dialog.getValue(); if (m_logarithmic) { if (m_position < powf(10, -10)) m_position = -10; @@ -453,7 +453,7 @@ Rotary::mouseDoubleClickEvent(QMouseEvent * /*e*/) } void -Rotary::mouseReleaseEvent(QMouseEvent *e) +Rotary::mouseReleaseEvent(TQMouseEvent *e) { if (e->button() == LeftButton) { m_buttonPressed = false; @@ -468,7 +468,7 @@ Rotary::mouseReleaseEvent(QMouseEvent *e) } void -Rotary::mouseMoveEvent(QMouseEvent *e) +Rotary::mouseMoveEvent(TQMouseEvent *e) { if (m_buttonPressed) { // Dragging by x or y axis when clicked modifies value @@ -498,15 +498,15 @@ Rotary::mouseMoveEvent(QMouseEvent *e) // draw on the float text if (m_logarithmic) { - _float->setText(QString("%1").arg(powf(10, m_snapPosition))); + _float->setText(TQString("%1").arg(powf(10, m_snapPosition))); } else { - _float->setText(QString("%1").arg(m_snapPosition)); + _float->setText(TQString("%1").arg(m_snapPosition)); } } } void -Rotary::wheelEvent(QWheelEvent *e) +Rotary::wheelEvent(TQWheelEvent *e) { if (e->delta() > 0) m_position -= m_pageStep; @@ -527,17 +527,17 @@ Rotary::wheelEvent(QWheelEvent *e) // draw on the float text if (m_logarithmic) { - _float->setText(QString("%1").arg(powf(10, m_snapPosition))); + _float->setText(TQString("%1").arg(powf(10, m_snapPosition))); } else { - _float->setText(QString("%1").arg(m_snapPosition)); + _float->setText(TQString("%1").arg(m_snapPosition)); } // Reposition - we need to sum the relative positions up to the // topLevel or dialog to please move(). Move just top/right of the rotary // - QPoint totalPos = mapTo(topLevelWidget(), QPoint(0, 0)); + TQPoint totalPos = mapTo(topLevelWidget(), TQPoint(0, 0)); _float->reparent(this); - _float->move(totalPos + QPoint(width() + 2, -height() / 2)); + _float->move(totalPos + TQPoint(width() + 2, -height() / 2)); _float->show(); // one shot, 500ms |