on xenial help sign in
WIP: shell theme updates
commite11e7bb0dbe425bca9f628e68c8f1837758e76b2 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 23 Mar 2016, 21:05 (11 years ago) parent2d6f528
16 files changed+138−58
CMakeLists.txt+1−1 qml/Components/PanelState/PanelState.qml+1−1 qml/Components/UbuntuShapeForItem.qml+1 qml/Components/WindowControlButtons.qml+6−6 qml/Launcher/LauncherDelegate.qml+10−11 qml/Launcher/LauncherPanel.qml+20−11 qml/Panel/Indicators/client/IndicatorsClient.qml+1−1 qml/Panel/MenuContent.qml−1 qml/Panel/Panel.qml+12−2 qml/Stages/DecoratedWindow.qml−11 qml/Stages/DesktopStage.qml+57 qml/Stages/WindowDecoration.qml+2−6 tests/mocks/Unity/CMakeLists.txt+1−1 tests/qmltests/Stages/ApplicationCheckBox.qml−1 tests/qmltests/Stages/tst_DesktopStage.qml+2−4 tests/qmltests/tst_Shell.qml+24−1
CMakeLists.txt+1−1
@@ -57,7 +57,7 @@ find_package(Qt5DBus 5.4 REQUIRED)
5757find_package(Qt5Concurrent 5.4 REQUIRED)
5858find_package(Qt5Sql 5.4 REQUIRED)
5959
60−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=13)
60+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application>=13)
6161pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
6262pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
6363pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
qml/Components/PanelState/PanelState.qml+1−1
@@ -23,7 +23,7 @@ QtObject {
2323 property string title: ""
2424 property bool buttonsVisible: false
2525 property bool dropShadow: false
26− property int panelHeight: units.gu(3)
26+ property int panelHeight: 0
2727
2828 signal close()
2929 signal minimize()
qml/Components/UbuntuShapeForItem.qml+1
@@ -28,6 +28,7 @@ Item {
2828
2929 property alias radius: shape.radius
3030 property alias image: source.sourceItem
31+ property alias aspect: shape.aspect
3132
3233 ShaderEffectSource {
3334 id: source
qml/Components/WindowControlButtons.qml+6−6
@@ -41,7 +41,7 @@ Row {
4141 width: units.gu(2)
4242 height: units.gu(2)
4343 radius: height / 2
44− color: "#ed3146"
44+ color: UbuntuColors.red
4545 visible: parent.containsMouse
4646 }
4747 Icon {
@@ -49,7 +49,7 @@ Row {
4949 height: parent.height *.5
5050 anchors.centerIn: parent
5151 source: "graphics/window-close.svg"
52− color: root.active ? "white" : "#5d5d5d"
52+ color: root.active ? "white" : UbuntuColors.slate
5353 keyColor: "black"
5454 }
5555 }
@@ -67,7 +67,7 @@ Row {
6767 width: units.gu(2)
6868 height: units.gu(2)
6969 radius: height / 2
70− color: "#888888"
70+ color: UbuntuColors.graphite
7171 visible: parent.containsMouse
7272 }
7373 Icon {
@@ -75,7 +75,7 @@ Row {
7575 height: parent.height *.5
7676 anchors.centerIn: parent
7777 source: "graphics/window-minimize.svg"
78− color: root.active ? "white" : "#5d5d5d"
78+ color: root.active ? "white" : UbuntuColors.slate
7979 keyColor: "black"
8080 }
8181 }
@@ -93,7 +93,7 @@ Row {
9393 width: units.gu(2)
9494 height: units.gu(2)
9595 radius: height / 2
96− color: "#888888"
96+ color: UbuntuColors.graphite
9797 visible: parent.containsMouse
9898 }
9999 Icon {
@@ -101,7 +101,7 @@ Row {
101101 height: parent.height *.5
102102 anchors.centerIn: parent
103103 source: "graphics/window-maximize.svg"
104− color: root.active ? "white" : "#5d5d5d"
104+ color: root.active ? "white" : UbuntuColors.slate
105105 keyColor: "black"
106106 }
107107 }
qml/Launcher/LauncherDelegate.qml+10−11
@@ -164,7 +164,7 @@ Item {
164164 }
165165 width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
166166 height: units.gu(2)
167− backgroundColor: UbuntuColors.orange
167+ backgroundColor: UbuntuColors.green
168168 visible: root.countVisible
169169 aspect: UbuntuShape.Flat
170170
@@ -173,14 +173,12 @@ Item {
173173 objectName: "countLabel"
174174 text: root.count
175175 anchors.centerIn: parent
176− // FIXME: verticalCenter seems to be off wee bit and QML doesn't have a centerLine
177− // property for Text: https://bugreports.qt-project.org/browse/QTBUG-40479
178− anchors.verticalCenterOffset: -units.dp(.5)
179176 width: root.itemWidth - units.gu(1)
180177 horizontalAlignment: Text.AlignHCenter
181178 elide: Text.ElideRight
182179 color: "white"
183180 fontSize: "x-small"
181+ font.weight: Font.Light
184182 }
185183 }
186184
@@ -190,9 +188,9 @@ Item {
190188
191189 anchors.centerIn: parent
192190 width: root.itemWidth * .8
193− height: units.gu(1)
191+ height: units.dp(3)
194192 visible: root.progress > -1
195− backgroundColor: UbuntuColors.darkGrey
193+ backgroundColor: "white"
196194 borderSource: "none"
197195
198196 Item {
@@ -210,7 +208,7 @@ Item {
210208 top: parent.top
211209 bottom: parent.bottom
212210 }
213− backgroundColor: "white"
211+ backgroundColor: UbuntuColors.blue
214212 borderSource: "none"
215213 width: progressOverlay.width
216214 }
@@ -247,18 +245,19 @@ Item {
247245 visible: root.itemFocused
248246 }
249247
250− Rectangle {
248+ UbuntuShape {
251249 objectName: "shortcutHint"
252250 anchors.centerIn: parent
253− width: units.gu(3)
251+ width: units.gu(2)
254252 height: width
255− color: "#E0292929"
253+ backgroundColor: Qt.rgba(17/255, 17/255, 17/255, 0.95) // #111111, 95%
256254 visible: root.shortcutHintShown
255+ aspect: UbuntuShape.Flat
257256 Label {
258257 anchors.centerIn: parent
259258 text: (itemIndex + 1) % 10
260259 color: "white"
261− font.weight: Font.DemiBold
260+ font.weight: Font.Light
262261 }
263262 }
264263 }
qml/Launcher/LauncherPanel.qml+20−11
@@ -25,7 +25,7 @@ import "../Components/"
2525
2626Rectangle {
2727 id: root
28− color: "#E0292929"
28+ color: Qt.rgba(17/255, 17/255, 17/255, 0.95) // #111111, 95%
2929
3030 rotation: inverted ? 180 : 0
3131
@@ -633,9 +633,10 @@ Rectangle {
633633 id: quickListShape
634634 objectName: "quickListShape"
635635 anchors.fill: quickList
636− opacity: quickList.state === "open" ? 0.8 : 0
636+ opacity: quickList.state === "open" ? 0.95 : 0 // FIXME: should this have some transparency at all?
637637 visible: opacity > 0
638638 rotation: root.rotation
639+ aspect: UbuntuShape.Flat
639640
640641 Behavior on opacity {
641642 UbuntuNumberAnimation {}
@@ -696,7 +697,7 @@ Rectangle {
696697 Rectangle {
697698 id: quickList
698699 objectName: "quickList"
699− color: "#f5f5f5"
700+ color: UbuntuColors.jet
700701 // Because we're setting left/right anchors depending on orientation, it will break the
701702 // width setting after rotating twice. This makes sure we also re-apply width on rotation
702703 width: root.inverted ? units.gu(30) : units.gu(30)
@@ -767,14 +768,10 @@ Rectangle {
767768 quickList.state = "open";
768769 }
769770
770− StyledItem {
771+ Item {
771772 width: parent.width
772773 height: quickListColumn.height
773774
774− theme: ThemeSettings {
775− name: "Ubuntu.Components.Themes.Ambiance"
776− }
777−
778775 Column {
779776 id: quickListColumn
780777 width: parent.width
@@ -784,11 +781,23 @@ Rectangle {
784781 id: popoverRepeater
785782 model: quickList.model
786783
787− ListItems.Standard {
784+ ListItem {
788785 objectName: "quickListEntry" + index
789− text: (model.clickable ? "" : "<b>") + model.label + (model.clickable ? "" : "</b>")
790− highlightWhenPressed: model.clickable
791786 selected: index === quickList.selectedIndex
787+ divider.colorFrom: UbuntuColors.slate
788+ divider.colorTo: UbuntuColors.slate
789+ highlightColor: !model.clickable ? quickList.color : undefined
790+
791+ Label {
792+ anchors.fill: parent
793+ anchors.leftMargin: units.gu(4) // 2 GU for an optional checkmark
794+ anchors.rightMargin: units.gu(1)
795+ verticalAlignment: Label.AlignVCenter
796+ text: model.label
797+ color: model.clickable ? "white" /*theme.palette.normal.backgroundText*/ : theme.palette.normal.backgroundSecondaryText
798+ //fontSize: model.clickable && index == 0 ? "medium" : "small" // FIXME too small
799+ font.weight: index == 0 ? Font.Medium : Font.Light
800+ }
792801
793802 onClicked: {
794803 if (!model.clickable) {
qml/Panel/Indicators/client/IndicatorsClient.qml+1−1
@@ -22,7 +22,7 @@ import Ubuntu.Components 1.3
2222import Ubuntu.Components.ListItems 1.3 as ListItem
2323
2424Rectangle {
25− color: "#292929"
25+ color: UbuntuColors.jet
2626 id: root
2727
2828 Component.onCompleted: {
qml/Panel/MenuContent.qml−1
@@ -27,7 +27,6 @@ Rectangle {
2727
2828 property QtObject indicatorsModel: null
2929 property int currentMenuIndex: -1
30− color: theme.palette.normal.background
3130
3231 width: units.gu(40)
3332 height: units.gu(42)
qml/Panel/Panel.qml+12−2
@@ -101,6 +101,7 @@ Item {
101101 }
102102
103103 MouseArea {
104+ objectName: "windowControlArea"
104105 anchors {
105106 top: parent.top
106107 left: parent.left
@@ -111,6 +112,15 @@ Item {
111112 onClicked: callHint.visible ? callHint.showLiveCall() : PanelState.focusMaximizedApp()
112113 onDoubleClicked: PanelState.maximize()
113114
115+ property bool mouseWasPressed: false
116+ onPressed: mouseWasPressed = containsPress
117+ onExited: {
118+ if (mouseWasPressed && !indicatorAreaBackground.contains(Qt.point(mouseX, mouseY))) {
119+ PanelState.maximize(); // restore the window when "dragging" the panel down
120+ mouseWasPressed = false;
121+ }
122+ }
123+
114124 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
115125 // cf. https://bugreports.qt.io/browse/QTBUG-32909
116126 WindowControlButtons {
@@ -176,12 +186,12 @@ Item {
176186 topMargin: units.gu(0.5)
177187 bottomMargin: units.gu(0.5)
178188 }
179− color: PanelState.buttonsVisible ? "#ffffff" : "#5d5d5d"
189+ color: PanelState.buttonsVisible ? "white" : UbuntuColors.slate
180190 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
181191 visible: !windowControlButtons.visible && !root.locked && !callHint.visible
182192 verticalAlignment: Text.AlignVCenter
183193 fontSize: "medium"
184− font.weight: Font.Normal
194+ font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
185195 text: PanelState.title
186196 elide: Text.ElideRight
187197 maximumLineCount: 1
qml/Stages/DecoratedWindow.qml−11
@@ -34,7 +34,6 @@ FocusScope {
3434
3535 readonly property bool decorationShown: !fullscreen
3636 property bool highlightShown: false
37− property real shadowOpacity: 1
3837
3938 property alias requestedWidth: applicationWindow.requestedWidth
4039 property real requestedHeight
@@ -66,16 +65,6 @@ FocusScope {
6665 visible: highlightShown
6766 }
6867
69− BorderImage {
70− anchors {
71− fill: root
72− margins: active ? -units.gu(2) : -units.gu(1.5)
73− }
74− source: "graphics/dropshadow2gu.sci"
75− opacity: root.shadowOpacity * .3
76− enabled: !fullscreen
77− }
78−
7968 WindowDecoration {
8069 id: decoration
8170 target: root.parent
qml/Stages/DesktopStage.qml+57
@@ -486,6 +486,63 @@ AbstractStage {
486486 onMinimize: appDelegate.minimize()
487487 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
488488 }
489+
490+ BorderImage {
491+ anchors {
492+ fill: decoratedWindow
493+ margins: decoratedWindow.active ? -units.gu(2) : -units.gu(1.5)
494+ }
495+ source: "graphics/dropshadow2gu.sci"
496+ opacity: .3
497+ visible: !decoratedWindow.fullscreen && !appDelegate.maximized
498+ enabled: visible
499+ }
500+
501+ Rectangle {
502+ id: mask
503+ radius: appDelegate.maximized ? 0 : units.gu(.7) // disable rounded corners when maximized/fullscreen
504+ anchors.fill: decoratedWindow
505+ }
506+
507+ ShaderEffectSource {
508+ id: sourceMask
509+ hideSource: true
510+ sourceItem: mask
511+ }
512+
513+ ShaderEffectSource {
514+ id: sourceImage
515+ hideSource: !decoratedWindow.fullscreen
516+ sourceItem: decoratedWindow
517+ }
518+
519+ ShaderEffect {
520+ id: maskEffect
521+ anchors.fill: mask
522+ blending: false
523+ enabled: state == "normal" || state == "closing"
524+ || appDelegate.maximizedLeft || appDelegate.maximizedRight
525+
526+ property variant sourceTexture: sourceImage
527+ property variant maskTexture: sourceMask
528+
529+ fragmentShader: "
530+ uniform sampler2D sourceTexture;
531+ uniform sampler2D maskTexture;
532+ varying highp vec2 qt_TexCoord0;
533+
534+ void main()
535+ {
536+ highp vec4 c = texture2D(sourceTexture, qt_TexCoord0);
537+ highp vec4 m = texture2D(maskTexture, qt_TexCoord0);
538+
539+ if (m.a == 0.0) // if the mask is transparent, discard the pixel
540+ discard;
541+ else
542+ gl_FragColor = c; // otherwise use the original color
543+ }
544+ "
545+ }
489546 }
490547 }
491548 }
qml/Stages/WindowDecoration.qml+2−6
@@ -22,7 +22,6 @@ import "../Components/PanelState"
2222
2323MouseArea {
2424 id: root
25− clip: true
2625
2726 property Item target
2827 property alias title: titleLabel.text
@@ -64,9 +63,6 @@ MouseArea {
6463 }
6564
6665 Rectangle {
67− anchors.fill: parent
68− anchors.bottomMargin: -radius
69− radius: units.gu(.5)
7066 color: theme.palette.normal.background
7167 }
7268
@@ -92,12 +88,12 @@ MouseArea {
9288 Label {
9389 id: titleLabel
9490 objectName: "windowDecorationTitle"
95− color: root.active ? "white" : "#5d5d5d"
91+ color: root.active ? "white" : UbuntuColors.slate
9692 height: parent.height
9793 width: parent.width - buttons.width - parent.anchors.rightMargin - parent.anchors.leftMargin
9894 verticalAlignment: Text.AlignVCenter
9995 fontSize: "medium"
100− font.weight: root.active ? Font.Light : Font.Normal
96+ font.weight: root.active ? Font.Light : Font.Medium
10197 elide: Text.ElideRight
10298 }
10399 }
tests/mocks/Unity/CMakeLists.txt+1−1
@@ -8,7 +8,7 @@ add_subdirectory(DashCommunicator)
88add_subdirectory(Screens)
99
1010pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
11−pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=10)
11+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=11)
1212
1313include_directories(
1414 ${CMAKE_CURRENT_BINARY_DIR}
tests/qmltests/Stages/ApplicationCheckBox.qml−1
@@ -88,7 +88,6 @@ RowLayout {
8888 Label {
8989 id: appIdLabel
9090 text: root.appId
91− color: "white"
9291 anchors.verticalCenter: parent.verticalCenter
9392 }
9493 Rectangle {
tests/qmltests/Stages/tst_DesktopStage.qml+2−4
@@ -65,7 +65,6 @@ Item {
6565 property bool itemDestroyed: false
6666 sourceComponent: Component {
6767 DesktopStage {
68− color: "white"
6968 anchors.fill: parent
7069 background: "../../../qml/graphics/tablet_background.jpg"
7170
@@ -82,13 +81,13 @@ Item {
8281
8382 Rectangle {
8483 id: controls
85− color: "darkgrey"
8684 width: units.gu(30)
8785 anchors {
8886 top: parent.top
8987 bottom: parent.bottom
9088 right: parent.right
9189 }
90+ color: "darkgrey"
9291
9392 Flickable {
9493 anchors.fill: parent
@@ -98,7 +97,6 @@ Item {
9897 spacing: units.gu(1)
9998
10099 Button {
101− color: "white"
102100 text: "Make surface slow to resize"
103101 activeFocusOnPress: false
104102 onClicked: {
@@ -125,7 +123,7 @@ Item {
125123 }
126124 }
127125
128− SurfaceManagerControls { textColor: "white" }
126+ SurfaceManagerControls { }
129127 }
130128 }
131129 }
tests/qmltests/tst_Shell.qml+24−1
@@ -215,7 +215,6 @@ Rectangle {
215215 MouseTouchEmulationCheckbox {
216216 id: mouseEmulation
217217 checked: true
218− color: "white"
219218 }
220219 ListItem.ItemSelector {
221220 id: ctrlModifier
@@ -2224,5 +2223,29 @@ Rectangle {
22242223 compare(topmostSurfaceItem.touchPressCount, 2);
22252224 compare(topmostSurfaceItem.touchReleaseCount, 2);
22262225 }
2226+
2227+ function test_dragPanelToRestoreMaximizedWindow() {
2228+ loadShell("desktop");
2229+ shell.usageScenario = "desktop";
2230+ waitForRendering(shell);
2231+ var panel = findChild(shell, "windowControlArea");
2232+ verify(panel);
2233+
2234+ var app = ApplicationManager.startApplication("dialer-app")
2235+ waitUntilAppWindowIsFullyLoaded(app);
2236+
2237+ // start dialer, maximize it
2238+ var appContainer = findChild(shell, "appContainer");
2239+ var appDelegate = findChild(appContainer, "appDelegate_dialer-app");
2240+ verify(appDelegate);
2241+ appDelegate.maximize();
2242+ tryCompare(appDelegate, "state", "maximized");
2243+
2244+ mousePress(panel);
2245+ mouseMove(shell, shell.width/2, shell.height/2);
2246+ mouseRelease(shell);
2247+
2248+ tryCompare(appDelegate, "state", "normal");
2249+ }
22272250 }
22282251}