Skip to content

Commit

Permalink
Merge pull request #11 from lgolouz/lgolouz_zxtapereviver-10
Browse files Browse the repository at this point in the history
Fixed [ZXTAPEREVIVER-10] No suspicious points displayed when wfm file…
  • Loading branch information
lgolouz authored Sep 27, 2020
2 parents 9d6c9cc + 04b99da commit 5474fcf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
33 changes: 22 additions & 11 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ ApplicationWindow {
return channelsComboBox.currentIndex == 0 ? waveformControlCh0 : waveformControlCh1;
}

function restoreWaveformView() {
waveformControlCh0.xScaleFactor = 1;
waveformControlCh0.yScaleFactor = 80000;
waveformControlCh0.wavePos = 0;

waveformControlCh1.xScaleFactor = 1;
waveformControlCh1.yScaleFactor = 80000;
waveformControlCh1.wavePos = 0;
}

menuBar: MenuBar {
Menu {
title: "File"
Expand Down Expand Up @@ -110,15 +120,9 @@ ApplicationWindow {
title: "Waveform"

MenuItem {
text: "Restore"
text: "Restore view"
onTriggered: {
waveformControlCh0.xScaleFactor = 1;
waveformControlCh0.yScaleFactor = 80000;
waveformControlCh0.wavePos = 0;

waveformControlCh1.xScaleFactor = 1;
waveformControlCh1.yScaleFactor = 80000;
waveformControlCh1.wavePos = 0;
restoreWaveformView();
}
}

Expand All @@ -142,9 +146,16 @@ ApplicationWindow {
onAccepted: {
var filetype = isWavOpening ? "WAV" : "Waveform";
console.log("Selected %1 file: ".arg(filetype) + openFileDialog.fileUrl);
console.log("Open %1 file result: ".arg(filetype) + (isWavOpening
? FileWorkerModel.openWavFileByUrl(openFileDialog.fileUrl)
: FileWorkerModel.openWaveformFileByUrl(openFileDialog.fileUrl)));
var res = (isWavOpening
? FileWorkerModel.openWavFileByUrl(openFileDialog.fileUrl)
: FileWorkerModel.openWaveformFileByUrl(openFileDialog.fileUrl));
console.log("Open %1 file result: ".arg(filetype) + res);
if (res === 0) {
if (isWavOpening) {
SuspiciousPointsModel.clearSuspiciousPoints();
}
restoreWaveformView();
}
}

onRejected: {
Expand Down
7 changes: 7 additions & 0 deletions sources/models/suspiciouspointsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ uint SuspiciousPointsModel::getSuspiciousPoint(int idx)
return 0;
}

void SuspiciousPointsModel::clearSuspiciousPoints()
{
mSuspiciousPoints.clear();
emit suspiciousPointsChanged();
emit sizeChanged();
}

int SuspiciousPointsModel::getSize() const
{
return mSuspiciousPoints.size();
Expand Down
1 change: 1 addition & 0 deletions sources/models/suspiciouspointsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class SuspiciousPointsModel : public QObject
Q_INVOKABLE bool addSuspiciousPoint(uint idx);
Q_INVOKABLE bool removeSuspiciousPoint(int idx);
Q_INVOKABLE uint getSuspiciousPoint(int idx);
Q_INVOKABLE void clearSuspiciousPoints();

signals:
void suspiciousPointsChanged();
Expand Down

0 comments on commit 5474fcf

Please sign in to comment.