summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/CMakeLists.txt19
-rw-r--r--src/gui/incoming_call_popup.cpp15
-rw-r--r--src/gui/incoming_call_popup.h8
-rw-r--r--src/gui/osd.cpp30
-rw-r--r--src/gui/osd.h19
-rw-r--r--src/gui/qml/ImageButton.qml2
-rw-r--r--src/gui/qml/TextImageButton.qml2
-rw-r--r--src/gui/qml/incoming_call.qml21
-rw-r--r--src/gui/qml/osd.qml20
9 files changed, 45 insertions, 91 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 41e8a04..fca7d2e 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -40,22 +40,6 @@ set (twinkle_lang_SRC
lang/twinkle_sv.ts
)
-if (WITH_QT4)
-qt4_wrap_ui(
- twinkle_UIS
- ${twinkle_ui_SRC}
-)
-
-qt4_add_resources(twinkle_QRC icons.qrc qml/qml.qrc)
-
-qt4_add_translation(twinkle_LANG
- ${twinkle_lang_SRC}
-)
-
-set(qt_LIBS Qt4::QtGui Qt4::QtDeclarative)
-
-elseif (WITH_QT5)
-
qt5_wrap_ui(
twinkle_UIS
${twinkle_ui_SRC}
@@ -67,8 +51,7 @@ qt5_add_translation(twinkle_LANG
${twinkle_lang_SRC}
)
-set(qt_LIBS Qt5::Widgets Qt5::Quick Qt5::Declarative)
-endif (WITH_QT4)
+set(qt_LIBS Qt5::Widgets Qt5::Quick)
set(CMAKE_AUTOMOC ON)
diff --git a/src/gui/incoming_call_popup.cpp b/src/gui/incoming_call_popup.cpp
index 1159ece..07ce3b0 100644
--- a/src/gui/incoming_call_popup.cpp
+++ b/src/gui/incoming_call_popup.cpp
@@ -1,17 +1,16 @@
#include "incoming_call_popup.h"
#include <QDesktopWidget>
#include <QApplication>
-#include <QDeclarativeContext>
+#include <QQmlContext>
#include <QSettings>
extern QSettings* g_gui_state;
IncomingCallPopup::IncomingCallPopup(QObject *parent) : QObject(parent)
{
- m_view = new QDeclarativeView;
+ m_view = new QQuickView;
- // Qt5 QQuickView: setFlags()
- m_view->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip);
+ m_view->setFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip);
m_view->rootContext()->setContextProperty("viewerWidget", m_view);
m_view->setSource(QUrl("qrc:/qml/incoming_call.qml"));
@@ -27,7 +26,7 @@ IncomingCallPopup::IncomingCallPopup(QObject *parent) : QObject(parent)
button = m_view->rootObject()->findChild<QObject*>("buttonReject");
connect(button, SIGNAL(clicked()), this, SLOT(onRejectClicked()));
- m_callerText = m_view->rootObject()->findChild<QDeclarativeItem*>("callerText");
+ m_callerText = m_view->rootObject()->findChild<QQuickItem*>("callerText");
connect(m_view->rootObject(), SIGNAL(moved()), this, SLOT(saveState()));
}
@@ -54,19 +53,19 @@ void IncomingCallPopup::positionWindow()
if (y > desktop->height() || y < 0)
y = defaultY;
- m_view->move(x, y);
+ m_view->setPosition(x, y);
}
void IncomingCallPopup::saveState()
{
- QPoint pos = m_view->pos();
+ QPoint pos = m_view->position();
g_gui_state->setValue("incoming_popup/x", pos.x());
g_gui_state->setValue("incoming_popup/y", pos.y());
}
void IncomingCallPopup::move(int x, int y)
{
- m_view->move(QPoint(x, y));
+ m_view->setPosition(QPoint(x, y));
}
void IncomingCallPopup::setCallerName(const QString& name)
diff --git a/src/gui/incoming_call_popup.h b/src/gui/incoming_call_popup.h
index 461e610..abfab18 100644
--- a/src/gui/incoming_call_popup.h
+++ b/src/gui/incoming_call_popup.h
@@ -1,8 +1,8 @@
#ifndef T_INCOMING_CALL_POPUP_H
#define T_INCOMING_CALL_POPUP_H
-#include <QDeclarativeItem>
-#include <QDeclarativeView>
+#include <QQuickItem>
+#include <QQuickView>
class IncomingCallPopup : public QObject
{
@@ -27,8 +27,8 @@ public slots:
void onRejectClicked();
void saveState();
private:
- QDeclarativeView* m_view;
- QDeclarativeItem* m_callerText;
+ QQuickView* m_view;
+ QQuickItem* m_callerText;
};
#endif // T_INCOMING_CALL_POPUP_H
diff --git a/src/gui/osd.cpp b/src/gui/osd.cpp
index 7dcd5a1..421f021 100644
--- a/src/gui/osd.cpp
+++ b/src/gui/osd.cpp
@@ -1,27 +1,20 @@
#include "osd.h"
#include <QtDebug>
-#if 0 //QT_VERSION >= 0x050000
-# include <QQuickView>
-# include <QQmlContext>
-# include <QQuickItem>
-#else
-# include <QDeclarativeView>
-# include <QDeclarativeContext>
-# include <QDeclarativeItem>
-#endif
#include <QDesktopWidget>
#include <QSettings>
#include <QApplication>
+#include <QQuickView>
+#include <QQuickItem>
+#include <QQmlContext>
extern QSettings* g_gui_state;
OSD::OSD(QObject* parent)
: QObject(parent)
{
- m_view = new OSD_VIEWCLASS;
- // Qt5 QQuickView: setFlags()
- m_view->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip);
+ m_view = new QQuickView;
+ m_view->setFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::ToolTip);
m_view->rootContext()->setContextProperty("viewerWidget", m_view);
m_view->setSource(QUrl("qrc:/qml/osd.qml"));
@@ -33,9 +26,9 @@ OSD::OSD(QObject* parent)
connect(buttonHangup, SIGNAL(clicked()), this, SLOT(onHangupClicked()));
- m_caller = m_view->rootObject()->findChild<QML_ITEMTYPE*>("callerName");
- m_time = m_view->rootObject()->findChild<QML_ITEMTYPE*>("callTime");
- m_mute = m_view->rootObject()->findChild<QML_ITEMTYPE*>("mute");
+ m_caller = m_view->rootObject()->findChild<QQuickItem*>("callerName");
+ m_time = m_view->rootObject()->findChild<QQuickItem*>("callTime");
+ m_mute = m_view->rootObject()->findChild<QQuickItem*>("mute");
connect(m_mute, SIGNAL(clicked()), this, SLOT(onMuteClicked()));
@@ -65,12 +58,12 @@ void OSD::positionWindow()
if (y > desktop->height() || y < 0)
y = defaultY;
- m_view->move(x, y);
+ m_view->setPosition(x, y);
}
void OSD::saveState()
{
- QPoint pos = m_view->pos();
+ QPoint pos = m_view->position();
g_gui_state->setValue("osd/x", pos.x());
g_gui_state->setValue("osd/y", pos.y());
}
@@ -109,8 +102,7 @@ void OSD::setTime(const QString& timeText)
void OSD::move(int x, int y)
{
- // Qt5 QQuickView: setPosition
- m_view->move(x, y);
+ m_view->setPosition(x, y);
}
void OSD::show()
diff --git a/src/gui/osd.h b/src/gui/osd.h
index c5f83af..a8b78d3 100644
--- a/src/gui/osd.h
+++ b/src/gui/osd.h
@@ -2,19 +2,12 @@
#define OSD_H
#include <QObject>
#include <QString>
-#if 0 //QT_VERSION >= 0x050000
-# define OSD_VIEWCLASS QQuickView
-# define QML_ITEMTYPE QQuickItem
-#else
-# define OSD_VIEWCLASS QDeclarativeView
-# define QML_ITEMTYPE QDeclarativeItem
-#endif
// Must use forward declaration, otherwise build fails
// due to double QMetaTypeID<QAction*> definition (wtf).
// Hence I also cannot inherit from OSD_VIEWCLASS...
-class OSD_VIEWCLASS;
-class QML_ITEMTYPE;
+class QQuickView;
+class QQuickItem;
class OSD : public QObject
{
@@ -46,10 +39,10 @@ signals:
void muteClicked();
private:
- OSD_VIEWCLASS* m_view;
- QML_ITEMTYPE* m_caller;
- QML_ITEMTYPE* m_time;
- QML_ITEMTYPE* m_mute;
+ QQuickView* m_view;
+ QQuickItem* m_caller;
+ QQuickItem* m_time;
+ QQuickItem* m_mute;
};
#endif // OSD_H
diff --git a/src/gui/qml/ImageButton.qml b/src/gui/qml/ImageButton.qml
index 3d76fa7..3e673fd 100644
--- a/src/gui/qml/ImageButton.qml
+++ b/src/gui/qml/ImageButton.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
diff --git a/src/gui/qml/TextImageButton.qml b/src/gui/qml/TextImageButton.qml
index 3630029..83f61d7 100644
--- a/src/gui/qml/TextImageButton.qml
+++ b/src/gui/qml/TextImageButton.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: backgroundRect
diff --git a/src/gui/qml/incoming_call.qml b/src/gui/qml/incoming_call.qml
index 1b8428e..8f1ae0e 100644
--- a/src/gui/qml/incoming_call.qml
+++ b/src/gui/qml/incoming_call.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: rectanglePopup
@@ -63,21 +63,14 @@ Rectangle {
MouseArea {
anchors.fill: parent
- property variant previousPosition
+ property real lastMouseX: 0
+ property real lastMouseY: 0
onPressed: {
- previousPosition = Qt.point(mouseX, mouseY)
- }
- onPositionChanged: {
- if (pressedButtons == Qt.LeftButton) {
- var dx = mouseX - previousPosition.x
- var dy = mouseY - previousPosition.y
- viewerWidget.pos = Qt.point(viewerWidget.pos.x + dx,
- viewerWidget.pos.y + dy)
-
- previousPosition = Qt.point(mouseX, mouseY)
- rectanglePopup.moved()
- }
+ lastMouseX = mouseX
+ lastMouseY = mouseY
}
+ onMouseXChanged: viewerWidget.x += (mouseX - lastMouseX)
+ onMouseYChanged: viewerWidget.y += (mouseY - lastMouseY)
}
}
diff --git a/src/gui/qml/osd.qml b/src/gui/qml/osd.qml
index 42f7b1f..f42fea7 100644
--- a/src/gui/qml/osd.qml
+++ b/src/gui/qml/osd.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: rectangleOsd
@@ -79,20 +79,14 @@ Rectangle {
MouseArea {
anchors.fill: parent
- property variant previousPosition
+ property real lastMouseX: 0
+ property real lastMouseY: 0
onPressed: {
- previousPosition = Qt.point(mouseX, mouseY)
- }
- onPositionChanged: {
- if (pressedButtons == Qt.LeftButton) {
- var dx = mouseX - previousPosition.x
- var dy = mouseY - previousPosition.y
- viewerWidget.pos = Qt.point(viewerWidget.pos.x + dx,
- viewerWidget.pos.y + dy)
-
- rectangleOsd.moved()
- }
+ lastMouseX = mouseX
+ lastMouseY = mouseY
}
+ onMouseXChanged: viewerWidget.x += (mouseX - lastMouseX)
+ onMouseYChanged: viewerWidget.y += (mouseY - lastMouseY)
}
}