summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog1
-rw-r--r--muse2/muse/master/masteredit.cpp5
-rw-r--r--muse2/muse/widgets/tempolabel.cpp61
-rw-r--r--muse2/muse/widgets/tempolabel.h17
4 files changed, 42 insertions, 42 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 30415c52..7c9ea9f8 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,5 +1,6 @@
07.11.2010
- Conversion of TLLayout class to QT4. (Tim)
+ - Conversion of TempoEdit class to QT4. Displays proper doubles now.
06.11.2010
- Yipee! De retour aux les popup menus 'stay-open'. (Tim)
- Fixed PopupMenu class. All routing popups done (midi trackinfo, midi strip, audio strip).
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index ae7dbecb..5ec6e9b7 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -153,8 +153,9 @@ MasterEdit::MasterEdit()
info->addWidget(curTempo);
info->addWidget(curSig);
connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
- connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
-
+ ///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
+ connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));
+
//---------------------------------------------------
// master
//---------------------------------------------------
diff --git a/muse2/muse/widgets/tempolabel.cpp b/muse2/muse/widgets/tempolabel.cpp
index 35f75b09..25a3176a 100644
--- a/muse2/muse/widgets/tempolabel.cpp
+++ b/muse2/muse/widgets/tempolabel.cpp
@@ -5,9 +5,8 @@
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
//=========================================================
-#include <qapplication.h>
-#include <qstyle.h>
-#include <qvalidator.h>
+#include <QApplication>
+#include <QStyle>
//Added by qt3to4:
#include <QLabel>
#include "tempolabel.h"
@@ -63,14 +62,13 @@ QSize TempoLabel::sizeHint() const
// TempoSpinBox
//---------------------------------------------------------
-TempoEdit::TempoEdit(QWidget* parent, const char* name)
- : QSpinBox(parent, name)
+TempoEdit::TempoEdit(QWidget* parent)
+ : QDoubleSpinBox(parent)
{
- setLineStep(100);
- setMaxValue(60000);
- setMinValue(3000);
- //setValidator(new QDoubleValidator(this)); ddskrjo
- connect(this, SIGNAL(valueChanged(int)), SLOT(tempoChanged(int)));
+ curVal = -1.0;
+ setSingleStep(1.0);
+ setRange(30.0, 600.0);
+ connect(this, SIGNAL(valueChanged(double)), SLOT(newValue(double)));
}
//---------------------------------------------------------
@@ -80,47 +78,46 @@ TempoEdit::TempoEdit(QWidget* parent, const char* name)
QSize TempoEdit::sizeHint() const
{
QFontMetrics fm(font());
- int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo
+ int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
int h = fm.height() + fw * 2;
int w = 2 + fm.width(QString("000.00")) + fw * 4 + 30;
return QSize(w, h).expandedTo(QApplication::globalStrut());
}
//---------------------------------------------------------
-// mapValueToText
+// tempoChanged
//---------------------------------------------------------
-QString TempoEdit::mapValueToText(int val)
+void TempoEdit::newValue(double val)
{
- double v = val / 100.0;
- return QString("%1").arg(v, 3, 'f', 2);
+ if (val != curVal) {
+ curVal = val;
+ emit tempoChanged(curVal);
+ }
}
//---------------------------------------------------------
-// mapTextToValue
+// setValue
//---------------------------------------------------------
-int TempoEdit::mapTextToValue(bool* ok)
+void TempoEdit::setValue(double val)
{
- double v = text().toDouble(ok);
- return int(v * 100);
+ if (val != curVal) {
+ curVal = val;
+ blockSignals(true);
+ QDoubleSpinBox::setValue(val);
+ blockSignals(false);
+ }
}
-//---------------------------------------------------------
-// tempoChanged
-//---------------------------------------------------------
-
-void TempoEdit::tempoChanged(int val)
- {
- emit valueChanged(double(val)/100.0);
- }
//---------------------------------------------------------
-// setValue
+// tempo
//---------------------------------------------------------
-void TempoEdit::setValue(double val)
- {
- QSpinBox::setValue(int(val*100));
- }
+//int TempoEdit::tempo() const
+// {
+// return lrint(60000000.0/value());
+// }
+
diff --git a/muse2/muse/widgets/tempolabel.h b/muse2/muse/widgets/tempolabel.h
index 587938d7..71aeb4b8 100644
--- a/muse2/muse/widgets/tempolabel.h
+++ b/muse2/muse/widgets/tempolabel.h
@@ -8,8 +8,8 @@
#ifndef __TEMPOLABEL_H__
#define __TEMPOLABEL_H__
-#include <qlabel.h>
-#include <qspinbox.h>
+#include <QLabel>
+#include <QDoubleSpinBox>
//---------------------------------------------------------
// TempoLabel
@@ -35,25 +35,26 @@ class TempoLabel : public QLabel {
// TempoEdit
//---------------------------------------------------------
-class TempoEdit : public QSpinBox {
+class TempoEdit : public QDoubleSpinBox {
Q_OBJECT
+ double curVal;
+
protected:
QSize sizeHint() const;
- virtual QString mapValueToText(int);
- virtual int mapTextToValue(bool*);
private slots:
- void tempoChanged(int);
+ void newValue(double);
public slots:
void setValue(double);
signals:
- void valueChanged(double);
+ void tempoChanged(double);
public:
- TempoEdit(QWidget*, const char* name = 0);
+ TempoEdit(QWidget*);
+ //int tempo() const;
};
#endif