/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set et sw=2 ts=2: */ /*************************************************************************** * outputwindow.h * * Sat Aug 4 13:44:40 CEST 2012 * Copyright 2012 Bent Bisballe Nyeng * deva@aasimon.org ****************************************************************************/ /* * This file is part of Kaiman. * * Kaiman 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. * * Kaiman 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 Kaiman; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #pragma once #include #include #include #include #include #include class OutputWindow : public QGLWidget { Q_OBJECT public: OutputWindow(); void forward(double x); void turn(double x); void stopScript(); void setSpeed(int s); void setScale(double s); double getScale() const; void setColour(int r, int g, int b, int a); void loadPen(QString file); double coordX(); double coordY(); QImage acquire(bool includePen); public slots: void timeout(); void reset(); protected: void mouseMoveEvent(QMouseEvent* event); void mousePressEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); void wheelEvent(QWheelEvent* event); void paintEvent(QPaintEvent* event); private: void paint(QPainter& p, const QPointF& offset, bool includePen, double scale); class ColLine { public: QColor colour; QLine line; }; QImage kaiman; double x, y, r; QTimer timer; QSemaphore sem; QVector lines; QVector current_points; QColor colour; volatile bool stop; volatile int speed; volatile bool loadpen; QString penfile; volatile float scale{2.0f}; bool dragging{false}; QPoint dragOffsetOrigo{0, 0}; QPoint dragOffset{0, 0}; QPointF offset{0.0, 0.0}; };