From f508189682b6fba62e08feeb1596f682bad5fff9 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 18:42:24 +0000 Subject: Added KDE3 version of PikLab git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/progs/tbl_bootloader/gui/Makefile.am | 6 ++ src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp | 80 ++++++++++++++++++++++ src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h | 42 ++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 src/progs/tbl_bootloader/gui/Makefile.am create mode 100644 src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp create mode 100644 src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h (limited to 'src/progs/tbl_bootloader/gui') 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 * + * * + * 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; iinsertItem(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; icurrentItem())==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; isetCurrentItem(k); + _timeout->setValue(config.readTimeout()); + _retries->setValue(config.readRetries()); +} + +//----------------------------------------------------------------------------- +::Programmer::ConfigWidget *TinyBootloader::GroupUI::createConfigWidget(QWidget *parent) const +{ + return new ConfigWidget(static_cast(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 * + * * + * 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 +#include + +#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 -- cgit v1.2.1