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))); }
UIMain::UIMain(): QMainWindow(), m_sizeDrawArea(800, 140), m_deviceInfo(QAudioDeviceInfo::defaultInputDevice()), m_audioInput(0), m_FFTDevice(0) { ui.setupUi(this); setWindowIcon(QIcon(":/img/qTuner.png")); ui.widgetNumTuner->setVisible(false); setupTunings(); slotSetupDrawArea(); connect(ui.actionShowGrTuner , SIGNAL(toggled(bool)), ui.drawArea , SLOT (setVisible(bool))); connect(ui.actionShowGrTuner , SIGNAL(toggled(bool)), ui.widgetPresets , SLOT (setVisible(bool))); connect(ui.actionShowNumTuner, SIGNAL(toggled(bool)), ui.widgetNumTuner , SLOT (setVisible(bool))); connect(ui.actionAbout, SIGNAL(triggered()), this , SLOT (slotShowAboutDialog())); connect(ui.cbPresets, SIGNAL(currentIndexChanged(int)), this , SLOT (slotSetupDrawArea())); m_audioFormat.setSampleRate(32000); m_audioFormat.setChannelCount(1); m_audioFormat.setSampleSize(16); m_audioFormat.setSampleType(QAudioFormat::SignedInt); m_audioFormat.setByteOrder(QAudioFormat::LittleEndian); m_audioFormat.setCodec("audio/pcm"); m_FFTDevice = new FFTDevice(m_audioFormat, this); m_audioInput = new QAudioInput(m_deviceInfo, m_audioFormat, this); connect(ui.sliderThreshold, SIGNAL(valueChanged(int)), m_FFTDevice , SLOT (slotSetSignalThreshold(int))); connect(m_FFTDevice , SIGNAL(signalNoteUpdated(NoteInfo)), this , SLOT (slotUpdateNoteInfo(NoteInfo))); connect(m_FFTDevice , SIGNAL(signalStatusMessage(QString,int)), statusBar() , SLOT (showMessage(QString,int))); // read settings after connections: toggles are recognized readSettings(); m_FFTDevice ->start(); m_audioInput->start(m_FFTDevice); }
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())); Q_ASSERT(b); updateWindowTitle(); setWindowIcon(QIcon(":icons/slowmoIcon.png")); QSettings settings; bool show = settings.value("ui/displayHelp", true).toBool(); m_wCanvas->showHelp(show); settings.sync(); if (!projectPath.isEmpty()) {