Improve some details in Qt Quick GUI
This commit is contained in:
parent
91e02d1123
commit
71652bcab3
|
@ -40,6 +40,7 @@ Kirigami.ScrollablePage {
|
|||
color: Kirigami.Theme.backgroundColor
|
||||
}
|
||||
|
||||
// dialog to confirm deletion of an entry
|
||||
BasicDialog {
|
||||
id: confirmDeletionDialog
|
||||
|
||||
|
@ -61,6 +62,7 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
|
||||
// dialog to rename an entry
|
||||
BasicDialog {
|
||||
id: renameDialog
|
||||
|
||||
|
@ -137,12 +139,12 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
|
||||
// component representing an entry
|
||||
Component {
|
||||
id: listDelegateComponent
|
||||
|
||||
Kirigami.SwipeListItem {
|
||||
id: listItem
|
||||
|
||||
contentItem: RowLayout {
|
||||
Kirigami.ListItemDragHandle {
|
||||
listItem: listItem
|
||||
|
@ -152,7 +154,6 @@ Kirigami.ScrollablePage {
|
|||
rootIndex, newIndex)
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Icon {
|
||||
width: Kirigami.Units.iconSizes.smallMedium
|
||||
height: Kirigami.Units.iconSizes.smallMedium
|
||||
|
@ -160,7 +161,6 @@ Kirigami.ScrollablePage {
|
|||
source: delegateModel.isNode(
|
||||
index) ? "folder-symbolic" : "story-editor"
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
@ -175,7 +175,6 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
iconName: "edit-cut"
|
||||
|
@ -183,19 +182,19 @@ Kirigami.ScrollablePage {
|
|||
onTriggered: {
|
||||
nativeInterface.cutEntry(entryModel.index(index, 0,
|
||||
rootIndex))
|
||||
showPassiveNotification(text + " " + name)
|
||||
showPassiveNotification(text + " " + model.name)
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
iconName: "edit-delete"
|
||||
text: qsTr("Delete")
|
||||
onTriggered: confirmDeletionDialog.confirmDeletion(name,
|
||||
index)
|
||||
onTriggered: confirmDeletionDialog.confirmDeletion(
|
||||
model.name, index)
|
||||
},
|
||||
Kirigami.Action {
|
||||
iconName: "edit-rename"
|
||||
text: qsTr("Rename")
|
||||
onTriggered: renameDialog.renameEntry(name, index)
|
||||
onTriggered: renameDialog.renameEntry(model.name, index)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -204,6 +203,9 @@ Kirigami.ScrollablePage {
|
|||
// list view to display one hierarchy level of entry model
|
||||
ListView {
|
||||
id: entriesListView
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
model: DelegateModel {
|
||||
id: delegateModel
|
||||
|
||||
|
|
47
qml/main.qml
47
qml/main.qml
|
@ -73,12 +73,17 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
onFileOpenChanged: {
|
||||
clearStack()
|
||||
if (!nativeInterface.fileOpen) {
|
||||
return
|
||||
if (nativeInterface.fileOpen) {
|
||||
var entryModel = nativeInterface.entryModel
|
||||
var rootIndex = entryModel.index(0, 0)
|
||||
pushStackEntry(entryModel, rootIndex)
|
||||
showPassiveNotification(qsTr("File opened"))
|
||||
} else {
|
||||
showPassiveNotification(qsTr("File closed"))
|
||||
}
|
||||
var entryModel = nativeInterface.entryModel
|
||||
var rootIndex = entryModel.index(0, 0)
|
||||
pushStackEntry(entryModel, rootIndex)
|
||||
}
|
||||
onFileSaved: {
|
||||
showPassiveNotification(qsTr("File saved"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,31 +125,23 @@ Kirigami.ApplicationWindow {
|
|||
onTriggered: nativeInterface.close()
|
||||
}
|
||||
]
|
||||
}
|
||||
contextDrawer: Kirigami.ContextDrawer {
|
||||
id: contextDrawer
|
||||
}
|
||||
pageStack.initialPage: mainPageComponent
|
||||
|
||||
// main app content
|
||||
Component {
|
||||
id: mainPageComponent
|
||||
|
||||
RowLayout {
|
||||
spacing: 5
|
||||
|
||||
Controls.Label {
|
||||
text: {
|
||||
if (nativeInterface.fileOpen) {
|
||||
return qsTr("The file %1 has been opened.").arg(
|
||||
nativeInterface.filePath)
|
||||
} else {
|
||||
return qsTr("No file has been opened.")
|
||||
}
|
||||
Controls.Label {
|
||||
wrapMode: Controls.Label.Wrap
|
||||
Layout.fillWidth: true
|
||||
text: {
|
||||
if (nativeInterface.fileOpen) {
|
||||
return nativeInterface.filePath
|
||||
} else {
|
||||
return qsTr("no file opened")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
contextDrawer: Kirigami.ContextDrawer {
|
||||
id: contextDrawer
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// load file if one has been specified via CLI argument
|
||||
if (nativeInterface.filePath.length) {
|
||||
|
|
|
@ -103,6 +103,7 @@ void Controller::save()
|
|||
m_file.clearPassword();
|
||||
}
|
||||
m_file.save(!m_password.isEmpty());
|
||||
emit fileSaved();
|
||||
} catch (const CryptoException &e) {
|
||||
emit fileError(tr("A crypto error occured when saving the file: ") + QString::fromLocal8Bit(e.what()));
|
||||
} catch (const runtime_error &e) {
|
||||
|
|
|
@ -60,6 +60,7 @@ signals:
|
|||
void windowTitleChanged(const QString &windowTitle);
|
||||
void fileOpenChanged(bool fileOpen);
|
||||
void fileError(const QString &errorMessage);
|
||||
void fileSaved();
|
||||
void entryModelChanged();
|
||||
void entryFilterModelChanged();
|
||||
void fieldModelChanged();
|
||||
|
|
Loading…
Reference in New Issue