Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simplify code
  • Loading branch information
pvuorela committed Jun 8, 2016
1 parent 1a58108 commit be65329
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
6 changes: 3 additions & 3 deletions qml/Key.qml
Expand Up @@ -149,9 +149,9 @@ Rectangle {
}

if (key.isClick) {
if (Math.abs(x - key.pressMouseX) > key.clickThreshold ||
Math.abs(y - key.pressMouseY) > key.clickThreshold )
key.isClick = false
if (Math.abs(x - key.pressMouseX) > key.clickThreshold
|| Math.abs(y - key.pressMouseY) > key.clickThreshold)
key.isClick = false
}

return true;
Expand Down
4 changes: 1 addition & 3 deletions qml/Lineview.qml
Expand Up @@ -63,11 +63,9 @@ Rectangle {
anchors.rightMargin: 2*window.pixelRatio
Repeater {
model: lines
delegate:
Rectangle {
delegate: Item {
height: fontHeightHack.height
width: lineTextCol.width
color: "transparent"
Text {
color: "#ffffff"
font.family: util.settingsValue("ui/fontFamily");
Expand Down
4 changes: 0 additions & 4 deletions qml/Main.qml
Expand Up @@ -339,9 +339,6 @@ Item {
textNotifyAnim.enabled = true;
textNotify.opacity = 0;
}
onWindowTitleChanged: {
windowTitle = util.currentWindowTitle();
}
}

Text {
Expand All @@ -352,7 +349,6 @@ Item {
color: "#ffffff"
z: 100
opacity: 0
text: ""
font.pointSize: 40*window.pixelRatio

Behavior on opacity {
Expand Down
6 changes: 2 additions & 4 deletions qml/MenuFingerterm.qml
Expand Up @@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.XmlListModel 2.0

Rectangle {
Item {
id: menuWin

property bool showing
Expand All @@ -31,7 +31,6 @@ Rectangle {
property string currentOrientationLockMode: util.settingsValue("ui/orientationLockMode")
property int keyboardFadeOutDelay: util.settingsValue("ui/keyboardFadeOutDelay")

color: "transparent"
z: 30
width: window.width
height: window.height
Expand All @@ -42,8 +41,7 @@ Rectangle {

color: "#000000"
opacity: 0
width: menuWin.width
height: menuWin.height
anchors.fill: parent

MouseArea {
anchors.fill: parent
Expand Down
6 changes: 3 additions & 3 deletions qml/NotifyWin.qml
Expand Up @@ -24,7 +24,7 @@ Rectangle {

property string text

signal dismissed();
signal dismissed()

width: window.width-1
height: window.height-1
Expand All @@ -40,8 +40,7 @@ Rectangle {
// event eater
anchors.fill: parent
}
Rectangle {
color: "transparent"
Item {
anchors.top: notifyWin.top
anchors.left: notifyWin.left
anchors.right: notifyWin.right
Expand All @@ -62,6 +61,7 @@ Rectangle {

Button {
id: okButton

anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: window.paddingMedium
Expand Down
11 changes: 7 additions & 4 deletions util.cpp
Expand Up @@ -138,15 +138,17 @@ void Util::bellAlert()
}
}

void Util::mousePress(float eventX, float eventY) {
void Util::mousePress(float eventX, float eventY)
{
if(!iAllowGestures)
return;

dragOrigin = QPointF(eventX, eventY);
newSelection = true;
}

void Util::mouseMove(float eventX, float eventY) {
void Util::mouseMove(float eventX, float eventY)
{
QPointF eventPos(eventX, eventY);

if(!iAllowGestures)
Expand All @@ -160,7 +162,8 @@ void Util::mouseMove(float eventX, float eventY) {
}
}

void Util::mouseRelease(float eventX, float eventY) {
void Util::mouseRelease(float eventX, float eventY)
{
QPointF eventPos(eventX, eventY);
const int reqDragLength = 140;

Expand Down Expand Up @@ -190,7 +193,7 @@ void Util::mouseRelease(float eventX, float eventY) {

void Util::selectionHelper(QPointF scenePos)
{
int yCorr = iRenderer->fontDescent();
int yCorr = iRenderer->fontDescent();

QPoint start(qRound((dragOrigin.x()+2)/iRenderer->fontWidth()),
qRound((dragOrigin.y()+yCorr)/iRenderer->fontHeight()));
Expand Down

0 comments on commit be65329

Please sign in to comment.