diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
commit | f508189682b6fba62e08feeb1596f682bad5fff9 (patch) | |
tree | 28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/devices/base/device_group.h | |
download | piklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip |
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/devices/base/device_group.h')
-rw-r--r-- | src/devices/base/device_group.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/devices/base/device_group.h b/src/devices/base/device_group.h new file mode 100644 index 0000000..087ca99 --- /dev/null +++ b/src/devices/base/device_group.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef DEVICE_GROUP_H +#define DEVICE_GROUP_H + +#if !defined(NO_KDE) +# include <qcolor.h> +#endif + +#include "generic_device.h" +#include "common/common/group.h" +#include "common/common/streamer.h" +namespace Debugger { class DeviceSpecific; class Base; } + +namespace Device +{ +class Memory; + +//---------------------------------------------------------------------------- +class MemoryRange { +public: + MemoryRange() {} + virtual ~MemoryRange() {} + virtual bool all() const { return true; } +}; + +//---------------------------------------------------------------------------- +class GroupBase : public ::Group::Base +{ +public: + virtual Memory *createMemory(const Device::Data &data) const = 0; + virtual QString informationHtml(const Device::Data &data) const = 0; +#if !defined(NO_KDE) + virtual QPixmap memoryGraph(const Device::Data &data) const = 0; +#endif + +protected: + virtual void addDevice(const QString &name, const Device::Data *data, ::Group::Support support) { + const_cast<Device::Data *>(data)->_group = this; + ::Group::Base::addDevice(name, data, support); + } +}; + +template <class DataType> +class Group : public GroupBase, public DataStreamer<DataType> +{ +protected: + virtual void initSupported() { + QValueList<DataType *> list = fromCppString(dataStream(), dataSize()); + for (uint i=0; i<uint(list.count()); i++) addDevice(list[i]->name(), list[i], ::Group::Support::Tested); + } + virtual uint dataSize() const = 0; + virtual const char *dataStream() const = 0; +}; + +//---------------------------------------------------------------------------- +#if !defined(NO_KDE) +extern QColor statusColor(Status status); +extern QPixmap vddGraph(const QString &xLabel, const QString &yLabel, const QValueVector<RangeBox> &boxes); +extern const Package *barPackage(const char *name, const Data &data); +extern QPixmap pinsGraph(const Package &package); + +extern QString htmlInfo(const Data &data, const QString &deviceHref, const QString &documentHtml); +extern QString htmlPinDiagrams(const Device::Data &data, const QString &imagePrefix, QMimeSourceFactory *msf); +extern QString htmlVoltageFrequencyGraphs(const Device::Data &data, const QString &imagePrefix, QMimeSourceFactory *msf); + +class MemoryGraphData +{ +public: + Address startAddress, endAddress; + QString start, end, label; + int height; + bool operator <(const MemoryGraphData &data) const { return ( startAddress < data.startAddress ); } +}; +extern QPixmap memoryGraph(const QValueList<MemoryGraphData> &ranges); + +#endif + +} // namespace + +#endif |