diff --git a/main.cpp b/main.cpp index 0bfceb6..b2c8d13 100644 --- a/main.cpp +++ b/main.cpp @@ -72,8 +72,7 @@ int main(int argc, char *argv[]) execCmd.append(" --login"); } - if(settings) - delete settings; // don't need 'em here + delete settings; // don't need 'em here QStringList execParts = execCmd.split(' ', QString::SkipEmptyParts); if(execParts.length()==0) @@ -94,11 +93,11 @@ int main(int argc, char *argv[]) QScreen* sc = app.primaryScreen(); if(sc){ - sc->setOrientationUpdateMask(Qt::PrimaryOrientation - | Qt::LandscapeOrientation - | Qt::PortraitOrientation - | Qt::InvertedLandscapeOrientation - | Qt::InvertedPortraitOrientation); + sc->setOrientationUpdateMask(Qt::PrimaryOrientation + | Qt::LandscapeOrientation + | Qt::PortraitOrientation + | Qt::InvertedLandscapeOrientation + | Qt::InvertedPortraitOrientation); } qmlRegisterType("TextRender",1,0,"TextRender"); diff --git a/qml/Key.qml b/qml/Key.qml index d2094f7..c5f9a38 100644 --- a/qml/Key.qml +++ b/qml/Key.qml @@ -21,22 +21,24 @@ import QtQuick 2.0 Rectangle { id: key - property string label: "" - property string label_alt: "" - property int code: 0 - property int code_alt: 0 + + property string label + property string label_alt + property int code + property int code_alt property int currentCode: (shiftActive && label_alt != '') ? code_alt : code property string currentLabel: (shiftActive && label_alt != '') ? label_alt : label - property bool sticky: false // can key be stickied? - property bool becomesSticky: false // will this become sticky after release? - property int stickiness: 0 // current stickiness status + property bool sticky // can key be stickied? + property bool becomesSticky // will this become sticky after release? + property int stickiness // current stickiness status property real labelOpacity: keyboard.active ? 1.0 : 0.3 // mouse input handling property int clickThreshold: 20 - property bool isClick: false - property int pressMouseY: 0 - property int pressMouseX: 0 + property bool isClick + property int pressMouseY + property int pressMouseX + property bool shiftActive: (keyboard.keyModifiers & Qt.ShiftModifier) && !sticky width: window.width/12 // some default height: window.height/8 < 55*window.pixelRatio ? window.height/8 : 55*window.pixelRatio @@ -45,8 +47,6 @@ Rectangle { border.width: 1 radius: window.radiusSmall - property bool shiftActive: (keyboard.keyModifiers & Qt.ShiftModifier) && !sticky - Image { id: keyImage anchors.centerIn: parent diff --git a/qml/Keyboard.qml b/qml/Keyboard.qml index 868df07..31cf879 100644 --- a/qml/Keyboard.qml +++ b/qml/Keyboard.qml @@ -21,12 +21,8 @@ import QtQuick 2.0 Rectangle { id: keyboard - color: "transparent" - - width: parent.width - height: childrenRect.height + outmargins - property int keyModifiers: 0 + property int keyModifiers property variant resetSticky: 0 property variant currentStickyPressed: null property variant currentKeyPressed: 0 @@ -36,21 +32,29 @@ Rectangle { property string keyHilightBgColor: "#ffffff" property string keyBorderColor: "#303030" - property bool active: false + property bool active property int outmargins: util.settingsValue("ui/keyboardMargins") property int keyspacing: 6 property int keysPerRow: keyLoader.vkbColumns() property real keywidth: (keyboard.width - keyspacing*keysPerRow - outmargins*2)/keysPerRow; + color: "transparent" + width: parent.width + height: childrenRect.height + outmargins + Component { id: keyboardContents + Column { id: col + x: (keyboard.width-width)/2 spacing: keyboard.keyspacing + Repeater { id: rowRepeater + model: keyLoader.vkbRows() delegate: Row { spacing: keyboard.keyspacing diff --git a/qml/Lineview.qml b/qml/Lineview.qml index e164590..cbd23a4 100644 --- a/qml/Lineview.qml +++ b/qml/Lineview.qml @@ -21,6 +21,7 @@ import QtQuick 2.0 Rectangle { id: lineView + property variant lines: [""] property int fontPointSize: util.settingsValue("ui/fontSize")*window.pixelRatio; property int cursorX: 1 @@ -32,7 +33,6 @@ Rectangle { border.width: 2 border.color: "#909090" radius: window.radiusSmall - height: 0 width: parent.width Text { diff --git a/qml/Main.qml b/qml/Main.qml index 367153a..f1b480a 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -64,6 +64,8 @@ Item { } Rectangle { + id: window + property string fgcolor: "black" property string bgcolor: "#000000" property int fontSize: 14*pixelRatio @@ -97,15 +99,15 @@ Item { property int scrollBarWidth: 6*window.pixelRatio anchors.fill: parent - - id: window objectName: "window" color: bgcolor NotifyWin { id: aboutDialog - property int termW: 0 - property int termH: 0 + + property int termW + property int termH + text: { var str = "FingerTerm " + util.versionString() + "
\n" + "" + @@ -131,7 +133,7 @@ Item { NotifyWin { id: errorDialog - text: "" + z: 1002 } @@ -148,10 +150,11 @@ Item { Lineview { id: lineView - x: 0 + + property int duration + y: -(height+1) z: 20 - property int duration: 0; onFontPointSizeChanged: { lineView.setPosition(vkb.active) } @@ -159,8 +162,9 @@ Item { Keyboard { id: vkb + property bool visibleSetting: true - x: 0 + y: parent.height-vkb.height visible: page.activeFocus && visibleSetting } @@ -237,7 +241,6 @@ Item { Rectangle { //top right corner menu button x: window.width - width - y: 0 z: 1 width: menuImg.width + 60*window.pixelRatio height: menuImg.height + 30*window.pixelRatio @@ -272,21 +275,20 @@ Item { MenuFingerterm { id: menu x: window.width-width - y: 0 } TextRender { id: textrender + + property int duration + property int cutAfter: height + objectName: "textrender" - x: 0 - y: 0 height: parent.height width: parent.width myWidth: width myHeight: height - opacity: 1.0 - property int duration: 0; - property int cutAfter: height + z: 10 Behavior on opacity { NumberAnimation { duration: textrender.duration; easing.type: Easing.InOutQuad } @@ -304,8 +306,6 @@ Item { // painted with the updated value (might not otherwise happen because of caching) textrender.redraw(); } - - z: 10 } Timer { @@ -348,12 +348,14 @@ Item { Text { // shows large text notification in the middle of the screen (for gestures) id: textNotify + anchors.centerIn: parent color: "#ffffff" z: 100 opacity: 0 text: "" font.pointSize: 40*window.pixelRatio + Behavior on opacity { id: textNotifyAnim NumberAnimation { duration: 500; } @@ -364,15 +366,14 @@ Item { // visual key press feedback... // easier to work with the coordinates if it's here and not under keyboard element id: visualKeyFeedbackRect + + property string label + visible: false - x: 0 - y: 0 z: 200 - width: 0 - height: 0 radius: window.radiusSmall color: "#ffffff" - property string label: "" + Text { color: "#000000" font.pointSize: 34*window.pixelRatio diff --git a/qml/MenuFingerterm.qml b/qml/MenuFingerterm.qml index 44f53db..209fb3a 100644 --- a/qml/MenuFingerterm.qml +++ b/qml/MenuFingerterm.qml @@ -22,27 +22,29 @@ import QtQuick.XmlListModel 2.0 Rectangle { id: menuWin + + property bool showing + property bool enableCopy + property bool enablePaste + property string currentShowMethod: util.settingsValue("ui/vkbShowMethod") + property string currentDragMode: util.settingsValue("ui/dragMode") + property string currentOrientationLockMode: util.settingsValue("ui/orientationLockMode") + property int keyboardFadeOutDelay: util.settingsValue("ui/keyboardFadeOutDelay") + color: "transparent" z: 30 width: window.width height: window.height visible: false - property bool showing: false - property bool enableCopy: false - property bool enablePaste: false - property string currentShowMethod: util.settingsValue("ui/vkbShowMethod") - property string currentDragMode: util.settingsValue("ui/dragMode") - property string currentOrientationLockMode: util.settingsValue("ui/orientationLockMode") - property int keyboardFadeOutDelay: util.settingsValue("ui/keyboardFadeOutDelay") Rectangle { id: fader + color: "#000000" opacity: 0 - y: 0 - x: 0 width: menuWin.width height: menuWin.height + MouseArea { anchors.fill: parent onClicked: { @@ -58,8 +60,8 @@ Rectangle { } Rectangle { id: rect + color: "#e0e0e0" - y: 0 x: menuWin.width+1; width: flickableContent.width + 22*window.pixelRatio; height: menuWin.height @@ -174,6 +176,7 @@ Rectangle { color: "#606060" border.color: "#000000" border.width: 1 + Column { Text { width: window.buttonWidthLarge @@ -214,6 +217,7 @@ Rectangle { color: "#606060" border.color: "#000000" border.width: 1 + Column { Text { width: window.buttonWidthLarge @@ -264,6 +268,7 @@ Rectangle { color: "#606060" border.color: "#000000" border.width: 1 + Column { Text { width: window.buttonWidthLarge @@ -319,6 +324,7 @@ Rectangle { color: "#606060" border.color: "#000000" border.width: 1 + Column { Text { width: window.buttonWidthLarge @@ -404,12 +410,14 @@ Rectangle { // VKB delay slider Rectangle { id: vkbDelaySliderArea + width: menuBlocksRow.width height: window.buttonHeightLarge radius: window.radiusSmall color: "#606060" border.color: "#000000" border.width: 1 + Text { width: parent.width height: window.headerHeight @@ -429,7 +437,9 @@ Rectangle { } Rectangle { id: vkbDelaySlider + property int keyboardFadeOutDelayLabel: keyboardFadeOutDelay + x: (keyboardFadeOutDelay-1000)/9000 * (vkbDelaySliderArea.width - vkbDelaySlider.width) y: window.headerHeight width: window.buttonWidthSmall diff --git a/qml/NotifyWin.qml b/qml/NotifyWin.qml index 27e869c..1fb434a 100644 --- a/qml/NotifyWin.qml +++ b/qml/NotifyWin.qml @@ -22,7 +22,9 @@ import QtQuick 2.0 Rectangle { id: notifyWin - property string text: "" + property string text + + signal dismissed(); width: window.width-1 height: window.height-1 @@ -34,8 +36,6 @@ Rectangle { border.width: 1 radius: window.radiusMedium - signal dismissed(); - MouseArea { // event eater anchors.fill: parent diff --git a/qml/UrlWindow.qml b/qml/UrlWindow.qml index 12630f7..e7ee3e0 100644 --- a/qml/UrlWindow.qml +++ b/qml/UrlWindow.qml @@ -22,11 +22,12 @@ import QtQuick 2.0 Rectangle { id: urlWindow + property variant urls: [""] + width: window.width-1 height: window.height-1 color: "#000000" z: 100 - property variant urls: [""] state: "" y: -(height+1) border.color: "#c0c0c0" diff --git a/util.h b/util.h index df8d40b..dfdbfb3 100644 --- a/util.h +++ b/util.h @@ -29,9 +29,12 @@ class QQuickView; class Util : public QObject { Q_OBJECT + Q_PROPERTY(bool allowGestures READ allowGestures WRITE setAllowGestures NOTIFY allowGesturesChanged) + public: explicit Util(QSettings* settings, QObject *parent = 0); virtual ~Util(); + void setWindow(QQuickView* win); void setWindowTitle(QString title); Q_INVOKABLE QString currentWindowTitle(); @@ -61,8 +64,6 @@ class Util : public QObject bool allowGestures() { return iAllowGestures; } void setAllowGestures(bool a) { if(iAllowGestures!=a) { iAllowGestures=a; emit allowGesturesChanged(); } } - Q_PROPERTY(bool allowGestures READ allowGestures WRITE setAllowGestures NOTIFY allowGesturesChanged) - static bool charIsHexDigit(QChar ch); public slots: