From f508189682b6fba62e08feeb1596f682bad5fff9 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 18:42:24 +0000 Subject: Added KDE3 version of PikLab git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/progs/base/prog_group.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/progs/base/prog_group.cpp (limited to 'src/progs/base/prog_group.cpp') diff --git a/src/progs/base/prog_group.cpp b/src/progs/base/prog_group.cpp new file mode 100644 index 0000000..5801318 --- /dev/null +++ b/src/progs/base/prog_group.cpp @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 Nicolas Hadacek * + * * + * 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. * + ***************************************************************************/ +#include "prog_group.h" + +#include "common/global/global.h" +#include "generic_prog.h" +#include "prog_config.h" +#include "generic_debug.h" +#include "devices/base/device_group.h" + +// order is important +const PURL::FileType Programmer::INPUT_FILE_TYPE_DATA[Nb_InputFileTypes] = { + PURL::Coff, PURL::Cod, PURL::Hex +}; + +QString Programmer::Group::statusLabel(PortType type) const +{ + uint nb = 0; + FOR_EACH(PortType, ptype) if ( isPortSupported(ptype) ) nb++; + if ( nb<=0 ) return label(); + return label() + " (" + type.label() + ")"; +} + +Programmer::Base *Programmer::Group::createProgrammer(bool targetSelfPowered, const Device::Data *data, const HardwareDescription &hd) const +{ + ::Programmer::Base *base = createBase(data); + Hardware *hardware = createHardware(*base, hd); + DeviceSpecific *ds = (data ? createDeviceSpecific(*base) : 0); + base->init(targetSelfPowered, hardware, ds); + return base; +} + +Debugger::Base *Programmer::Group::createDebugger(::Programmer::Base &base) const +{ + ::Debugger::Base *dbase = createDebuggerBase(base); + if (dbase) { + ::Debugger::DeviceSpecific *dspecific = createDebuggerDeviceSpecific(*dbase); + ::Debugger::Specific *specific = createDebuggerSpecific(*dbase); + dbase->init(dspecific, specific); + } + return dbase; +} + +bool Programmer::Group::checkConnection(const HardwareDescription &hd) const +{ + ::Programmer::Base *base = createProgrammer(false, 0, hd); + bool ok = base->simpleConnectHardware(); + delete base; + return ok; +} + +bool Programmer::Group::isSoftware() const +{ + FOR_EACH(PortType, type) if ( isPortSupported(type) ) return false; + return true; +} -- cgit v1.2.1