⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 texteventdialog.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    for (int i = 0; i < 5; ++i)    {        p.drawLine(0, ls * i, mapWidth - 1, ls * i);        pm.drawLine(0, ls * i, mapWidth - 1, ls * i);    }    p.end();    pm.end();    map.setMask(mask);    m_staffAboveLabel = new QLabel("staff", exampleVBox);    m_staffAboveLabel->setPixmap(map);    m_textExampleLabel = new QLabel(i18n("Example"), exampleVBox);    m_staffBelowLabel = new QLabel("staff", exampleVBox);    m_staffBelowLabel->setPixmap(map);    // restore last setting for shortcut combos    KConfig *config = kapp->config();    config->setGroup(NotationViewConfigGroup);    m_dynamicShortcutCombo->setCurrentItem(config->readNumEntry("dynamic_shortcut", 0));    m_directionShortcutCombo->setCurrentItem(config->readNumEntry("direction_shortcut", 0));    m_localDirectionShortcutCombo->setCurrentItem(config->readNumEntry("local_direction_shortcut", 0));    m_tempoShortcutCombo->setCurrentItem(config->readNumEntry("tempo_shortcut", 0));    m_localTempoShortcutCombo->setCurrentItem(config->readNumEntry("local_tempo_shortcut", 0));    m_lilypondDirectiveCombo->setCurrentItem(config->readNumEntry("lilypond_directive_combo", 0));    m_prevChord = config->readEntry("previous_chord", "");    m_prevLyric = config->readEntry("previous_lyric", "");    m_prevAnnotation = config->readEntry("previous_annotation", "");    QObject::connect(m_text, SIGNAL(textChanged(const QString &)),                     this, SLOT(slotTextChanged(const QString &)));    QObject::connect(m_typeCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotTypeChanged(const QString &)));    QObject::connect(this, SIGNAL(okClicked()), this, SLOT(slotOK()));    QObject::connect(m_dynamicShortcutCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotDynamicShortcutChanged(const QString &)));    QObject::connect(m_directionShortcutCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotDirectionShortcutChanged(const QString &)));    QObject::connect(m_localDirectionShortcutCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotLocalDirectionShortcutChanged(const QString &)));    QObject::connect(m_tempoShortcutCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotTempoShortcutChanged(const QString &)));    QObject::connect(m_localTempoShortcutCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotLocalTempoShortcutChanged(const QString &)));    QObject::connect(m_lilypondDirectiveCombo, SIGNAL(activated(const QString &)),                     this, SLOT(slotLilypondDirectiveChanged(const QString &)));    m_text->setFocus();    slotTypeChanged(strtoqstr(getTextType()));    // a hacky little fix for #1512143, to restore the capability to edit    // existing annotations and other whatnots    //!!! tacking another one of these on the bottom strikes me as lame in the    // extreme, but it works, and it costs little, and other solutions I can    // imagine would cost so much more.    m_text->setText(strtoqstr(defaultText.getText()));}TextTextEventDialog::getText() const{    Text text(getTextString(), getTextType());    text.setVerse(m_verseSpin->value() - 1);    return text;}std::stringTextEventDialog::getTextType() const{    return m_styles[m_typeCombo->currentItem()];}std::stringTextEventDialog::getTextString() const{    return std::string(qstrtostr(m_text->text()));}voidTextEventDialog::slotTextChanged(const QString &qtext){    std::string type(getTextType());    QString qtrunc(qtext);    if (qtrunc.length() > 20)        qtrunc = qtrunc.left(20) + "...";    std::string text(qstrtostr(qtrunc));    if (text == "")        text = "Sample";    Text rtext(text, type);    m_textExampleLabel->setPixmap    (NotePixmapFactory::toQPixmap(m_notePixmapFactory->makeTextPixmap(rtext)));}voidTextEventDialog::slotTypeChanged(const QString &){    std::string type(getTextType());    QString qtrunc(m_text->text());    if (qtrunc.length() > 20)        qtrunc = qtrunc.left(20) + "...";    std::string text(qstrtostr(qtrunc));    if (text == "")        text = "Sample";    Text rtext(text, type);    m_textExampleLabel->setPixmap    (NotePixmapFactory::toQPixmap(m_notePixmapFactory->makeTextPixmap(rtext)));    //    // swap widgets in and out, depending on the current text type    //    if (type == Text::Dynamic) {        m_dynamicShortcutLabel->show();        m_dynamicShortcutCombo->show();        slotDynamicShortcutChanged(text);    } else {        m_dynamicShortcutLabel->hide();        m_dynamicShortcutCombo->hide();    }    if (type == Text::Direction) {        m_directionShortcutLabel->show();        m_directionShortcutCombo->show();        slotDirectionShortcutChanged(text);    } else {        m_directionShortcutLabel->hide();        m_directionShortcutCombo->hide();    }    if (type == Text::LocalDirection) {        m_localDirectionShortcutLabel->show();        m_localDirectionShortcutCombo->show();        slotLocalDirectionShortcutChanged(text);    } else {        m_localDirectionShortcutLabel->hide();        m_localDirectionShortcutCombo->hide();    }    if (type == Text::Tempo) {        m_tempoShortcutLabel->show();        m_tempoShortcutCombo->show();        slotTempoShortcutChanged(text);    } else {        m_tempoShortcutLabel->hide();        m_tempoShortcutCombo->hide();    }    if (type == Text::LocalTempo) {        m_localTempoShortcutLabel->show();        m_localTempoShortcutCombo->show();        slotLocalTempoShortcutChanged(text);    } else {        m_localTempoShortcutLabel->hide();        m_localTempoShortcutCombo->hide();    }    // restore previous text of appropriate type    if (type == Text::Lyric)        m_text->setText(m_prevLyric);    else if (type == Text::Chord)        m_text->setText(m_prevChord);    else if (type == Text::Annotation)        m_text->setText(m_prevAnnotation);    //    // Lilypond directives only taking temporary residence here; will move out    // into some new class eventually    //    if (type == Text::LilypondDirective) {        m_lilypondDirectiveCombo->show();        m_directiveLabel->show();        m_staffAboveLabel->hide();        m_staffBelowLabel->show();        m_text->setReadOnly(true);        m_text->setEnabled(false);        slotLilypondDirectiveChanged(text);    } else {        m_lilypondDirectiveCombo->hide();        m_directiveLabel->hide();        m_text->setReadOnly(false);        m_text->setEnabled(true);        if (type == Text::Dynamic ||            type == Text::LocalDirection ||            type == Text::UnspecifiedType ||            type == Text::Lyric ||            type == Text::Annotation) {            m_staffAboveLabel->show();            m_staffBelowLabel->hide();        } else {            m_staffAboveLabel->hide();            m_staffBelowLabel->show();        }        if (type == Text::Lyric) {            m_verseLabel->show();            m_verseSpin->show();        }    }}voidTextEventDialog::slotOK(){    // store last setting for shortcut combos    KConfig *config = kapp->config();    config->setGroup(NotationViewConfigGroup);    config->writeEntry("dynamic_shortcut", m_dynamicShortcutCombo->currentItem());    config->writeEntry("direction_shortcut", m_directionShortcutCombo->currentItem());    config->writeEntry("local_direction_shortcut", m_localDirectionShortcutCombo->currentItem());    config->writeEntry("tempo_shortcut", m_tempoShortcutCombo->currentItem());    config->writeEntry("local_tempo_shortcut", m_localTempoShortcutCombo->currentItem());    // temporary home:    config->writeEntry("lilypond_directive_combo", m_lilypondDirectiveCombo->currentItem());    // store  last chord, lyric, annotation, depending on what's currently in    // the text entry widget    int index = m_typeCombo->currentItem();    if (index == 5)        config->writeEntry("previous_chord", m_text->text());    else if (index == 6)        config->writeEntry("previous_lyric", m_text->text());    else if (index == 7)        config->writeEntry("previous_annotation", m_text->text());}voidTextEventDialog::slotDynamicShortcutChanged(const QString &text){    if (text == "" || text == "Sample") {        m_text->setText(strtoqstr(m_dynamicShortcutCombo->currentText()));    } else {        m_text->setText(text);    }}voidTextEventDialog::slotDirectionShortcutChanged(const QString &text){    if (text == "" || text == "Sample") {        m_text->setText(strtoqstr(m_directionShortcutCombo->currentText()));    } else {        m_text->setText(text);    }}voidTextEventDialog::slotLocalDirectionShortcutChanged(const QString &text){    if (text == "" || text == "Sample") {        m_text->setText(strtoqstr(m_localDirectionShortcutCombo->currentText()));    } else {        m_text->setText(text);    }}voidTextEventDialog::slotTempoShortcutChanged(const QString &text){    if (text == "" || text == "Sample") {        m_text->setText(strtoqstr(m_tempoShortcutCombo->currentText()));    } else {        m_text->setText(text);    }}voidTextEventDialog::slotLocalTempoShortcutChanged(const QString &text){    if (text == "" || text == "Sample") {        m_text->setText(strtoqstr(m_localTempoShortcutCombo->currentText()));    } else {        m_text->setText(text);    }}voidTextEventDialog::slotLilypondDirectiveChanged(const QString &){    m_text->setText(strtoqstr(m_lilypondDirectiveCombo->currentText()));}}#include "TextEventDialog.moc"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -