Logo Search packages:      
Sourcecode: canorus version File versions  Download package

void CAMainWin::setupCustomUi (  )  [private]

Creates more complex widgets and layouts that cannot be created using Qt Designer (like adding custom toolbars to main window, button boxes etc.).

Todo:
When Qt Designer have support for setting the visibility property, do this in Qt Designer already! -Matevz

Definition at line 573 of file mainwin.cpp.

References on_uiKeySig_activated(), CAMenuToolButton::setCurrentId(), and CAToolButton::setDefaultAction().

Referenced by CAMainWin().

                              {
      _musElementFactory = new CAMusElementFactory();

      _poPrintPreviewCtl = new CAPreviewCtl( this );
      _poPrintCtl = new CAPrintCtl( this );
      //uiPrint->setEnabled( false );
      // Standard Toolbar
      uiUndo->setDefaultAction( uiStandardToolBar->insertWidget( uiCut, uiUndo ) );
      uiUndo->defaultAction()->setText(tr("Undo"));
    uiUndo->defaultAction()->setShortcut(QApplication::translate("uiMainWindow", "Ctrl+Z", 0, QApplication::UnicodeUTF8));
      uiMenuEdit->insertAction( uiCut, uiUndo->defaultAction() );
      QList<QKeySequence> redoShortcuts;
      redoShortcuts << QApplication::translate("uiMainWindow", "Ctrl+Y", 0, QApplication::UnicodeUTF8);
      redoShortcuts << QApplication::translate("uiMainWindow", "Ctrl+Shift+Z", 0, QApplication::UnicodeUTF8);
      uiRedo->setDefaultAction( uiStandardToolBar->insertWidget( uiCut, uiRedo ) );
      uiRedo->defaultAction()->setText(tr("Redo"));
    uiRedo->defaultAction()->setShortcuts(redoShortcuts);
      uiMenuEdit->insertAction( uiCut, uiRedo->defaultAction() );

      // Hide the specialized pre-created toolbars in Qt designer.
      /// \todo When Qt Designer have support for setting the visibility property, do this in Qt Designer already! -Matevz
      uiPrintToolBar->hide();
      uiFileToolBar->hide();
      uiStandardToolBar->updateGeometry();

      // Insert Toolbar
      uiInsertToolBar->addAction( uiSelectMode );
      uiInsertToolBar->addAction( uiEditMode );
      uiInsertToolBar->addSeparator();
      uiContextType->setDefaultAction( uiInsertToolBar->addWidget( uiContextType ) );
      uiContextType->defaultAction()->setToolTip(tr("Insert context"));
      uiContextType->setCurrentId( CAContext::Staff );
      connect( uiNewContext, SIGNAL( triggered() ), uiContextType, SLOT( click() ) );
      uiInsertToolBar->addSeparator();
      uiInsertToolBar->addAction( uiInsertPlayable );
      uiSlurType->setDefaultAction( uiInsertToolBar->addWidget( uiSlurType ) );
      uiSlurType->defaultAction()->setToolTip(tr("Insert slur"));
      uiSlurType->setCurrentId( CASlur::TieType );
      uiSlurType->defaultAction()->setCheckable(false);
      uiClefType->setDefaultAction( uiInsertToolBar->addWidget( uiClefType ) );
      uiClefType->defaultAction()->setToolTip(tr("Insert clef"));
      uiClefType->setCurrentId( CAClef::Treble );
      connect( uiInsertClef, SIGNAL( triggered() ), uiClefType, SLOT( click() ) );
      uiInsertToolBar->addAction( uiInsertKeySig );
      uiTimeSigType->setDefaultAction( uiInsertToolBar->addWidget( uiTimeSigType ) );
      uiTimeSigType->defaultAction()->setToolTip(tr("Insert time signature"));
      uiTimeSigType->setCurrentId( 44 );
      connect( uiInsertTimeSig, SIGNAL( triggered() ), uiTimeSigType, SLOT( click() ) );
      uiBarlineType->setDefaultAction( uiInsertToolBar->addWidget( uiBarlineType ) );
      uiBarlineType->defaultAction()->setToolTip(tr("Insert barline"));
      uiBarlineType->setCurrentId( CABarline::End );
      connect( uiInsertBarline, SIGNAL( triggered() ), uiBarlineType, SLOT( click() ) );
      uiMarkType->setDefaultAction( uiInsertToolBar->addWidget( uiMarkType ) );
      uiMarkType->defaultAction()->setToolTip( tr("Insert mark") );
      uiMarkType->setCurrentId( CAMark::Dynamic );
      connect( uiInsertMark, SIGNAL( triggered() ), uiMarkType, SLOT( click() ) );
      uiArticulationType->setDefaultAction( uiInsertToolBar->addWidget( uiArticulationType ) );
      uiArticulationType->defaultAction()->setToolTip( tr("Insert articulation mark") );
      uiArticulationType->setCurrentId( CAArticulation::Accent );
      connect( uiInsertArticulation, SIGNAL( triggered() ), uiArticulationType, SLOT( click() ) );
      uiInsertToolBar->addAction( uiInsertSyllable );
      uiInsertToolBar->addAction( uiInsertFM );

      if(qApp->isRightToLeft())
            addToolBar(Qt::RightToolBarArea, uiInsertToolBar);
      else
            addToolBar(Qt::LeftToolBarArea, uiInsertToolBar);

      // Sheet Toolbar
      uiSheetToolBar->addAction( uiNewSheet );
      uiSheetToolBar->addWidget( uiSheetName );
      uiSheetToolBar->addAction( uiRemoveSheet );
      uiSheetToolBar->addAction( uiSheetProperties );
      addToolBar(Qt::TopToolBarArea, uiSheetToolBar);

      // Context Toolbar
      uiContextToolBar->addWidget( uiContextName );
      uiStanzaNumberAction = uiContextToolBar->addWidget( uiStanzaNumber );
      uiAssociatedVoiceAction = uiContextToolBar->addWidget( uiAssociatedVoice );
      uiContextToolBar->addAction( uiRemoveContext );
      uiContextToolBar->addAction( uiContextProperties );
      addToolBar(Qt::TopToolBarArea, uiContextToolBar);

      // Playable Toolbar
      uiPlayableLength->setDefaultAction( uiPlayableToolBar->addWidget( uiPlayableLength ) );
      uiPlayableLength->defaultAction()->setToolTip(tr("Playable length"));
      uiPlayableLength->defaultAction()->setCheckable(false);
      uiPlayableLength->setCurrentId( CAPlayableLength::Quarter );
      uiPlayableToolBar->addAction( uiAccsVisible );
      uiTupletType->setDefaultAction( uiPlayableToolBar->addWidget( uiTupletType ) );
      uiTupletType->defaultAction()->setToolTip(tr("Insert tuplet"));
      uiTupletType->setCurrentId( 0 );
      uiTupletNumberAction = uiPlayableToolBar->addWidget( uiTupletNumber );
      uiTupletInsteadOfAction = uiPlayableToolBar->addWidget( uiTupletInsteadOf );
      uiTupletActualNumberAction = uiPlayableToolBar->addWidget( uiTupletActualNumber );
      uiNoteStemDirection->setDefaultAction( uiPlayableToolBar->addWidget(uiNoteStemDirection ) );
      uiNoteStemDirection->defaultAction()->setToolTip(tr("Note stem direction"));
      uiNoteStemDirection->defaultAction()->setCheckable(false);
      uiNoteStemDirection->setCurrentId( CANote::StemPreferred );
      uiPlayableToolBar->addAction( uiHiddenRest );
      addToolBar(Qt::TopToolBarArea, uiPlayableToolBar);

      // KeySig Toolbar
      uiKeySigToolBar->addWidget( uiKeySig );
      addToolBar(Qt::TopToolBarArea, uiKeySigToolBar);

      // Clef Toolbar
      uiClefToolBar->addWidget( uiClefOffset );
      addToolBar(Qt::TopToolBarArea, uiClefToolBar);

      // TimeSig Toolbar
      uiTimeSigToolBar->addWidget( uiTimeSigBeats );
      uiTimeSigToolBar->addWidget( uiTimeSigSlash );
      uiTimeSigToolBar->addWidget( uiTimeSigBeat );
      addToolBar(Qt::TopToolBarArea, uiTimeSigToolBar);

      // Voice Toolbar
      uiVoiceToolBar->addAction( uiNewVoice );
      uiVoiceToolBar->addWidget( uiVoiceNum );
      uiVoiceToolBar->addWidget( uiVoiceName );
      uiVoiceToolBar->addWidget( uiVoiceInstrument );
      uiVoiceToolBar->addAction( uiRemoveVoice );
      uiVoiceStemDirection->setDefaultAction( uiVoiceToolBar->addWidget( uiVoiceStemDirection ) );
      uiVoiceStemDirection->defaultAction()->setToolTip(tr("Voice stem direction"));
      uiVoiceStemDirection->defaultAction()->setCheckable(false);
      uiVoiceToolBar->addAction( uiVoiceProperties );
      addToolBar(Qt::TopToolBarArea, uiVoiceToolBar);

      // Function mark Toolbar
      uiFMFunction->setDefaultAction( uiFMToolBar->addWidget( uiFMFunction ) );
      uiFMFunction->defaultAction()->setToolTip( tr("Function mark") );
      uiFMFunction->setCurrentId( CAFunctionMark::T );
      uiFMFunction->defaultAction()->setCheckable( false );
      uiFMChordArea->setDefaultAction( uiFMToolBar->addWidget( uiFMChordArea ) );
      uiFMChordArea->defaultAction()->setToolTip( tr("Function mark chord area") );
      uiFMChordArea->setCurrentId( CAFunctionMark::T );
      uiFMChordArea->defaultAction()->setCheckable( false );
      uiFMTonicDegree->setDefaultAction( uiFMToolBar->addWidget( uiFMTonicDegree ) );
      uiFMTonicDegree->defaultAction()->setCheckable( false );
      uiFMTonicDegree->defaultAction()->setToolTip( tr("Function mark tonic degree") );
      uiFMTonicDegree->setCurrentId( CAFunctionMark::T );
      uiFMToolBar->addAction( uiFMEllipse );
      uiFMToolBar->addWidget( uiFMKeySig );
      connect( uiFMKeySig, SIGNAL( activated(int) ), this, SLOT( on_uiKeySig_activated(int) ) );
      addToolBar(Qt::TopToolBarArea, uiFMToolBar);

      // Dynamic marks toolbar
      uiDynamicText->setDefaultAction( uiDynamicToolBar->addWidget( uiDynamicText ) );
      uiDynamicText->defaultAction()->setToolTip( tr("Predefined dynamic mark") );
      uiDynamicText->setCurrentId( CADynamic::mf );
      uiDynamicText->defaultAction()->setCheckable( false );
      uiDynamicToolBar->addWidget( uiDynamicVolume );
      uiDynamicToolBar->addWidget( uiDynamicCustomText );
      addToolBar(Qt::TopToolBarArea, uiDynamicToolBar);

      // Instrument tool bar
      uiInstrumentToolBar->addWidget( uiInstrumentChange );
      addToolBar(Qt::TopToolBarArea, uiInstrumentToolBar);

      // Tempo tool bar
      uiTempoBeat->setDefaultAction( uiTempoToolBar->addWidget( uiTempoBeat ) );
      uiTempoBeat->defaultAction()->setCheckable(false);
      uiTempoBeat->defaultAction()->setToolTip(tr("Beat", "tempo"));
      uiTempoToolBar->addWidget( uiTempoEquals );
      uiTempoToolBar->addWidget( uiTempoBpm );
      addToolBar(Qt::TopToolBarArea, uiTempoToolBar);

      // Fermata tool bar
      uiFermataType->setDefaultAction( uiFermataToolBar->addWidget( uiFermataType ) );
      uiFermataType->defaultAction()->setCheckable(false);
      uiFermataType->defaultAction()->setToolTip(tr("Fermata Type", "fermata"));
      addToolBar(Qt::TopToolBarArea, uiFermataToolBar);

      // Repeat Mark tool bar
      uiRepeatMarkType->setDefaultAction( uiRepeatMarkToolBar->addWidget( uiRepeatMarkType ) );
      uiRepeatMarkType->defaultAction()->setCheckable(false);
      uiRepeatMarkType->defaultAction()->setToolTip(tr("Repeat Mark Type", "repeat mark"));
      addToolBar(Qt::TopToolBarArea, uiRepeatMarkToolBar);

      // Fingering tool bar
      uiFinger->setDefaultAction( uiFingeringToolBar->addWidget( uiFinger ) );
      uiFinger->defaultAction()->setCheckable(false);
      uiFinger->defaultAction()->setToolTip(tr("Finger", "fingering"));
      uiFingeringOriginal->setChecked(false);
      uiFingeringToolBar->addWidget( uiFingeringOriginal );
      addToolBar(Qt::TopToolBarArea, uiFingeringToolBar);

#ifdef USE_PYTHON
      // Python console dock widget
      addDockWidget(Qt::BottomDockWidgetArea, uiPyConsoleDock);
      uiPyConsoleDock->hide();
#endif

      // Help
      addDockWidget( (qApp->isLeftToRight()) ? Qt::RightDockWidgetArea : Qt::LeftDockWidgetArea, uiHelpDock);
      uiHelpDock->hide();

      // Mutual exclusive groups
      uiInsertGroup = new QActionGroup( this );
      uiInsertGroup->addAction( uiSelectMode );
      uiInsertGroup->addAction( uiEditMode );
      uiInsertGroup->addAction( uiNewContext );
      uiInsertGroup->addAction( uiContextType->defaultAction() );
      uiInsertGroup->addAction( uiInsertPlayable );
      uiInsertGroup->addAction( uiSlurType->defaultAction() );
      uiInsertGroup->addAction( uiInsertClef );
      uiInsertGroup->addAction( uiClefType->defaultAction() );
      uiInsertGroup->addAction( uiInsertTimeSig );
      uiInsertGroup->addAction( uiTimeSigType->defaultAction() );
      uiInsertGroup->addAction( uiInsertKeySig );
      uiInsertGroup->addAction( uiInsertBarline );
      uiInsertGroup->addAction( uiBarlineType->defaultAction() );
      uiInsertGroup->addAction( uiMarkType->defaultAction() );
      uiInsertGroup->addAction( uiInsertMark );
      uiInsertGroup->addAction( uiArticulationType->defaultAction() );
      uiInsertGroup->addAction( uiInsertArticulation );
      uiInsertGroup->addAction( uiInsertSyllable );
      uiInsertGroup->addAction( uiInsertFM );
      uiInsertGroup->setExclusive( true );

      uiInsertToolBar->hide();
      uiSheetToolBar->hide();
      uiContextToolBar->hide();
      uiPlayableToolBar->hide();
      uiTimeSigToolBar->hide();
      uiKeySigToolBar->hide();
      uiClefToolBar->hide();
      uiFMToolBar->hide();
      uiDynamicToolBar->hide();
      uiInstrumentToolBar->hide();
      uiTempoToolBar->hide();
      uiFermataToolBar->hide();
      uiRepeatMarkToolBar->hide();
      uiFingeringToolBar->hide();
}


Generated by  Doxygen 1.6.0   Back to index