summaryrefslogtreecommitdiffstats
path: root/src/devices/pic/gui/pic_config_editor.cpp
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/devices/pic/gui/pic_config_editor.cpp
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/devices/pic/gui/pic_config_editor.cpp')
-rw-r--r--src/devices/pic/gui/pic_config_editor.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/devices/pic/gui/pic_config_editor.cpp b/src/devices/pic/gui/pic_config_editor.cpp
new file mode 100644
index 0000000..1812bbf
--- /dev/null
+++ b/src/devices/pic/gui/pic_config_editor.cpp
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * 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. *
+ ***************************************************************************/
+#include "pic_config_editor.h"
+
+#include <qlayout.h>
+#include <qvgroupbox.h>
+#include <qapplication.h>
+
+#include "pic_config_word_editor.h"
+#include "common/common/misc.h"
+#include "common/gui/misc_gui.h"
+
+//----------------------------------------------------------------------------
+Pic::MemoryConfigEditorWidget::MemoryConfigEditorWidget(Memory &memory, bool withWordEditor, QWidget *parent)
+ : Device::MemoryEditorGroup(&memory, parent, "pic_config_editor_widget"),
+ MemoryCaster(MemoryRangeType::Config, memory)
+{
+ QHBoxLayout *hb = new QHBoxLayout(_top);
+
+ TabWidget *tabw = 0;
+ uint nbWords = device().nbWords(MemoryRangeType::Config);
+ if ( nbWords>1 ) {
+ tabw = new TabWidget(this);
+ tabw->setIgnoreWheelEvent(true);
+ hb->addWidget(tabw);
+ }
+
+ for(uint i=0; i<nbWords; ++i) {
+ //qDebug("BinWordsEditor for config word #%i", i);
+ //uint address = device().range(Device::MemoryConfig).start + device().addressIncrement(Device::MemoryConfig) * i;
+ //qDebug("address: %s %s nb: %i", toHex(address, 8).data(), device().configWord(i).name.latin1(), device().configWord(i).masks.count());
+ if ( device().config()._words[i].masks.count()==0 ) continue;
+ QWidget *page = 0;
+ if ( nbWords>1 ) {
+ page = new QWidget(tabw);
+ tabw->addTab(page, device().config()._words[i].name);
+ } else {
+ page = new QGroupBox(this);
+ hb->addWidget(page);
+ }
+ QVBoxLayout *vbox = new QVBoxLayout(page, 10, 10);
+ QHBoxLayout *hbox = new QHBoxLayout(vbox);
+ ConfigWordEditor *we = new ConfigWordEditor(memory, i, withWordEditor, page);
+ addEditor(we);
+ hbox->addWidget(we);
+ hbox->addStretch(1);
+ vbox->addStretch(1);
+ }
+}
+
+//----------------------------------------------------------------------------
+Pic::MemoryConfigEditor::MemoryConfigEditor(const HexView *hexview, Memory &memory, QWidget *parent)
+ : MemoryTypeEditor(hexview, MemoryRangeType::Config, memory, parent, "pic_config_editor")
+{}
+
+void Pic::MemoryConfigEditor::init(bool first)
+{
+ MemoryTypeEditor::init(first);
+ MemoryConfigEditorWidget *w = new MemoryConfigEditorWidget(memory(), true, this);
+ addEditor(w);
+ _top->addWidget(w);
+}