1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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, TQWidget *parent)
: ::Programmer::PicAdvancedDialog(base, parent, "icd2_advanced_dialog")
{
uint row = _firmwareContainer->numRows();
TQLabel *label = new TQLabel(i18n("Id:"), _firmwareContainer);
_firmwareContainer->addWidget(label, row,row, 0,0);
_firmwareIdLabel = new TQLabel(_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"), TQT_TQOBJECT(this), TQT_SLOT(updateDebugExecutive()), _programmerContainer);
_programmerContainer->addWidget(container, row,row, 0,1);
label = new TQLabel(i18n("Version:"), container);
container->addWidget(label, 1,1, 0,0);
_debugExecLabel = new TQLabel(container);
container->addWidget(_debugExecLabel, 1,1, 1,1);
row++;
} else _debugExecLabel = 0;
for (uint i=0; i<TestData::Nb_VoltageTypes; i++) {
TQLabel *label = new TQLabel(i18n(TestData::VOLTAGE_LABELS[i]) + ":", _selfTestContainer);
_selfTestContainer->addWidget(label, 1+i,1+i, 0,0);
_tests[i] = new TQLabel(_selfTestContainer);
_selfTestContainer->addWidget(_tests[i], 1+i,1+i, 1,1);
}
}
void Icd2::AdvancedDialog::updateDebugExecutive()
{
::PBusyCursor 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(TQWidget *parent) const
{
return new ::Programmer::ConfigWidget(static_cast<const Group &>(group()), parent);
}
::Programmer::AdvancedDialog *Icd2::GroupUI::createAdvancedDialog(::Programmer::Base &base, TQWidget *parent) const
{
return new AdvancedDialog(static_cast<ProgrammerBase &>(base), parent);
}
|