@@ -13,10 +13,8 @@ UM.Dialog
1313 id: dialog;
1414
1515 title: catalog .i18nc (" @title:window" , " DuetRRF Servers" );
16- width: 450 * Screen .devicePixelRatio ;
17- height: 150 * Screen .devicePixelRatio ;
18- minimumWidth: 300 * Screen .devicePixelRatio ;
19- minimumHeight: 200 * Screen .devicePixelRatio ;
16+ width: 650 * Screen .devicePixelRatio ;
17+ height: 300 * Screen .devicePixelRatio ;
2018
2119 property string currentName: (instanceList .currentIndex != - 1 ? instanceList .currentItem .name : " " );
2220 property int defaultVerticalMargin: UM .Theme .getSize (" default_margin" ).height ;
@@ -34,13 +32,14 @@ UM.Dialog
3432 iconName: " list-add" ;
3533 onClicked: {
3634 instanceDialog .oldName = " " ;
37- instanceDialog .name = " DuetRRF " ;
38- instanceDialog .url = " http://printer.local " ;
39- instanceDialog .duet_password = " reprap " ;
35+ instanceDialog .name = " My Printer " ;
36+ instanceDialog .url = " http://192.168.1.42 " ;
37+ instanceDialog .duet_password = " " ;
4038 instanceDialog .http_user = " " ;
4139 instanceDialog .http_password = " " ;
4240 instanceDialog .open ();
4341 nameField .textChanged ();
42+ urlField .textChanged ();
4443 }
4544 }
4645 Button {
@@ -177,10 +176,11 @@ UM.Dialog
177176 property alias http_password: http_passwordField .text ;
178177
179178 property bool validName: true ;
179+ property bool validUrl: true ;
180180 property real inputWidth: UM .Theme .getSize (" standard_list_input" ).width * 1.5 ;
181181
182- width: 210 * Screen .devicePixelRatio ;
183- height: 200 * Screen .devicePixelRatio ;
182+ width: 420 * Screen .devicePixelRatio ;
183+ height: 350 * Screen .devicePixelRatio ;
184184
185185 onAccepted: {
186186 manager .saveInstance (oldName, nameField .text , urlField .text , duet_passwordField .text , http_userField .text , http_passwordField .text );
@@ -211,12 +211,15 @@ UM.Dialog
211211 }
212212
213213 Item { width: parent .width ; height: displayNameLabel .height ; }
214- Label { text: catalog .i18nc (" @label" , " Server Address (url )" ); }
214+ Label { text: catalog .i18nc (" @label" , " Server Address (URL )" ); }
215215 TextField {
216216 id: urlField;
217217 text: " " ;
218218 implicitWidth: instanceDialog .inputWidth ;
219219 maximumLength: 1024 ;
220+ onTextChanged: {
221+ instanceDialog .validUrl = manager .validUrl (instanceDialog .oldName , urlField .text );
222+ }
220223 }
221224
222225 Item { width: parent .width ; height: displayNameLabel .height ; }
@@ -251,6 +254,11 @@ UM.Dialog
251254 visible: ! instanceDialog .validName ;
252255 text: catalog .i18nc (" @error" , " That instance name already exists." );
253256 }
257+ Item { width: parent .width ; height: displayNameLabel .height ; }
258+ Label {
259+ visible: ! instanceDialog .validUrl ;
260+ text: catalog .i18nc (" @error" , " URL not valid. Example: http://192.168.1.42" );
261+ }
254262 }
255263
256264 rightButtons: [
@@ -262,7 +270,7 @@ UM.Dialog
262270 id: okButton;
263271 text: catalog .i18nc (" @action:button" , " Ok" );
264272 onClicked: instanceDialog .accept ();
265- enabled: instanceDialog .validName ;
273+ enabled: instanceDialog .validName && instanceDialog . validUrl ;
266274 isDefault: true ;
267275 }
268276 ]
0 commit comments