A couple bug fixes for the Qt RAM watch window.
This commit is contained in:
parent
e03c558db6
commit
66c34c2d49
|
@ -106,9 +106,9 @@ RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
|
||||||
fileMenu->addAction(menuAct);
|
fileMenu->addAction(menuAct);
|
||||||
|
|
||||||
// File -> Append
|
// File -> Append
|
||||||
menuAct = new QAction(tr("Append"), this);
|
menuAct = new QAction(tr("Append from File"), this);
|
||||||
//menuAct->setShortcut( QKeySequence(tr("Ctrl+A")) );
|
//menuAct->setShortcut( QKeySequence(tr("Ctrl+A")) );
|
||||||
menuAct->setStatusTip(tr("Append to Watch File"));
|
menuAct->setStatusTip(tr("Append from File"));
|
||||||
connect(menuAct, SIGNAL(triggered()), this, SLOT(appendListCB(void)) );
|
connect(menuAct, SIGNAL(triggered()), this, SLOT(appendListCB(void)) );
|
||||||
|
|
||||||
fileMenu->addAction(menuAct);
|
fileMenu->addAction(menuAct);
|
||||||
|
@ -209,7 +209,7 @@ RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
|
||||||
|
|
||||||
tree->setHeaderItem( item );
|
tree->setHeaderItem( item );
|
||||||
|
|
||||||
tree->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
|
//tree->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
|
||||||
|
|
||||||
vbox1 = new QVBoxLayout();
|
vbox1 = new QVBoxLayout();
|
||||||
vbox = new QVBoxLayout();
|
vbox = new QVBoxLayout();
|
||||||
|
@ -343,9 +343,16 @@ void RamWatchDialog_t::updateRamWatchDisplay(void)
|
||||||
strcpy (addrStr, "--------");
|
strcpy (addrStr, "--------");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( rw->size > 1 )
|
||||||
|
{
|
||||||
|
sprintf (addrStr, "$%04X-$%04X", rw->addr, rw->addr + rw->size - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sprintf (addrStr, "$%04X", rw->addr);
|
sprintf (addrStr, "$%04X", rw->addr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rw->updateMem ();
|
rw->updateMem ();
|
||||||
|
|
||||||
|
@ -403,8 +410,8 @@ void RamWatchDialog_t::updateRamWatchDisplay(void)
|
||||||
item->setText( 3, tr(rw->name.c_str()) );
|
item->setText( 3, tr(rw->name.c_str()) );
|
||||||
|
|
||||||
item->setTextAlignment( 0, Qt::AlignLeft);
|
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||||
item->setTextAlignment( 1, Qt::AlignLeft);
|
item->setTextAlignment( 1, Qt::AlignCenter);
|
||||||
item->setTextAlignment( 2, Qt::AlignLeft);
|
item->setTextAlignment( 2, Qt::AlignCenter);
|
||||||
item->setTextAlignment( 3, Qt::AlignLeft);
|
item->setTextAlignment( 3, Qt::AlignLeft);
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -492,19 +499,15 @@ void RamWatchDialog_t::appendListCB(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
const char *romFile = NULL;
|
const char *romFile = NULL;
|
||||||
QFileDialog dialog(this, tr("Append Watch List To File") );
|
QFileDialog dialog(this, tr("Append from Watch File") );
|
||||||
|
|
||||||
if ( ramWatchList.size() == 0 )
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
|
||||||
|
|
||||||
dialog.setNameFilter(tr("Watch Files (*.wch *.WCH) ;; All files (*)"));
|
dialog.setNameFilter(tr("Watch Files (*.wch *.WCH) ;; All files (*)"));
|
||||||
|
|
||||||
dialog.setViewMode(QFileDialog::List);
|
dialog.setViewMode(QFileDialog::List);
|
||||||
dialog.setFilter( QDir::AllEntries | QDir::Hidden );
|
dialog.setFilter( QDir::AllEntries | QDir::Hidden );
|
||||||
dialog.setLabelText( QFileDialog::Accept, tr("Save") );
|
dialog.setLabelText( QFileDialog::Accept, tr("Load") );
|
||||||
dialog.setDefaultSuffix( tr(".wch") );
|
dialog.setDefaultSuffix( tr(".wch") );
|
||||||
|
|
||||||
romFile = getRomFile();
|
romFile = getRomFile();
|
||||||
|
@ -547,7 +550,7 @@ void RamWatchDialog_t::appendListCB(void)
|
||||||
}
|
}
|
||||||
//qDebug() << "selected file path : " << filename.toUtf8();
|
//qDebug() << "selected file path : " << filename.toUtf8();
|
||||||
|
|
||||||
saveWatchFile( filename.toStdString().c_str(), 1 );
|
loadWatchFile( filename.toStdString().c_str(), 1 );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void RamWatchDialog_t::saveListCB(void)
|
void RamWatchDialog_t::saveListCB(void)
|
||||||
|
@ -1053,7 +1056,7 @@ void RamWatchDialog_t::saveWatchFile (const char *filename, int append )
|
||||||
|
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void RamWatchDialog_t::loadWatchFile (const char *filename)
|
void RamWatchDialog_t::loadWatchFile (const char *filename, int append )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i, j, a, t, s, isSep, literal;
|
int i, j, a, t, s, isSep, literal;
|
||||||
|
@ -1069,6 +1072,13 @@ void RamWatchDialog_t::loadWatchFile (const char *filename)
|
||||||
}
|
}
|
||||||
saveFileName.assign( filename );
|
saveFileName.assign( filename );
|
||||||
|
|
||||||
|
if ( !append )
|
||||||
|
{
|
||||||
|
ramWatchList.clear();
|
||||||
|
tree->clear();
|
||||||
|
tree->viewport()->update();
|
||||||
|
}
|
||||||
|
|
||||||
while (fgets (line, sizeof (line) - 1, fp) != NULL)
|
while (fgets (line, sizeof (line) - 1, fp) != NULL)
|
||||||
{
|
{
|
||||||
a = -1;
|
a = -1;
|
||||||
|
|
|
@ -207,7 +207,7 @@ class RamWatchDialog_t : public QDialog
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void loadWatchFile (const char *filename);
|
void loadWatchFile (const char *filename, int append = 0);
|
||||||
void saveWatchFile (const char *filename, int append = 0);
|
void saveWatchFile (const char *filename, int append = 0);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
Loading…
Reference in New Issue