summaryrefslogtreecommitdiffstats
path: root/src/progs/gui/hardware_config_widget.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
commitf508189682b6fba62e08feeb1596f682bad5fff9 (patch)
tree28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/progs/gui/hardware_config_widget.h
downloadpiklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz
piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/progs/gui/hardware_config_widget.h')
-rw-r--r--src/progs/gui/hardware_config_widget.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/progs/gui/hardware_config_widget.h b/src/progs/gui/hardware_config_widget.h
new file mode 100644
index 0000000..d373990
--- /dev/null
+++ b/src/progs/gui/hardware_config_widget.h
@@ -0,0 +1,102 @@
+/***************************************************************************
+ * Copyright (C) 2005-2007 Nicolas Hadacek <hadacek@kde.org> *
+ * Copyright (C) 2003-2004 Alain Gibaud <alain.gibaud@free.fr> *
+ * *
+ * 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 HARDWARE_CONFIG_WIDGET
+#define HARDWARE_CONFIG_WIDGET
+
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <kdialogbase.h>
+#include <ktextbrowser.h>
+
+#include "progs/base/hardware_config.h"
+#include "progs/gui/prog_config_widget.h"
+#include "progs/base/generic_prog.h"
+#include "progs/base/prog_specific.h"
+
+namespace Hardware
+{
+
+//-----------------------------------------------------------------------------
+class HConfigWidget : public QFrame
+{
+Q_OBJECT
+public:
+ HConfigWidget(::Programmer::Base &base, QWidget *parent, bool edit);
+ virtual ~HConfigWidget() { delete _hardware; }
+ virtual bool set(const Port::Description &pd, const Data &data) = 0;
+ virtual Data *data() const = 0;
+ Port::Description portDescription() const { return _hardware->portDescription(); }
+
+protected:
+ ::Programmer::Hardware *_hardware;
+ QVBoxLayout *_mainVBox, *_editVBox;
+ bool _edit, _connected;
+ ::Programmer::Base &_base;
+};
+
+//-----------------------------------------------------------------------------
+class ConfigWidget;
+
+class EditDialog : public KDialogBase
+{
+Q_OBJECT
+public:
+ EditDialog(ConfigWidget *parent, const QString &name, const Port::Description &pd, Data *data);
+ QString savedName() const { return _savedName; }
+
+private slots:
+ virtual void slotOk();
+ virtual void slotCancel();
+
+private:
+ ConfigWidget *_cwidget;
+ QString _savedName;
+ Data *_oldData;
+ HConfigWidget *_hc;
+ QLineEdit *_name;
+};
+
+//-----------------------------------------------------------------------------
+class ConfigWidget : public ::Programmer::ConfigWidget
+{
+Q_OBJECT
+public:
+ ConfigWidget(::Programmer::Base *base, Config *config, QWidget *parent);
+ virtual ~ConfigWidget() { delete _base; }
+ virtual void saveConfig();
+ virtual bool setPort(const ::Programmer::HardwareDescription &hd);
+ virtual HConfigWidget *createHardwareConfigWidget(QWidget *parent, bool edit) const = 0;
+
+private slots:
+ void editClicked();
+ void deleteClicked();
+ void configChanged(int i);
+
+protected:
+ ::Programmer::Base *_base;
+
+private:
+ Config *_config;
+ QStringList _names;
+ HConfigWidget *_hc;
+ QPushButton *_editButton, *_deleteButton;
+ QComboBox *_configCombo;
+ KTextBrowser *_comment;
+ QHBoxLayout *_hbox;
+
+ void updateList(PortType type);
+ bool set(const Port::Description &pd, uint i);
+
+ friend class EditDialog;
+};
+
+} // namespace
+
+#endif