Esempio n. 1
0
DisassemblerView::DisassemblerView(DisassemblerDefinition *disassemblerdefinition, bool canloaddatabase, QHexEditData *hexeditdata, const QString &loadedfile, QLabel *labelinfo, QWidget *parent): AbstractView(hexeditdata, loadedfile, labelinfo, parent), ui(new Ui::DisassemblerView), _worker(nullptr), _listing(nullptr), _stringsymbols(nullptr), _disassembler(disassemblerdefinition), _canloaddatabase(canloaddatabase)
{
    ui->setupUi(this);
    ui->hSplitter->setStretchFactor(0, 1);

    ui->functionList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->functionList->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    ui->tvVariables->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->tvVariables->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    ui->tvStrings->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->tvStrings->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    this->_toolbar = new QToolBar();
    this->_toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    this->_toolbar->setEnabled(false);

    ui->verticalLayout->insertWidget(0, this->_toolbar);

    this->_actback = this->_toolbar->addAction(QIcon(":/action_icons/res/back.png"), "Back");
    this->_actforward = this->_toolbar->addAction(QIcon(":/action_icons/res/forward.png"), "Forward");
    this->_actgoto = this->_toolbar->addAction(QIcon(":/action_icons/res/goto.png"), "Goto");
    this->_toolbar->addSeparator();
    this->_actentrypoints = this->_toolbar->addAction(QIcon(":/action_icons/res/entry.png"), "Entry Points");
    this->_actsegments = this->_toolbar->addAction(QIcon(":/action_icons/res/segments.png"), "Segments");
    this->_actbookmarks = this->_toolbar->addAction(QIcon(":/action_icons/res/bookmark.png"), "Bookmarks");
    this->_actloaddatabase = this->_toolbar->addAction(QIcon(":/signature_database/res/database.png"), "Load Database");

    this->_actback->setEnabled(false);
    this->_actforward->setEnabled(false);
    this->_actbookmarks->setEnabled(false);

    this->_actback->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Left));
    this->_actforward->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Right));
    this->_actgoto->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_G));
    this->_actentrypoints->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_E));
    this->_actsegments->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
    this->_actbookmarks->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_B));

    this->createListingMenu();
    this->createFunctionsMenu();
    this->createVariablesMenu();
    this->createStringsMenu();

    connect(this->_actback, SIGNAL(triggered()), ui->disassemblerWidget, SLOT(back()));
    connect(this->_actforward, SIGNAL(triggered()), ui->disassemblerWidget, SLOT(forward()));
    connect(this->_actgoto, SIGNAL(triggered()), ui->gotoWidget, SLOT(show()));
    connect(this->_actentrypoints, SIGNAL(triggered()), this, SLOT(showEntryPoints()));
    connect(this->_actsegments, SIGNAL(triggered()), this, SLOT(showSegments()));
    connect(this->_actbookmarks, SIGNAL(triggered()), this, SLOT(showBookmarks()));
    connect(this->_actloaddatabase, SIGNAL(triggered()), this, SLOT(loadDatabase()));
    connect(ui->gotoWidget, SIGNAL(addressRequested(PrefSDK::DataValue)), this, SLOT(gotoAddress(PrefSDK::DataValue)));
    connect(ui->bookmarkWidget, SIGNAL(saveBookmarkRequested(Block*,QString)), this, SLOT(onSaveBookmarkRequested(Block*,QString)));
    connect(ui->renameWidget, SIGNAL(renameRequested(Block*,QString)), this, SLOT(onRenameSymbolRequested(Block*,QString)));
    connect(ui->disassemblerWidget, SIGNAL(backAvailable(bool)), this->_actback, SLOT(setEnabled(bool)));
    connect(ui->disassemblerWidget, SIGNAL(forwardAvailable(bool)), this->_actforward, SLOT(setEnabled(bool)));
    connect(ui->disassemblerWidget, SIGNAL(renameRequested(Block*)), this, SLOT(renameBlock(Block*)));
    connect(ui->disassemblerWidget, SIGNAL(crossReferenceRequested(Block*)), this, SLOT(showCrossReference(Block*)));
    connect(ui->disassemblerWidget, SIGNAL(jumpToRequested()), ui->gotoWidget, SLOT(show()));
}
Esempio n. 2
0
void QgsBookmarks::newBookmark()
{
  showBookmarks();
  sInstance->addClicked();
}