Exemplo n.º 1
0
void MainWindow::createActions()
{
    ui->actionNew->setShortcut(QKeySequence(QKeySequence::New));
    ui->actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
    ui->actionSave->setShortcut(QKeySequence(QKeySequence::Save));
    ui->actionSave_as->setShortcut(QKeySequence("Shift+Ctrl+S"));
    ui->actionShortcuts->setShortcut(QKeySequence("Ctrl+H"));
    ui->actionRender->setShortcut(QKeySequence("Ctrl+R"));
    ui->actionRenderPreview->setShortcut(QKeySequence("Shift+Ctrl+R"));
    ui->actionExamineFlow->setShortcut(QKeySequence("Shift+Ctrl+X"));
    ui->actionPreferences->setShortcut(QKeySequence("Ctrl+,"));
    ui->actionAbout->setShortcut(QKeySequence("F1"));
    ui->actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));
    ui->actionZoomIn->setShortcut(QKeySequence(QKeySequence::ZoomIn));
    ui->actionZoomOut->setShortcut(QKeySequence(QKeySequence::ZoomOut));
    
    m_cs.addShortcut("h", Help, tr("Show help overlay"));
    m_cs.addShortcut("q-q", Quit, tr("Quit"));
    m_cs.addShortcut("n", New, tr("New project"));
    m_cs.addShortcut("o", Open, tr("Open project"));
    m_cs.addShortcut("s-s", Save_Same, tr("Save"));
    m_cs.addShortcut("s-a", Save_As, tr("Save as ..."));
    m_cs.addShortcut("a", Abort, tr("Abort move"));
    m_cs.addShortcut("a-s", Abort_Selection, tr("Unselect all"));
    m_cs.addShortcut("d-n", Delete_Node, tr("Delete selected nodes"));
    m_cs.addShortcut("t-s", Tool_Select, tr("Selecting tool"));
    m_cs.addShortcut("t-m", Tool_Move, tr("Move tool"));
    m_cs.addShortcut("t-t", Tag, tr("Insert label (tag)"));
    
    connect(&m_cs, SIGNAL(signalShortcutUsed(int)), this, SLOT(slotShortcutUsed(int)));
    
    connect(this, SIGNAL(deleteNodes()), m_wCanvas, SLOT(slotDeleteNodes()));
    connect(this, SIGNAL(setMode(Canvas::ToolMode)), m_wCanvas, SLOT(slotSetToolMode(Canvas::ToolMode)));
    connect(this, SIGNAL(abort(Canvas::Abort)), m_wCanvas, SLOT(slotAbort(Canvas::Abort)));
    connect(this, SIGNAL(addTag()), m_wCanvas, SLOT(slotAddTag()));
    
    connect(ui->actionZoomIn, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomIn()));
    connect(ui->actionZoomOut, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomOut()));
    
    connect(m_wCanvas, SIGNAL(signalMouseInputTimeChanged(qreal)),
            this, SLOT(slotForwardInputPosition(qreal)));
    connect(m_wCanvas, SIGNAL(signalMouseCurveSrcTimeChanged(qreal)),
            this, SLOT(slotForwardCurveSrcPosition(qreal)));
    
    
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(slotNewProject()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(slotLoadProjectDialog()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSaveProject()));
    connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(slotSaveProjectDialog()));
    connect(ui->actionRender, SIGNAL(triggered()), this, SLOT(slotShowRenderDialog()));
    connect(ui->actionRenderPreview, SIGNAL(triggered()), this, SLOT(slotUpdateRenderPreview()));
    connect(ui->actionExamineFlow, SIGNAL(triggered()), this, SLOT(slotShowFlowExaminerDialog()));
    connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(slotShowPreferencesDialog()));
    connect(ui->actionShortcuts, SIGNAL(triggered()), this, SLOT(slotToggleHelp()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotShowAboutDialog()));
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionProjectPreferences, SIGNAL(triggered()), this, SLOT(slotShowProjectPreferencesDialog()));
    connect(ui->actionEdit_Flow, SIGNAL(triggered()), this, SLOT(slotShowFlowEditWindow()));
    connect(ui->actionDebug_Window, SIGNAL(toggled(bool)), this, SLOT(slotShowDebugWindow(bool)));
}
Exemplo n.º 2
0
    m_cs.addShortcut("t-t", Tag, tr("Insert label (tag)"));

    bool b = true;
    b &= connect(&m_cs, SIGNAL(signalShortcutUsed(int)), this, SLOT(slotShortcutUsed(int)));

    b &= connect(this, SIGNAL(deleteNodes()), m_wCanvas, SLOT(slotDeleteNodes()));
    b &= connect(this, SIGNAL(setMode(Canvas::ToolMode)), m_wCanvas, SLOT(slotSetToolMode(Canvas::ToolMode)));
    b &= connect(this, SIGNAL(abort(Canvas::Abort)), m_wCanvas, SLOT(slotAbort(Canvas::Abort)));
    b &= connect(this, SIGNAL(addTag()), m_wCanvas, SLOT(slotAddTag()));

    b &= connect(ui->actionZoomIn, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomIn()));
    b &= connect(ui->actionZoomOut, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomOut()));

    b &= connect(m_wCanvas, SIGNAL(signalMouseInputTimeChanged(qreal)),
                 this, SLOT(slotForwardInputPosition(qreal)));
    b &= connect(m_wCanvas, SIGNAL(signalMouseCurveSrcTimeChanged(qreal)),
                 this, SLOT(slotForwardCurveSrcPosition(qreal)));

    b &= connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(slotNewProject()));
    b &= connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(slotLoadProjectDialog()));
    b &= connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSaveProject()));
    b &= connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(slotSaveProjectDialog()));
    b &= connect(ui->actionRender, SIGNAL(triggered()), this, SLOT(slotShowRenderDialog()));
    b &= connect(ui->actionRenderPreview, SIGNAL(triggered()), this, SLOT(slotUpdateRenderPreview()));
    b &= connect(ui->actionExamineFlow, SIGNAL(triggered()), this, SLOT(slotShowFlowExaminerDialog()));
    b &= connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(slotShowPreferencesDialog()));
    b &= connect(ui->actionShortcuts, SIGNAL(triggered()), this, SLOT(slotToggleHelp()));
    b &= connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotShowAboutDialog()));
    b &= connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    b &= connect(ui->actionProjectPreferences, SIGNAL(triggered()), this, SLOT(slotShowProjectPreferencesDialog()));