summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Merry <dev@randomguy3.me.uk>2012-04-20 18:54:02 +0100
committerAlex Merry <dev@randomguy3.me.uk>2012-04-20 18:54:02 +0100
commita6fda32752feb31a6272010b7cd530b6901bb0f2 (patch)
tree432c13e65bbfa32fc89dd80a79657369fb82d375
parent75abbc415e6655da08057416a0d7e2c546964d8f (diff)
Fix the time inputs2.0
Previously, they claimed to be in microseconds, but were in milliseconds. Now you have the option of entering values in microseconds, milliseconds or seconds.
-rw-r--r--mpris2/playertestwidget.cpp20
-rw-r--r--ui/playertest.ui37
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 @@
<x>0</x>
<y>0</y>
<width>667</width>
- <height>675</height>
+ <height>523</height>
</rect>
</property>
<property name="windowTitle">
@@ -471,14 +471,17 @@
</property>
</widget>
</item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="Line" name="line_5">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QSpinBox" name="seekSpinBox">
<property name="suffix">
- <string>µs</string>
+ <string/>
</property>
<property name="minimum">
<number>-999999999</number>
@@ -492,6 +495,16 @@
</widget>
</item>
<item>
+ <widget class="QComboBox" name="seekTimeUnits">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="seekBtn">
<property name="text">
<string>Seek by</string>
@@ -522,7 +535,7 @@
<item>
<widget class="QSpinBox" name="setPosSpinBox">
<property name="suffix">
- <string>µs</string>
+ <string/>
</property>
<property name="minimum">
<number>-999999999</number>
@@ -536,6 +549,16 @@
</widget>
</item>
<item>
+ <widget class="QComboBox" name="setPosTimeUnits">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="setPosBtn">
<property name="text">
<string>Set position</string>