1*bb02e0acSNicolas Bonnefon /* 2*bb02e0acSNicolas Bonnefon * Copyright (C) 2011, 2012, 2013 Nicolas Bonnefon and other contributors 3*bb02e0acSNicolas Bonnefon * 4*bb02e0acSNicolas Bonnefon * This file is part of glogg. 5*bb02e0acSNicolas Bonnefon * 6*bb02e0acSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 7*bb02e0acSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 8*bb02e0acSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 9*bb02e0acSNicolas Bonnefon * (at your option) any later version. 10*bb02e0acSNicolas Bonnefon * 11*bb02e0acSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 12*bb02e0acSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*bb02e0acSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*bb02e0acSNicolas Bonnefon * GNU General Public License for more details. 15*bb02e0acSNicolas Bonnefon * 16*bb02e0acSNicolas Bonnefon * You should have received a copy of the GNU General Public License 17*bb02e0acSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18*bb02e0acSNicolas Bonnefon */ 19*bb02e0acSNicolas Bonnefon 20*bb02e0acSNicolas Bonnefon #ifndef OVERVIEWWIDGET_H 21*bb02e0acSNicolas Bonnefon #define OVERVIEWWIDGET_H 22*bb02e0acSNicolas Bonnefon 23*bb02e0acSNicolas Bonnefon #include <QWidget> 24*bb02e0acSNicolas Bonnefon #include <QBasicTimer> 25*bb02e0acSNicolas Bonnefon 26*bb02e0acSNicolas Bonnefon class Overview; 27*bb02e0acSNicolas Bonnefon 28*bb02e0acSNicolas Bonnefon class OverviewWidget : public QWidget 29*bb02e0acSNicolas Bonnefon { 30*bb02e0acSNicolas Bonnefon Q_OBJECT 31*bb02e0acSNicolas Bonnefon 32*bb02e0acSNicolas Bonnefon public: 33*bb02e0acSNicolas Bonnefon OverviewWidget( QWidget* parent = 0 ); 34*bb02e0acSNicolas Bonnefon 35*bb02e0acSNicolas Bonnefon // Associate the widget with an Overview object. setOverview(Overview * overview)36*bb02e0acSNicolas Bonnefon void setOverview( Overview* overview ) { overview_ = overview; } 37*bb02e0acSNicolas Bonnefon 38*bb02e0acSNicolas Bonnefon public slots: 39*bb02e0acSNicolas Bonnefon // Sent when a match at the line passed must be highlighted in 40*bb02e0acSNicolas Bonnefon // the overview 41*bb02e0acSNicolas Bonnefon void highlightLine( qint64 line ); 42*bb02e0acSNicolas Bonnefon void removeHighlight(); 43*bb02e0acSNicolas Bonnefon 44*bb02e0acSNicolas Bonnefon protected: 45*bb02e0acSNicolas Bonnefon void paintEvent( QPaintEvent* paintEvent ); 46*bb02e0acSNicolas Bonnefon void mousePressEvent( QMouseEvent* mouseEvent ); 47*bb02e0acSNicolas Bonnefon void mouseMoveEvent( QMouseEvent* mouseEvent ); 48*bb02e0acSNicolas Bonnefon void timerEvent( QTimerEvent* event ); 49*bb02e0acSNicolas Bonnefon 50*bb02e0acSNicolas Bonnefon signals: 51*bb02e0acSNicolas Bonnefon // Sent when the user click on a line in the Overview. 52*bb02e0acSNicolas Bonnefon void lineClicked( int line ); 53*bb02e0acSNicolas Bonnefon 54*bb02e0acSNicolas Bonnefon private: 55*bb02e0acSNicolas Bonnefon // Constants 56*bb02e0acSNicolas Bonnefon static const int LINE_MARGIN; 57*bb02e0acSNicolas Bonnefon static const int STEP_DURATION_MS; 58*bb02e0acSNicolas Bonnefon static const int INITIAL_TTL_VALUE; 59*bb02e0acSNicolas Bonnefon 60*bb02e0acSNicolas Bonnefon Overview* overview_; 61*bb02e0acSNicolas Bonnefon 62*bb02e0acSNicolas Bonnefon // Highlight: 63*bb02e0acSNicolas Bonnefon // Which line is higlighted, or -1 if none 64*bb02e0acSNicolas Bonnefon int highlightedLine_; 65*bb02e0acSNicolas Bonnefon // Number of step until the highlight become static 66*bb02e0acSNicolas Bonnefon int highlightedTTL_; 67*bb02e0acSNicolas Bonnefon 68*bb02e0acSNicolas Bonnefon QBasicTimer highlightTimer_; 69*bb02e0acSNicolas Bonnefon 70*bb02e0acSNicolas Bonnefon void handleMousePress( int position ); 71*bb02e0acSNicolas Bonnefon }; 72*bb02e0acSNicolas Bonnefon 73*bb02e0acSNicolas Bonnefon #endif 74