mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Mobile: UI for selecting what to copy-paste
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
de813c27ce
commit
8e7a9a4f4c
6 changed files with 268 additions and 8 deletions
168
mobile-widgets/qml/CopySettings.qml
Normal file
168
mobile-widgets/qml/CopySettings.qml
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
import QtQuick 2.6
|
||||||
|
import QtQuick.Controls 2.2 as Controls
|
||||||
|
import QtQuick.Window 2.2
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
import org.kde.kirigami 2.4 as Kirigami
|
||||||
|
import org.subsurfacedivelog.mobile 1.0
|
||||||
|
|
||||||
|
Kirigami.ScrollablePage {
|
||||||
|
objectName: "CopySettings"
|
||||||
|
id: settingsCopy
|
||||||
|
|
||||||
|
title: qsTr("Copy Settings")
|
||||||
|
background: Rectangle { color: subsurfaceTheme.backgroundColor }
|
||||||
|
|
||||||
|
property real gridWidth: settingsCopy.width - Kirigami.Units.gridUnit
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
width: gridWidth
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
id: copy_settings
|
||||||
|
columns: 2
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Selection for copy-paste")
|
||||||
|
font.pointSize: subsurfaceTheme.headingPointSize
|
||||||
|
font.weight: Font.Light
|
||||||
|
color: subsurfaceTheme.textColor
|
||||||
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||||
|
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Dive site")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleDiveSite(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleDiveSite(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Notes")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleNotes(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleNotes(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Dive master")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleDiveMaster(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleDiveMaster(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Buddy")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleBuddy(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleBuddy(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Suit")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleSuit(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleSuit(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Rating")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleRating(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleRating(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Visibility")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleVisibility(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleVisibility(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Tags")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleTags(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleTags(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Cylinders")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleCylinders(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleCylinders(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
text: qsTr("Weights")
|
||||||
|
font.pointSize: subsurfaceTheme.regularPointSize
|
||||||
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
|
}
|
||||||
|
SsrfSwitch {
|
||||||
|
checked: manager.toggleWeights(false)
|
||||||
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
|
onClicked: {
|
||||||
|
manager.toggleWeights(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
color: subsurfaceTheme.darkerPrimaryColor
|
||||||
|
height: 1
|
||||||
|
opacity: 0.5
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
height: Kirigami.Units.gridUnit * 6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -232,6 +232,10 @@ Kirigami.ScrollablePage {
|
||||||
timer.stop()
|
timer.stop()
|
||||||
manager.copyDiveData(dive.id)
|
manager.copyDiveData(dive.id)
|
||||||
}
|
}
|
||||||
|
onPressAndHold: {
|
||||||
|
globalDrawer.close()
|
||||||
|
pageStack.push(settingsCopyWindow)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -592,6 +592,11 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CopySettings {
|
||||||
|
id: settingsCopyWindow
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
About {
|
About {
|
||||||
id: aboutWindow
|
id: aboutWindow
|
||||||
visible: false
|
visible: false
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<file>main.qml</file>
|
<file>main.qml</file>
|
||||||
<file>MapPage.qml</file>
|
<file>MapPage.qml</file>
|
||||||
<file>Settings.qml</file>
|
<file>Settings.qml</file>
|
||||||
|
<file>CopySettings.qml</file>
|
||||||
<file>ThemeTest.qml</file>
|
<file>ThemeTest.qml</file>
|
||||||
<file>StartPage.qml</file>
|
<file>StartPage.qml</file>
|
||||||
<file>SsrfButton.qml</file>
|
<file>SsrfButton.qml</file>
|
||||||
|
|
|
@ -1317,6 +1317,86 @@ void QMLManager::deleteDive(int id)
|
||||||
changesNeedSaving();
|
changesNeedSaving();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleDiveSite(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.divesite = what.divesite ? false : true;
|
||||||
|
|
||||||
|
return what.divesite;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleNotes(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.notes = what.notes ? false : true;
|
||||||
|
|
||||||
|
return what.notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleDiveMaster(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.divemaster = what.divemaster ? false : true;
|
||||||
|
|
||||||
|
return what.divemaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleBuddy(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.buddy = what.buddy ? false : true;
|
||||||
|
|
||||||
|
return what.buddy;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleSuit(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.suit = what.suit ? false : true;
|
||||||
|
|
||||||
|
return what.suit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleRating(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.rating = what.rating ? false : true;
|
||||||
|
|
||||||
|
return what.rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleVisibility(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.visibility = what.visibility ? false : true;
|
||||||
|
|
||||||
|
return what.visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleTags(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.tags = what.tags ? false : true;
|
||||||
|
|
||||||
|
return what.tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleCylinders(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.cylinders = what.cylinders ? false : true;
|
||||||
|
|
||||||
|
return what.cylinders;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QMLManager::toggleWeights(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
what.weights = what.weights ? false : true;
|
||||||
|
|
||||||
|
return what.weights;
|
||||||
|
}
|
||||||
|
|
||||||
void QMLManager::copyDiveData(int id)
|
void QMLManager::copyDiveData(int id)
|
||||||
{
|
{
|
||||||
m_copyPasteDive = get_dive_by_uniq_id(id);
|
m_copyPasteDive = get_dive_by_uniq_id(id);
|
||||||
|
@ -1325,14 +1405,6 @@ void QMLManager::copyDiveData(int id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: selection dialog for the data to be copied
|
|
||||||
what.divemaster = true;
|
|
||||||
what.buddy = true;
|
|
||||||
what.suit = true;
|
|
||||||
what.tags = true;
|
|
||||||
what.cylinders = true;
|
|
||||||
what.weights = true;
|
|
||||||
|
|
||||||
setNotificationText("Copy");
|
setNotificationText("Copy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,16 @@ public slots:
|
||||||
void deleteDive(int id);
|
void deleteDive(int id);
|
||||||
void copyDiveData(int id);
|
void copyDiveData(int id);
|
||||||
void pasteDiveData(int id);
|
void pasteDiveData(int id);
|
||||||
|
bool toggleDiveSite(bool toggle);
|
||||||
|
bool toggleNotes(bool toggle);
|
||||||
|
bool toggleDiveMaster(bool toggle);
|
||||||
|
bool toggleBuddy(bool toggle);
|
||||||
|
bool toggleSuit(bool toggle);
|
||||||
|
bool toggleRating(bool toggle);
|
||||||
|
bool toggleVisibility(bool toggle);
|
||||||
|
bool toggleTags(bool toggle);
|
||||||
|
bool toggleCylinders(bool toggle);
|
||||||
|
bool toggleWeights(bool toggle);
|
||||||
bool undoDelete(int id);
|
bool undoDelete(int id);
|
||||||
QString addDive();
|
QString addDive();
|
||||||
void addDiveAborted(int id);
|
void addDiveAborted(int id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue