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

📄 eventeditdialog.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    case Bool: {            QCheckBox *checkBox = new QCheckBox                                  ("", m_persistentGrid, strtoqstr(name));            checkBox->setChecked(m_originalEvent.get<Bool>(name));            QObject::connect(checkBox, SIGNAL(activated()),                             this, SLOT(slotBoolPropertyChanged()));            checkBox->show();            break;        }    case String: {            QLineEdit *lineEdit = new QLineEdit                                  (strtoqstr(m_originalEvent.get<String>(name)),                                   m_persistentGrid,                                   strtoqstr(name));            QObject::connect(lineEdit, SIGNAL(textChanged(const QString &)),                             this, SLOT(slotStringPropertyChanged(const QString &)));            lineEdit->show();            break;        }    }    QPushButton *button = new QPushButton("X", m_persistentGrid,                                          strtoqstr(name));    button->setFixedSize(QSize(24, 24));    QToolTip::add        (button, i18n("Delete this property"));    QObject::connect(button, SIGNAL(clicked()),                     this, SLOT(slotPropertyDeleted()));    button->show();}EventEventEditDialog::getEvent() const{    return Event(m_event, m_absoluteTime, m_duration, m_subOrdering);}voidEventEditDialog::slotEventTypeChanged(const QString &type){    std::string t(qstrtostr(type));    if (t != m_type) {        m_modified = true;        m_type = t;    }}voidEventEditDialog::slotAbsoluteTimeChanged(int value){    if (value == m_absoluteTime)        return ;    m_modified = true;    m_absoluteTime = value;}voidEventEditDialog::slotDurationChanged(int value){    timeT error = 0;    m_durationDisplay->setPixmap    (NotePixmapFactory::toQPixmap(m_notePixmapFactory.makeNoteMenuPixmap(timeT(value), error)));    if (error >= value / 2) {        m_durationDisplayAux->setText("++ ");    } else if (error > 0) {        m_durationDisplayAux->setText("+ ");    } else if (error < 0) {        m_durationDisplayAux->setText("- ");    } else {        m_durationDisplayAux->setText(" ");    }    if (timeT(value) == m_duration)        return ;    m_modified = true;    m_duration = value;}voidEventEditDialog::slotSubOrderingChanged(int value){    if (value == m_subOrdering)        return ;    m_modified = true;    m_subOrdering = value;}voidEventEditDialog::slotIntPropertyChanged(int value){    const QObject *s = sender();    const QSpinBox *spinBox = dynamic_cast<const QSpinBox *>(s);    if (!spinBox)        return ;    m_modified = true;    QString propertyName = spinBox->name();    m_event.set<Int>(qstrtostr(propertyName), value);}voidEventEditDialog::slotRealTimePropertyChanged(int value){    const QObject *s = sender();    const QSpinBox *spinBox = dynamic_cast<const QSpinBox *>(s);    if (!spinBox)        return ;    m_modified = true;    QString propertyFullName = spinBox->name();    QString propertyName = propertyFullName.section('%', 0, 0),                           nsecOrSec = propertyFullName.section('%', 1, 1);    RealTime realTime = m_event.get<RealTimeT>(qstrtostr(propertyName));    if (nsecOrSec == "sec")        realTime.sec = value;    else        realTime.nsec = value;    m_event.set<Int>(qstrtostr(propertyName), value);}voidEventEditDialog::slotBoolPropertyChanged(){    const QObject *s = sender();    const QCheckBox *checkBox = dynamic_cast<const QCheckBox *>(s);    if (!checkBox)        return ;    m_modified = true;    QString propertyName = checkBox->name();    bool checked = checkBox->isChecked();    m_event.set<Bool>(qstrtostr(propertyName), checked);}voidEventEditDialog::slotStringPropertyChanged(const QString &value){    const QObject *s = sender();    const QLineEdit *lineEdit = dynamic_cast<const QLineEdit *>(s);    if (!lineEdit)        return ;    m_modified = true;    QString propertyName = lineEdit->name();    m_event.set<String>(qstrtostr(propertyName), qstrtostr(value));}voidEventEditDialog::slotPropertyDeleted(){    const QObject *s = sender();    const QPushButton *pushButton = dynamic_cast<const QPushButton *>(s);    if (!pushButton)        return ;    QString propertyName = pushButton->name();    if (KMessageBox::warningContinueCancel            (this,             i18n("Are you sure you want to delete the \"%1\" property?\n\n"                  "Removing necessary properties may cause unexpected behavior.").             arg(propertyName),             i18n("Edit Event"),             i18n("&Delete")) != KMessageBox::Continue)        return ;    m_modified = true;    QObjectList *list = m_persistentGrid->queryList(0, propertyName, false);    QObjectListIt i(*list);    QObject *obj;    while ((obj = i.current()) != 0) {        ++i;        delete obj;    }    delete list;    m_event.unset(qstrtostr(propertyName));}voidEventEditDialog::slotPropertyMadePersistent(){    const QObject *s = sender();    const QPushButton *pushButton = dynamic_cast<const QPushButton *>(s);    if (!pushButton)        return ;    QString propertyName = pushButton->name();    if (KMessageBox::warningContinueCancel            (this,             i18n("Are you sure you want to make the \"%1\" property persistent?\n\n"                  "This could cause problems if it overrides a different "                  "computed value later on.").             arg(propertyName),             i18n("Edit Event"),             i18n("Make &Persistent")) != KMessageBox::Continue)        return ;    QObjectList *list = m_nonPersistentGrid->queryList(0, propertyName, false);    QObjectListIt i(*list);    QObject *obj;    while ((obj = i.current()) != 0) {        ++i;        delete obj;    }    delete list;    m_modified = true;    addPersistentProperty(qstrtostr(propertyName));    PropertyType type =        m_originalEvent.getPropertyType(qstrtostr(propertyName));    switch (type) {    case Int:        m_event.set<Int>        (qstrtostr(propertyName),         m_originalEvent.get<Int>         (qstrtostr(propertyName)));        break;    case UInt:        m_event.set<UInt>        (qstrtostr(propertyName),         m_originalEvent.get<UInt>         (qstrtostr(propertyName)));        break;    case RealTimeT:        m_event.set<RealTimeT>        (qstrtostr(propertyName),         m_originalEvent.get<RealTimeT>         (qstrtostr(propertyName)));        break;    case Bool:        m_event.set<Bool>        (qstrtostr(propertyName),         m_originalEvent.get<Bool>         (qstrtostr(propertyName)));        break;    case String:        m_event.set<String>        (qstrtostr(propertyName),         m_originalEvent.get<String>         (qstrtostr(propertyName)));        break;    }}}#include "EventEditDialog.moc"

⌨️ 快捷键说明

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