summaryrefslogtreecommitdiffstats
path: root/src/progs/tbl_bootloader/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/progs/tbl_bootloader/gui')
-rw-r--r--src/progs/tbl_bootloader/gui/Makefile.am6
-rw-r--r--src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp80
-rw-r--r--src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h42
3 files changed, 128 insertions, 0 deletions
diff --git a/src/progs/tbl_bootloader/gui/Makefile.am b/src/progs/tbl_bootloader/gui/Makefile.am
new file mode 100644
index 0000000..d10b944
--- /dev/null
+++ b/src/progs/tbl_bootloader/gui/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libtblbootloaderui.la
+libtblbootloaderui_la_LDFLAGS = $(all_libraries)
+libtblbootloaderui_la_SOURCES = tbl_bootloader_ui.cpp
diff --git a/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp
new file mode 100644
index 0000000..5b576b9
--- /dev/null
+++ b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * Copyright (C) 2007 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 "tbl_bootloader_ui.h"
+
+#include "progs/tbl_bootloader/base/tbl_bootloader.h"
+#include "common/port/serial.h"
+
+//-----------------------------------------------------------------------------
+TinyBootloader::ConfigWidget::ConfigWidget(const::Programmer::Group &group, QWidget *parent)
+ : ::Programmer::ConfigWidget(group, parent)
+{
+ uint row = numRows();
+
+ QLabel *label = new QLabel(i18n("Port Speed:"), this);
+ addWidget(label, row,row, 0,0);
+ _speed = new KComboBox(this);
+ for (uint i=0; i<Port::Serial::Nb_Speeds; i++) {
+ if ( Port::Serial::SPEED_VALUES[i]==0 || !Port::Serial::SPEED_DATA[i].supported ) continue;
+ _speed->insertItem(QString::number(Port::Serial::SPEED_VALUES[i]));
+ }
+ addWidget(_speed, row,row, 1,1);
+ row++;
+
+ label = new QLabel(i18n("Timeout (ms):"), this);
+ addWidget(label, row,row, 0,0);
+ _timeout = new KIntNumInput(this);
+ _timeout->setMinValue(0);
+ addWidget(_timeout, row,row, 1,1);
+ row++;
+
+ label = new QLabel(i18n("No of Retries:"), this);
+ addWidget(label, row,row, 0,0);
+ _retries = new KIntNumInput(this);
+ _retries->setMinValue(0);
+ addWidget(_retries, row,row, 1,1);
+ row++;
+}
+
+void TinyBootloader::ConfigWidget::saveConfig()
+{
+ Config config;
+ uint k = 0;
+ for (uint i=0; i<Port::Serial::Nb_Speeds; i++) {
+ if ( Port::Serial::SPEED_VALUES[i]==0 || !Port::Serial::SPEED_DATA[i].supported ) continue;
+ if ( uint(_speed->currentItem())==k ) {
+ config.writeSpeed(Port::Serial::Speed(i));
+ break;
+ }
+ k++;
+ }
+ config.writeTimeout(_timeout->value());
+ config.writeRetries(_retries->value());
+}
+
+void TinyBootloader::ConfigWidget::loadConfig()
+{
+ Config config;
+ Port::Serial::Speed speed = config.readSpeed();
+ uint k = 0;
+ for (uint i=0; i<Port::Serial::Nb_Speeds; i++) {
+ if ( Port::Serial::SPEED_VALUES[i]==0 || !Port::Serial::SPEED_DATA[i].supported ) continue;
+ if ( i==uint(speed) ) break;
+ k++;
+ }
+ _speed->setCurrentItem(k);
+ _timeout->setValue(config.readTimeout());
+ _retries->setValue(config.readRetries());
+}
+
+//-----------------------------------------------------------------------------
+::Programmer::ConfigWidget *TinyBootloader::GroupUI::createConfigWidget(QWidget *parent) const
+{
+ return new ConfigWidget(static_cast<const ::Programmer::Group &>(group()), parent);
+}
diff --git a/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h
new file mode 100644
index 0000000..d0285af
--- /dev/null
+++ b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * Copyright (C) 2007 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. *
+ ***************************************************************************/
+#ifndef TBL_BOOTLOADER_UI_H
+#define TBL8BOOTLOADER_UI_H
+
+#include <kcombobox.h>
+#include <knuminput.h>
+
+#include "progs/bootloader/gui/bootloader_ui.h"
+
+//-----------------------------------------------------------------------------
+namespace TinyBootloader
+{
+class ConfigWidget: public ::Programmer::ConfigWidget
+{
+Q_OBJECT
+public:
+ ConfigWidget(const ::Programmer::Group &group, QWidget *parent);
+ virtual void loadConfig();
+ virtual void saveConfig();
+
+private:
+ KIntNumInput *_timeout, *_retries;
+ KComboBox *_type, *_speed;
+};
+
+//----------------------------------------------------------------------------
+class GroupUI : public ::Bootloader::GroupUI
+{
+public:
+ virtual ::Programmer::ConfigWidget *createConfigWidget(QWidget *parent) const;
+};
+
+} // namespace
+
+#endif