Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
[fingerterm] remove QtComponents dependency. Contributes to JB#10224

Had I realized the dependency is this easy to remove, would have done it long time ago. Not sure if it makes that much sense to introduce Silica dependency in return. Or if done, should use if available maybe.

Lots of cruft to clean up, but will do that separately.


See merge request !4
  • Loading branch information
pvuorela committed May 3, 2016
2 parents 2d5f10d + bf4b112 commit ab80773
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 32 deletions.
1 change: 1 addition & 0 deletions main.cpp
Expand Up @@ -148,6 +148,7 @@ int main(int argc, char *argv[])
context->setContextProperty( "keyLoader", &keyLoader );

view.setSource(QUrl("qrc:/qml/Main.qml"));
view.setResizeMode(QQuickView::SizeRootObjectToView);

QObject *root = view.rootObject();
if(!root)
Expand Down
69 changes: 38 additions & 31 deletions qml/Main.qml
Expand Up @@ -20,24 +20,48 @@
import QtQuick 2.0
import TextRender 1.0
import QtQuick.Window 2.0
import com.nokia.meego 2.0

PageStackWindow {
id: pageStackWindow

focus: true

Keys.onPressed: {
term.keyPress(event.key,event.modifiers,event.text);
}
Item {
id: root

property string windowTitle: util.currentWindowTitle();

initialPage:Page {
Item {
id: page
anchors.fill: parent

orientationLock: window.getOrientationLockMode()
property bool forceOrientation
property int forcedOrientation
property bool portrait: rotation % 180 == 0

width: portrait ? root.width : root.height
height: portrait ? root.height : root.width
anchors.centerIn: parent
rotation: Screen.angleBetween((forceOrientation ? forcedOrientation : Screen.orientation),
Screen.primaryOrientation)
focus: true
Keys.onPressed: {
term.keyPress(event.key,event.modifiers,event.text);
}

Component.onCompleted: {
var stringMode = util.settingsValue("ui/orientationLockMode");
applyOrientationLock(stringMode)
}

function applyOrientationLock(stringMode) {
switch (stringMode) {
case "auto":
page.forceOrientation = false
break
case "landscape":
page.forceOrientation = true
page.forcedOrientation = Qt.LandscapeOrientation
break
case "portrait":
page.forceOrientation = true
page.forcedOrientation = Qt.PortraitOrientation
}
}

Rectangle {
property string fgcolor: "black"
Expand All @@ -46,7 +70,7 @@ PageStackWindow {

property int fadeOutTime: 80
property int fadeInTime: 350
property real pixelRatio: pageStackWindow.width / 540
property real pixelRatio: root.width / 540

// layout constants
property int buttonWidthSmall: 60*pixelRatio
Expand Down Expand Up @@ -463,27 +487,10 @@ PageStackWindow {
util.allowGestures = true;
}

function lockModeStringToQtEnum(stringMode) {
switch (stringMode) {
case "auto":
return PageOrientation.Automatic
case "landscape":
return PageOrientation.LockLandscape
case "portrait":
return PageOrientation.LockPortrait
}
}

function getOrientationLockMode()
{
var stringMode = util.settingsValue("ui/orientationLockMode");
page.orientationLock = lockModeStringToQtEnum(stringMode)
}

function setOrientationLockMode(stringMode)
{
util.setSettingsValue("ui/orientationLockMode", stringMode);
page.orientationLock = lockModeStringToQtEnum(stringMode)
page.applyOrientationLock(stringMode)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion rpm/fingerterm.spec
Expand Up @@ -15,7 +15,6 @@ BuildRequires: pkgconfig(Qt0Feedback)
BuildRequires: pkgconfig(nemonotifications-qt5) >= 1.0.4
Requires: qt5-qtdeclarative-import-xmllistmodel
Requires: qt5-qtdeclarative-import-window2
Requires: qt-components-qt5
Obsoletes: meego-terminal <= 0.2.2
Provides: meego-terminal > 0.2.2

Expand Down

0 comments on commit ab80773

Please sign in to comment.