Changeset View
Changeset View
Standalone View
Standalone View
scripts/desktopchangeosd/contents/ui/osd.qml
Show All 14 Lines | |||||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | import QtQuick 2.0; | 20 | import QtQuick 2.0; | ||
21 | import QtQuick.Window 2.0; | 21 | import QtQuick.Window 2.0; | ||
22 | import org.kde.plasma.core 2.0 as PlasmaCore; | 22 | import org.kde.plasma.core 2.0 as PlasmaCore; | ||
23 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||||
23 | import org.kde.plasma.components 2.0 as Plasma; | 24 | import org.kde.plasma.components 2.0 as Plasma; | ||
24 | import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons; | 25 | import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons; | ||
25 | import org.kde.kwin 2.0; | 26 | import org.kde.kwin 2.0; | ||
26 | 27 | | |||
27 | PlasmaCore.Dialog { | 28 | PlasmaCore.Dialog { | ||
28 | id: dialog | 29 | id: dialog | ||
29 | location: PlasmaCore.Types.Floating | 30 | location: PlasmaCore.Types.Floating | ||
30 | visible: false | 31 | visible: false | ||
Show All 39 Lines | 35 | mainItem: Item { | |||
70 | property int screenWidth: 0 | 71 | property int screenWidth: 0 | ||
71 | property int screenHeight: 0 | 72 | property int screenHeight: 0 | ||
72 | // we count desktops starting from 0 to have it better match the layout in the Grid | 73 | // we count desktops starting from 0 to have it better match the layout in the Grid | ||
73 | property int currentDesktop: 0 | 74 | property int currentDesktop: 0 | ||
74 | property int previousDesktop: 0 | 75 | property int previousDesktop: 0 | ||
75 | property int animationDuration: 1000 | 76 | property int animationDuration: 1000 | ||
76 | property bool showGrid: true | 77 | property bool showGrid: true | ||
77 | 78 | | |||
78 | width: dialogItem.showGrid ? view.itemWidth * view.columns : textElement.width | 79 | width: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth) | ||
79 | height: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.height : textElement.height | 80 | height: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.height : textElement.height | ||
80 | 81 | | |||
81 | Plasma.Label { | 82 | PlasmaExtras.Heading { | ||
82 | id: textElement | 83 | id: textElement | ||
83 | anchors.top: dialogItem.showGrid ? parent.top : undefined | 84 | anchors.top: dialogItem.showGrid ? parent.top : undefined | ||
84 | anchors.horizontalCenter: parent.horizontalCenter | 85 | anchors.left: parent.left | ||
86 | anchors.right: parent.right | ||||
87 | horizontalAlignment: Text.AlignHCenter | ||||
88 | wrapMode: Text.NoWrap | ||||
89 | elide: Text.ElideRight | ||||
85 | text: workspace.desktopName(workspace.currentDesktop) | 90 | text: workspace.desktopName(workspace.currentDesktop) | ||
86 | } | 91 | } | ||
92 | | ||||
87 | Grid { | 93 | Grid { | ||
88 | id: view | 94 | id: view | ||
89 | columns: 1 | 95 | columns: 1 | ||
90 | rows: 1 | 96 | rows: 1 | ||
91 | property int itemWidth: dialogItem.screenWidth * Math.min(0.8/columns, 0.1) | 97 | property int itemWidth: dialogItem.screenWidth * Math.min(0.8/columns, 0.1) | ||
92 | property int itemHeight: Math.min(itemWidth * (dialogItem.screenHeight / dialogItem.screenWidth), dialogItem.screenHeight * Math.min(0.8/rows, 0.1)) | 98 | property int itemHeight: Math.min(itemWidth * (dialogItem.screenHeight / dialogItem.screenWidth), dialogItem.screenHeight * Math.min(0.8/rows, 0.1)) | ||
93 | anchors { | 99 | anchors { | ||
94 | top: textElement.bottom | 100 | top: textElement.bottom | ||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |