CURA-4870 Don't allow to connect more than one instance to the same

group.
This commit is contained in:
Diego Prado Gesto 2018-03-15 20:01:47 +01:00
parent 222a18e698
commit 99d653cea5
3 changed files with 36 additions and 4 deletions

View file

@ -5,6 +5,7 @@ import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import QtQuick.Dialogs 1.2
Cura.MachineAction
{
@ -33,15 +34,34 @@ Cura.MachineAction
{
var printerKey = base.selectedDevice.key
var printerName = base.selectedDevice.name // TODO To change when the groups have a name
if(manager.getStoredKey() != printerKey)
if (manager.getStoredKey() != printerKey)
{
manager.setKey(printerKey)
manager.setGroupName(printerName) // TODO To change when the groups have a name
completed()
// Check if there is another instance with the same key
if (!manager.existsKey(printerKey))
{
manager.setKey(printerKey)
manager.setGroupName(printerName) // TODO To change when the groups have a name
completed()
}
else
{
existingConnectionDialog.open()
}
}
}
}
MessageDialog
{
id: existingConnectionDialog
title: catalog.i18nc("@window:title", "Existing Connection")
icon: StandardIcon.Information
text: catalog.i18nc("@message:text", "There is an instance already connected to this group")
detailedText: catalog.i18nc("@message:description", "You can't connect two instances to the same group. Please use the other instance or connect to another group.")
standardButtons: StandardButton.Ok
modality: Qt.ApplicationModal
}
Column
{
anchors.fill: parent;