Skip to content

Commit

Permalink
Merge pull request #16 from lgolouz/lgolouz_zxtr-15
Browse files Browse the repository at this point in the history
Fixed [ZXTR-15] Implement parsing paremeters settings
  • Loading branch information
lgolouz authored Dec 22, 2020
2 parents 02413fa + a840914 commit fae6891
Show file tree
Hide file tree
Showing 14 changed files with 774 additions and 56 deletions.
2 changes: 2 additions & 0 deletions ZXTapeReviver.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SOURCES += \
sources/controls/waveformcontrol.cpp \
sources/core/waveformparser.cpp \
sources/core/wavreader.cpp \
sources/models/parsersettingsmodel.cpp \
sources/models/suspiciouspointsmodel.cpp

HEADERS += \
Expand All @@ -28,6 +29,7 @@ HEADERS += \
sources/controls/waveformcontrol.h \
sources/core/waveformparser.h \
sources/core/wavreader.h \
sources/models/parsersettingsmodel.h \
sources/models/suspiciouspointsmodel.h

RESOURCES += qml/qml.qrc
Expand Down
37 changes: 37 additions & 0 deletions qml/Frequency.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//*******************************************************************************
// ZX Tape Reviver
//-----------------
//
// Author: Leonid Golouz
// E-mail: [email protected]
//*******************************************************************************

import QtQuick 2.3
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.3

Dialog {
id: frequencyDialog

property var frequency: 0

visible: false
title: "Measured frequency"
standardButtons: StandardButton.Ok
modality: Qt.WindowModal
width: 200
height: 120

Text {
id: textWithField
text: "Measured frequency:"
}

TextField {
id: textField
anchors.top: textWithField.bottom
anchors.topMargin: 5
width: parent.width
text: frequency
}
}
206 changes: 206 additions & 0 deletions qml/ParserSettings.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
//*******************************************************************************
// ZX Tape Reviver
//-----------------
//
// Author: Leonid Golouz
// E-mail: [email protected]
//*******************************************************************************

import QtQuick 2.3
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.15

import com.models.zxtapereviver 1.0

Dialog {
id: parserSettingsDialog

visible: false
title: "Parser settings"
standardButtons: StandardButton.Ok | StandardButton.RestoreDefaults
modality: Qt.WindowModal

Grid {
id: grid
columns: 4

GroupBox {
title: "Pilot-tone settings:"
ColumnLayout {
Layout.fillHeight: true
Text {
text: "Pilot half frequency:"
}

TextField {
text: ParserSettingsModel.pilotHalfFreq;
onTextChanged: {
ParserSettingsModel.pilotHalfFreq = parseInt(text, 10);
}
}

Text {
text: "Pilot frequency:"
}

TextField {
text: ParserSettingsModel.pilotFreq;
onTextChanged: {
ParserSettingsModel.pilotFreq = parseInt(text, 10);
}
}

Text {
text: "Pilot delta:"
}

TextField {
text: ParserSettingsModel.pilotDelta
onTextChanged: {
ParserSettingsModel.pilotDelta = text;
}
}
}
}

GroupBox {
title: "Synchro signal settigns:"
ColumnLayout {
Text {
text: "Synchro first half frequency:"
}

TextField {
text: ParserSettingsModel.synchroFirstHalfFreq;
onTextChanged: {
ParserSettingsModel.synchroFirstHalfFreq = parseInt(text, 10);
}
}

Text {
text: "Synchro second half frequency:"
}

TextField {
text: ParserSettingsModel.synchroSecondHalfFreq;
onTextChanged: {
ParserSettingsModel.synchroSecondHalfFreq = parseInt(text, 10);
}
}

Text {
text: "Synchro frequency:"
}

TextField {
text: ParserSettingsModel.synchroFreq;
onTextChanged: {
ParserSettingsModel.synchroFreq = parseInt(text, 10);
}
}

Text {
text: "Synchro delta:"
}

TextField {
text: ParserSettingsModel.synchroDelta
onTextChanged: {
ParserSettingsModel.synchroDelta = text;
}
}
}
}

GroupBox {
title: "Zero digit settings:"
ColumnLayout {
Text {
text: "Zero half frequency:"
}

TextField {
text: ParserSettingsModel.zeroHalfFreq;
onTextChanged: {
ParserSettingsModel.zeroHalfFreq = parseInt(text, 10);
}
}

Text {
text: "Zero frequency:"
}

TextField {
text: ParserSettingsModel.zeroFreq;
onTextChanged: {
ParserSettingsModel.zeroFreq = parseInt(text, 10);
}
}

Text {
text: "Zero delta:"
}

TextField {
text: ParserSettingsModel.zeroDelta
onTextChanged: {
ParserSettingsModel.zeroDelta = text;
}
}
}
}

GroupBox {
title: "One digit settings:"
ColumnLayout {
Text {
text: "One half frequency:"
}

TextField {
text: ParserSettingsModel.oneHalfFreq;
onTextChanged: {
ParserSettingsModel.oneHalfFreq = parseInt(text, 10);
}
}

Text {
text: "One frequency:"
}

TextField {
text: ParserSettingsModel.oneFreq;
onTextChanged: {
ParserSettingsModel.oneFreq = parseInt(text, 10);
}
}

Text {
text: "One delta:"
}

TextField {
text: ParserSettingsModel.oneDelta
onTextChanged: {
ParserSettingsModel.oneDelta = text;
}
}
}
}
}
CheckBox {
anchors.top: grid.bottom
anchors.topMargin: 5

text: "Check for abnormal sine when parsing"
checked: ParserSettingsModel.checkForAbnormalSine
onCheckedChanged: {
ParserSettingsModel.checkForAbnormalSine = checked;
}
}

onReset: {
ParserSettingsModel.restoreDefaultSettings();
}
}
65 changes: 55 additions & 10 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ ApplicationWindow {
MenuItem {
text: "Reparse"
}

MenuSeparator { }

MenuItem {
text: "Parser settings..."
onTriggered: {
parserSettingsDialog.open();
}
}
}
}

Expand Down Expand Up @@ -455,7 +464,7 @@ ApplicationWindow {
width: hZoomOutButton.width

onClicked: {
gotoAddressDialogLoader.item.open();
gotoAddressDialog.open();
}
}

Expand All @@ -469,9 +478,37 @@ ApplicationWindow {
anchors.rightMargin: 5
width: hZoomOutButton.width
checkable: true
visible: !measurementModeToggleButton.checked

onCheckedChanged: {
waveformControlCh0.selectionMode = waveformControlCh1.selectionMode = checked;
waveformControlCh0.operationMode = waveformControlCh1.operationMode = checked ? WaveformControlOperationModes.WaveformSelectionMode : WaveformControlOperationModes.WaveformRepairMode;
}
}

Button {
id: measurementModeToggleButton

text: "Measurement mode"
anchors {
right: parent.right
rightMargin: 5
bottom: selectionModeToggleButton.top
bottomMargin: 5
}
width: hZoomOutButton.width
checkable: true
visible: !selectionModeToggleButton.checked

onCheckedChanged: {
waveformControlCh0.operationMode = waveformControlCh1.operationMode = checked ? WaveformControlOperationModes.WaveformMeasurementMode : WaveformControlOperationModes.WaveformRepairMode;
}
}

states: State {
when: measurementModeToggleButton.checked
AnchorChanges {
target: measurementModeToggleButton
anchors.bottom: waveformControlCh1.bottom
}
}

Expand Down Expand Up @@ -710,14 +747,9 @@ ApplicationWindow {
}
}

Loader {
id: gotoAddressDialogLoader
source: "GoToAddress.qml"
}

Connections {
target: gotoAddressDialogLoader.item
function onGotoAddress(adr) {
GoToAddress {
id: gotoAddressDialog
onGotoAddress: {
console.log("Goto address: " + adr);
var pos = WaveformParser.getPositionByAddress(channelsComboBox.currentIndex, parsedDataView.currentRow, adr);
if (pos !== 0) {
Expand All @@ -730,4 +762,17 @@ ApplicationWindow {
}
}
}

ParserSettings {
id: parserSettingsDialog
}

Frequency {
id: frequencyDialog
Component.onCompleted: {
var func = function(fr) { frequency = fr; frequencyDialog.open(); };
waveformControlCh0.frequency.connect(func);
waveformControlCh1.frequency.connect(func);
}
}
}
2 changes: 2 additions & 0 deletions qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<qresource prefix="/">
<file>main.qml</file>
<file>GoToAddress.qml</file>
<file>Frequency.qml</file>
<file>ParserSettings.qml</file>
</qresource>
</RCC>
Loading

0 comments on commit fae6891

Please sign in to comment.