Esempio n. 1
0
void ListingTracePane::setDebuggingState(bool b)
{
    QTableWidget *tableWidget;
    if (Sim::trapped) {
        tableWidget = ui->listingPepOsTraceTableWidget;
        ui->listingPepOsTraceTableWidget->show();
        ui->listingTraceTableWidget->hide();
    }
    else {
        tableWidget = ui->listingTraceTableWidget;
        ui->listingPepOsTraceTableWidget->hide();
        ui->listingTraceTableWidget->show();
    }

    for (int i = 0; i < tableWidget->rowCount(); i++) {
        tableWidget->item(i, 1)->setBackgroundColor(Qt::white);
        tableWidget->item(i, 1)->setTextColor(Qt::black);
    }
    highlightedItemList.clear();
    
    if (b && Pep::memAddrssToAssemblerListing->contains(Sim::programCounter)) {
        QTableWidgetItem *highlightedItem = tableWidget->item(Pep::memAddrssToAssemblerListing->value(Sim::programCounter), 1);
        highlightedItem->setBackgroundColor(QColor(56, 117, 215));
        highlightedItem->setTextColor(Qt::white);
        highlightedItemList.append(highlightedItem);

        tableWidget->scrollToItem(highlightedItem);
    }
    tableWidget->horizontalScrollBar()->setValue(tableWidget->horizontalScrollBar()->minimum());
//    resizeDocWidth();
}
Esempio n. 2
0
void ListingTracePane::updateListingTrace()
{
    // tableWidget depends on whether we are in the OS or a program
    QTableWidget *tableWidget;
    if (Sim::trapped) {
        tableWidget = ui->listingPepOsTraceTableWidget;
        ui->listingPepOsTraceTableWidget->show();
        ui->listingTraceTableWidget->hide();
    }
    else {
        tableWidget = ui->listingTraceTableWidget;
        ui->listingPepOsTraceTableWidget->hide();
        ui->listingTraceTableWidget->show();
    }

    for (int i = highlightedItemList.size() - 1; i >= 0; i--) {
        highlightedItemList.at(i)->setBackgroundColor(Qt::white);
        highlightedItemList.at(i)->setTextColor(Qt::black);
        highlightedItemList.removeLast();
    }
    if (Pep::memAddrssToAssemblerListing->contains(Sim::programCounter)) {
        QTableWidgetItem *highlightedItem = tableWidget->item(Pep::memAddrssToAssemblerListing->value(Sim::programCounter), 1);
        highlightedItem->setBackgroundColor(QColor(56, 117, 215));
        highlightedItem->setTextColor(Qt::white);
        highlightedItemList.append(highlightedItem);

        tableWidget->scrollToItem(highlightedItem);
    }
    tableWidget->horizontalScrollBar()->setValue(tableWidget->horizontalScrollBar()->minimum());
}
Esempio n. 3
0
void ListingTracePane::setListingTrace(QStringList listingTraceList, QList<bool> hasCheckBox)
{
    // tableWidget depends on whether we are assembling the OS or a program
    QTableWidget *tableWidget;
    if (Pep::memAddrssToAssemblerListing == &Pep::memAddrssToAssemblerListingProg) {
        tableWidget = ui->listingTraceTableWidget;
    }
    else {
        tableWidget = ui->listingPepOsTraceTableWidget;
    }
    QTableWidgetItem *item;
    int numRows = listingTraceList.size();
    tableWidget->setRowCount(numRows);
    for (int i = 0; i < numRows; i++) {
        item = new QTableWidgetItem(listingTraceList[i]);
        tableWidget->setItem(i, 1, item);
    }
    for (int i = 0; i < numRows; i++) {
        item = new QTableWidgetItem();
        if (hasCheckBox[i]) {
            item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
            item->setCheckState(Qt::Unchecked);
        }
        else {
            item->setFlags(Qt::NoItemFlags);
        }
        tableWidget->setItem(i, 0, item);
    }
    tableWidget->resizeColumnsToContents();
    ui->listingTraceTableWidget->width();
    tableWidget->resizeRowsToContents();
//    if (Pep::memAddrssToAssemblerListing == &Pep::memAddrssToAssemblerListingProg) {
//        programDocWidth = tableWidget->columnWidth(1);
//    }
//    else {
//        osDocWidth = tableWidget->columnWidth(1);
//    }
//    resizeDocWidth();
    tableWidget->horizontalScrollBar()->setValue(tableWidget->horizontalScrollBar()->minimum());
}