Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderView.qml
Show First 20 Lines • Show All 478 Lines • ▼ Show 20 Line(s) | 191 | MouseEventListener { | |||
---|---|---|---|---|---|
479 | 479 | | |||
480 | PlasmaExtras.ScrollArea { | 480 | PlasmaExtras.ScrollArea { | ||
481 | id: scrollArea | 481 | id: scrollArea | ||
482 | 482 | | |||
483 | anchors.fill: parent | 483 | anchors.fill: parent | ||
484 | 484 | | |||
485 | focus: true | 485 | focus: true | ||
486 | 486 | | |||
487 | readonly property int viewportWidth: viewport ? Math.ceil(viewport.width) : 0 | 487 | property bool ready: false | ||
488 | readonly property int viewportHeight: viewport ? Math.ceil(viewport.height) : 0 | 488 | readonly property int viewportWidth: scrollArea.ready && viewport ? Math.ceil(viewport.width) : 0 | ||
489 | readonly property int viewportHeight: scrollArea.ready && viewport ? Math.ceil(viewport.height) : 0 | ||||
490 | | ||||
491 | Component.onCompleted: { | ||||
492 | scrollArea.ready = true; | ||||
hein: Missing semicolon, also ready is defined nowhere. | |||||
Arg, curses. ready is defined 2 lines up. Also, do you want me to put scrollArea.ready so it's not confused with folderViewLayer.ready defined in main.qml? Zren: Arg, curses.
`ready` is defined 2 lines up. Also, do you want me to put `scrollArea.ready` so… | |||||
Maybe I'm blind, but you're linking to a definition of a 'ready' prop in a different file. FolderView.qml can't depend on a property in main.qml, this will e.g. break in FolderViewDialog. And yeah, disambiguification is good ... hein: Maybe I'm blind, but you're linking to a definition of a 'ready' prop in a different file. | |||||
Ready is defined right here https://i.imgur.com/fvRe3CI.png Zren: Ready is defined right here https://i.imgur.com/fvRe3CI.png
The definition, assignment, and… | |||||
493 | } | ||||
489 | 494 | | |||
490 | GridView { | 495 | GridView { | ||
491 | id: gridView | 496 | id: gridView | ||
492 | 497 | | |||
493 | property bool isRootView: false | 498 | property bool isRootView: false | ||
494 | 499 | | |||
495 | property int iconSize: makeIconSize() | 500 | property int iconSize: makeIconSize() | ||
496 | property int verticalDropHitscanOffset: 0 | 501 | property int verticalDropHitscanOffset: 0 | ||
Show All 18 Lines | |||||
515 | keyNavigationWraps: false | 520 | keyNavigationWraps: false | ||
516 | boundsBehavior: Flickable.StopAtBounds | 521 | boundsBehavior: Flickable.StopAtBounds | ||
517 | 522 | | |||
518 | function calcExtraSpacing(cellSize, containerSize) { | 523 | function calcExtraSpacing(cellSize, containerSize) { | ||
519 | var availableColumns = Math.floor(containerSize / cellSize); | 524 | var availableColumns = Math.floor(containerSize / cellSize); | ||
520 | var extraSpacing = 0; | 525 | var extraSpacing = 0; | ||
521 | if (availableColumns > 0) { | 526 | if (availableColumns > 0) { | ||
522 | var allColumnSize = availableColumns * cellSize; | 527 | var allColumnSize = availableColumns * cellSize; | ||
523 | var extraSpace = Math.max(containerSize - allColumnSize); | 528 | var extraSpace = Math.max(containerSize - allColumnSize, 0); | ||
524 | extraSpacing = extraSpace / availableColumns; | 529 | extraSpacing = extraSpace / availableColumns; | ||
525 | } | 530 | } | ||
526 | return extraSpacing; | 531 | return extraSpacing; | ||
527 | } | 532 | } | ||
528 | 533 | | |||
529 | readonly property int iconWidth: iconSize + (2 * units.largeSpacing) + (2 * units.smallSpacing) | | |||
530 | readonly property real extraWidth: calcExtraSpacing(iconWidth, scrollArea.viewportWidth) | | |||
531 | cellWidth: { | 534 | cellWidth: { | ||
532 | if (root.useListViewMode) { | 535 | if (root.useListViewMode) { | ||
533 | return gridView.width; | 536 | return gridView.width; | ||
534 | } else if (root.isContainment && isRootView) { | 537 | } else { | ||
538 | var iconWidth = iconSize + (2 * units.largeSpacing) + (2 * units.smallSpacing); | ||||
539 | if (root.isContainment && isRootView && scrollArea.viewportWidth > 0) { | ||||
540 | var extraWidth = calcExtraSpacing(iconWidth, scrollArea.viewportWidth); | ||||
535 | return iconWidth + extraWidth; | 541 | return iconWidth + extraWidth; | ||
536 | } else { | 542 | } else { | ||
537 | return iconWidth; | 543 | return iconWidth; | ||
538 | } | 544 | } | ||
539 | } | 545 | } | ||
546 | } | ||||
540 | 547 | | |||
541 | readonly property int iconHeight: (iconSize + (theme.mSize(theme.defaultFont).height * plasmoid.configuration.textLines) + (6 * units.smallSpacing)) | | |||
542 | readonly property real extraHeight: calcExtraSpacing(iconHeight, scrollArea.viewportHeight) | | |||
543 | cellHeight: { | 548 | cellHeight: { | ||
544 | if (root.useListViewMode) { | 549 | if (root.useListViewMode) { | ||
545 | return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) | 550 | return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) | ||
546 | + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | 551 | + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | ||
547 | listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; | 552 | listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; | ||
548 | } else if (root.isContainment && isRootView) { | 553 | } else { | ||
554 | var iconHeight = iconSize + (theme.mSize(theme.defaultFont).height * plasmoid.configuration.textLines) + (6 * units.smallSpacing); | ||||
555 | if (root.isContainment && isRootView && scrollArea.viewportHeight > 0) { | ||||
556 | var extraHeight = calcExtraSpacing(iconHeight, scrollArea.viewportHeight); | ||||
549 | return iconHeight + extraHeight; | 557 | return iconHeight + extraHeight; | ||
550 | } else { | 558 | } else { | ||
551 | return iconHeight; | 559 | return iconHeight; | ||
552 | } | 560 | } | ||
553 | } | 561 | } | ||
562 | } | ||||
554 | 563 | | |||
555 | delegate: FolderItemDelegate { | 564 | delegate: FolderItemDelegate { | ||
556 | width: gridView.cellWidth | 565 | width: gridView.cellWidth | ||
557 | height: gridView.cellHeight | 566 | height: gridView.cellHeight | ||
558 | } | 567 | } | ||
559 | 568 | | |||
560 | onContentXChanged: { | 569 | onContentXChanged: { | ||
561 | if (hoveredItem) { | 570 | if (hoveredItem) { | ||
▲ Show 20 Lines • Show All 715 Lines • Show Last 20 Lines |
Missing semicolon, also ready is defined nowhere.