Commit bc973f6d authored by Pekka Vuorela's avatar Pekka Vuorela

Move allowGestures as property of TextRender

parent 7b451731
......@@ -33,12 +33,6 @@ Item {
value: page.orientation
}
Binding {
target: util
property: "allowGestures"
value: !vkb.active && !menu.showing && !urlWindow.show && !aboutDialog.show && !layoutWindow.show
}
Item {
id: page
......@@ -215,6 +209,7 @@ Item {
fontPointSize: util.fontSize
opacity: (util.keyboardMode == Util.KeyboardFade && vkb.active) ? 0.3
: 1.0
allowGestures: !vkb.active && !menu.showing && !urlWindow.show && !aboutDialog.show && !layoutWindow.show
Behavior on opacity {
NumberAnimation { duration: textrender.duration; easing.type: Easing.InOutQuad }
......
......@@ -27,7 +27,8 @@ Util* TextRender::sUtil = 0;
TextRender::TextRender(QQuickItem *parent) :
QQuickPaintedItem(parent),
newSelection(true)
newSelection(true),
iAllowGestures(true)
{
setFlag(ItemHasContents);
......@@ -299,7 +300,7 @@ void TextRender::updateTermSize()
void TextRender::mousePress(float eventX, float eventY)
{
if(!sUtil->allowGestures())
if (!allowGestures())
return;
dragOrigin = QPointF(eventX, eventY);
......@@ -310,7 +311,7 @@ void TextRender::mouseMove(float eventX, float eventY)
{
QPointF eventPos(eventX, eventY);
if(!sUtil->allowGestures())
if (!allowGestures())
return;
if(sUtil->dragMode() == Util::DragScroll) {
......@@ -326,7 +327,7 @@ void TextRender::mouseRelease(float eventX, float eventY)
QPointF eventPos(eventX, eventY);
const int reqDragLength = 140;
if(!sUtil->allowGestures())
if (!allowGestures())
return;
if(sUtil->dragMode() == Util::DragGestures) {
......@@ -403,6 +404,19 @@ QSize TextRender::cursorPixelSize()
return QSize(iFontWidth, iFontHeight);
}
bool TextRender::allowGestures()
{
return iAllowGestures;
}
void TextRender::setAllowGestures(bool allow)
{
if (iAllowGestures != allow) {
iAllowGestures = allow;
emit allowGesturesChanged();
}
}
QPointF TextRender::scrollBackBuffer(QPointF now, QPointF last)
{
int xdist = qAbs(now.x() - last.x());
......
......@@ -33,6 +33,7 @@ class TextRender : public QQuickPaintedItem
Q_PROPERTY(int fontHeight READ fontHeight NOTIFY fontSizeChanged)
Q_PROPERTY(int fontPointSize READ fontPointSize WRITE setFontPointSize NOTIFY fontSizeChanged)
Q_PROPERTY(bool showBufferScrollIndicator READ showBufferScrollIndicator WRITE setShowBufferScrollIndicator NOTIFY showBufferScrollIndicatorChanged)
Q_PROPERTY(bool allowGestures READ allowGestures WRITE setAllowGestures NOTIFY allowGesturesChanged)
Q_OBJECT
public:
......@@ -54,9 +55,13 @@ public:
Q_INVOKABLE QPoint cursorPixelPos();
Q_INVOKABLE QSize cursorPixelSize();
bool allowGestures();
void setAllowGestures(bool allow);
signals:
void fontSizeChanged();
void showBufferScrollIndicatorChanged();
void allowGesturesChanged();
public slots:
void redraw();
......@@ -97,6 +102,7 @@ private:
int iFontHeight;
int iFontDescent;
bool iShowBufferScrollIndicator;
bool iAllowGestures;
static Terminal *sTerm;
static Util *sUtil;
......
......@@ -36,7 +36,6 @@
Util::Util(QSettings *settings, QObject *parent) :
QObject(parent),
iAllowGestures(false),
iSettings(settings),
iWindow(0),
iTerm(0)
......
......@@ -29,7 +29,6 @@ class QQuickView;
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)
......@@ -103,9 +102,6 @@ public:
void bellAlert();
bool allowGestures() { return iAllowGestures; }
void setAllowGestures(bool a) { if(iAllowGestures!=a) { iAllowGestures=a; emit allowGesturesChanged(); } }
QString fontFamily();
int dragMode();
......@@ -134,7 +130,6 @@ public:
signals:
void visualBell();
void allowGesturesChanged();
void notify(QString msg);
void clipboardOrSelectionChanged();
void windowTitleChanged();
......@@ -150,8 +145,6 @@ signals:
private:
Q_DISABLE_COPY(Util)
bool iAllowGestures;
QString iCurrentWinTitle;
QSettings* iSettings;
......
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