Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
Refactorings

Getting rid of the worst peculiarities of Fingerterm code.

@rainemak perhaps?

See merge request !11
  • Loading branch information
pvuorela committed Jun 10, 2016
2 parents 1d07de6 + fdf9ab2 commit 4c98a6d
Show file tree
Hide file tree
Showing 15 changed files with 596 additions and 722 deletions.
14 changes: 4 additions & 10 deletions main.cpp
Expand Up @@ -117,6 +117,9 @@ int main(int argc, char *argv[])
Terminal term;
Util util(settings);
term.setUtil(&util);
TextRender::setUtil(&util);
TextRender::setTerminal(&term);

QString startupErrorMsg;

// copy the default config files to the config dir if they don't already exist
Expand All @@ -143,6 +146,7 @@ int main(int argc, char *argv[])
context->setContextProperty( "term", &term );
context->setContextProperty( "util", &util );
context->setContextProperty( "keyLoader", &keyLoader );
context->setContextProperty( "startupErrorMessage", startupErrorMsg);

view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/qml/Main.qml"));
Expand All @@ -151,19 +155,9 @@ int main(int argc, char *argv[])
if(!root)
qFatal("no root object - qml error");

QObject* win = root->findChild<QObject*>("window");

if(!startupErrorMsg.isEmpty())
QMetaObject::invokeMethod(win, "showErrorMessage", Qt::QueuedConnection, Q_ARG(QVariant, startupErrorMsg));

TextRender *tr = root->findChild<TextRender*>("textrender");
tr->setUtil(&util);
tr->setTerminal(&term);
term.setRenderer(tr);
term.setWindow(&view);
util.setWindow(&view);
util.setTerm(&term);
util.setRenderer(tr);

QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));

Expand Down
29 changes: 5 additions & 24 deletions qml/Button.qml
Expand Up @@ -30,9 +30,10 @@ Rectangle {
// for custom user menu actions
property bool isShellCommand

signal clicked();
signal clicked()

color: highlighted ? "#606060" : "#202020"
color: btnMouseArea.pressed ? "#ffffff"
: highlighted ? "#606060" : "#202020"
border.color: "#303030"
border.width: 1
radius: window.radiusSmall
Expand All @@ -41,13 +42,6 @@ Rectangle {
width: window.buttonWidthLarge
height: window.buttonHeightLarge

onHighlightedChanged: {
if(highlighted)
button.color = "#606060"
else
button.color = "#202020"
}

Text {
// decoration for user-defined command buttons
visible: isShellCommand
Expand All @@ -67,21 +61,8 @@ Rectangle {

MouseArea {
id: btnMouseArea
enabled: button.enabled

anchors.fill: parent
onClicked: {
button.clicked();
}
onPressedChanged: {
if(pressed) {
button.color = "#ffffff"
} else {
if(highlighted)
button.color = "#606060"
else
button.color = "#202020"
}
}
onClicked: button.clicked()
}

}
8 changes: 4 additions & 4 deletions qml/Key.qml
Expand Up @@ -113,7 +113,6 @@ Rectangle {
anchors.fill: parent
radius: key.radius
opacity: 0.5
z: 1
anchors.topMargin: key.height/2
}

Expand Down Expand Up @@ -149,9 +148,10 @@ 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
7 changes: 1 addition & 6 deletions qml/LayoutWindow.qml
Expand Up @@ -28,8 +28,6 @@ Rectangle {
width: window.width-1
height: window.height-1
color: "#000000"
z: 100
state: ""
y: -(height+1)
border.color: "#c0c0c0"
border.width: 1
Expand Down Expand Up @@ -124,10 +122,7 @@ Rectangle {
Transition {
from: "*"
to: "*"
SequentialAnimation {
PropertyAnimation { target: layoutWindow; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
ScriptAction { script: window.updateGesturesAllowed(); }
}
PropertyAnimation { target: layoutWindow; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
}
]
}
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

0 comments on commit 4c98a6d

Please sign in to comment.