diff options
Diffstat (limited to 'src/progs/icd2/gui/icd2_group_ui.cpp')
-rw-r--r-- | src/progs/icd2/gui/icd2_group_ui.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/progs/icd2/gui/icd2_group_ui.cpp b/src/progs/icd2/gui/icd2_group_ui.cpp new file mode 100644 index 0000000..6f00788 --- /dev/null +++ b/src/progs/icd2/gui/icd2_group_ui.cpp @@ -0,0 +1,81 @@ +/*************************************************************************** + * 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 "icd2_group_ui.h" + +#include "common/gui/misc_gui.h" +#include "progs/gui/prog_config_widget.h" +#include "progs/base/prog_group.h" +#include "progs/icd2/base/icd2_debug.h" + +//---------------------------------------------------------------------------- +Icd2::AdvancedDialog::AdvancedDialog(ProgrammerBase &base, QWidget *parent) + : ::Programmer::PicAdvancedDialog(base, parent, "icd2_advanced_dialog") +{ + uint row = _firmwareContainer->numRows(); + QLabel *label = new QLabel(i18n("Id:"), _firmwareContainer); + _firmwareContainer->addWidget(label, row,row, 0,0); + _firmwareIdLabel = new QLabel(_firmwareContainer); + _firmwareContainer->addWidget(_firmwareIdLabel, row,row, 1,1); + row++; + + row = _programmerContainer->numRows(); + if ( base.group().properties() & ::Programmer::Debugger ) { + ButtonContainer *container = new ::Programmer::ButtonContainer(i18n("Debug Executive"), this, SLOT(updateDebugExecutive()), _programmerContainer); + _programmerContainer->addWidget(container, row,row, 0,1); + label = new QLabel(i18n("Version:"), container); + container->addWidget(label, 1,1, 0,0); + _debugExecLabel = new QLabel(container); + container->addWidget(_debugExecLabel, 1,1, 1,1); + row++; + } else _debugExecLabel = 0; + + for (uint i=0; i<TestData::Nb_VoltageTypes; i++) { + QLabel *label = new QLabel(i18n(TestData::VOLTAGE_LABELS[i]) + ":", _selfTestContainer); + _selfTestContainer->addWidget(label, 1+i,1+i, 0,0); + _tests[i] = new QLabel(_selfTestContainer); + _selfTestContainer->addWidget(_tests[i], 1+i,1+i, 1,1); + } +} + +void Icd2::AdvancedDialog::updateDebugExecutive() +{ + ::BusyCursor bc; + if ( ensureConnected() ) { + Pic::TargetMode mode; + if ( !base().getTargetMode(mode) ) return; + if ( mode==Pic::TargetInProgramming ) + MessageBox::sorry(i18n("You need to initiate debugging to read the debug executive version."), Log::Show); + else static_cast<DebugProgrammer &>(base()).readDebugExecutiveVersion(); + } + updateDisplay(); +} + +void Icd2::AdvancedDialog::updateDisplay() +{ + ::Programmer::PicAdvancedDialog::updateDisplay(); + uchar id = base().firmwareId(); + _firmwareIdLabel->setText(id==0 ? "---" : toHexLabel(id, 2)); + if (_debugExecLabel) { + const VersionData &vd = static_cast<DebugProgrammer &>(base()).debugExecutiveVersion(); + _debugExecLabel->setText(vd.isValid() ? vd.pretty() : "---"); + } + for (uint i=0; i<TestData::Nb_VoltageTypes; i++) + _tests[i]->setText(base().testData().result(TestData::VoltageType(i))); +} + +//---------------------------------------------------------------------------- +::Programmer::ConfigWidget *Icd2::GroupUI::createConfigWidget(QWidget *parent) const +{ + return new ::Programmer::ConfigWidget(static_cast<const Group &>(group()), parent); +} + +::Programmer::AdvancedDialog *Icd2::GroupUI::createAdvancedDialog(::Programmer::Base &base, QWidget *parent) const +{ + return new AdvancedDialog(static_cast<ProgrammerBase &>(base), parent); +} |