summaryrefslogtreecommitdiff
path: root/plasma/gtft.h
blob: e2daa217ddb1cd00bb75b3b4a2af575135f9b855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66


#ifndef _GTFT_H
#define _GTFT_H

#include <QPainter>
#include <QGraphicsSceneMouseEvent>
#include <Plasma/Applet>

#include <comthread.hpp>

class ConfigDialog;

// using namespace Plasma;

class GtftApplet : public Plasma::Applet
{
   Q_OBJECT

   public:

      GtftApplet(QObject* parent, const QVariantList& args);
      ~GtftApplet();

      void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* mouseEvent);
      void mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent);
      void wheelEvent(QGraphicsSceneWheelEvent* wheelEvent);
      void mousePressEvent(QGraphicsSceneMouseEvent *event);
      void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
      void keyPressEvent(QKeyEvent* keyEvent);

      void paintInterface(QPainter* painter, const QStyleOptionGraphicsItem* option,
                          const QRect& contentsRect);
      void init();

   public slots:

      void updateImage(unsigned char* buffer, int size);
      void createConfigurationInterface(KConfigDialog *parent);

   protected Q_SLOTS:

      void configAccepted();

   protected:

      QPoint clickCoordinate(QPoint screenPos);

   private:

      ConfigDialog* configDialog;
      bool smoothScaling;
      QString host;
      unsigned int port;
      QRect paintRect;

      QPixmap picture;
      ComThread* thread;

      int vdrWidth;
      int vdrHeight;
};

K_EXPORT_PLASMA_APPLET(gtft, GtftApplet)

#endif // _GTFT_H