mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
CURA-4870 Don't allow to connect more than one instance to the same
group.
This commit is contained in:
parent
222a18e698
commit
99d653cea5
3 changed files with 36 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue