--- /dev/null
+atk_object_set_name..assertion
+gtk_widget_set_sensitive: assertion
TEMP_FILE_EXEC_NOT_FOUND="temp_exec_not_found.txt"
TEMP_REPORT_FILE="temp_report.txt"
+MAKE_OPTIONS="-j3 -k -s -w"
+
+SCRIPT_DIR=(`pwd`)
+
# check that directories are found
if [[ -d $REPORT_PATH && -d $UNIT_TESTS_ROOT_DIR ]]; then
# convert relational paths to absolute ones
# run qmake
cd $UNIT_TESTS_ROOT_DIR_ABSOLUTE
qmake -r
- make
+ make $MAKE_OPTIONS
cd -
echo ""
# go to unit test directory
cd "`echo $PROJECT | grep --perl-regexp -o .*\(?=/\)`"
# run unit test, save to temp file, ignore strerr stream
- $PROJECT -silent -o $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE 2>&1 | grep -v "atk_object_set_name..assertion"
+ $PROJECT -silent -o $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE 2>&1 | grep -v -f $SCRIPT_DIR/filtering_patterns_for_unit_tests_output.txt
cd - > /dev/null
# print to screen and append to summary
cat $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE
cat $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE >> $REPORT_PATH_ABSOLUTE/$REPORT_FILE
+ echo ""
echo "" >> $REPORT_PATH_ABSOLUTE/$REPORT_FILE
else
# save path of missing test to temporary file
qDebug() << __PRETTY_FUNCTION__;
static Qt::HANDLE rootWindow = QX11Info::appRootWindow();
- static Atom activeAppAtom = XInternAtom(QX11Info::display(),
- ACTIVE_APP_ATOM, false);
-
- if (event->type == PropertyNotify) {
- XPropertyEvent *pevent = (XPropertyEvent*)event;
- if (pevent->window == rootWindow) {
- if (pevent->atom == activeAppAtom) {
- WId activeWindow = activeDesktopWindow(pevent->display,
- rootWindow);
-
- if(m_topmost != m_windows.contains(activeWindow)) {
- m_topmost = !m_topmost;
- emit topmostChanged(!m_topmost);
+ static Atom activeAppAtom = XInternAtom(QX11Info::display(), ACTIVE_APP_ATOM, false);
+
+ switch (event->type) {
+ case PropertyNotify: {
+ XPropertyEvent *pevent = (XPropertyEvent*)event;
+ if (pevent->window == rootWindow) {
+ if (pevent->atom == activeAppAtom) {
+ WId activeWindow = activeDesktopWindow(pevent->display, rootWindow);
+
+ if(m_topmost != m_windows.contains(activeWindow)) {
+ m_topmost = !m_topmost;
+ emit topmostChanged(!m_topmost);
+ }
}
}
}
+ break;
+ case KeyPress:
+ case KeyRelease:
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify: // required when returning from statusbar menu
+ case FocusIn: // required when returning from update location dialog
+ emit showFullScreenButton();
+ break;
}
+
+ // don't block any events here, so false is returned
return false;
}
class Application : public QApplication
{
Q_OBJECT
-public:
+public:
/**
* @brief Constructor
*
*/
Application(int &argc, char **argv);
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
/**
* @brief Registers window
*
void unregisterWindow(WId wId);
private:
-
/**
* @brief Return active window
*
*/
bool x11EventFilter(XEvent *event);
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
signals:
+ /**
+ * @brief Signal is emitted when full screen button must be invoked and it's hiding timer
+ cleared.
+ *
+ * Signal is emitted when user interacts with keyboard or with mouse/finger, or when the
+ * main window is exposed.
+ */
+ void showFullScreenButton();
/**
* @brief Signals when window state is changed
*/
void topmostChanged(bool topmost);
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
private:
+ bool m_topmost; ///< Flag for topmost
- bool m_topmost; ///< Flag for topmost
-
- QList<WId> m_windows; ///< List of window ids
+ QList<WId> m_windows; ///< List of window ids
};
#endif // APPLICATION_H
const QPoint ONE_PIXEL = QPoint(1, 1);
- QGraphicsView *view = m_mapScene->views().at(0);
+ QGraphicsView *view = m_mapScene->views().first();
QPointF sceneTopLeft = view->mapToScene(0, 0);
QPoint viewBottomRight = QPoint(view->size().width(), view->size().height()) - ONE_PIXEL;
QPointF sceneBottomRight = view->mapToScene(viewBottomRight);
* Logic for controlling map functionality. Does also include static methods for
* converting coordinates.
*
+ * NOTE: MapEngine must have a view attached before using it!
+ *
* @author Sami Rämö - sami.ramo (at) ixonos.com
* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
#include <QDebug>
#include <QPainter>
+#include <QTimer>
#include "math.h"
{
qDebug() << __PRETTY_FUNCTION__;
+ const int HIDING_DELAY_MS = 5000;
+
setIcon(QIcon::fromTheme(QLatin1String("general_fullsize")));
setFixedSize(sizeHint());
m_backgroundPath.lineTo(0, this->height()); // Bottom left corner
m_backgroundPath.lineTo(this->width(), this->height()); // Bottom right corner
m_backgroundPath.closeSubpath(); // Back to the beginning
+
+ // Timer for hiding the button automatically after a delay
+ m_hidingTimer = new QTimer(this);
+ if (m_hidingTimer) {
+ m_hidingTimer->setSingleShot(true);
+ m_hidingTimer->setInterval(HIDING_DELAY_MS);
+
+ connect(m_hidingTimer, SIGNAL(timeout()),
+ this, SLOT(hide()));
+ }
}
FullScreenButton::~FullScreenButton()
delete m_selectedGradient;
}
+void FullScreenButton::invoke()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (isHidden())
+ show();
+
+ if (m_hidingTimer)
+ m_hidingTimer->start();
+}
+
void FullScreenButton::paintEvent(QPaintEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
#include <QToolButton>
+class QTimer;
+
/**
* @brief Fullscreen button class
*
void paintEvent(QPaintEvent *event);
/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public slots:
+ /**
+ * @brief Invoke the button (if not already visible) and set hiding timer
+ */
+ void invoke();
+
+/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
QColor *m_normalColor; ///< Normal background color
QLinearGradient *m_selectedGradient; ///< Selected background
QPainterPath m_backgroundPath; ///< Item shape path
+ QTimer *m_hidingTimer; ///< Timer for hiding the button after a delay
};
#endif // FULLSCREENBUTTON_H
* @brief Sets direction information for the distance indicator button
*
* Paints the button and its icon
- * @param Direction to the GPS position (in degrees)
- * @param Draw direction triangle
+ *
+ * @param direction Direction to the GPS position (in degrees)
+ * @param draw True if direction triangle should be drawn
*/
void setDirection(qreal direction, bool draw);
* @brief Toggle indicator button panel draggability
*
* @param mode True if draggable, otherwise false
- * @param distance Start value for dragging
+ * @param eventPosition Start position of the dragging
*/
void setDraggable(bool mode, QPoint eventPosition = QPoint(0,0));
void MainWindow::buildFullScreenButton()
{
qDebug() << __PRETTY_FUNCTION__;
+
#ifdef Q_WS_MAEMO_5
m_fullScreenButton = new FullScreenButton(this);
- connect(m_fullScreenButton, SIGNAL(clicked()),
- this, SLOT(toggleFullScreen()));
+
+ if (m_fullScreenButton) {
+ connect(m_fullScreenButton, SIGNAL(clicked()),
+ this, SLOT(toggleFullScreen()));
+
+ connect(qApp, SIGNAL(showFullScreenButton()),
+ m_fullScreenButton, SLOT(invoke()));
+ }
#endif // Q_WS_MAEMO_5
}
*/
#include <QGraphicsScene>
+#include <QGraphicsView>
#include <QtTest/QtTest>
#include "common.h"
void convertTileNumberToSceneCoordinate_data();
void setLocationNewTilesCount();
void setLocationRemovedTilesCount();
- void zoomOutRemovedTilesCount();
- void zoomInRemovedTilesCount();
void usingLastLocation();
+ void zoomInRemovedTilesCount();
+ void zoomOutRemovedTilesCount();
signals:
void setCenterPosition(SceneCoordinate); // a way to call a private slot
void TestMapEngine::setLocationNewTilesCount()
{
MapEngine engine;
+ QGraphicsView view;
+ view.setScene(engine.scene());
engine.viewResized(QSize(800, 480));
connect(this, SIGNAL(setCenterPosition(SceneCoordinate)),
&engine, SLOT(setCenterPosition(SceneCoordinate)));
void TestMapEngine::setLocationRemovedTilesCount()
{
MapEngine engine;
+ QGraphicsView view;
+ view.setScene(engine.scene());
engine.viewResized(QSize(800, 480));
connect(this, SIGNAL(setCenterPosition(SceneCoordinate)),
&engine, SLOT(setCenterPosition(SceneCoordinate)));
void TestMapEngine::zoomInRemovedTilesCount()
{
MapEngine engine;
+ QGraphicsView view;
+ view.setScene(engine.scene());
engine.viewResized(QSize(800, 480));
connect(this, SIGNAL(setCenterPosition(SceneCoordinate)),
&engine, SLOT(setCenterPosition(SceneCoordinate)));
void TestMapEngine::zoomOutRemovedTilesCount()
{
MapEngine engine;
+ QGraphicsView view;
+ view.setScene(engine.scene());
engine.viewResized(QSize(800, 480));
connect(this, SIGNAL(setCenterPosition(SceneCoordinate)),
&engine, SLOT(setCenterPosition(SceneCoordinate)));
{
// Create mapengine and start monitoring zoomLevelChanged-signal
MapEngine *mapengine = new MapEngine;
+ QGraphicsView view;
+ view.setScene(mapengine->scene());
QSignalSpy mapEngineSpy(mapengine, SIGNAL(zoomLevelChanged(int)));
connect(this, SIGNAL(setCenterPosition(SceneCoordinate)),
mapengine, SLOT(setCenterPosition(SceneCoordinate)));