From a6fda32752feb31a6272010b7cd530b6901bb0f2 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Fri, 20 Apr 2012 18:54:02 +0100 Subject: Fix the time inputs Previously, they claimed to be in microseconds, but were in milliseconds. Now you have the option of entering values in microseconds, milliseconds or seconds. --- mpris2/playertestwidget.cpp | 20 ++++++++++++++++++-- ui/playertest.ui | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/mpris2/playertestwidget.cpp b/mpris2/playertestwidget.cpp index 5d39626..187919a 100644 --- a/mpris2/playertestwidget.cpp +++ b/mpris2/playertestwidget.cpp @@ -33,6 +33,14 @@ PlayerTestWidget::PlayerTestWidget(PlayerInterfaceTest* test, QWidget* parent) ui.loopStatusCombo->addItem("None"); ui.loopStatusCombo->addItem("Track"); ui.loopStatusCombo->addItem("Playlist"); + ui.seekTimeUnits->addItem(QString::fromUtf8("µs")); + ui.seekTimeUnits->addItem("ms"); + ui.seekTimeUnits->addItem("s"); + ui.seekTimeUnits->setCurrentIndex(0); + ui.setPosTimeUnits->addItem(QString::fromUtf8("µs")); + ui.setPosTimeUnits->addItem("ms"); + ui.setPosTimeUnits->addItem("s"); + ui.setPosTimeUnits->setCurrentIndex(0); metadataModel = new MetadataModel(this); ui.metadataTableView->setModel(metadataModel); this->test = test; @@ -180,13 +188,21 @@ void PlayerTestWidget::updateEstPos() void PlayerTestWidget::testSeek() { - qint64 offset = (qint64)ui.seekSpinBox->value() * 1000; + qint64 offset = (qint64)ui.seekSpinBox->value(); // µs + if (ui.seekTimeUnits->currentIndex() > 0) + offset *= 1000; // ms + if (ui.seekTimeUnits->currentIndex() > 1) + offset *= 1000; // s test->testSeek(offset); } void PlayerTestWidget::testSetPos() { - qint64 pos = (qint64)ui.setPosSpinBox->value() * 1000; + qint64 pos = (qint64)ui.setPosSpinBox->value(); // µs + if (ui.setPosTimeUnits->currentIndex() > 0) + pos *= 1000; // ms + if (ui.setPosTimeUnits->currentIndex() > 1) + pos *= 1000; // s test->testSetPosition(QDBusObjectPath(ui.setPosTrackIdEdit->text()), pos); } diff --git a/ui/playertest.ui b/ui/playertest.ui index ff43ef9..1aa91f8 100644 --- a/ui/playertest.ui +++ b/ui/playertest.ui @@ -7,7 +7,7 @@ 0 0 667 - 675 + 523 @@ -471,14 +471,17 @@ - - - - + + + + Qt::Vertical + + + - µs + -999999999 @@ -491,6 +494,16 @@ + + + + + 0 + 0 + + + + @@ -522,7 +535,7 @@ - µs + -999999999 @@ -535,6 +548,16 @@ + + + + + 0 + 0 + + + + -- cgit v1.2.3