diff --git a/fingerterm.pro b/fingerterm.pro index 0b1e130..6c8e540 100644 --- a/fingerterm.pro +++ b/fingerterm.pro @@ -30,8 +30,7 @@ HEADERS += \ textrender.h \ version.h \ util.h \ - keyloader.h \ - mainwindow.h + keyloader.h SOURCES += \ main.cpp \ @@ -39,8 +38,7 @@ SOURCES += \ textrender.cpp \ ptyiface.cpp \ util.cpp \ - keyloader.cpp \ - mainwindow.cpp + keyloader.cpp OTHER_FILES += \ qml/Main.qml \ diff --git a/main.cpp b/main.cpp index 42a2403..0bfceb6 100644 --- a/main.cpp +++ b/main.cpp @@ -21,6 +21,7 @@ #include #include +#include extern "C" { #include @@ -30,7 +31,6 @@ extern "C" { #include } -#include "mainwindow.h" #include "ptyiface.h" #include "terminal.h" #include "textrender.h" @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) } qmlRegisterType("TextRender",1,0,"TextRender"); - MainWindow view; + QQuickView view; Terminal term; Util util(settings); diff --git a/mainwindow.cpp b/mainwindow.cpp deleted file mode 100644 index e07a659..0000000 --- a/mainwindow.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright 2011-2012 Heikki Holstila - - This file is part of FingerTerm. - - FingerTerm is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - FingerTerm is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with FingerTerm. If not, see . -*/ - -#include "qplatformdefs.h" - -#include -#include -#include "mainwindow.h" - -MainWindow::MainWindow() -{ - rootContext()->setContextProperty("windowHasFocus", false); -} - -MainWindow::~MainWindow() -{ -} - -void MainWindow::focusInEvent(QFocusEvent *event) -{ - rootContext()->setContextProperty("windowHasFocus", true); - QQuickView::focusInEvent(event); - emit focusChanged(true); -} - -void MainWindow::focusOutEvent(QFocusEvent *event) -{ - rootContext()->setContextProperty("windowHasFocus", false); - QQuickView::focusOutEvent(event); - emit focusChanged(false); -} diff --git a/mainwindow.h b/mainwindow.h deleted file mode 100644 index 6a3ab71..0000000 --- a/mainwindow.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright 2011-2012 Heikki Holstila - - This file is part of FingerTerm. - - FingerTerm is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - FingerTerm is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with FingerTerm. If not, see . -*/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class MainWindow : public QQuickView -{ - Q_OBJECT -public: - explicit MainWindow(); - virtual ~MainWindow(); - -protected: - virtual void focusInEvent(QFocusEvent *event); - virtual void focusOutEvent(QFocusEvent *event); - -signals: - void focusChanged(bool in); - -private: - Q_DISABLE_COPY(MainWindow) -}; - -#endif // MAINWINDOW_H diff --git a/qml/Main.qml b/qml/Main.qml index 9c0f8e2..367153a 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -162,7 +162,7 @@ Item { property bool visibleSetting: true x: 0 y: parent.height-vkb.height - visible: windowHasFocus && visibleSetting + visible: page.activeFocus && visibleSetting } // area that handles gestures/select/scroll modes and vkb-keypresses diff --git a/util.cpp b/util.cpp index 750f1a3..37f8d8d 100644 --- a/util.cpp +++ b/util.cpp @@ -25,7 +25,6 @@ #include #include -#include "mainwindow.h" #include "terminal.h" #include "util.h" #include "textrender.h" @@ -52,7 +51,7 @@ Util::~Util() void Util::setWindow(QQuickView* win) { - iWindow = dynamic_cast(win); + iWindow = win; if(!iWindow) qFatal("invalid main window"); } diff --git a/util.h b/util.h index 329e5a4..df8d40b 100644 --- a/util.h +++ b/util.h @@ -23,7 +23,6 @@ #include class Terminal; -class MainWindow; class TextRender; class QQuickView; @@ -101,7 +100,7 @@ public slots: QString iCurrentWinTitle; QSettings* iSettings; - MainWindow* iWindow; + QQuickView* iWindow; Terminal* iTerm; TextRender* iRenderer; };