summaryrefslogtreecommitdiffstats
path: root/src/progs/icd2/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/progs/icd2/gui')
-rw-r--r--src/progs/icd2/gui/Makefile.am6
-rw-r--r--src/progs/icd2/gui/icd2_group_ui.cpp81
-rw-r--r--src/progs/icd2/gui/icd2_group_ui.h48
3 files changed, 135 insertions, 0 deletions
diff --git a/src/progs/icd2/gui/Makefile.am b/src/progs/icd2/gui/Makefile.am
new file mode 100644
index 0000000..df597a0
--- /dev/null
+++ b/src/progs/icd2/gui/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+libicd2ui_la_LDFLAGS = $(all_libraries)
+noinst_LTLIBRARIES = libicd2ui.la
+
+libicd2ui_la_SOURCES = icd2_group_ui.cpp
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 <[email protected]> *
+ * *
+ * 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);
+}
diff --git a/src/progs/icd2/gui/icd2_group_ui.h b/src/progs/icd2/gui/icd2_group_ui.h
new file mode 100644
index 0000000..93d66e7
--- /dev/null
+++ b/src/progs/icd2/gui/icd2_group_ui.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2005 Nicolas Hadacek <[email protected]> *
+ * *
+ * 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 ICD2_GROUP_UI_H
+#define ICD2_GROUP_UI_H
+
+#include "devices/pic/gui/pic_prog_group_ui.h"
+#include "progs/icd2/base/icd2_prog.h"
+
+namespace Icd2
+{
+class ProgrammerBase;
+class Group;
+
+//----------------------------------------------------------------------------
+class AdvancedDialog : public ::Programmer::PicAdvancedDialog
+{
+Q_OBJECT
+public:
+ AdvancedDialog(ProgrammerBase &base, QWidget *parent);
+ virtual void updateDisplay();
+
+private slots:
+ void updateDebugExecutive();
+
+private:
+ QLabel *_firmwareIdLabel, *_debugExecLabel;
+ QLabel *_tests[TestData::Nb_VoltageTypes];
+ ProgrammerBase &base() { return static_cast<ProgrammerBase &>(_base); }
+};
+
+//----------------------------------------------------------------------------
+class GroupUI : public ::Programmer::GroupUI
+{
+public:
+ virtual ::Programmer::ConfigWidget *createConfigWidget(QWidget *parent) const;
+ virtual bool hasAdvancedDialog() const { return true; }
+ virtual ::Programmer::AdvancedDialog *createAdvancedDialog(::Programmer::Base &base, QWidget *parent) const;
+};
+
+} // namespace
+
+#endif