Commit 8f5c1d22 authored by Pekka Vuorela's avatar Pekka Vuorela

[fingerterm] Update window hint. Fixes JB#35598

Used to be done by Qt-components.
parent 4c98a6d4
......@@ -148,6 +148,12 @@ int main(int argc, char *argv[])
context->setContextProperty( "keyLoader", &keyLoader );
context->setContextProperty( "startupErrorMessage", startupErrorMsg);
term.setWindow(&view);
util.setWindow(&view);
util.setTerm(&term);
QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/qml/Main.qml"));
......@@ -155,12 +161,6 @@ int main(int argc, char *argv[])
if(!root)
qFatal("no root object - qml error");
term.setWindow(&view);
util.setWindow(&view);
util.setTerm(&term);
QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));
if (fullscreen) {
view.showFullScreen();
} else {
......
......@@ -27,6 +27,12 @@ Item {
width: 540
height: 960
Binding {
target: util
property: "windowOrientation"
value: page.orientation
}
Binding {
target: util
property: "allowGestures"
......@@ -39,13 +45,13 @@ Item {
property bool forceOrientation
property int forcedOrientation
property int orientation: forceOrientation ? forcedOrientation : Screen.orientation
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)
rotation: Screen.angleBetween(orientation, Screen.primaryOrientation)
focus: true
Keys.onPressed: {
term.keyPress(event.key,event.modifiers,event.text);
......
......@@ -50,9 +50,12 @@ Util::~Util()
void Util::setWindow(QQuickView* win)
{
if (iWindow)
qFatal("Should set window property only once");
iWindow = win;
if(!iWindow)
qFatal("invalid main window");
connect(win, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)), this, SIGNAL(windowOrientationChanged()));
}
void Util::setWindowTitle(QString title)
......@@ -67,6 +70,16 @@ QString Util::windowTitle()
return iCurrentWinTitle;
}
int Util::windowOrientation()
{
return iWindow->contentOrientation();
}
void Util::setWindowOrientation(int orientation)
{
iWindow->reportContentOrientationChange(static_cast<Qt::ScreenOrientation>(orientation));
}
void Util::setTerm(Terminal *term)
{
if (iTerm) {
......
......@@ -31,6 +31,7 @@ class Util : public QObject
Q_OBJECT
Q_PROPERTY(bool allowGestures READ allowGestures WRITE setAllowGestures NOTIFY allowGesturesChanged)
Q_PROPERTY(QString windowTitle READ windowTitle NOTIFY windowTitleChanged)
Q_PROPERTY(int windowOrientation READ windowOrientation WRITE setWindowOrientation NOTIFY windowOrientationChanged)
Q_PROPERTY(bool canPaste READ canPaste NOTIFY clipboardOrSelectionChanged)
Q_PROPERTY(bool terminalHasSelection READ terminalHasSelection NOTIFY clipboardOrSelectionChanged)
......@@ -41,6 +42,8 @@ public:
void setWindow(QQuickView* win);
void setWindowTitle(QString title);
QString windowTitle();
int windowOrientation();
void setWindowOrientation(int orientation);
void setTerm(Terminal* term);
Q_INVOKABLE void openNewWindow();
......@@ -74,6 +77,7 @@ signals:
void notify(QString msg);
void clipboardOrSelectionChanged();
void windowTitleChanged();
void windowOrientationChanged();
private:
Q_DISABLE_COPY(Util)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment