示例#1
0
int myBoard_prepare( int board ) {
    MY_BOARD_HARDWARE *pBoardHard = myBoard_getHardwareBoard( board );
    MY_BOARD_SOFTWARE *pBoardSoft = myBoard_getSoftwareBoard( board );

    if (pBoardHard == NULL || pBoardSoft == NULL) return 1;

    if (getOptimalRangeNumber( board )) {
        return 1;
    }

    if (configBoard( board )) {
        return 1;
    }

    if (prepareCommand( board )) {
        return 1;
    }

    return 0;
}
示例#2
0
void NodeEditorWindows::createToolBarAndMenu()
{
    _mainToolBar = new QToolBar(this);
    addToolBar(_mainToolBar);

    // ============= Node =============
    QMenu *nodeMenu = menuBar()->addMenu(tr("&Node"));

    QAction *newDocAction = new QAction(tr("&New"),this);
    newDocAction->setStatusTip(tr("Creates a new node project"));
    newDocAction->setIcon(QIcon(":/icons/img/new.png"));
    newDocAction->setShortcut(QKeySequence::New);
    _mainToolBar->addAction(newDocAction);
    nodeMenu->addAction(newDocAction);
    connect(newDocAction, SIGNAL(triggered(bool)), _project, SLOT(newProject()));
    connect(newDocAction, SIGNAL(triggered(bool)), _compileLog, SLOT(clear()));

    QAction *openDocAction = new QAction(tr("&Open"),this);
    openDocAction->setStatusTip(tr("Opens a node project"));
    openDocAction->setIcon(QIcon(":/icons/img/open.png"));
    openDocAction->setShortcut(QKeySequence::Open);
    _mainToolBar->addAction(openDocAction);
    nodeMenu->addAction(openDocAction);
    connect(openDocAction, SIGNAL(triggered(bool)), _project, SLOT(openProject()));

    QAction *saveDocAction = new QAction(tr("&Save"),this);
    saveDocAction->setStatusTip(tr("Saves the current node project"));
    saveDocAction->setIcon(QIcon(":/icons/img/save.png"));
    saveDocAction->setShortcut(QKeySequence::Save);
    saveDocAction->setEnabled(false);
    _mainToolBar->addAction(saveDocAction);
    nodeMenu->addAction(saveDocAction);
    connect(saveDocAction, SIGNAL(triggered(bool)), _project, SLOT(saveProject()));
    connect(_project, SIGNAL(nodeModified(bool)), saveDocAction, SLOT(setEnabled(bool)));

    QAction *saveDocAsAction = new QAction(tr("Save &as..."),this);
    saveDocAsAction->setStatusTip(tr("Saves the current node project with a new name"));
    saveDocAsAction->setIcon(QIcon(":/icons/img/save.png"));
    saveDocAsAction->setShortcut(QKeySequence::SaveAs);
    nodeMenu->addAction(saveDocAsAction);
    connect(saveDocAsAction, SIGNAL(triggered(bool)), _project, SLOT(saveProjectAs()));

    nodeMenu->addSeparator();
    _mainToolBar->addSeparator();

    QAction *configNode = new QAction(tr("&Platform configuration"),this);
    configNode->setStatusTip(tr("Permits to choose the targeted platform and to choose associated periphericals"));
    configNode->setIcon(QIcon(":/icons/img/platform.png"));
    configNode->setShortcut(QKeySequence::Preferences);
    nodeMenu->addAction(configNode);
    _mainToolBar->addAction(configNode);
    connect(configNode, SIGNAL(triggered()), this, SLOT(configBoard()));

    nodeMenu->addSeparator();
    for (int i=0; i<MaxOldProject; i++)
    {
        QAction *recentAction = new QAction(this);
        nodeMenu->addAction(recentAction);
        recentAction->setVisible(false);
        connect(recentAction, SIGNAL(triggered()), this, SLOT(openRecentFile()));
        _oldProjectsActions.append(recentAction);
    }

    nodeMenu->addSeparator();
    QAction *exit = new QAction(tr("E&xit"),this);
    exit->setStatusTip(tr("Exits GPNode"));
    exit->setIcon(QIcon(":/icons/img/exit.png"));
    exit->setShortcut(QKeySequence::Quit);
    nodeMenu->addAction(exit);
    connect(exit, SIGNAL(triggered()), this, SLOT(close()));

    // ============= Edit =============
    QMenu *editMenu = menuBar()->addMenu(tr("&Edit"));
    _mainToolBar->addSeparator();

    QAction *undoAction = _project->undoStack()->createUndoAction(this, tr("&Undo"));
    undoAction->setStatusTip(tr("Undo the latest action"));
    undoAction->setIcon(QIcon(":/icons/img/edit-undo.png"));
    undoAction->setShortcut(QKeySequence::Undo);
    _mainToolBar->addAction(undoAction);
    editMenu->addAction(undoAction);

    QAction *redoAction = _project->undoStack()->createRedoAction(this, tr("&Redo"));
    redoAction->setStatusTip(tr("Redo the latest action"));
    redoAction->setIcon(QIcon(":/icons/img/edit-redo.png"));
    redoAction->setShortcut(QKeySequence::Redo);
    _mainToolBar->addAction(redoAction);
    editMenu->addAction(redoAction);

    // ============= View =============
    QMenu *viewMenu = menuBar()->addMenu(tr("&View"));

    viewMenu->addSeparator();
    QAction *viewLibAction = _libTreeViewDock->toggleViewAction();
    viewLibAction->setStatusTip(tr("Shows or hide the IP library explorer"));
    viewMenu->addAction(viewLibAction);

    QAction *viewCamexAction = _camExplorerDock->toggleViewAction();
    viewCamexAction->setStatusTip(tr("Shows or hide the camera explorer"));
    viewMenu->addAction(viewCamexAction);

    QAction *viewExplorerDock = _viewerExplorerDock->toggleViewAction();
    viewExplorerDock->setStatusTip(tr("Shows or hide the camera explorer"));
    viewMenu->addAction(viewExplorerDock);

    QAction *viewLogAction = _compileLogDock->toggleViewAction();
    viewLogAction->setStatusTip(tr("Shows or hide the compilation log"));
    viewMenu->addAction(viewLogAction);

    // ============= Project =============
    QMenu *projectMenu = menuBar()->addMenu(tr("&Project"));
    _mainToolBar->addSeparator();

    QAction *makecleanAction = new QAction(tr("&Clean project"), this);
    makecleanAction->setStatusTip(tr("Removes all intermediary files"));
    makecleanAction->setIcon(QIcon(":/icons/img/make-clean.png"));
    connect(makecleanAction, SIGNAL(triggered(bool)), _compileLog, SLOT(launchClean()));
    connect(_compileLog, SIGNAL(cleanAvailable(bool)), makecleanAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(makecleanAction);
    projectMenu->addAction(makecleanAction);

    QAction *makegenerateAction = new QAction(tr("&Generate project"), this);
    makegenerateAction->setStatusTip(tr("Generate a synthetisable project"));
    makegenerateAction->setIcon(QIcon(":/icons/img/make-generate.png"));
    connect(makegenerateAction, SIGNAL(triggered(bool)), _compileLog, SLOT(launchGenerate()));
    connect(_compileLog, SIGNAL(generateAvailable(bool)), makegenerateAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(makegenerateAction);
    projectMenu->addAction(makegenerateAction);

    QAction *makecompileAction = new QAction(tr("Comp&ile project"), this);
    makecompileAction->setStatusTip(tr("Synthetises the HDL project"));
    makecompileAction->setIcon(QIcon(":/icons/img/make-compile.png"));
    connect(makecompileAction, SIGNAL(triggered(bool)), _compileLog, SLOT(launchCompile()));
    connect(_compileLog, SIGNAL(compileAvailable(bool)), makecompileAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(makecompileAction);
    projectMenu->addAction(makecompileAction);

    QAction *makesendAction = new QAction(tr("&Program camera"), this);
    makesendAction->setStatusTip(tr("Programs your camera"));
    makesendAction->setIcon(QIcon(":/icons/img/make-send.png"));
    connect(makesendAction, SIGNAL(triggered(bool)), _compileLog, SLOT(launchSend()));
    connect(_compileLog, SIGNAL(sendAvailable(bool)), makesendAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(makesendAction);
    projectMenu->addAction(makesendAction);

    QAction *makerunAction = new QAction(tr("&Launch camera with viewer"), this);
    makerunAction->setStatusTip(tr("Launch your project on your camera with GPViewer"));
    makerunAction->setIcon(QIcon(":/icons/img/run.png"));
    connect(makerunAction, SIGNAL(triggered(bool)), _compileLog, SLOT(launchView()));
    connect(_compileLog, SIGNAL(runAvailable(bool)), makerunAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(makerunAction);
    projectMenu->addAction(makerunAction);

    QAction *makeallAction = new QAction(tr("Generate, &compile, send and run"), this);
    makeallAction->setShortcut(QKeySequence("Ctrl+R"));
    makeallAction->setStatusTip(tr("Generate, compile and lauch your projects"));
    makeallAction->setIcon(QIcon(":/icons/img/make-all.png"));
    connect(makeallAction, SIGNAL(triggered(bool)), _compileLog, SLOT(launchAll()));
    connect(_compileLog, SIGNAL(generateAvailable(bool)), makeallAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(makeallAction);
    projectMenu->addAction(makeallAction);

    QAction *stopAction = new QAction(tr("&Abort command"), this);
    stopAction->setStatusTip(tr("Aborts current launched command"));
    stopAction->setIcon(QIcon(":/icons/img/stop.png"));
    stopAction->setEnabled(false);
    connect(stopAction, SIGNAL(triggered(bool)), _compileLog, SLOT(stopAll()));
    connect(_compileLog, SIGNAL(stopAvailable(bool)), stopAction, SLOT(setEnabled(bool)));
    _mainToolBar->addAction(stopAction);
    projectMenu->addAction(stopAction);

    projectMenu->addSeparator();
    QAction *settingsAction = new QAction(tr("&Project Settings"), this);
    settingsAction->setStatusTip(tr("Paths settings"));
    settingsAction->setIcon(QIcon(":/icons/img/settings.png"));
    connect(settingsAction, SIGNAL(triggered(bool)), this, SLOT(showSettings()));
    _mainToolBar->addAction(settingsAction);
    projectMenu->addAction(settingsAction);

    // ========== Block view ==========
    _mainToolBar->addSeparator();
    QMenu *blockViewMenu = menuBar()->addMenu(tr("&Blocks"));

    QAction *zoomOut = new QAction(tr("Zoom &out"),this);
    zoomOut->setStatusTip(tr("Zoom out the the blocks view"));
    zoomOut->setIcon(QIcon(":/icons/img/zoom-out.png"));
    zoomOut->setShortcut(QKeySequence::ZoomOut);
    blockViewMenu->addAction(zoomOut);
    _mainToolBar->addAction(zoomOut);
    connect(zoomOut, SIGNAL(triggered()), _blocksView, SLOT(zoomOut()));

    QAction *zoomIn = new QAction(tr("Zoom &in"),this);
    zoomIn->setStatusTip(tr("Zoom in the the blocks view"));
    zoomIn->setIcon(QIcon(":/icons/img/zoom-in.png"));
    zoomIn->setShortcut(QKeySequence::ZoomIn);
    blockViewMenu->addAction(zoomIn);
    _mainToolBar->addAction(zoomIn);
    connect(zoomIn, SIGNAL(triggered()), _blocksView, SLOT(zoomIn()));

    QAction *zoomFit = new QAction(tr("Zoom &fit"),this);
    zoomFit->setStatusTip(tr("Zoom fit the the blocks view"));
    zoomFit->setIcon(QIcon(":/icons/img/zoom-fit.png"));
    zoomFit->setShortcut(QKeySequence("*"));
    blockViewMenu->addAction(zoomFit);
    _mainToolBar->addAction(zoomFit);
    connect(zoomFit, SIGNAL(triggered()), _blocksView, SLOT(zoomFit()));

    QAction *alignVerticalCenter = new QAction(tr("Align blocks &vertically"),this);
    alignVerticalCenter->setStatusTip(tr("Align blocks vertically"));
    alignVerticalCenter->setIcon(QIcon(":/icons/img/align-vertical-center.png"));
    alignVerticalCenter->setEnabled(false);
    blockViewMenu->addAction(alignVerticalCenter);
    _mainToolBar->addAction(alignVerticalCenter);
    connect(alignVerticalCenter, SIGNAL(triggered()), _blocksView, SLOT(alignVerticalCenter()));
    connect(_blocksView, SIGNAL(centerAvailable(bool)), alignVerticalCenter, SLOT(setEnabled(bool)));

    QAction *alignHorizontalCenter = new QAction(tr("Align blocks &horizontally"),this);
    alignHorizontalCenter->setStatusTip(tr("Align blocks horizontally"));
    alignHorizontalCenter->setIcon(QIcon(":/icons/img/align-horizontal-center.png"));
    alignHorizontalCenter->setEnabled(false);
    blockViewMenu->addAction(alignHorizontalCenter);
    _mainToolBar->addAction(alignHorizontalCenter);
    connect(alignHorizontalCenter, SIGNAL(triggered()), _blocksView, SLOT(alignHorizontalCenter()));
    connect(_blocksView, SIGNAL(centerAvailable(bool)), alignHorizontalCenter, SLOT(setEnabled(bool)));

    // ============= Help =============
    QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));

    QAction *aboutAction = new QAction(tr("&About"), this);
    aboutAction->setIcon(QIcon(":/img/img/gpstudio_viewer.ico"));
    aboutAction->setStatusTip(tr("Shows informations about node editor"));
    connect(aboutAction, SIGNAL(triggered(bool)), this, SLOT(about()));
    helpMenu->addAction(aboutAction);

    QAction *aboutQtAction = new QAction(tr("About &Qt"), this);
    aboutQtAction->setIcon(QIcon(":/icons/img/qt.png"));
    aboutQtAction->setStatusTip(tr("About Qt version"));
    connect(aboutQtAction, SIGNAL(triggered(bool)), this, SLOT(aboutQt()));
    helpMenu->addAction(aboutQtAction);
}