mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 12:15:27 +00:00
Improvement: port profile selector to TableView.
This commit is contained in:
parent
b1139a3911
commit
c7fbe591ba
@ -76,8 +76,6 @@ QtObject{
|
||||
|
||||
property int rasterization: no_rasterization
|
||||
|
||||
property int profilesIndex: 0
|
||||
|
||||
// FONTS //////////////////////////////////////////////////////////////////
|
||||
|
||||
property real fontScaling: 1.0
|
||||
@ -349,10 +347,6 @@ QtObject{
|
||||
return stringify(customProfiles);
|
||||
}
|
||||
|
||||
function loadCurrentProfile(){
|
||||
loadProfile(profilesIndex);
|
||||
}
|
||||
|
||||
function loadProfile(index){
|
||||
var profile = profilesList.get(index);
|
||||
loadProfileString(profile.obj_string);
|
||||
|
@ -26,40 +26,55 @@ Tab{
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
GroupBox{
|
||||
anchors {left: parent.left; right: parent.right}
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
title: qsTr("Profile")
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
ComboBox{
|
||||
id: profilesbox
|
||||
Layout.fillWidth: true
|
||||
model: appSettings.profilesList
|
||||
currentIndex: appSettings.profilesIndex
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
TableView {
|
||||
id: profilesView
|
||||
Layout.fillWidth: true
|
||||
anchors { top: parent.top; bottom: parent.bottom; }
|
||||
model: appSettings.profilesList
|
||||
headerVisible: false
|
||||
TableViewColumn {
|
||||
title: qsTr("Profile")
|
||||
role: "text"
|
||||
width: parent.width * 0.5
|
||||
}
|
||||
onActivated: {
|
||||
appSettings.loadProfile(row);
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
anchors { top: parent.top; bottom: parent.bottom }
|
||||
Layout.fillWidth: false
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
property alias currentIndex: profilesView.currentRow
|
||||
enabled: currentIndex >= 0
|
||||
text: qsTr("Load")
|
||||
onClicked: {
|
||||
appSettings.profilesIndex = profilesbox.currentIndex
|
||||
appSettings.loadCurrentProfile();
|
||||
appSettings.handleFontChanged();
|
||||
var index = profilesView.currentRow;
|
||||
if (index >= 0)
|
||||
appSettings.loadProfile(index);
|
||||
}
|
||||
}
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Save New Profile")
|
||||
text: qsTr("New")
|
||||
onClicked: insertname.show()
|
||||
}
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Remove Selected")
|
||||
enabled: !appSettings.profilesList.get(profilesbox.currentIndex).builtin
|
||||
text: qsTr("Remove")
|
||||
property alias currentIndex: profilesView.currentRow
|
||||
|
||||
enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin
|
||||
onClicked: {
|
||||
appSettings.profilesList.remove(profilesbox.currentIndex)
|
||||
profilesbox.currentIndex = profilesbox.currentIndex - 1
|
||||
}
|
||||
appSettings.profilesList.remove(profilesView.currentRow);
|
||||
profilesView.activated(currentIndex);
|
||||
}
|
||||
}
|
||||
InsertNameDialog{
|
||||
@ -68,6 +83,7 @@ Tab{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Lights")
|
||||
Layout.fillWidth: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user