Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 'master'
Cleanups and fullscreen mode by default

See individual commits. Still plenty to do...

See merge request !7
  • Loading branch information
pvuorela committed May 6, 2016
2 parents 0349ad4 + c3a97ce commit 875aa14
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 239 deletions.
8 changes: 3 additions & 5 deletions fingerterm.pro
@@ -1,4 +1,4 @@
QT = core gui qml quick dbus
QT = core gui qml quick

CONFIG += link_pkgconfig

Expand Down Expand Up @@ -30,17 +30,15 @@ HEADERS += \
textrender.h \
version.h \
util.h \
keyloader.h \
mainwindow.h
keyloader.h

SOURCES += \
main.cpp \
terminal.cpp \
textrender.cpp \
ptyiface.cpp \
util.cpp \
keyloader.cpp \
mainwindow.cpp
keyloader.cpp

OTHER_FILES += \
qml/Main.qml \
Expand Down
30 changes: 14 additions & 16 deletions main.cpp
Expand Up @@ -21,6 +21,7 @@

#include <QtGui>
#include <QtQml>
#include <QQuickView>

extern "C" {
#include <pty.h>
Expand All @@ -30,7 +31,6 @@ extern "C" {
#include <sys/types.h>
}

#include "mainwindow.h"
#include "ptyiface.h"
#include "terminal.h"
#include "textrender.h"
Expand Down Expand Up @@ -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)
Expand All @@ -94,15 +93,15 @@ 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>("TextRender",1,0,"TextRender");
MainWindow view;
QQuickView view;

Terminal term;
Util util(settings);
Expand Down Expand Up @@ -158,13 +157,14 @@ int main(int argc, char *argv[])
QObject::connect(&term,SIGNAL(displayBufferChanged()),win,SLOT(displayBufferChanged()));
QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));

QSize screenSize = QGuiApplication::primaryScreen()->size();
if ((screenSize.width() < 1024 || screenSize.height() < 768 || app.arguments().contains("-fs"))
&& !app.arguments().contains("-nofs"))
{
if (!app.arguments().contains("-nofs")) {
view.showFullScreen();
} else
} else {
QSize screenSize = QGuiApplication::primaryScreen()->size();
view.setWidth(screenSize.width() / 2);
view.setHeight(screenSize.height() / 2);
view.show();
}

PtyIFace ptyiface(pid, socketM, &term,
settings->value("terminal/charset").toString());
Expand Down Expand Up @@ -201,8 +201,6 @@ void defaultSettings(QSettings* settings)
settings->setValue("ui/fontSize", 11);
if(!settings->contains("ui/keyboardMargins"))
settings->setValue("ui/keyboardMargins", 10);
if(!settings->contains("ui/allowSwipe"))
settings->setValue("ui/allowSwipe", "auto"); // "true", "false", "auto"
if(!settings->contains("ui/keyboardFadeOutDelay"))
settings->setValue("ui/keyboardFadeOutDelay", 4000);
if(!settings->contains("ui/showExtraLinesFromCursor"))
Expand Down
52 changes: 0 additions & 52 deletions mainwindow.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions mainwindow.h

This file was deleted.

24 changes: 12 additions & 12 deletions qml/Key.qml
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 10 additions & 6 deletions qml/Keyboard.qml
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion qml/Lineview.qml
Expand Up @@ -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
Expand All @@ -32,7 +33,6 @@ Rectangle {
border.width: 2
border.color: "#909090"
radius: window.radiusSmall
height: 0
width: parent.width

Text {
Expand Down

0 comments on commit 875aa14

Please sign in to comment.