summaryrefslogtreecommitdiffstats
path: root/src/devices/list
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/list')
-rw-r--r--src/devices/list/Makefile.am11
-rw-r--r--src/devices/list/device_list.cpp40
-rw-r--r--src/devices/list/device_list.h34
-rw-r--r--src/devices/list/device_list_noui.cpp18
-rw-r--r--src/devices/list/device_list_ui.cpp20
-rw-r--r--src/devices/list/list.pro6
6 files changed, 129 insertions, 0 deletions
diff --git a/src/devices/list/Makefile.am b/src/devices/list/Makefile.am
new file mode 100644
index 0000000..ce1c03a
--- /dev/null
+++ b/src/devices/list/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+
+
+noinst_LTLIBRARIES = libdevicelistnoui.la libdevicelistui.la
+
+libdevicelistnoui_la_LDFLAGS = $(all_libraries)
+libdevicelistnoui_la_SOURCES = device_list.cpp device_list_noui.cpp
+
+libdevicelistui_la_LDFLAGS = $(all_libraries)
+libdevicelistui_la_SOURCES = device_list.cpp device_list_ui.cpp
diff --git a/src/devices/list/device_list.cpp b/src/devices/list/device_list.cpp
new file mode 100644
index 0000000..1434ec8
--- /dev/null
+++ b/src/devices/list/device_list.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * 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 "device_list.h"
+
+#include <qregexp.h>
+
+#include "devices/pic/pic/pic_group.h"
+#include "devices/mem24/mem24/mem24_group.h"
+
+const Device::AutoData Device::AUTO_DATA = { "*", I18N_NOOP("<auto>") };
+
+const Device::Data *Device::Lister::data(const QString &device) const
+{
+ for (ConstIterator it=begin(); it!=end(); it++) {
+ const Data *data = static_cast<const Data *>(it.data()->deviceData(device).data);
+ if (data) return data;
+ }
+ return 0;
+}
+
+QString Device::Lister::checkName(const QString &device) const
+{
+ if ( device==AUTO_DATA.name ) return device;
+ if ( isSupported(device) ) return device;
+ if ( device.startsWith("p") ) // compat mode for PiKdev
+ return checkName(device.mid(1));
+ return "16F871"; // default...
+}
+
+namespace Device
+{
+ Lister _lister;
+ const Lister &lister() { return _lister; }
+}
diff --git a/src/devices/list/device_list.h b/src/devices/list/device_list.h
new file mode 100644
index 0000000..3d9fb78
--- /dev/null
+++ b/src/devices/list/device_list.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * 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. *
+ ***************************************************************************/
+#ifndef DEVICE_LIST_H
+#define DEVICE_LIST_H
+
+#include "devices/base/generic_device.h"
+#include "common/common/lister.h"
+
+namespace Device
+{
+
+struct AutoData {
+ const char *name, *label;
+};
+extern const AutoData AUTO_DATA;
+
+class Lister : public ::Group::Lister<GroupBase>
+{
+public:
+ Lister();
+ const Data *data(const QString &device) const;
+ QString checkName(const QString &device) const;
+};
+extern const Lister &lister();
+
+} // namespace
+
+#endif
diff --git a/src/devices/list/device_list_noui.cpp b/src/devices/list/device_list_noui.cpp
new file mode 100644
index 0000000..46d909e
--- /dev/null
+++ b/src/devices/list/device_list_noui.cpp
@@ -0,0 +1,18 @@
+/***************************************************************************
+ * 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 "device_list.h"
+
+#include "devices/pic/pic/pic_group.h"
+#include "devices/mem24/mem24/mem24_group.h"
+
+Device::Lister::Lister()
+{
+ addGroup(new Pic::Group, 0);
+ addGroup(new Mem24::Group, 0);
+}
diff --git a/src/devices/list/device_list_ui.cpp b/src/devices/list/device_list_ui.cpp
new file mode 100644
index 0000000..ebcd7ea
--- /dev/null
+++ b/src/devices/list/device_list_ui.cpp
@@ -0,0 +1,20 @@
+/***************************************************************************
+ * 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 "device_list.h"
+
+#include "devices/pic/pic/pic_group.h"
+#include "devices/pic/gui/pic_group_ui.h"
+#include "devices/mem24/mem24/mem24_group.h"
+#include "devices/mem24/gui/mem24_group_ui.h"
+
+Device::Lister::Lister()
+{
+ addGroup(new Pic::Group, new Pic::GroupUI);
+ addGroup(new Mem24::Group, new Mem24::GroupUI);
+}
diff --git a/src/devices/list/list.pro b/src/devices/list/list.pro
new file mode 100644
index 0000000..02f07b0
--- /dev/null
+++ b/src/devices/list/list.pro
@@ -0,0 +1,6 @@
+STOPDIR = ../../..
+include($${STOPDIR}/lib.pro)
+
+TARGET = devicelist
+HEADERS += device_list.h
+SOURCES += device_list.cpp device_list_noui.cpp