Commit 7fcd1499 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Remove our isCompact concept and use Kirigami's

parent d8db2fa6
......@@ -42,7 +42,7 @@ DiscoverPage {
property alias allBackends: appsModel.allBackends
property alias count: apps.count
property alias listHeader: apps.header
property bool compact: page.width < 500 || Helpers.isCompact
property bool compact: page.width < 500 || !applicationWindow().wideScreen
property bool canNavigate: true
readonly property alias subcategories: appsModel.subcategories
......
......@@ -42,7 +42,7 @@ DiscoverPage
Navigation.openCategory(null, "")
}
property bool compact: page.width < 500 || Helpers.isCompact
readonly property bool compact: page.width < 500 || !applicationWindow().wideScreen
ListView {
id: browsingView
......
......@@ -28,6 +28,7 @@ import "navigation.js" as Navigation
Kirigami.GlobalDrawer {
id: drawer
property bool wideScreen: false
bannerImageSource: "qrc:/banners/banner.svg"
//make the left and bottom margins for search field the same
topPadding: -searchField.height - leftPadding
......@@ -131,12 +132,12 @@ Kirigami.GlobalDrawer {
states: [
State {
name: "full"
when: !Helpers.isCompact
when: drawer.wideScreen
PropertyChanges { target: drawer; drawerOpen: true }
},
State {
name: "compact"
when: Helpers.isCompact
when: !drawer.wideScreen
PropertyChanges { target: drawer; drawerOpen: false }
}
]
......@@ -188,6 +189,6 @@ Kirigami.GlobalDrawer {
actions: createCategoryActions(CategoryModel.rootCategories)
modal: Helpers.isCompact
handleVisible: Helpers.isCompact
modal: !drawer.wideScreen
handleVisible: !drawer.wideScreen
}
......@@ -37,7 +37,6 @@ Kirigami.ApplicationWindow
readonly property var leftPage: window.stack.depth>0 ? window.stack.get(0) : null
Component.onCompleted: {
Helpers.mainWindow = window
if (app.isRoot)
showPassiveNotification(i18n("Running as <em>root</em> is discouraged and unnecessary."));
}
......@@ -159,6 +158,7 @@ Kirigami.ApplicationWindow
}
globalDrawer: DiscoverDrawer {
wideScreen: window.wideScreen
focus: true
}
......
pragma Singleton
import QtQml 2.0
import QtQuick.Window 2.2
import org.kde.discover.app 1.0
QtObject
{
id: root
property QtObject mainWindow: null
property int compactMode: app.compactMode
readonly property real width: root.mainWindow ? root.mainWindow.width : 0
///we'll use compact if the width of the window is less than 10cm
readonly property bool isCompact: (!root.mainWindow || compactMode!=DiscoverMainWindow.Auto) ? compactMode==DiscoverMainWindow.Compact : (width/root.mainWindow.Screen.pixelDensity<100)
}
......@@ -32,7 +32,6 @@
<file>qml/DiscoverPage.qml</file>
<file>qml/DiscoverWindow.qml</file>
<file>qml/DiscoverDrawer.qml</file>
<file>qml/Helpers.qml</file>
<file>qml/ActionListItem.qml</file>
<file>qml/LoadingPage.qml</file>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment