diff --git a/src/applesoftfile/applesofttoken.h b/src/applesoftfile/applesofttoken.h index 9c7f8f3..534d4f5 100644 --- a/src/applesoftfile/applesofttoken.h +++ b/src/applesoftfile/applesofttoken.h @@ -16,8 +16,6 @@ public: static const quint16 IntegerTokenVal = 0x103; static const quint16 FloatTokenVal = 0x104; - - static const quint16 IntVarTokenVal = 0x105; static const quint16 IntAryVarTokenVal = 0x106; diff --git a/src/ui/viewers/applesoftfiledetailviewer.cpp b/src/ui/viewers/applesoftfiledetailviewer.cpp index d21a2ac..3c2a7e7 100644 --- a/src/ui/viewers/applesoftfiledetailviewer.cpp +++ b/src/ui/viewers/applesoftfiledetailviewer.cpp @@ -11,6 +11,7 @@ ApplesoftFileDetailViewer::ApplesoftFileDetailViewer(QWidget *parent) : ui(new Ui::ApplesoftFileDetailViewer) { ui->setupUi(this); + ui->m_varView->setSortingEnabled(true); } ApplesoftFileDetailViewer::~ApplesoftFileDetailViewer() @@ -20,7 +21,8 @@ ApplesoftFileDetailViewer::~ApplesoftFileDetailViewer() void ApplesoftFileDetailViewer::process() { - QMap vardata; + QMap vardata; + QMap vartypes; foreach (ApplesoftLine line, m_lines) { @@ -29,18 +31,22 @@ void ApplesoftFileDetailViewer::process() { quint16 tid = token.getTokenId(); if (tid == ApplesoftToken::IntVarTokenVal || - tid == ApplesoftToken::IntAryVarTokenVal || - tid == ApplesoftToken::FloatVarTokenVal || - tid == ApplesoftToken::FloatAryVarTokenVal || - tid == ApplesoftToken::StringVarTokenVal || - tid == ApplesoftToken::StringAryVarTokenVal) + tid == ApplesoftToken::IntAryVarTokenVal || + tid == ApplesoftToken::FloatVarTokenVal || + tid == ApplesoftToken::FloatAryVarTokenVal || + tid == ApplesoftToken::StringVarTokenVal || + tid == ApplesoftToken::StringAryVarTokenVal) { QString varname = token.getStringValue(); if (varname.contains("(")) { varname.append(")"); } vardata[varname].append(QString("%1").arg(linenum)); + vartypes[varname] = tid; } } } + + QMap typemap; + QStringList keys = vardata.keys(); ui->m_varView->setRowCount(keys.count()); qSort(keys); @@ -48,6 +54,19 @@ void ApplesoftFileDetailViewer::process() foreach (QString key, keys) { QString linenums = vardata[key].join(","); + quint16 vtype = vartypes[key]; + QString vtname; + switch (vtype) { + case ApplesoftToken::IntVarTokenVal: vtname = "Int"; break; + case ApplesoftToken::FloatVarTokenVal: vtname = "Float"; break; + case ApplesoftToken::StringVarTokenVal: vtname = "String"; break; + case ApplesoftToken::IntAryVarTokenVal: vtname = "Int Array"; break; + case ApplesoftToken::FloatAryVarTokenVal: vtname = "Float Array"; break; + case ApplesoftToken::StringAryVarTokenVal: vtname = "Float String"; break; + default: vtname = "Unknown"; + } + + ui->m_varView->setItem(idx,0,new QTableWidgetItem(vtname)); ui->m_varView->setItem(idx,1,new QTableWidgetItem(key)); ui->m_varView->setItem(idx,2,new QTableWidgetItem(linenums)); idx++;