2020-12-26 13:49:48 +00:00
|
|
|
/**
|
2022-03-05 16:49:35 +00:00
|
|
|
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
|
2022-01-12 17:47:17 +00:00
|
|
|
* Copyright (C) 2022 Ad5001
|
2020-12-26 13:49:48 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Enum {
|
|
|
|
constructor(...values) {
|
|
|
|
this.type = 'Enum'
|
|
|
|
this.values = values
|
2022-01-26 22:51:39 +00:00
|
|
|
this.translatedValues = values.map(x => qsTr(x))
|
2020-12-26 13:49:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ObjectType {
|
|
|
|
constructor(objType) {
|
|
|
|
this.type = 'ObjectType'
|
|
|
|
this.objType = objType
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class List {
|
|
|
|
constructor(type, format = /^.+$/, label = '', forbidAdding = false) {
|
|
|
|
// type can be string, int and double.
|
|
|
|
this.type = 'List'
|
|
|
|
this.valueType = type
|
|
|
|
this.format = format
|
|
|
|
this.label = label
|
|
|
|
this.forbidAdding = forbidAdding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Dictionary {
|
|
|
|
constructor(type, keyType = 'string', format = /^.+$/, keyFormat = /^.+$/, preKeyLabel = '', postKeyLabel = ': ', forbidAdding = false) {
|
|
|
|
// type & keyType can be string, int and double.
|
|
|
|
this.type = 'Dict'
|
|
|
|
this.valueType = type
|
|
|
|
this.keyType = keyType
|
|
|
|
this.format = format
|
|
|
|
this.keyFormat = keyFormat
|
|
|
|
this.preKeyLabel = preKeyLabel
|
|
|
|
this.postKeyLabel = postKeyLabel
|
|
|
|
this.forbidAdding = forbidAdding
|
|
|
|
}
|
|
|
|
}
|
2022-01-23 16:31:34 +00:00
|
|
|
|
2022-01-26 22:51:39 +00:00
|
|
|
// Common parameters for Enums
|
2022-01-23 16:31:34 +00:00
|
|
|
|
|
|
|
Enum.Position = new Enum(
|
|
|
|
QT_TR_NOOP('above'),
|
|
|
|
QT_TR_NOOP('below'),
|
|
|
|
QT_TR_NOOP('left'),
|
|
|
|
QT_TR_NOOP('right'),
|
|
|
|
QT_TR_NOOP('above-left'),
|
|
|
|
QT_TR_NOOP('above-right'),
|
|
|
|
QT_TR_NOOP('below-left'),
|
|
|
|
QT_TR_NOOP('below-right')
|
|
|
|
)
|
2022-01-26 22:51:39 +00:00
|
|
|
|
2022-01-28 10:50:57 +00:00
|
|
|
Enum.Positioning = new Enum(
|
|
|
|
QT_TR_NOOP('center'),
|
|
|
|
QT_TR_NOOP('top'),
|
|
|
|
QT_TR_NOOP('bottom'),
|
|
|
|
QT_TR_NOOP('left'),
|
|
|
|
QT_TR_NOOP('right'),
|
|
|
|
QT_TR_NOOP('top-left'),
|
|
|
|
QT_TR_NOOP('top-right'),
|
|
|
|
QT_TR_NOOP('bottom-left'),
|
|
|
|
QT_TR_NOOP('bottom-right')
|
|
|
|
)
|
|
|
|
|
2022-01-26 22:51:39 +00:00
|
|
|
Enum.FunctionDisplayType = new Enum(
|
|
|
|
QT_TR_NOOP('application'),
|
|
|
|
QT_TR_NOOP('function')
|
2022-01-27 00:02:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
Enum.BodePass = new Enum(
|
|
|
|
QT_TR_NOOP('high'),
|
|
|
|
QT_TR_NOOP('low')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
Enum.XCursorValuePosition = new Enum(
|
|
|
|
QT_TR_NOOP('Next to target'),
|
|
|
|
QT_TR_NOOP('With label'),
|
|
|
|
QT_TR_NOOP('Hidden')
|
|
|
|
)
|
|
|
|
|
|
|
|
|