diff options
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 2 | ||||
-rw-r--r-- | src/gui/util/qsystemtrayicon.cpp | 14 | ||||
-rw-r--r-- | src/gui/util/qsystemtrayicon.h | 1 | ||||
-rw-r--r-- | src/gui/util/qsystemtrayicon_win.cpp | 4 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 1 | ||||
-rw-r--r-- | src/opengl/qglshaderprogram.cpp | 21 | ||||
-rw-r--r-- | tests/auto/qsystemtrayicon/qsystemtrayicon.pro | 1 | ||||
-rw-r--r-- | tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp | 56 |
8 files changed, 96 insertions, 4 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index de59524..f3e5d22 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -445,7 +445,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP QPoint base(c.x + glyphMargin(), c.y + glyphMargin() + c.baseLineY-1); if (m_image.rect().contains(base)) m_image.setPixel(base, 255); - m_image.save(QString::fromLatin1("cache-%1.png").arg(int(this))); + m_image.save(QString::fromLatin1("cache-%1.png").arg(qint64(this))); #endif } diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/gui/util/qsystemtrayicon.cpp index 941961b..1c95558 100644 --- a/src/gui/util/qsystemtrayicon.cpp +++ b/src/gui/util/qsystemtrayicon.cpp @@ -335,6 +335,16 @@ bool QSystemTrayIcon::event(QEvent *e) \sa activated() */ +/*! + \fn void QSystemTrayIcon::messageTimeout() + + This signal is emitted when the message displayed using showMessage() + hides automatically after being shown for the timeout value. + + Currently this signal is not sent on Mac OS X. + + \since 4.8 +*/ /*! Returns true if the system tray is available; otherwise returns false. @@ -657,8 +667,10 @@ void QBalloonTip::timerEvent(QTimerEvent *e) { if (e->timerId() == timerId) { killTimer(timerId); - if (!underMouse()) + if (!underMouse()) { close(); + emit trayIcon->messageTimeout(); + } return; } QWidget::timerEvent(e); diff --git a/src/gui/util/qsystemtrayicon.h b/src/gui/util/qsystemtrayicon.h index 0a57e35..5812d07 100644 --- a/src/gui/util/qsystemtrayicon.h +++ b/src/gui/util/qsystemtrayicon.h @@ -111,6 +111,7 @@ public Q_SLOTS: Q_SIGNALS: void activated(QSystemTrayIcon::ActivationReason reason); void messageClicked(); + void messageTimeout(); protected: bool event(QEvent *event); diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index fc5de44..91b11ef 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -313,6 +313,10 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result ) emit q->messageClicked(); break; + case NIN_BALLOONTIMEOUT: + emit q->messageTimeout(); + break; + case WM_MBUTTONUP: emit q->activated(QSystemTrayIcon::MiddleClick); break; diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 547e457..a32a311 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -509,6 +509,7 @@ Q_SIGNALS: private slots: void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + Q_UNUSED(boundPixmap); #if defined(Q_WS_X11) if (boundPixmap) { QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext()); diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 74382b0..1f39884 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -260,10 +260,27 @@ bool QGLShaderPrivate::compile(QGLShader *q) glGetShaderInfoLog(shader, value, &len, logbuf); log = QString::fromLatin1(logbuf); QString name = q->objectName(); + + char *types[] = { + "Fragment", + "Vertex", + "Geometry", + "" + }; + + char *type = types[3]; + if (shaderType == QGLShader::Fragment) + type = types[0]; + else if (shaderType == QGLShader::Vertex) + type = types[1]; + else if (shaderType == QGLShader::Geometry) + type = types[2]; + if (name.isEmpty()) - qWarning() << "QGLShader::compile:" << log; + qWarning("QGLShader::compile(%s): %s", type, qPrintable(log)); else - qWarning() << "QGLShader::compile[" << name << "]:" << log; + qWarning("QGLShader::compile(%s)[%s]: %s", type, qPrintable(name), qPrintable(log)); + delete [] logbuf; } return compiled; diff --git a/tests/auto/qsystemtrayicon/qsystemtrayicon.pro b/tests/auto/qsystemtrayicon/qsystemtrayicon.pro index a77b478..a33d072 100644 --- a/tests/auto/qsystemtrayicon/qsystemtrayicon.pro +++ b/tests/auto/qsystemtrayicon/qsystemtrayicon.pro @@ -5,5 +5,6 @@ load(qttest_p4) SOURCES += tst_qsystemtrayicon.cpp +win32:LIBS += user32.lib diff --git a/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp index b1ec0ff..f4120ca 100644 --- a/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp @@ -47,6 +47,10 @@ #include <qsystemtrayicon.h> #include <qmenu.h> +#ifdef Q_OS_WIN32 +#include <windows.h> +#endif + //TESTED_CLASS= //TESTED_FILES= @@ -64,6 +68,7 @@ private slots: void showMessage(); void supportsMessages(); void lastWindowClosed(); + void messageTimeout(); }; tst_QSystemTrayIcon::tst_QSystemTrayIcon() @@ -144,5 +149,56 @@ void tst_QSystemTrayIcon::lastWindowClosed() QVERIFY(spy.count() == 1); } +#ifndef Q_WS_MAC + +static void triggerMessageTimeout() +{ +#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) + // the application has to loose focus on Windows for the message to timeout + INPUT input[2] = {}; + + input[0].type = INPUT_KEYBOARD; + input[0].ki.wVk = VK_LWIN; + input[0].ki.dwFlags = 0; + + input[1].type = INPUT_KEYBOARD; + input[1].ki.wVk = VK_LWIN; + input[1].ki.dwFlags = KEYEVENTF_KEYUP; + + for (int i = 0; i < 2; i++) { + QTest::qWait(100); + ::SendInput(2, input, sizeof(INPUT)); + } +#endif /* defined(Q_WS_WIN) && !defined(Q_WS_WINCE) */ +} + +void tst_QSystemTrayIcon::messageTimeout() +{ + QSystemTrayIcon icon; + if (icon.supportsMessages()) { + icon.setIcon(QIcon("whatever.png")); + icon.show(); + + QObject::connect(&icon, SIGNAL(messageTimeout()), qApp, SLOT(quit())); + QSignalSpy spy(&icon, SIGNAL(messageTimeout())); + icon.showMessage("Title", "Hello World!", QSystemTrayIcon::Information, 1000); + + triggerMessageTimeout(); + + QTimer::singleShot(30000, qApp, SLOT(quit())); // in case the test fails + qApp->exec(); + QVERIFY(spy.count() == 1); + } +} + +#else + +void tst_QSystemTrayIcon::messageTimeout() +{ + // skip the test on Mac OS X +} + +#endif /* Q_WS_MAC */ + QTEST_MAIN(tst_QSystemTrayIcon) #include "tst_qsystemtrayicon.moc" |