Qt Virtual Chart Table (QVCT)
CDeviceOverlay.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 
26 #ifndef QVCT_CDEVICEOVERLAY_HPP
27 #define QVCT_CDEVICEOVERLAY_HPP
28 
29 // QT
30 #include <QDomElement> // QtXml module
31 #include <QList>
32 #include <QMimeData>
33 #include <QPainter>
34 #include <QPointF>
35 #include <QStringList>
36 #include <QWidget>
37 #include <QXmlStreamWriter>
38 
39 // QVCT
41 class CChart;
42 class CDevice;
43 class CDevicePoint;
44 
45 
47 
56 {
57 
58  //------------------------------------------------------------------------------
59  // CONSTANTS / STATIC
60  //------------------------------------------------------------------------------
61 
62 public:
64  enum EColumn {
65  NAME = 0,
66  SELECT = 1
67  };
68 
69 
70  //------------------------------------------------------------------------------
71  // CONSTRUCTORS / DESTRUCTOR
72  //------------------------------------------------------------------------------
73 
74 public:
75  CDeviceOverlay( QWidget* _pqParent = 0 );
76  virtual ~CDeviceOverlay();
77 
78 
79  //------------------------------------------------------------------------------
80  // METHODS: COverlay (implement/override)
81  //------------------------------------------------------------------------------
82 
83 public:
84  virtual void drawContent( const CChart* _poChart, QPainter* _pqPainter ) const {};
85  virtual void showDetail( const QTreeWidgetItem* _pqTreeWidgetItem ) const;
86  virtual void setPosition( const QTreeWidgetItem* _pqTreeWidgetItem ) const {};
87  virtual COverlayPoint* matchScrPosition( const CChart* _poChart, const QPointF& _rqPointFScrPosition ) const { return 0; };
88 
89 
90  //------------------------------------------------------------------------------
91  // METHODS: COverlayBaseTree (implement/override)
92  //------------------------------------------------------------------------------
93 
94 public:
95  virtual void onChange( QTreeWidgetItem* _pqTreeWidgetItem, int __iColumn );
96 
97 
98  //------------------------------------------------------------------------------
99  // METHODS
100  //------------------------------------------------------------------------------
101 
102  // OTHER
103 public:
105  CDevice* pickDevice( const QString& _rqsName );
107  int deleteSelection();
109  void clear();
110 
111 public:
113  CDevice* load( const QString& _rqsFilename, bool _bSilent = false );
115  void save( const QString& _rqsFilename, CDevice* _poDevice = 0, bool _bApplicationDump = false ) const;
117  int parseQVCT( const QDomElement& _rqDomElement, CDevice** _ppoDevice = 0 );
119  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter, CDevice* _poDevice = 0, bool _bApplicationDump = false ) const;
120 
121 };
122 
123 #endif // QVCT_CDEVICEOVERLAY_HPP
[UI] Chart (view)
Definition: CChart.hpp:44
[UI] Device overlay container
virtual void setPosition(const QTreeWidgetItem *_pqTreeWidgetItem) const
Centers the chart on the given overlay object's position.
CDeviceOverlay(QWidget *_pqParent=0)
int deleteSelection()
Deletes selected devices from this overlay.
void clear()
Clear the entire content of this overlay.
CDevice * pickDevice(const QString &_rqsName)
Returns the device matching the given name (0 if none is found)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, CDevice *_poDevice=0, bool _bApplicationDump=false) const
Stores this object's content to the given QVCT destination (file)
virtual void showDetail(const QTreeWidgetItem *_pqTreeWidgetItem) const
Displays the given overlay object's details (in the appropriate widget/view)
EColumn
Implemented tree-widget columns.
@ NAME
Device name.
@ SELECT
Device selection status.
int parseQVCT(const QDomElement &_rqDomElement, CDevice **_ppoDevice=0)
Retrieves this object's content from the given QVCT source (file)
void save(const QString &_rqsFilename, CDevice *_poDevice=0, bool _bApplicationDump=false) const
Save this object's content (device) to the given file (all selected items if no device is given)
virtual COverlayPoint * matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns the overlay's point that (first) matches the given screen position (0 if none is found)
virtual void onChange(QTreeWidgetItem *_pqTreeWidgetItem, int __iColumn)
Handles item (content) changes in the underlying QTreeWidget.
virtual ~CDeviceOverlay()
CDevice * load(const QString &_rqsFilename, bool _bSilent=false)
Load this object's content from the given file and returns the last loaded device (0 if none)
virtual void drawContent(const CChart *_poChart, QPainter *_pqPainter) const
Draws this overlay's content.
Generic navigation device (GPS, speedometer, compass, etc.)
Definition: CDevice.hpp:43
Generic overlay base (tree widget)
Generic overlay point.