Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Refactored haptic motor driver to use hw factory
Browse files Browse the repository at this point in the history
- Setting QQmlEngine::CppOwnership for hw device singletons
- using `#pragma once` instead of ifndef header guards
- added license template for Qt Creator

Part of #346
  • Loading branch information
zehnm committed Dec 30, 2019
1 parent 1fb47b0 commit d4d1b56
Show file tree
Hide file tree
Showing 58 changed files with 350 additions and 429 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ $RECYCLE.BIN/
### Project specific ###
software/build-*
build
qml_qmlcache.qrc

# plugins
plugins/*.so
Expand Down
9 changes: 5 additions & 4 deletions MainContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import QtQuick 2.11
import QtQuick.Controls 2.5
import QtGraphicalEffects 1.0
import Haptic 1.0

import "qrc:/basic_ui" as BasicUI

Expand Down Expand Up @@ -59,7 +60,7 @@ Item {
loader_main.item.mainNavigationSwipeview.incrementCurrentIndex();
// mainNavigation.mainNavigationListView.currentIndex += 1;
} else {
haptic.playEffect("buzz");
Haptic.playEffect("buzz");
}
break;
case "dpad left":
Expand All @@ -68,13 +69,13 @@ Item {
loader_main.item.mainNavigationSwipeview.decrementCurrentIndex();
// mainNavigation.mainNavigationListView.currentIndex -= 1;
} else {
haptic.playEffect("buzz");
Haptic.playEffect("buzz");
}
break;
case "dpad up":
var newpos = mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentY - 200;
if (newpos <=0 && mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentY == 0) {
haptic.playEffect("buzz");
Haptic.playEffect("buzz");
}
if (newpos <= 0) {
newpos = 0;
Expand All @@ -84,7 +85,7 @@ Item {
case "dpad down":
newpos = mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentY + 200;
if (newpos >= (mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentHeight - mainNavigationSwipeview.currentItem.mainNavigationLoader.item.height) && mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentY == (mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentHeight - mainNavigationSwipeview.currentItem.mainNavigationLoader.item.height)) {
haptic.playEffect("buzz");
Haptic.playEffect("buzz");
}
if (newpos >= (mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentHeight - mainNavigationSwipeview.currentItem.mainNavigationLoader.item.height)) {
newpos = mainNavigationSwipeview.currentItem.mainNavigationLoader.item.contentHeight - mainNavigationSwipeview.currentItem.mainNavigationLoader.item.height;
Expand Down
5 changes: 3 additions & 2 deletions basic_ui/ContextMenu.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import QtQuick 2.11
import Haptic 1.0

Rectangle {
id: main
Expand Down Expand Up @@ -105,7 +106,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
if (list[index] == "PLAY")
obj.playMedia(id, type);
else if (list[index] == "QUEUE")
Expand Down Expand Up @@ -140,7 +141,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
main.state = "closed";
}
}
Expand Down
3 changes: 2 additions & 1 deletion basic_ui/ContextMenuIcon.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import QtQuick 2.11
import Haptic 1.0

Rectangle {
id: circleButton
Expand Down Expand Up @@ -46,7 +47,7 @@ Rectangle {
anchors.centerIn: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
}
}
}
4 changes: 3 additions & 1 deletion basic_ui/CustomButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import QtQuick 2.11
import QtQuick.Controls 2.5

import Haptic 1.0

Rectangle {

property alias mouseArea: mouseArea
Expand Down Expand Up @@ -69,7 +71,7 @@ Rectangle {
anchors.fill: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
}
}
}
4 changes: 3 additions & 1 deletion basic_ui/CustomSwitch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import QtQuick 2.11
import QtQuick.Controls 2.5

import Haptic 1.0

Item {
width: 66
height: 36
Expand Down Expand Up @@ -65,7 +67,7 @@ Item {
height: button.height + 60

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
button.toggle();
}
}
Expand Down
6 changes: 4 additions & 2 deletions basic_ui/MainNavigation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import QtQuick 2.11
import QtGraphicalEffects 1.0
import QtQml.Models 2.3

import Haptic 1.0

import "qrc:/scripts/helper.js" as JSHelper

Item {
Expand Down Expand Up @@ -139,13 +141,13 @@ Item {

onPressAndHold: {
held = true;
haptic.playEffect("click");
Haptic.playEffect("click");
}
onReleased: {
if (held) {
savemenuConfig()
}
haptic.playEffect("click");
Haptic.playEffect("click");

held = false
mainNavigationListView.currentIndex = index
Expand Down
14 changes: 8 additions & 6 deletions basic_ui/MiniMediaPlayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import QtGraphicalEffects 1.0

import "qrc:/basic_ui" as BasicUI

import Haptic 1.0

import Entity.MediaPlayer 1.0
import MediaPlayerUtils 1.0

Expand Down Expand Up @@ -111,14 +113,14 @@ Item {
if (mediaPlayers.currentIndex < mediaPlayers.count-1) {
mediaPlayers.currentIndex += 1;
} else {
haptic.playEffect("buzz");
Haptic.playEffect("buzz");
}
break;
case "dpad left":
if (mediaPlayers.currentIndex > 0) {
mediaPlayers.currentIndex -= 1;
} else {
haptic.playEffect("buzz");
Haptic.playEffect("buzz");
}
break;
case "top right":
Expand Down Expand Up @@ -507,7 +509,7 @@ Item {
enabled: miniMediaPlayer.state == "open"

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
miniMediaPlayer.state = "closed"
}
}
Expand Down Expand Up @@ -541,7 +543,7 @@ Item {
enabled: miniMediaPlayer.state == "open"

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
entities.mediaplayersPlaying[mediaPlayers.currentIndex].previous();
}
}
Expand Down Expand Up @@ -599,7 +601,7 @@ Item {
enabled: miniMediaPlayer.state == "open"

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
if (entities.mediaplayersPlaying[mediaPlayers.currentIndex].state == MediaPlayer.PLAYING ) {
entities.mediaplayersPlaying[mediaPlayers.currentIndex].pause();
} else {
Expand Down Expand Up @@ -637,7 +639,7 @@ Item {
enabled: miniMediaPlayer.state == "open"

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
entities.mediaplayersPlaying[mediaPlayers.currentIndex].next();
}
}
Expand Down
6 changes: 4 additions & 2 deletions basic_ui/Profiles.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import QtQuick 2.11
import QtQuick.Controls 2.5

import Haptic 1.0

Rectangle {
id: profiles
width: 480
Expand Down Expand Up @@ -169,7 +171,7 @@ Rectangle {
anchors.fill: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
config.profile = id;
profileModel.move(index, 0, 1);
}
Expand Down Expand Up @@ -212,7 +214,7 @@ Rectangle {
anchors.centerIn: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
profiles.state = "closed"
}
}
Expand Down
4 changes: 3 additions & 1 deletion basic_ui/StatusBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import QtQuick 2.11
import QtQuick.Controls 2.5
import QtGraphicalEffects 1.0

import Haptic 1.0

Item {
id: statusBar
width: parent.width
Expand Down Expand Up @@ -287,7 +289,7 @@ Item {
}

onPressAndHold: {
haptic.playEffect("press");
Haptic.playEffect("press");
loader_second.setSource("qrc:/basic_ui/Profiles.qml");
}
}
Expand Down
8 changes: 5 additions & 3 deletions basic_ui/settings/Integrations.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import QtQuick 2.11
import QtQuick.Controls 2.5

import Haptic 1.0

import "qrc:/basic_ui" as BasicUI

Item {
Expand Down Expand Up @@ -101,7 +103,7 @@ Item {
anchors.fill: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
popup.open();
}
}
Expand Down Expand Up @@ -157,7 +159,7 @@ Item {
enabled: obj.state == 0 ? false : true

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
obj.connect();
popup.close();
}
Expand Down Expand Up @@ -192,7 +194,7 @@ Item {
enabled: obj.state == 2 ? false : true

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
obj.disconnect();
popup.close();
}
Expand Down
3 changes: 2 additions & 1 deletion basic_ui/settings/Network.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import QtQuick 2.11
import QtQuick.Controls 2.5

import Haptic 1.0
import WifiControl 1.0

Item {
Expand Down Expand Up @@ -101,7 +102,7 @@ Item {
anchors.fill: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");

// Start wifi network scan
wifiNetworks = [];
Expand Down
10 changes: 6 additions & 4 deletions components/ButtonBase.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.0

import Haptic 1.0

import "qrc:/scripts/helper.js" as JSHelper
import "qrc:/basic_ui" as BasicUI

Expand Down Expand Up @@ -121,13 +123,13 @@ Rectangle {
enabled: buttonContainer.state == "open" ? false : true

onPressAndHold: {
haptic.playEffect("press");
Haptic.playEffect("press");

addToFavButton.state = "open"
}

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
originParent = buttonContainer.parent
// buttonContainer.state = "open"
cardLoader.active = true;
Expand Down Expand Up @@ -264,7 +266,7 @@ Rectangle {
anchors.fill: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
addToFavButton.state = "closed"
}
}
Expand Down Expand Up @@ -418,7 +420,7 @@ Rectangle {
anchors.centerIn: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
buttonContainer.state = "closed"
cardLoader.active = false;
}
Expand Down
7 changes: 4 additions & 3 deletions components/blind/ui/Button.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.5
import QtGraphicalEffects 1.0

import Haptic 1.0
import Entity.Blind 1.0

import "qrc:/scripts/helper.js" as JSHelper
Expand Down Expand Up @@ -182,13 +183,13 @@ Rectangle {
enabled: blindButton.state == "open" ? false : true

onPressAndHold: {
haptic.playEffect("press");
Haptic.playEffect("press");

addToFavButton.state = "open"
}

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");

originParent = blindButton.parent

Expand Down Expand Up @@ -319,7 +320,7 @@ Rectangle {
anchors.fill: parent

onClicked: {
haptic.playEffect("click");
Haptic.playEffect("click");
addToFavButton.state = "closed"
}
}
Expand Down
Loading

0 comments on commit d4d1b56

Please sign in to comment.