Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework some stuff and fix startup #77

Merged
merged 8 commits into from Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions glacier-home.pro
Expand Up @@ -48,7 +48,7 @@ system.path = /usr/share/lipstick-glacier-home-qt5/qml/system
system.files = src/qml/ShutdownScreen.qml

volumecontrol.path = /usr/share/lipstick-glacier-home-qt5/qml/volumecontrol
volumecontrol.files = src/qml/VolumeControl.qml
volumecontrol.files = src/qml/volumecontrol/VolumeControl.qml

connectivity.path = /usr/share/lipstick-glacier-home-qt5/qml/connectivity
connectivity.files = src/qml/connectivity/USBModeSelector.qml \
Expand Down Expand Up @@ -76,7 +76,8 @@ applauncher.files = src/qml/applauncher/SearchListView.qml \
src/qml/applauncher/LauncherItemFolder.qml

controlcenter.path = /usr/share/lipstick-glacier-home-qt5/qml/controlcenter
controlcenter.files = src/qml/controlcenter/ControlButton.qml
controlcenter.files = src/qml/controlcenter/ControlButton.qml \
src/qml/controlcenter/NetworkControlButton.qml

lockscreen.path = /usr/share/lipstick-glacier-home-qt5/qml/lockscreen
lockscreen.files = src/qml/lockscreen/LockscreenClock.qml \
Expand Down Expand Up @@ -146,14 +147,19 @@ OTHER_FILES += src/qml/*.qml \
src/nemovars.conf \
src/qml/connectivity/*.qml

TRANSLATIONS += i18n/glacer-home.ts
TRANSLATIONS += translations/glacer-home.ts \
translations/glacer-home_ru.ts

i18n_files.files = translations
i18n_files.path = /usr/share/lipstick-glacier-home-qt5/

INSTALLS += i18n_files

DISTFILES += \
i18n/glacer-home.ts \
translations/*.ts \
qml/*/*.qml \
settings-plugins/*/*.qml \
settings-plugins/*/*.json \
settings-plugins/*/*.svg \
rpm/* \
src/qml/lockscreen/LockscreenClock.qml
rpm/*

1 change: 1 addition & 0 deletions rpm/lipstick-glacier-home-qt5.spec
Expand Up @@ -61,6 +61,7 @@ ln -s ../lipstick.service %{buildroot}%{_libdir}/systemd/user/user-session.targe
%{_libdir}/systemd/user/user-session.target.wants/lipstick.service
%{_datadir}/lipstick-glacier-home-qt5/nemovars.conf
%{_datadir}/lipstick-glacier-home-qt5/qml
%{_datadir}/lipstick-glacier-home-qt5/translations
%{_datadir}/glacier-settings/

%post
Expand Down
7 changes: 3 additions & 4 deletions rpm/lipstick.service
Expand Up @@ -2,13 +2,12 @@
Description=The lipstick UI
Requires=dbus.socket pre-user-session.target
After=pre-user-session.target

[Service]
Type=notify
EnvironmentFile=-/var/lib/environment/compositor/*.conf
EnvironmentFile=-/usr/share/lipstick-glacier-home-qt5/nemovars.conf
ExecStart=/usr/bin/lipstick $LIPSTICK_OPTIONS --systemd
ExecStart=/usr/bin/invoker --type=generic /usr/bin/lipstick $LIPSTICK_OPTIONS --systemd
Restart=always

[Install]
WantedBy=user-session.target
20 changes: 15 additions & 5 deletions src/main.cpp
@@ -1,5 +1,5 @@

// This file is part of colorful-home, a nice user experience for touchscreens.
// This file is part of glacier-home, a nice user experience for NemoMobile.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,19 +20,29 @@
// SOFTWARE.
//
// Copyright (c) 2012, Timur Kristóf <venemo@fedoraproject.org>
// Copyright (c) 2018, Chupligin Sergey <neochapay@gmail.com>

#include <homeapplication.h>
#include <QFont>
#include <homewindow.h>
#include <lipstickqmlpath.h>
#include <QQmlEngine>
#include <QQmlContext>
#include "glacierwindowmodel.h"
#include <QScreen>
#include <QTranslator>

#include <homewindow.h>
#include <homeapplication.h>
#include <lipstickqmlpath.h>

#include "glacierwindowmodel.h"


int main(int argc, char **argv)
{
HomeApplication app(argc, argv, QString());

QTranslator myappTranslator;
myappTranslator.load(QStringLiteral("/usr/share/lipstick-glacier-home-qt5/translations/glacer-home_%1.qm").arg(QLocale::system().name()));
app.installTranslator(&myappTranslator);

QmlPath::append("/usr/share/lipstick-glacier-home-qt5/qml");
QGuiApplication::setFont(QFont("Open Sans"));
app.setCompositorPath("/usr/share/lipstick-glacier-home-qt5/qml/compositor.qml");
Expand Down
225 changes: 119 additions & 106 deletions src/qml/ControlCenter.qml
Expand Up @@ -46,139 +46,152 @@ import org.nemomobile.lipstick 0.1
import "controlcenter"

//Area to return
MouseArea{
Item{
id: controlCenterArea
property bool controlCenterState: false //Is control center enabled or disabled?

property bool activated: false

width: Screen.width
height: Screen.height
visible: controlCenterState
state: "hide"
height: 0
visible: height > 0

clip: true

function down() {
controlCenterArea.height = 0
controlCenterArea.activated = false
}


onHeightChanged: {
if(height != Screen.height) {
hiderTimer.restart()
} else {
hiderTimer.stop()
}
}

onActivatedChanged: {
if(!activated) {
down()
}
}

Timer{
id: hiderTimer
repeat: false
running: false
interval: 5000
onTriggered: {
down()
}
}

Rectangle{
id: controlCenterOutAreaDim
anchors.fill: parent
color: "black"
opacity:0.5
color: Theme.backgroundColor
}

//Control Center area
MouseArea{
InverseMouseArea{
anchors.fill: parent
enabled: parent.activated
parent: controlCenterArea

onPressed: {
controlCenterArea.height = 0
controlCenterArea.activated = false
}
}

Rectangle {
id: controlCenter
width: parent.width
height: parent.width
color: "transparent"

Rectangle {
id: controlCenter
RowLayout {
id: layout

anchors.top: parent.top
anchors.topMargin: size.dp(40 + 22)
width: parent.width
height: parent.width
color: Theme.backgroundColor
radius:32
x:0
y:0

RowLayout {
id: layout

anchors.top: parent.top
anchors.topMargin: size.dp(40 + 22)
width: parent.width
height: size.dp(86)

ControlButton{
image: "image://theme/wifi"
textLabel: qsTr("Wi-Fi")
}
ControlButton{
image: "image://theme/bluetooth"
textLabel: qsTr("Bluetooth")
}
ControlButton{
image: "image://theme/exchange-alt"
textLabel: qsTr("Data")
}
ControlButton{
image: "image://theme/map-marker-alt"
textLabel: qsTr("Location")
}
ControlButton{
image: "image://theme/moon"
textLabel: qsTr("Quiet")
}
height: size.dp(86)

NetworkControlButton{
image: "image://theme/wifi"
textLabel: qsTr("Wi-Fi")
networkingModel: "wifi"
}
NetworkControlButton{
image: "image://theme/bluetooth"
textLabel: qsTr("Bluetooth")
networkingModel: "bluetooth"
}
NetworkControlButton{
image: "image://theme/exchange-alt"
textLabel: qsTr("Data")
networkingModel: "cellular"
}
NetworkControlButton{
image: "image://theme/map-marker-alt"
textLabel: qsTr("Location")
networkingModel: "gps"
}
ControlButton{
image: "image://theme/moon"
textLabel: qsTr("Quiet")
}
}

GridView{
id: notifyLayout
GridView{
id: notifyLayout

anchors{
top: layout.bottom
topMargin: size.dp(62)
left: controlCenterArea.left
leftMargin: size.dp(31)
}
anchors{
top: layout.bottom
topMargin: size.dp(62)
left: controlCenterArea.left
leftMargin: size.dp(31)
}

width: parent.width
width: parent.width

cellWidth: parent.width/5
cellHeight: cellWidth
cellWidth: parent.width/5
cellHeight: cellWidth

model: statusNotiferModel
delegate: ControlButton{
width: notifyLayout.cellWidth;
height: notifyLayout.cellHeight
image: notifierItem.icon
textLabel: notifierItem.title
model: statusNotiferModel
delegate: ControlButton{
width: notifyLayout.cellWidth;
height: notifyLayout.cellHeight
image: notifierItem.icon
textLabel: notifierItem.title

onClicked: {
notifierItem.activate()
}
onClicked: {
notifierItem.activate()
}
}
}
}
/*Little hack for hide control center*/
MouseArea{
id: backgroundMouseArea
anchors.fill: parent

//Close the thing if background is tapped
onClicked: {
//Do the stuff to show the menu
setControlCenterState( false )
}

function setControlCenterState(enabled) {
controlCenterState = true
enabled ? state = '' : state = 'hide'
}

function getControlCenterState(){
return controlCenterState;
}

states: [
State { name: "hide"
property int pMouse: 0

PropertyChanges {
target: controlCenter
y: -controlCenter.height
}
PropertyChanges {
target: controlCenterOutAreaDim
opacity: 0
}
onPressed: {
backgroundMouseArea.pMouse = backgroundMouseArea.mouseY
}
]
transitions: [
Transition {
SequentialAnimation {
ScriptAction {
script: controlCenterState = true
}
id: closeAnimation
NumberAnimation {
properties: "x,y,opacity"
easing.type: Easing.InOutQuint
}
ScriptAction {
script: state == 'hide' ? controlCenterState = false : controlCenterState = true
}
onReleased: {
if(pMouse-backgroundMouseArea.mouseY >= Screen.height/4){
controlCenterArea.down()
}
pMouse = 0;
}
]
}

Behavior on height {
NumberAnimation { duration: 100 }
}
}

4 changes: 3 additions & 1 deletion src/qml/MainScreen.qml
Expand Up @@ -72,7 +72,8 @@ Page {

property alias lockscreen: lockScreen
property alias switcher: switcher
property int statusBarHeight: statusbar.height
property alias statusbar: statusbar

property bool codepadVisible: false
property bool deviceLocked: DeviceLock.state >= DeviceLock.Locked

Expand Down Expand Up @@ -112,6 +113,7 @@ Page {
}

Component.onCompleted: {
Desktop.instance = desktop
Lipstick.compositor.screenOrientation = nativeOrientation
LipstickSettings.lockScreen(true)
}
Expand Down