2013-12-28 14:52:10 +01:00
|
|
|
/*******************************************************************************
|
2021-06-30 22:49:03 +02:00
|
|
|
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
|
2014-09-03 22:19:34 +02:00
|
|
|
* https://github.com/Swordfish90/cool-retro-term
|
2013-12-28 14:52:10 +01:00
|
|
|
*
|
2014-09-03 22:19:34 +02:00
|
|
|
* This file is part of cool-retro-term.
|
2013-12-28 14:52:10 +01:00
|
|
|
*
|
2014-09-03 22:19:34 +02:00
|
|
|
* cool-retro-term is free software: you can redistribute it and/or modify
|
2013-12-28 14:52:10 +01:00
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*******************************************************************************/
|
2014-04-17 13:56:13 +02:00
|
|
|
import QtQuick 2.2
|
2021-06-30 08:33:31 +02:00
|
|
|
import QtQuick.Controls 2.0
|
2013-12-22 23:08:16 +01:00
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
|
2015-01-08 03:55:19 +01:00
|
|
|
import "Components"
|
|
|
|
|
2013-12-22 23:08:16 +01:00
|
|
|
RowLayout {
|
2014-06-27 16:27:27 +02:00
|
|
|
property alias name: check.text
|
2014-08-09 14:45:01 +02:00
|
|
|
|
|
|
|
property double value
|
2021-06-30 08:33:31 +02:00
|
|
|
property alias min_value: slider.from
|
|
|
|
property alias max_value: slider.to
|
2014-06-27 16:27:27 +02:00
|
|
|
property alias stepSize: slider.stepSize
|
2013-12-22 23:08:16 +01:00
|
|
|
|
2021-06-30 22:49:03 +02:00
|
|
|
signal newValue(real newValue)
|
2014-08-09 14:45:01 +02:00
|
|
|
|
2013-12-22 23:08:16 +01:00
|
|
|
id: setting_component
|
2018-10-28 01:08:21 +02:00
|
|
|
Layout.fillWidth: true
|
2013-12-22 23:08:16 +01:00
|
|
|
|
2014-08-09 14:45:01 +02:00
|
|
|
onValueChanged: {
|
2021-06-30 22:49:03 +02:00
|
|
|
check.checked = !(value == 0)
|
|
|
|
if (check.checked)
|
|
|
|
slider.value = value
|
2014-08-09 14:45:01 +02:00
|
|
|
}
|
|
|
|
|
2021-06-30 22:49:03 +02:00
|
|
|
CheckBox {
|
2013-12-22 23:08:16 +01:00
|
|
|
id: check
|
2015-01-08 03:55:19 +01:00
|
|
|
implicitWidth: 160
|
2014-08-09 14:45:01 +02:00
|
|
|
onClicked: {
|
2021-06-30 22:49:03 +02:00
|
|
|
if (!checked) {
|
|
|
|
checked = false
|
|
|
|
slider.enabled = false
|
|
|
|
newValue(0)
|
2014-08-09 14:45:01 +02:00
|
|
|
} else {
|
2021-06-30 22:49:03 +02:00
|
|
|
checked = true
|
|
|
|
newValue(slider.value)
|
|
|
|
slider.enabled = true
|
2014-08-09 14:45:01 +02:00
|
|
|
}
|
|
|
|
}
|
2013-12-22 23:08:16 +01:00
|
|
|
}
|
2021-06-30 22:49:03 +02:00
|
|
|
Slider {
|
2013-12-22 23:08:16 +01:00
|
|
|
id: slider
|
2014-03-22 11:11:27 +01:00
|
|
|
stepSize: parent.stepSize
|
2013-12-22 23:08:16 +01:00
|
|
|
Layout.fillWidth: true
|
2014-08-09 14:45:01 +02:00
|
|
|
onValueChanged: {
|
2021-06-30 22:49:03 +02:00
|
|
|
newValue(value)
|
2014-08-09 14:45:01 +02:00
|
|
|
}
|
2013-12-22 23:08:16 +01:00
|
|
|
}
|
2015-01-08 03:55:19 +01:00
|
|
|
SizedLabel {
|
2021-06-30 22:49:03 +02:00
|
|
|
text: Math.round(
|
|
|
|
((value - min_value) / (max_value - min_value)) * 100) + "%"
|
2013-12-22 23:08:16 +01:00
|
|
|
}
|
|
|
|
}
|