@@ -28,6 +28,8 @@ PAGWindow {
2828
2929 property int windowTitleBarHeight: isWindows ? 32 : 22
3030
31+ property int minWindowHeightWithEditPanel: 650
32+
3133 Settings {
3234 id: settings
3335 property bool isEditPanelOpen: false
@@ -67,6 +69,9 @@ PAGWindow {
6769 let preferredSize = pagView .preferredSize ;
6870 let width = Math .max (viewWindow .minimumWidth , preferredSize .width );
6971 let height = Math .max (viewWindow .minimumHeight , preferredSize .height );
72+ if (settings .isEditPanelOpen ) {
73+ width += mainForm .rightItem .width + mainForm .splitHandleWidth ;
74+ }
7075 let x = Math .max (0 , oldX - ((width - oldWidth) / 2 ));
7176 let y = Math .max (50 , oldY - ((height - oldHeight) / 2 ));
7277 settings .lastX = x;
@@ -289,9 +294,7 @@ PAGWindow {
289294 }
290295
291296 function updateProgress () {
292- let duration = mainForm .pagView .duration ;
293- let displayedTime = duration * mainForm .pagView .progress ;
294- mainForm .controlForm .timeDisplayedText .text = Utils .msToTime (displayedTime);
297+ mainForm .controlForm .timeDisplayedText .text = mainForm .pagView .displayedTime ;
295298 mainForm .controlForm .currentFrameText .text = mainForm .pagView .currentFrame ;
296299 mainForm .controlForm .totalFrameText .text = mainForm .pagView .totalFrame ;
297300 }
@@ -312,7 +315,31 @@ PAGWindow {
312315 if (mainForm .controlForm .panelsButton .checked !== willOpen) {
313316 mainForm .controlForm .panelsButton .checked = willOpen;
314317 }
318+
319+ if (willOpen) {
320+ let widthChange = (mainForm .rightItem .width === 0 ) ? mainForm .minPanelWidth : mainForm .rightItem .width ;
321+ widthChange += mainForm .splitHandleWidth ;
322+ if (viewWindow .visibility === Window .FullScreen ) {
323+ mainForm .centerItem .width = viewWindow .width - widthChange;
324+ } else {
325+ viewWindow .width = viewWindow .width + widthChange;
326+ }
327+ mainForm .rightItem .width = widthChange;
328+ if (viewWindow .height < minWindowHeightWithEditPanel) {
329+ viewWindow .height = minWindowHeightWithEditPanel;
330+ }
331+ } else {
332+ let widthChange = - 1 * mainForm .rightItem .width ;
333+ if ((viewWindow .width + widthChange) < viewWindow .minimumWidth ) {
334+ viewWindow .width = viewWindow .minimumWidth ;
335+ } else {
336+ viewWindow .width = viewWindow .width + widthChange;
337+ }
338+ mainForm .rightItem .width = 0 ;
339+ }
340+
315341 settings .isEditPanelOpen = willOpen;
342+ mainForm .isEditPanelOpen = willOpen;
316343 }
317344
318345 function onCommand (command ) {
@@ -325,14 +352,17 @@ PAGWindow {
325352 } else {
326353 openFileDialog .currentFolder = StandardPaths .writableLocation (StandardPaths .DocumentsLocation );
327354 }
328- openFileDialog .accepted .disconnect ();
355+ if (openFileDialog .currentAcceptHandler ) {
356+ openFileDialog .accepted .disconnect (openFileDialog .currentAcceptHandler );
357+ }
329358 openFileDialog .fileMode = FileDialog .OpenFile ;
330359 openFileDialog .title = qsTr (" Open PAG File" );
331360 openFileDialog .nameFilters = [" PAG files(*.pag)" ];
332- openFileDialog .accepted . connect ( function () {
361+ openFileDialog .currentAcceptHandler = function () {
333362 let filePath = openFileDialog .selectedFile ;
334363 mainForm .pagView .setFile (filePath);
335- });
364+ };
365+ openFileDialog .accepted .connect (openFileDialog .currentAcceptHandler );
336366 openFileDialog .open ();
337367 break ;
338368 case " close-window" :
0 commit comments