Qt Virtual Chart Table (QVCT)
CVesselContainerDevice.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 #ifndef QVCT_CVESSELCONTAINERDEVICE_HPP
20 #define QVCT_CVESSELCONTAINERDEVICE_HPP
21 
22 // QT
23 #include <QDataStream>
24 #include <QDomElement> // QtXml module
25 #include <QPainter>
26 #include <QTreeWidgetItem>
27 #include <QXmlStreamWriter>
28 
29 // QVCT
32 class CChart;
33 class CDevice;
34 
35 
37 
44 {
45  Q_OBJECT
46 
47  //------------------------------------------------------------------------------
48  // FIELDS
49  //------------------------------------------------------------------------------
50 
51 private:
54 
56 
57  int iTTL;
58 
59 
60  //------------------------------------------------------------------------------
61  // CONSTRUCTORS / DESTRUCTOR
62  //------------------------------------------------------------------------------
63 
64 public:
65  CVesselContainerDevice( const QString& _rqsName );
67 
68 
69  //------------------------------------------------------------------------------
70  // METHODS: COverlayObject (implement/override)
71  //------------------------------------------------------------------------------
72 
73 public:
74  virtual void serialize( QDataStream& _rqDataStream ) const {};
75  virtual void unserialize( QDataStream& _rqDataStream ) {};
76 
77 public:
78  virtual COverlay* useOverlay() { return (COverlay*)QTreeWidgetItem::parent()->parent(); };
79 
80 public:
81  virtual void draw( const CChart* _poChart, QPainter* _pqPainter ) {};
82  virtual void showDetail();
83  virtual void showEdit();
84 
85 
86  //------------------------------------------------------------------------------
87  // METHODS
88  //------------------------------------------------------------------------------
89 
90  // SIGNALS
91 signals:
94 
95  // SLOTS
96 private slots:
98  void slotDestroyed( QObject* _pqObject );
99 
100 private slots:
102  void slotDataFix( const CDeviceDataFix& _roDeviceDataFix );
103 
104  // SETTERS
105 public:
107  void setTTL( int _iTTL ) { iTTL = _iTTL; };
108 
109  // GETTERS
110 public:
112  bool isDeviceConnected() const;
114  int getTTL() const { return iTTL; };
115 
116  // OTHER
117 public:
119  bool connectDevice();
121  void disconnectDevice();
122 
123 public:
125  void parseQVCT( const QDomElement& _rqDomElement );
127  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const;
128 
129 };
130 
131 #endif // QVCT_CVESSELCONTAINERDEVICE_HPP
[UI] Chart (view)
Definition: CChart.hpp:44
Fix data [source,time,position,course,DOPs,...].
Generic navigation device (GPS, speedometer, compass, etc.)
Definition: CDevice.hpp:43
Generic overlay item.
Generic overlay.
Definition: COverlay.hpp:45
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
int getTTL() const
Returns the (vessels) time-to-live.
CDevice * poDevice
Corresponding device's pointer.
int iTTL
(Vessels) Time-to-live (seconds)
virtual void draw(const CChart *_poChart, QPainter *_pqPainter)
Draws this object (itself or its content)
void slotDestroyed(QObject *_pqObject)
Slot to handle object destruction.
virtual COverlay * useOverlay()
Returns this object's (base) overlay.
void slotDataFix(const CDeviceDataFix &_roDeviceDataFix)
Slot to handle fix data (sent by device)
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
bool connectDevice()
Connects to the actual device.
void signalRefreshContent()
Signal emitted when views should refresh this object's corresponding content.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
bool isDeviceConnected() const
Returns whether the actual device is connected.
virtual void showEdit()
Displays this object's edit widget/view.
CVesselContainerDevice(const QString &_rqsName)
void disconnectDevice()
Dicconnects from the actual device.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
void setTTL(int _iTTL)
Sets the (vessels) time-to-live (seconds)