Nom des fichiers source d'un programme ELF
Bonjour,
j'ai ajouté dans le MainWindow.Cpp les deux fonctions suivantes ; qui permet d'afficher la liste des noms des fichier source dans un menu et quand on clicke sur ce menu qui est un fichier source on l'affiche dans la fenêtre de MainWindow ;
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| void MainWindow::menu() {
source_menu = this->menuBar()->addMenu(tr("Source")) ;
//menu file source
QSet<QString> sources = prog->filsource();
for( QSet<QString>::ConstIterator i = sources.begin(); i != sources.end(); ++i )
{
qDebug() << *i ;
source_menu->addAction(sourceAct);
sourceAct = new QAction( *i, this) ;
connect(sourceAct, SIGNAL(triggered()), this, SLOT(source_Act())) ;
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| void MainWindow::source_Act() {
QString texte;
QFile fichier(this);
if(fichier.open(QIODevice::ReadOnly | QIODevice::Text))
{
texte = fichier.readAll();
fichier.close();
}
zoneTexte.setText(texte);
zoneTexte.show();
} |
j'ai fait appel de la fonction menu dans loadExec :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| void MainWindow::loadExec(QString path) {
// load the board
ActionMonitor mon(*this, "load an executable");
prog = new Program(path, mon);
if(!mon.hasError())
prog->load(_board, mon);
if(!mon.handleError()) {
delete prog;
prog = 0;
return;
}
_board.setProgram(prog);
// compute the settings path
if(path.endsWith(".elf"))
settings_path = path.left(path.size() - 4) + ".bsim";
else
settings_path = path + ".bsim";
QSettings settings(settings_path, QSettings::NativeFormat);
for(QList<IView *>::const_iterator view = views.begin(); view != views.end(); ++ view)
(*view)->loadSettings(settings);
// if a board is loaded, show it
if(current)
showInSource(prog->start());
menu();
} |
MAINTENANT j'ai des erreurs d'exécution de debugage j'arrive pas a afficher le contenue des fichiers dan MA fenêtre :oops:
Merci d'avance de votre aide! :)