]>
Commit | Line | Data |
---|---|---|
be52b11e UH |
1 | /* |
2 | * This file is part of the sigrok project. | |
3 | * | |
4 | * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
ffc5c0c2 UH |
21 | #ifndef SIGROK_QT_CHANNELFORM_H |
22 | #define SIGROK_QT_CHANNELFORM_H | |
be52b11e UH |
23 | |
24 | #include <QtGui/QWidget> | |
25 | #include <QPainter> | |
26 | #include <QPen> | |
27 | #include <QWheelEvent> | |
28 | #include <stdint.h> | |
29 | ||
30 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) | |
31 | ||
32 | namespace Ui { | |
33 | class ChannelForm; | |
34 | } | |
35 | ||
36 | class ChannelForm : public QWidget { | |
37 | Q_OBJECT | |
38 | public: | |
39 | ChannelForm(QWidget *parent = 0); | |
40 | ~ChannelForm(); | |
41 | Ui::ChannelForm *m_ui; | |
42 | void setChannelColor(QColor color); | |
43 | QColor getChannelColor(void); | |
44 | void setChannelNumber(int c); | |
45 | int getChannelNumber(void); | |
46 | void setNumSamples(uint64_t s); | |
47 | uint64_t getNumSamples(void); | |
48 | uint64_t getNumSamplesVisible(void); | |
49 | uint64_t getSampleStart(void); | |
50 | uint64_t getSampleEnd(void); | |
51 | float getScaleFactor(void); | |
52 | int getStepSize(void); | |
53 | int getScrollBarValue(void); | |
54 | ||
55 | public slots: | |
56 | void setSampleStart(uint64_t s); | |
57 | void setSampleEnd(uint64_t s); | |
58 | void setScaleFactor(float z); | |
59 | void generatePainterPath(void); | |
60 | void setScrollBarValue(int value); | |
61 | ||
62 | signals: | |
63 | void sampleStartChanged(uint64_t); | |
64 | void sampleStartChanged(QString); | |
65 | void sampleEndChanged(uint64_t); | |
66 | void sampleEndChanged(QString); | |
67 | void scaleFactorChanged(float); | |
68 | void scaleFactorChanged(QString); | |
69 | ||
70 | protected: | |
71 | void changeEvent(QEvent *e); | |
72 | void resizeEvent(QResizeEvent *event); | |
73 | void paintEvent(QPaintEvent *event); | |
74 | void wheelEvent(QWheelEvent *event); | |
75 | ||
76 | private: | |
77 | QColor channelColor; | |
78 | int channelNumber; | |
79 | uint64_t sampleStart; | |
80 | uint64_t sampleEnd; | |
81 | uint64_t numSamples; | |
82 | float scaleFactor; | |
83 | QPainterPath *painterPath; | |
84 | // static int numTotalChannels; | |
85 | int scrollBarValue; | |
86 | int stepSize; | |
87 | }; | |
88 | ||
89 | #endif |