Skip to content

Commit e4bf73e

Browse files
refactor(L.8): migrate EntryListPanel and fix signal connections
Change entrySelected signal from double to TimePos. Fix boundaryMoved and boundaryDragFinished lambda signatures in PhonemeLabelerPageSetup to match TimePos signals. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 2d93725 commit e4bf73e

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/apps/PhonemeLabeler/gui/PhonemeLabelerPageSetup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void PhonemeLabelerPage::connectSignals() {
238238
updateAllBoundaryOverlays();
239239
});
240240
// Also repaint overlays when boundaries move (real-time during drag)
241-
connect(m_document, &TextGridDocument::boundaryMoved, this, [this](int, int, double) {
241+
connect(m_document, &TextGridDocument::boundaryMoved, this, [this](int, int, TimePos) {
242242
updateAllBoundaryOverlays();
243243
m_tierEditWidget->update();
244244
for (auto *child : m_tierEditWidget->findChildren<QWidget *>()) {
@@ -305,7 +305,7 @@ void PhonemeLabelerPage::connectSignals() {
305305
connect(m_spectrogramWidget, &SpectrogramWidget::boundaryDragStarted, this, onDragStarted);
306306

307307
// Drag finished → clear drag highlight
308-
auto onDragFinished = [this](int, int, double) {
308+
auto onDragFinished = [this](int, int, TimePos) {
309309
m_boundaryOverlay->setDraggedBoundary(-1);
310310
};
311311
connect(m_waveformWidget, &WaveformWidget::boundaryDragFinished, this, onDragFinished);

src/apps/PhonemeLabeler/gui/ui/EntryListPanel.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "EntryListPanel.h"
22
#include "TextGridDocument.h"
3+
#include <dstools/TimePos.h>
34
#include <dstools/ViewportController.h>
45

56
#include <QVBoxLayout>
@@ -67,27 +68,27 @@ void EntryListPanel::rebuildEntries() {
6768
int count = m_document->intervalCount(tier);
6869
for (int i = 0; i < count; ++i) {
6970
QString text = m_document->intervalText(tier, i);
70-
double start = m_document->intervalStart(tier, i);
71-
double end = m_document->intervalEnd(tier, i);
71+
TimePos start = m_document->intervalStart(tier, i);
72+
TimePos end = m_document->intervalEnd(tier, i);
7273

7374
QString display;
7475
if (text.isEmpty()) {
7576
display = QString("[%1] (%2s - %3s)")
7677
.arg(i)
77-
.arg(start, 0, 'f', 3)
78-
.arg(end, 0, 'f', 3);
78+
.arg(usToSec(start), 0, 'f', 3)
79+
.arg(usToSec(end), 0, 'f', 3);
7980
} else {
8081
display = QString("[%1] %2 (%3s - %4s)")
8182
.arg(i)
8283
.arg(text)
83-
.arg(start, 0, 'f', 3)
84-
.arg(end, 0, 'f', 3);
84+
.arg(usToSec(start), 0, 'f', 3)
85+
.arg(usToSec(end), 0, 'f', 3);
8586
}
8687

8788
auto *item = new QListWidgetItem(display, m_listWidget);
8889
item->setData(IntervalIndexRole, i); // interval index
89-
item->setData(IntervalStartRole, start); // start time
90-
item->setData(IntervalEndRole, end); // end time
90+
item->setData(IntervalStartRole, static_cast<qlonglong>(start)); // start time
91+
item->setData(IntervalEndRole, static_cast<qlonglong>(end)); // end time
9192
}
9293

9394
// Restore previous selection, or default to first entry
@@ -146,8 +147,8 @@ void EntryListPanel::onCurrentRowChanged(int row) {
146147
if (!item) return;
147148

148149
int intervalIndex = item->data(IntervalIndexRole).toInt();
149-
double start = item->data(IntervalStartRole).toDouble();
150-
double end = item->data(IntervalEndRole).toDouble();
150+
TimePos start = item->data(IntervalStartRole).toLongLong();
151+
TimePos end = item->data(IntervalEndRole).toLongLong();
151152
int tier = m_document->activeTierIndex();
152153

153154
centerEntryInViewport(intervalIndex);
@@ -165,8 +166,8 @@ void EntryListPanel::centerEntryInViewport(int intervalIndex) {
165166
if (tier < 0 || intervalIndex < 0 || intervalIndex >= m_document->intervalCount(tier))
166167
return;
167168

168-
double start = m_document->intervalStart(tier, intervalIndex);
169-
double end = m_document->intervalEnd(tier, intervalIndex);
169+
double start = usToSec(m_document->intervalStart(tier, intervalIndex));
170+
double end = usToSec(m_document->intervalEnd(tier, intervalIndex));
170171
double entryCenter = (start + end) / 2.0;
171172

172173
// Center the viewport on the entry

src/apps/PhonemeLabeler/gui/ui/EntryListPanel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <QListWidget>
55

66
#include <dstools/ViewportController.h>
7+
#include <dstools/TimePos.h>
78

89
namespace dstools {
910
namespace phonemelabeler {
@@ -36,7 +37,7 @@ class EntryListPanel : public QWidget {
3637

3738
signals:
3839
/// Emitted when the user selects an entry (by click or scroll).
39-
void entrySelected(int tierIndex, int intervalIndex, double startTime, double endTime);
40+
void entrySelected(int tierIndex, int intervalIndex, TimePos startTime, TimePos endTime);
4041

4142
protected:
4243
void wheelEvent(QWheelEvent *event) override;

0 commit comments

Comments
 (0)