InterpretDialog::InterpretDialog(QWidget *parent) :
        QDialog(parent)
{
    //setHelp("nv-interpret");

    setModal(true);
    setWindowTitle(tr("Interpret"));

    QGridLayout *metagrid = new QGridLayout;
    setLayout(metagrid);
    QGroupBox *vbox = new QGroupBox(tr("Interpretations to apply"), this);
    QVBoxLayout *vboxLayout = new QVBoxLayout;
    metagrid->addWidget(vbox, 0, 0);

    m_applyTextDynamics = new QCheckBox
                          (tr("Apply text dynamics (p, mf, ff etc)"));
    vboxLayout->addWidget(m_applyTextDynamics);
    m_applyHairpins = new QCheckBox
                      (tr("Apply hairpin dynamics"));
    vboxLayout->addWidget(m_applyHairpins);
    m_stressBeats = new QCheckBox
                    (tr("Stress beats"));
    vboxLayout->addWidget(m_stressBeats);
    m_articulate = new QCheckBox
                   (tr("Articulate slurs, staccato, tenuto etc"));
    vboxLayout->addWidget(m_articulate);
    m_allInterpretations = new QCheckBox
                           (tr("All available interpretations"));
    vboxLayout->addWidget(m_allInterpretations);

    vbox->setLayout(vboxLayout);

    QSettings settings;
    settings.beginGroup( NotationViewConfigGroup );

    m_allInterpretations->setChecked
    ( qStrToBool( settings.value("interpretall", "true" ) ) );
    m_applyTextDynamics->setChecked
    ( qStrToBool( settings.value("interprettextdynamics", "true" ) ) );
    m_applyHairpins->setChecked
    ( qStrToBool( settings.value("interprethairpins", "true" ) ) );
    m_stressBeats->setChecked
    ( qStrToBool( settings.value("interpretstressbeats", "true" ) ) );
    m_articulate->setChecked
    ( qStrToBool( settings.value("interpretarticulate", "true" ) ) );

    connect(m_allInterpretations,
            SIGNAL(clicked()), this, SLOT(slotAllBoxChanged()));

    slotAllBoxChanged();
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    metagrid->addWidget(buttonBox, 1, 0);
    metagrid->setRowStretch(0, 10);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(slotHelpRequested()));

    settings.endGroup();
}
void
LilyPondOptionsDialog::populateDefaultValues()
{
    QSettings settings;
    settings.beginGroup(LilyPondExportConfigGroup);

    m_lilyLanguage->setCurrentIndex(settings.value("lilylanguage", 0).toUInt());
    // See also setDefaultLilyPondVersion below
    int defaultPaperSize = 1; // A4
    if (QLocale::system().country() == QLocale::UnitedStates) {
        defaultPaperSize = 5; // Letter
    }
    m_lilyPaperSize->setCurrentIndex(settings.value("lilypapersize", defaultPaperSize).toUInt());
    m_lilyPaperLandscape->setChecked(qStrToBool(settings.value("lilypaperlandscape", "false")));
    m_lilyFontSize->setCurrentIndex(settings.value("lilyfontsize", FONT_20).toUInt());
    m_lilyRaggedBottom->setChecked(qStrToBool(settings.value("lilyraggedbottom", "false")));
    m_useShortNames->setChecked(qStrToBool(settings.value("lilyuseshortnames", "true")));
    m_lilyExportEmptyStaves->setChecked(qStrToBool(settings.value("lilyexportemptystaves", "false")));
    m_lilyChordNamesMode->setChecked(qStrToBool(settings.value("lilychordnamesmode", "false")));
    m_lilyExportLyrics->setCurrentIndex(settings.value("lilyexportlyrics", 1).toUInt());
    m_lilyTempoMarks->setCurrentIndex(settings.value("lilyexporttempomarks", 0).toUInt());
    if (m_createdFromNotationEditor) {
        // This item is the default when the dialog is opened from the notation
        // editor.
        m_lilyExportSelection->setCurrentIndex(m_editedSegmentsIndex);
    } else {
        m_lilyExportSelection->setCurrentIndex(settings.value("lilyexportselection", 1).toUInt());
    }
    m_lilyExportBeams->setChecked(settings.value("lilyexportbeamings", "false").toBool());
    m_lilyExportStaffGroup->setChecked(settings.value("lilyexportstaffbrackets", "true").toBool());
    m_lilyMarkerMode->setCurrentIndex(settings.value("lilyexportmarkermode", 0).toUInt());
    m_lilyNoteLanguage->setCurrentIndex(settings.value("lilyexportnotelanguage", 6).toUInt());
//    m_lilyRepeatMode->setCurrentIndex(settings.value("lilyrepeatmode", 0).toUInt());
    m_lilyRepeatMode->setChecked(settings.value("lilyexportrepeat", "true").toBool());
    m_lilyDrawBarAtVolta->setChecked(settings.value("lilydrawbaratvolta", "true").toBool());
    m_cancelAccidentals->setChecked(settings.value("lilycancelaccidentals", "false").toBool());
    m_fingeringsInStaff->setChecked(settings.value("lilyfingeringsinstaff", "true").toBool());

    std::cerr << "QSettings for LilyPond (populateDefaultValues):" << std::endl
              << "  lilyexportmarkermode: " << settings.value("lilyexportmarkermode").toUInt() << std::endl
              << "  lilyraggedbottom: " << (settings.value("lilyraggedbottom").toBool() ? "true" : "false") << std::endl
              << std::endl;

    settings.endGroup();
}
Beispiel #3
0
void
MatrixSelector::setContextHelpFor(const MatrixMouseEvent *e, bool ctrlPressed)
{
    QSettings settings;
    settings.beginGroup( GeneralOptionsConfigGroup );

    if (! qStrToBool( settings.value("toolcontexthelp", "true" ) ) ) {
        settings.endGroup();
        return;
    }
    settings.endGroup();

    MatrixElement *element = e->element;

    if (!element) {
        
        setContextHelp
            (tr("Click and drag to select; middle-click and drag to draw new note"));

    } else {
        
        // same logic as in handleLeftButtonPress
        
        float x = element->getLayoutX();
        float width = element->getWidth();
        float resizeStart = int(double(width) * 0.85) + x;

        // max size of 10
        if ((x + width) - resizeStart > 10) resizeStart = x + width - 10;

        EventSelection *s = m_scene->getSelection();

        if (e->sceneX > resizeStart) {
            if (s && s->getAddedEvents() > 1) {
                setContextHelp(tr("Click and drag to resize selected notes"));
            } else {
                setContextHelp(tr("Click and drag to resize note"));
            }
        } else {
            if (s && s->getAddedEvents() > 1) {
                if (!ctrlPressed) {
                    setContextHelp(tr("Click and drag to move selected notes; hold Ctrl as well to copy"));
                } else {
                    setContextHelp(tr("Click and drag to copy selected notes"));
                }
            } else {
                if (!ctrlPressed) {
                    setContextHelp(tr("Click and drag to move note; hold Ctrl as well to copy"));
                } else {
                    setContextHelp(tr("Click and drag to copy note"));
                }
            }                
        }
    }
}
Beispiel #4
0
RescaleDialog::RescaleDialog(QWidget *parent,
                             Composition *composition,
                             timeT startTime,
                             timeT originalDuration,
                             timeT minimumDuration,
                             bool showCloseGapOption,
                             bool constrainToCompositionDuration) :
        QDialog(parent)
{
    setModal(true);
    setWindowTitle(tr("Stretch or Squash"));

    QWidget *vbox = new QWidget(this);
    QVBoxLayout *vboxLayout = new QVBoxLayout;
    setLayout(vboxLayout);


    m_newDuration = new TimeWidget(tr("Duration of selection"), vbox,
                     composition, startTime, originalDuration, 
                     minimumDuration, true,
                     constrainToCompositionDuration);
    vboxLayout->addWidget(m_newDuration);

    if (showCloseGapOption) {
        QGroupBox *optionBox = new QGroupBox( tr("Options"), vbox );
        QVBoxLayout *optionBoxLayout = new QVBoxLayout;
        optionBox->setLayout(optionBoxLayout);
        vboxLayout->addWidget(optionBox);
        m_closeGap = new QCheckBox(tr("Adjust times of following events accordingly"),
                                   optionBox);
        optionBoxLayout->addWidget(m_closeGap);

        QSettings settings;
        settings.beginGroup( GeneralOptionsConfigGroup );

        m_closeGap->setChecked(qStrToBool(settings.value("rescaledialogadjusttimes", "true")));

        settings.endGroup();
    } else {
        m_closeGap = 0;
    }

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Reset | QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    vboxLayout->addWidget(buttonBox);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QPushButton *resetButton = buttonBox->button(QDialogButtonBox::Reset);
    connect(resetButton, SIGNAL(clicked()),
            m_newDuration, SLOT(slotResetToDefault()));

    updateGeometry();
}
void
UseOrnamentDialog::setupFromConfig()
{
    QSettings settings;
    settings.beginGroup( NotationViewConfigGroup );

    Mark mark = qstrtostr(settings.value("useornamentmark", "trill").toString());
    int seg = settings.value("useornamentlastornament", 0).toInt() ;
    std::string timing = qstrtostr(settings.value("useornamenttiming",
            strtoqstr(BaseProperties::TRIGGER_SEGMENT_ADJUST_SQUISH)).toString());
    bool retune = qStrToBool( settings.value("useornamentretune", "true" ) ) ;

    size_t i = 0;
    for (i = 0; i < m_marks.size(); ++i) {
        if (mark == m_marks[i]) {
            m_mark->setCurrentIndex(i);
            m_text->setEnabled(false);
            break;
        }
    }
    if (i >= m_marks.size()) {
        m_mark->setCurrentIndex(m_marks.size());
        m_text->setEnabled(true);
        m_text->setText(strtoqstr(Marks::getTextFromMark(mark)));
    }

    if (seg >= 0 && seg < m_ornament->count())
        m_ornament->setCurrentIndex(seg);

    if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_NONE) {
        m_adjustTime->setCurrentIndex(0);
    } else if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_SQUISH) {
        m_adjustTime->setCurrentIndex(3);
    } else if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_SYNC_START) {
        m_adjustTime->setCurrentIndex(1);
    } else if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_SYNC_END) {
        m_adjustTime->setCurrentIndex(2);
    }

    m_retune->setChecked(retune);

    settings.endGroup();
}
void
CollapsingFrame::setWidget(QWidget *widget)
{
    Q_ASSERT(!m_widget);
    m_widget = widget;
    if (m_fill) {
        m_layout->addWidget(widget, 1, 0, 1, 3);
    } else {
        m_layout->addWidget(widget, 1, 1);
    }

    bool expanded = true;
    if (!objectName().isEmpty()) {
        QSettings settings;
        settings.beginGroup(CollapsingFrameConfigGroup);
        expanded = qStrToBool(settings.value(objectName(), true));
        settings.endGroup();
    }

    if (expanded != !m_collapsed)
        toggle();
}
CollapsingFrame::CollapsingFrame(
        QString label, QWidget *parent, const QString &name,
        bool defaultExpanded) :
    QFrame(parent),
    m_widget(0),
    m_fill(false),
    m_collapsed(false)
{
    setObjectName(name);

    // Set up the initial default state if needed.
    QSettings settings;
    settings.beginGroup(CollapsingFrameConfigGroup);
    bool expanded = qStrToBool(settings.value(
            name, defaultExpanded ? "true" : "false"));
    settings.setValue(name, expanded);

    setContentsMargins(0, 0, 0, 0);
    m_layout = new QGridLayout(this);
    m_layout->setMargin(0);
    m_layout->setSpacing(0);

    m_toggleButton = new QToolButton(this);
    m_toggleButton->setText(label);
    m_toggleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    m_toggleButton->setAutoRaise(true);

    QFont font(m_toggleButton->font());
    font.setBold(true);
    m_toggleButton->setFont(font);

    m_toggleButton->setIcon(IconLoader().load("style/arrow-down-small-inverted"));

    connect(m_toggleButton, SIGNAL(clicked()), this, SLOT(toggle()));

    m_layout->addWidget(m_toggleButton, 0, 0, 1, 3);
}
AudioConfigurationPage::AudioConfigurationPage(
    RosegardenDocument *doc,
    QWidget *parent):
    TabbedConfigurationPage(parent),
    m_externalAudioEditorPath(0)
{
    // set the document in the super class
    m_doc = doc;

    QSettings settings;

    QFrame *frame = new QFrame(m_tabWidget);
    frame->setContentsMargins(10, 10, 10, 10);
    QGridLayout *layout = new QGridLayout(frame);
    layout->setSpacing(5);

    QLabel *label = 0;

    int row = 0;

    settings.beginGroup( GeneralOptionsConfigGroup );

    layout->setRowMinimumHeight(row, 15);
    ++row;

    layout->addWidget(new QLabel(tr("Audio preview scale"),
                                 frame), row, 0);

    m_previewStyle = new QComboBox(frame);
    connect(m_previewStyle, SIGNAL(activated(int)), this, SLOT(slotModified()));
    m_previewStyle->addItem(tr("Linear - easier to see loud peaks"));
    m_previewStyle->addItem(tr("Meter scaling - easier to see quiet activity"));
    m_previewStyle->setCurrentIndex( settings.value("audiopreviewstyle", 1).toUInt() );
    layout->addWidget(m_previewStyle, row, 1, row- row+1, 2);
    ++row;

    settings.endGroup();

#ifdef HAVE_LIBJACK
    settings.beginGroup( SequencerOptionsConfigGroup );

    label = new QLabel(tr("Record audio files as"), frame);
    m_audioRecFormat = new QComboBox(frame);
    connect(m_audioRecFormat, SIGNAL(activated(int)), this, SLOT(slotModified()));
    m_audioRecFormat->addItem(tr("16-bit PCM WAV format (smaller files)"));
    m_audioRecFormat->addItem(tr("32-bit float WAV format (higher quality)"));
    m_audioRecFormat->setCurrentIndex( settings.value("audiorecordfileformat", 1).toUInt() );
    layout->addWidget(label, row, 0);
    layout->addWidget(m_audioRecFormat, row, 1, row- row+1, 2);
    ++row;

    settings.endGroup();

#endif
    settings.beginGroup( GeneralOptionsConfigGroup );

    layout->addWidget(new QLabel(tr("External audio editor"), frame),
                      row, 0);

    QString defaultAudioEditor = getBestAvailableAudioEditor();

    std::cerr << "defaultAudioEditor = " << defaultAudioEditor << std::endl;

    QString externalAudioEditor = settings.value("externalaudioeditor",
                                  defaultAudioEditor).toString() ;

    if (externalAudioEditor == "") {
        externalAudioEditor = defaultAudioEditor;
        settings.setValue("externalaudioeditor", externalAudioEditor);
    }

    m_externalAudioEditorPath = new LineEdit(externalAudioEditor, frame);
    connect(m_externalAudioEditorPath, SIGNAL(textChanged(const QString &)), this, SLOT(slotModified()));
//    m_externalAudioEditorPath->setMinimumWidth(150);
    layout->addWidget(m_externalAudioEditorPath, row, 1);
    
    QPushButton *changePathButton =
        new QPushButton(tr("Choose..."), frame);

    layout->addWidget(changePathButton, row, 2);
    connect(changePathButton, SIGNAL(clicked()), SLOT(slotFileDialog()));
    ++row;

    settings.endGroup();

    layout->addWidget(new QLabel(tr("Create JACK outputs"), frame),
                      row, 0);
//    ++row;

#ifdef HAVE_LIBJACK
    settings.beginGroup( SequencerOptionsConfigGroup );

    m_createFaderOuts = new QCheckBox(tr("for individual audio instruments"), frame);
    connect(m_createFaderOuts, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
    m_createFaderOuts->setChecked( qStrToBool( settings.value("audiofaderouts", "false" ) ) );

//    layout->addWidget(label, row, 0, Qt::AlignRight);
    layout->addWidget(m_createFaderOuts, row, 1);
    ++row;

    m_createSubmasterOuts = new QCheckBox(tr("for submasters"), frame);
    connect(m_createSubmasterOuts, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
    m_createSubmasterOuts->setChecked( qStrToBool( settings.value("audiosubmasterouts", "false" ) ) );

//    layout->addWidget(label, row, 0, Qt::AlignRight);
    layout->addWidget(m_createSubmasterOuts, row, 1);
    ++row;

    settings.endGroup();
#endif

    ++row;
    layout->addWidget(new QLabel(tr("Make default JACK connections for"),frame),
                      row, 0);

#ifdef HAVE_LIBJACK
    settings.beginGroup(SequencerOptionsConfigGroup);

    m_connectDefaultAudioOutputs = new QCheckBox(tr("audio outputs"));
    connect(m_connectDefaultAudioOutputs, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
    m_connectDefaultAudioOutputs->setChecked(qStrToBool(settings.value("connect_default_jack_outputs", "true")));
    layout->addWidget(m_connectDefaultAudioOutputs, row, 1);
    ++row;

    m_connectDefaultAudioInputs = new QCheckBox(tr("audio inputs"));
    connect(m_connectDefaultAudioInputs, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
    m_connectDefaultAudioInputs->setChecked(qStrToBool(settings.value("connect_default_jack_inputs", "true")));
    layout->addWidget(m_connectDefaultAudioInputs, row, 1);
    settings.endGroup();
    ++row;

    layout->addWidget(new QLabel(tr("Start JACK automatically"),frame), row, 0);
    m_autoStartJackServer = new QCheckBox();
    connect(m_autoStartJackServer, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
    m_autoStartJackServer->setChecked(settings.value("autostartjack", "true").toBool());
    layout->addWidget(m_autoStartJackServer, row, 1);
    ++row;
#endif

    layout->setRowStretch(row, 10);

    addTab(frame, tr("General"));
}
Beispiel #9
0
bool
ImportDeviceDialog::doImport()
{
    setModal(true);
    setWindowTitle(tr("Import from Device..."));
    QGridLayout *metagrid = new QGridLayout;
    setLayout(metagrid);
    QWidget *mainFrame = new QWidget(this);
    QVBoxLayout *mainFrameLayout = new QVBoxLayout;
    metagrid->addWidget(mainFrame, 0, 0);

    if (m_url.isEmpty()) {
        reject();
        return false;
    }

    QString target;
    FileSource source(m_url);
    if (!source.isAvailable()) {
        QMessageBox::critical(
          dynamic_cast<QWidget*>(this),
          "", /* no title */
          tr("Cannot download file %1").arg(m_url.toString()),
          QMessageBox::Ok,
          QMessageBox::Ok);
        return false;
    }

    source.waitForData();
    target = source.getLocalFilename();
    std::string filename = qStrToStrLocal8(target);

    bool fileRead = false;
    if (SF2PatchExtractor::isSF2File(filename)) {
        fileRead = importFromSF2(target);
    } else if (LSCPPatchExtractor::isLSCPFile(target)) {
        fileRead = importFromLSCP(target);
    } else {
        fileRead = importFromRG(target);
    }
    if (!fileRead) {
        QMessageBox::critical(
          dynamic_cast<QWidget*>(this),
          "", /* no title */
          tr("Cannot open file %1").arg(m_url.toString()),
          QMessageBox::Ok,
          QMessageBox::Ok);
        reject();
        close();
        return false;
    }
    if (m_devices.size() == 0) {
        QMessageBox::warning(
          dynamic_cast<QWidget*>(this),
          "", /* no title */
          tr("No devices found in file %1").arg(m_url.toString()),
          QMessageBox::Ok,
          QMessageBox::Ok);
        reject();
        close();
        return false;
    }

    QGroupBox *groupBox = new QGroupBox(tr("Source device"));
    QHBoxLayout *groupBoxLayout = new QHBoxLayout;
    mainFrameLayout->addWidget(groupBox);

    QWidget *deviceBox = new QWidget(groupBox);
    QHBoxLayout *deviceBoxLayout = new QHBoxLayout( deviceBox );
    groupBoxLayout->addWidget(deviceBox);

    deviceBoxLayout->addWidget(new QLabel(tr("Import from: "), deviceBox));

    bool showRenameOption = false;

    if (m_devices.size() > 1) {
        m_deviceLabel = 0;
        m_deviceCombo = new QComboBox( deviceBox );
        deviceBoxLayout->addWidget(m_deviceCombo);
    } else {
        m_deviceCombo = 0;
        m_deviceLabel = new QLabel( deviceBox );
        deviceBoxLayout->addWidget(m_deviceLabel);
    }

    deviceBoxLayout->addStretch(10);

    int count = 1;
    for (std::vector<MidiDevice *>::iterator i = m_devices.begin();
         i != m_devices.end(); ++i) {
        if ((*i)->getName() != "") {
            showRenameOption = true;
        } else {
            (*i)->setName(qstrtostr(tr("Device %1").arg(count)));
        }
        if (m_devices.size() > 1) {
            m_deviceCombo->addItem(strtoqstr((*i)->getName()));
        } else {
            m_deviceLabel->setText(strtoqstr((*i)->getName()));
        }
        ++count;
    }

    QWidget *optionsBox = new QWidget(mainFrame);
    QHBoxLayout *optionsBoxLayout = new QHBoxLayout;
    mainFrameLayout->addWidget(optionsBox);

    QGroupBox *gb = new QGroupBox(tr("Options"));
    QVBoxLayout *gbLayout = new QVBoxLayout;
    optionsBoxLayout->addWidget(gb);

    m_importBanks = new QCheckBox(tr("Import banks"), gb);
    gbLayout->addWidget(m_importBanks);
    m_importKeyMappings = new QCheckBox(tr("Import key mappings"), gb);
    gbLayout->addWidget(m_importKeyMappings);
    m_importControllers = new QCheckBox(tr("Import controllers"), gb);
    gbLayout->addWidget(m_importControllers);

    if (showRenameOption) {
        m_rename = new QCheckBox(tr("Import device name"), gb);
        gbLayout->addWidget(m_rename);
    } else {
        m_rename = 0;
    }

    QGroupBox *buttonGroupBox = new QGroupBox(tr("Bank import behavior"));
    QVBoxLayout *buttonGroupBoxLayout = new QVBoxLayout;
    optionsBoxLayout->addWidget(buttonGroupBox);
    m_buttonGroup = new QButtonGroup(buttonGroupBox);

    m_mergeBanks = new QRadioButton(tr("Merge banks"));
    buttonGroupBoxLayout->addWidget(m_mergeBanks);
    m_buttonGroup->addButton(m_mergeBanks, 0);

    m_overwriteBanks = new QRadioButton(tr("Overwrite banks"));
    buttonGroupBoxLayout->addWidget(m_overwriteBanks);
    m_buttonGroup->addButton(m_overwriteBanks, 1);

    gb->setLayout(gbLayout);
    buttonGroupBox->setLayout(buttonGroupBoxLayout);
    optionsBox->setLayout(optionsBoxLayout);
    deviceBox->setLayout(deviceBoxLayout);
    groupBox->setLayout(groupBoxLayout);
    mainFrame->setLayout(mainFrameLayout);

    QSettings settings;
    settings.beginGroup( GeneralOptionsConfigGroup );

    m_importBanks->setChecked( qStrToBool( settings.value("importbanks", "true" ) ) );
    m_importKeyMappings->setChecked( qStrToBool( settings.value("importkeymappings", "true" ) ) );
    m_importControllers->setChecked( qStrToBool( settings.value("importcontrollers", "true" ) ) );

    bool rename = qStrToBool( settings.value("importbanksrename", "true" ) ) ;
    if (m_rename)
        m_rename->setChecked(rename);

    bool overwrite = qStrToBool( settings.value("importbanksoverwrite", "true" ) ) ;
    if (overwrite)
        m_buttonGroup->button(1)->setChecked(true);
    else
        m_buttonGroup->button(0)->setChecked(true);

    settings.endGroup();

    QDialogButtonBox *buttonBox
        = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    metagrid->addWidget(buttonBox, 1, 0);
    metagrid->setRowStretch(0, 10);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel()));

    return true;
}
Beispiel #10
0
void
EventFilterDialog::initDialog()
{
    setModal(true);
    setWindowTitle(tr("Event Filter"));
    QGridLayout *metagrid = new QGridLayout;
    setLayout(metagrid);
    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *mainWidgetLayout = new QVBoxLayout;
    metagrid->addWidget(mainWidget, 0, 0);

    //----------[ Note Filter Widgets ]-------------------------

    // Frame
    QGroupBox* noteFrame = new QGroupBox(tr("Note Events"));
    noteFrame->setContentsMargins(20, 20, 20, 20);
    QGridLayout* noteFrameLayout = new QGridLayout;
    noteFrameLayout->setSpacing(6);
    mainWidgetLayout->addWidget(noteFrame);

    // Labels
    QLabel* pitchFromLabel = new QLabel(tr("lowest:"), noteFrame);
    noteFrameLayout->addWidget(pitchFromLabel, 0, 2);

    QLabel* pitchToLabel = new QLabel(tr("highest:"), noteFrame);
    noteFrameLayout->addWidget(pitchToLabel, 0, 4);

    QLabel* pitchLabel = new QLabel(tr("Pitch:"), noteFrame);
    noteFrameLayout->addWidget(pitchLabel, 1, 1);

    QLabel* velocityLabel = new QLabel(tr("Velocity:"), noteFrame);
    noteFrameLayout->addWidget(velocityLabel, 2, 1);

    QLabel* durationLabel = new QLabel(tr("Duration:"), noteFrame);
    noteFrameLayout->addWidget(durationLabel, 3, 1);

    m_useNotationDuration = new QCheckBox();
    noteFrameLayout->addWidget(m_useNotationDuration, 4, 1);

    m_selectRests = new QCheckBox();
    noteFrameLayout->addWidget(m_selectRests, 5, 1);

    // Include Boxes
    m_notePitchIncludeComboBox = new QComboBox(noteFrame);
    m_notePitchIncludeComboBox->setEditable(false);
    m_notePitchIncludeComboBox->addItem(tr("include"));
    m_notePitchIncludeComboBox->addItem(tr("exclude"));

    QSettings settings;
    settings.beginGroup( EventFilterDialogConfigGroup );

    m_notePitchIncludeComboBox->setCurrentIndex( qStrToBool( settings.value("pitchinclude", "0" ) ) );
    noteFrameLayout->addWidget(m_notePitchIncludeComboBox, 1, 0);

    m_noteVelocityIncludeComboBox = new QComboBox(noteFrame);
    m_noteVelocityIncludeComboBox->setEditable(false);
    m_noteVelocityIncludeComboBox->addItem(tr("include"));
    m_noteVelocityIncludeComboBox->addItem(tr("exclude"));

    m_noteVelocityIncludeComboBox->setCurrentIndex( qStrToBool( settings.value("velocityinclude", "0" ) ) );
    noteFrameLayout->addWidget(m_noteVelocityIncludeComboBox, 2, 0);

    m_noteDurationIncludeComboBox = new QComboBox(noteFrame);
    m_noteDurationIncludeComboBox->setEditable(false);
    m_noteDurationIncludeComboBox->addItem(tr("include"));
    m_noteDurationIncludeComboBox->addItem(tr("exclude"));

    m_noteDurationIncludeComboBox->setCurrentIndex( qStrToBool( settings.value("durationinclude", "0" ) ) );
    noteFrameLayout->addWidget(m_noteDurationIncludeComboBox, 3, 0);

    QLabel* durationCheckBoxLabel = new QLabel(tr("Use notation duration"));
    noteFrameLayout->addWidget(durationCheckBoxLabel, 4, 2);
    m_useNotationDuration->setChecked(settings.value("usenotationduration", "0").toBool());

    QLabel* useRestsLabel = new QLabel(tr("Select rests"));
    noteFrameLayout->addWidget(useRestsLabel, 5, 2);
    m_selectRests->setChecked(settings.value("selectrests", "0").toBool());

    // Pitch From
    m_pitchFromSpinBox = new QSpinBox(noteFrame);
    m_pitchFromSpinBox->setMaximum(127);

    m_pitchFromSpinBox->setValue( settings.value("pitchfrom", 0).toUInt() );
    noteFrameLayout->addWidget(m_pitchFromSpinBox, 1, 2);
    connect(m_pitchFromSpinBox, SIGNAL(valueChanged(int)),
            SLOT(slotPitchFromChanged(int)));

    m_pitchFromChooserButton = new QPushButton(tr("edit"), noteFrame);
    m_pitchFromChooserButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
                                                        QSizePolicy::Fixed,
                                                        QSizePolicy::PushButton));
    m_pitchFromChooserButton->setToolTip(tr("choose a pitch using a staff"));
    noteFrameLayout->addWidget(m_pitchFromChooserButton, 1, 3);
    connect(m_pitchFromChooserButton, SIGNAL(clicked()),
            SLOT(slotPitchFromChooser()));

    // Pitch To
    m_pitchToSpinBox = new QSpinBox(noteFrame);
    m_pitchToSpinBox->setMaximum(127);

    m_pitchToSpinBox->setValue( settings.value("pitchto", 127).toUInt() );
    noteFrameLayout->addWidget(m_pitchToSpinBox, 1, 4);
    connect(m_pitchToSpinBox, SIGNAL(valueChanged(int)),
            SLOT(slotPitchToChanged(int)));

    m_pitchToChooserButton = new QPushButton(tr("edit"), noteFrame);
    m_pitchToChooserButton->setToolTip(tr("choose a pitch using a staff"));
    noteFrameLayout->addWidget(m_pitchToChooserButton, 1, 5);
    connect(m_pitchToChooserButton, SIGNAL(clicked()),
            SLOT(slotPitchToChooser()));

    // Velocity From/To
    m_velocityFromSpinBox = new QSpinBox(noteFrame);
    m_velocityFromSpinBox->setMaximum(127);

    m_velocityFromSpinBox->setValue( settings.value("velocityfrom", 0).toUInt() );
    noteFrameLayout->addWidget(m_velocityFromSpinBox, 2, 2);
    connect(m_velocityFromSpinBox, SIGNAL(valueChanged(int)),
            SLOT(slotVelocityFromChanged(int)));

    m_velocityToSpinBox = new QSpinBox(noteFrame);
    m_velocityToSpinBox->setMaximum(127);

    m_velocityToSpinBox->setValue( settings.value("velocityto", 127).toUInt() );
    noteFrameLayout->addWidget( m_velocityToSpinBox, 2, 4 );
    connect(m_velocityToSpinBox, SIGNAL(valueChanged(int)),
            SLOT(slotVelocityToChanged(int)));


    // Duration From/To
    m_noteDurationFromComboBox = new QComboBox(noteFrame);
    m_noteDurationFromComboBox->setEditable(false);
    m_noteDurationFromComboBox->addItem(tr("longest"));
    noteFrameLayout->addWidget(m_noteDurationFromComboBox, 3, 2);
    connect(m_noteDurationFromComboBox, SIGNAL(activated(int)),
            SLOT(slotDurationFromChanged(int)));

    m_noteDurationToComboBox = new QComboBox(noteFrame);
    m_noteDurationToComboBox->setEditable(false);
    m_noteDurationToComboBox->addItem(tr("longest"));
    noteFrameLayout->addWidget(m_noteDurationToComboBox, 3, 4);
    connect(m_noteDurationToComboBox, SIGNAL(activated(int)),
            SLOT(slotDurationToChanged(int)));

    populateDurationCombos();


    //---------[ Buttons ]--------------------------------------
    QFrame* privateLayoutWidget = new QFrame(mainWidget);
    privateLayoutWidget->setContentsMargins(20, 20, 20, 20);
    QGridLayout* buttonLayout = new QGridLayout;
    buttonLayout->setSpacing(6);
    mainWidgetLayout->addWidget(privateLayoutWidget);

    m_buttonAll = new QPushButton(tr("Include all"), privateLayoutWidget);
    m_buttonAll->setAutoDefault(true);
    m_buttonAll->setToolTip(tr("Include entire range of values"));
    buttonLayout->addWidget( m_buttonAll, 0, 0 );

    m_buttonNone = new QPushButton(tr("Exclude all"), privateLayoutWidget);
    m_buttonNone->setAutoDefault(true);
    m_buttonNone->setToolTip(tr("Exclude entire range of values"));
    buttonLayout->addWidget( m_buttonNone, 0, 1 );

    connect(m_buttonAll, SIGNAL(clicked()), this, SLOT(slotToggleAll()));
    connect(m_buttonNone, SIGNAL(clicked()), this, SLOT(slotToggleNone()));

    settings.endGroup();

    privateLayoutWidget->setLayout(buttonLayout);
    noteFrame->setLayout(noteFrameLayout);
    mainWidget->setLayout(mainWidgetLayout);

    QDialogButtonBox *buttonBox
        = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    metagrid->addWidget(buttonBox, 1, 0);
    metagrid->setRowStretch(0, 10);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}