Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Common base for popup windows and avoid showing during orientation ch…
…ange
  • Loading branch information
pvuorela committed Jun 27, 2016
1 parent 9ff2af5 commit a7aa9f2
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 51 deletions.
3 changes: 2 additions & 1 deletion fingerterm.pro
Expand Up @@ -49,7 +49,8 @@ OTHER_FILES += \
qml/MenuFingerterm.qml \
qml/NotifyWin.qml \
qml/UrlWindow.qml \
qml/LayoutWindow.qml
qml/LayoutWindow.qml \
qml/PopupWindow.qml

RESOURCES += \
resources.qrc
Expand Down
18 changes: 1 addition & 17 deletions qml/LayoutWindow.qml
Expand Up @@ -19,26 +19,10 @@

import QtQuick 2.0

Rectangle {
PopupWindow {
id: layoutWindow

property variant layouts: [""]
property bool show

width: window.width-1
height: window.height-1
color: "#000000"
y: show ? 0 : -(height+1)
border.color: "#c0c0c0"
border.width: 1
radius: window.radiusMedium

Behavior on y { NumberAnimation { duration: 200; easing.type: Easing.InOutCubic } }

MouseArea {
// event eater
anchors.fill: parent
}

Component {
id: listDelegate
Expand Down
17 changes: 1 addition & 16 deletions qml/NotifyWin.qml
Expand Up @@ -19,28 +19,13 @@

import QtQuick 2.0

Rectangle {
PopupWindow {
id: notifyWin

property string text
property bool show

signal dismissed()

width: window.width-1
height: window.height-1
color: "#000000"
y: show ? 0 : -(height+1)
border.color: "#c0c0c0"
border.width: 1
radius: window.radiusMedium

Behavior on y { NumberAnimation { duration: 200; easing.type: Easing.InOutCubic } }

MouseArea {
// event eater
anchors.fill: parent
}
Item {
anchors.top: notifyWin.top
anchors.left: notifyWin.left
Expand Down
58 changes: 58 additions & 0 deletions qml/PopupWindow.qml
@@ -0,0 +1,58 @@
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0

Rectangle {
id: root

property bool show

width: window.width
height: window.height
color: "#000000"
y: -height
border.color: "#c0c0c0"
border.width: 1
radius: window.radiusMedium

MouseArea {
// event eater
anchors.fill: parent
}

states: [
State {
name: "shown"
when: root.show
PropertyChanges { target: root; y: 0 }
}
]

transitions: [
Transition {
to: "*"
NumberAnimation {
properties: "y"
duration: 200
easing.type: Easing.InOutCubic
}
}
]
}
18 changes: 1 addition & 17 deletions qml/UrlWindow.qml
Expand Up @@ -19,26 +19,10 @@

import QtQuick 2.0

Rectangle {
PopupWindow {
id: urlWindow

property variant urls: [""]
property bool show

width: window.width-1
height: window.height-1
color: "#000000"
y: show ? 0 : -(height+1)
border.color: "#c0c0c0"
border.width: 1
radius: window.radiusMedium

Behavior on y { NumberAnimation { duration: 200; easing.type: Easing.InOutCubic } }

MouseArea {
// event eater
anchors.fill: parent
}

Component {
id: listDelegate
Expand Down
1 change: 1 addition & 0 deletions resources.qrc
Expand Up @@ -7,6 +7,7 @@
<file>qml/Button.qml</file>
<file>qml/MenuFingerterm.qml</file>
<file>qml/NotifyWin.qml</file>
<file>qml/PopupWindow.qml</file>
<file>icons/backspace.png</file>
<file>icons/down.png</file>
<file>icons/enter.png</file>
Expand Down

0 comments on commit a7aa9f2

Please sign in to comment.