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/progs/base/prog_config.cpp | |
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/progs/base/prog_config.cpp')
-rw-r--r-- | src/progs/base/prog_config.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/progs/base/prog_config.cpp b/src/progs/base/prog_config.cpp new file mode 100644 index 0000000..8115ce7 --- /dev/null +++ b/src/progs/base/prog_config.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#include "prog_config.h" + +//---------------------------------------------------------------------------- +PortType Programmer::GroupConfig::portType(const Group &group) +{ + GenericConfig config(group.name()); + PortType ctype = config.readEnumEntry<PortType>("port_group"); + if ( group.isPortSupported(ctype) ) return ctype; + FOR_EACH(PortType, type) if ( group.isPortSupported(type) ) return type; + return PortType::Nb_Types; +} +void Programmer::GroupConfig::writePortType(const Group &group, PortType type) +{ + if ( type==PortType::Nb_Types ) return; + GenericConfig config(group.name()); + config.writeEnumEntry<PortType>("port_group", type); +} + +QString Programmer::GroupConfig::portDevice(const Group &group, PortType portType) +{ + GenericConfig config(group.name()); + QString device = config.readEntry(QString(portType.key()) + "_port_device" , QString::null); + if ( device.isNull() ) { + QStringList list = Port::probedDeviceList(portType); + if ( list.isEmpty() ) return QString::null; + return list[0]; + } + return device; +} +void Programmer::GroupConfig::writePortDevice(const Group &group, PortType type, const QString &device) +{ + if ( type==PortType::Nb_Types ) return; + GenericConfig config(group.name()); + config.writeEntry(QString(type.key()) + "_port_device", device); +} + +Port::Description Programmer::GroupConfig::portDescription(const Group &group) +{ + PortType type = portType(group); + return Port::Description(type, portDevice(group, type)); +} +void Programmer::GroupConfig::writePortDescription(const Group &group, const Port::Description &dp) +{ + writePortType(group, dp.type); + writePortDevice(group, dp.type, dp.device); +} + +QString Programmer::GroupConfig::firmwareDirectory(const Group &group) +{ + GenericConfig config(group.name()); + return config.readEntry("firmware_directory", QString::null); +} +void Programmer::GroupConfig::writeFirmwareDirectory(const Group &group, const QString &path) +{ + GenericConfig config(group.name()); + config.writeEntry("firmware_directory", path); +} + +//---------------------------------------------------------------------------- +const Programmer::Config::Data Programmer::Config::DATA[Nb_Types] = { + { "only_program_non_mask", I18N_NOOP("Only program what is needed (faster)."), QVariant(true, 0) }, + { "verify_after_program", I18N_NOOP("Verify device memory after programming."), QVariant(true, 0) }, + { "only_verify_programmed", I18N_NOOP("Only verify programmed words in code memory (faster)."), QVariant(true, 0) }, + { "power_down_after_programming", I18N_NOOP("Power down target after programming."), QVariant(true, 0) }, + { "target_self_powered", I18N_NOOP("Target is self-powered (when possible)."), QVariant(true, 0) }, + { "blank_check_after_erase", I18N_NOOP("Blank check after erase."), QVariant(false, 0) }, + { "preserve_eeprom", I18N_NOOP("Preserve data EEPROM when programming."), QVariant(false, 0) }, + { "program_eeprom", I18N_NOOP("Program data EEPROM."), QVariant(true, 0) }, + { "run_after_program", I18N_NOOP("Run device after successful programming."), QVariant(false, 0) } +}; |