2020-10-19 13:20:02 +03:00
|
|
|
/*
|
2020-10-19 20:34:47 +03:00
|
|
|
Copyright (C) 2020 Sebastian J. Wolf and other contributors
|
2020-10-19 13:20:02 +03:00
|
|
|
|
|
|
|
This file is part of Fernschreiber.
|
|
|
|
|
|
|
|
Fernschreiber is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Fernschreiber is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
import QtQuick 2.6
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
import "../../pages"
|
|
|
|
import "../"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: tabItem
|
|
|
|
property string title
|
|
|
|
property url image
|
|
|
|
property bool loading
|
|
|
|
//overrideable:
|
|
|
|
property alias loadingVisible: loadingColumn.loadingVisible
|
|
|
|
property string loadingText
|
|
|
|
|
2020-11-16 23:38:55 +03:00
|
|
|
property int tabIndex: index
|
|
|
|
property bool active: index === tabView.currentIndex
|
2020-10-19 13:20:02 +03:00
|
|
|
|
|
|
|
default property alias _data: contentItem.data
|
|
|
|
|
2020-11-17 12:09:06 +03:00
|
|
|
opacity: active ? 1.0 : 0.0
|
|
|
|
Behavior on opacity { FadeAnimation {}}
|
2020-10-19 13:20:02 +03:00
|
|
|
|
|
|
|
Column {
|
|
|
|
id: loadingColumn
|
|
|
|
property bool loadingVisible: tabItem.loading
|
|
|
|
width: tabItem.width
|
|
|
|
height: loadingLabel.height + loadingBusyIndicator.height + Theme.paddingMedium
|
|
|
|
spacing: Theme.paddingMedium
|
|
|
|
topPadding: Theme.paddingLarge
|
|
|
|
anchors.top: parent.top
|
|
|
|
opacity: loadingVisible ? 1.0 : 0.0
|
2020-11-17 12:09:06 +03:00
|
|
|
Behavior on opacity { FadeAnimation {} }
|
2020-10-19 13:20:02 +03:00
|
|
|
visible: tabItem.loading
|
|
|
|
|
|
|
|
InfoLabel {
|
|
|
|
id: loadingLabel
|
|
|
|
text: tabItem.loadingText
|
|
|
|
}
|
|
|
|
|
|
|
|
BusyIndicator {
|
|
|
|
id: loadingBusyIndicator
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
running: parent.loadingVisible
|
|
|
|
size: BusyIndicatorSize.Large
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Item {
|
|
|
|
id: contentItem
|
|
|
|
width: parent.width
|
|
|
|
height: childrenRect.height
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|