33
44import QtQuick 2.7
55import QtQuick.Controls 2.3
6+ import QtQuick.Window 2.2
67
78import UM 1.3 as UM
89import Cura 1.1 as Cura
2526 property bool prepareStageActive: UM .Controller .activeStage .toString ().indexOf (" PrepareStage" ) > 0
2627 property bool preSlicedData: PrintInformation !== null && PrintInformation .preSliced
2728 property bool settingsVisible: UM .Preferences .getValue (" view/settings_visible" )
28- property bool sidebarVisible: settingsVisible && (prepareStageActive || ! preSlicedData)
29+ property bool settingsDocked: UM .Preferences .getValue (" sidebargui/docked_sidebar" )
30+ property bool sidebarVisible: settingsVisible && (prepareStageActive || ! preSlicedData) && settingsDocked
2931 property real sidebarWidth: sidebarVisible ? printSetupSelector .width : 0
3032
3133 Component .onCompleted :
@@ -156,10 +158,16 @@ Item
156158 target: UM .Preferences
157159 onPreferenceChanged:
158160 {
159- if (preference == " view/settings_visible " )
161+ switch (preference)
160162 {
161- settingsVisible = UM .Preferences .getValue (" view/settings_visible" )
162- base .onWidthChanged (base .width )
163+ case " view/settings_visible" :
164+ settingsVisible = UM .Preferences .getValue (" view/settings_visible" )
165+ base .onWidthChanged (base .width )
166+ break
167+ case " sidebargui/docked_sidebar" :
168+ settingsDocked = UM .Preferences .getValue (" sidebargui/docked_sidebar" )
169+ base .onWidthChanged (base .width )
170+ break
163171 }
164172 }
165173 }
@@ -225,18 +233,27 @@ Item
225233 }
226234 }
227235
228- SidebarContents
236+ Item
229237 {
230238 id: printSetupSidebar
231239 visible: sidebarVisible
232240
241+ width: UM .Theme .getSize (" print_setup_widget" ).width
233242 anchors
234243 {
235244 top: parent .top
236245 bottom: actionRow .top
237246 bottomMargin: actionRow .height == 0 ? 0 : UM .Theme .getSize (" thin_margin" ).height
238247 right: bottomRight .right
239248 }
249+
250+ children: [sidebarContents]
251+ }
252+
253+ SidebarContents
254+ {
255+ id: sidebarContents
256+ anchors .fill : parent
240257 }
241258
242259 SidebarFooter
@@ -253,4 +270,38 @@ Item
253270 anchors .right : parent .right
254271 y: base .height - stageMenu .mapToItem (base .contentItem , 0 , 0 ).y - height
255272 }
273+
274+ Window
275+ {
276+ id: sidebarToolWindow
277+ title: catalog .i18nc (" @title:window" , " Print Settings" )
278+
279+ flags: Qt .Tool | Qt .WindowTitleHint ;
280+
281+ minimumWidth: UM .Theme .getSize (" print_setup_widget" ).width
282+ maximumWidth: minimumWidth
283+ width: minimumWidth
284+ minimumHeight: Math .floor (1.5 * minimumWidth)
285+ height: minimumHeight
286+
287+ visible: ! settingsDocked && settingsVisible
288+ onVisibleChanged:
289+ {
290+ if (visible)
291+ {
292+ printSetupWindow .children = [sidebarContents]
293+ }
294+ else
295+ {
296+ printSetupSidebar .children = [sidebarContents]
297+ }
298+ }
299+
300+ Item
301+ {
302+ id: printSetupWindow
303+
304+ anchors .fill : parent
305+ }
306+ }
256307}
0 commit comments