void StaffTextProperties::channelItemChanged(QTreeWidgetItem* item, QTreeWidgetItem* pitem) { if (pitem) saveChannel(pitem->data(0, Qt::UserRole).toInt()); if (item == 0) return; actionList->clear(); Part* part = _staffText->staff()->part(); int channelIdx = item->data(0, Qt::UserRole).toInt(); int tick = static_cast<Segment*>(_staffText->parent())->tick(); Channel* channel = part->instrument(tick)->channel(channelIdx); QString channelName = channel->name; for (const NamedEventList& e : part->instrument(tick)->midiActions()) { QTreeWidgetItem* ti = new QTreeWidgetItem(actionList); if (e.name.isEmpty() || e.name == "normal") { ti->setText(0, tr("normal")); ti->setData(0, Qt::UserRole, "normal"); } else { ti->setText(0, qApp->translate("InstrumentsXML", e.name.toUtf8().data())); ti->setData(0, Qt::UserRole, e.name); } ti->setText(1, qApp->translate("InstrumentsXML", e.descr.toUtf8().data())); } for (const NamedEventList& e : channel->midiActions) { QTreeWidgetItem* ti = new QTreeWidgetItem(actionList); if (e.name.isEmpty() || e.name == "normal") { ti->setText(0, tr("normal")); ti->setData(0, Qt::UserRole, "normal"); } else { ti->setText(0, qApp->translate("InstrumentsXML", e.name.toUtf8().data())); ti->setData(0, Qt::UserRole, e.name); } ti->setText(1, qApp->translate("InstrumentsXML", e.descr.toUtf8().data())); } for (const ChannelActions& ca : *_staffText->channelActions()) { if (ca.channel == channelIdx) { for (QString s : ca.midiActionNames) { QList<QTreeWidgetItem*> items; for (int i = 0; i < actionList->topLevelItemCount(); i++) { QTreeWidgetItem* ti = actionList->topLevelItem(i); if (ti->data(0, Qt::UserRole) == s) { ti->setSelected(true); } } } } } }
void StaffTextProperties::saveValues() { // // save channel switches // Part* part = _staffText->staff()->part(); for (int voice = 0; voice < VOICES; ++voice) { _staffText->setChannelName(voice, QString()); for (int row = 0; row < VOICES; ++row) { if (vb[voice][row]->isChecked()) { int idx = channelCombo[row]->currentIndex(); int instrId = static_cast<Segment*>(_staffText->parent())->tick(); _staffText->setChannelName(voice, part->instrument(instrId)->channel()[idx]->name); break; } } } QTreeWidgetItem* pitem = channelList->currentItem(); if (pitem) saveChannel(pitem->data(0, Qt::UserRole).toInt()); // // save Aeolus stops // _staffText->setSetAeolusStops(changeStops->isChecked()); if (changeStops->isChecked()) { for (int i = 0; i < 4; ++i) { for (int k = 0; k < 16; ++k) { if (stops[i][k]) _staffText->setAeolusStop(i, k, stops[i][k]->isChecked()); } } } if (setSwingBox->isChecked()) { _staffText->setSwing(true); if (SwingOff->isChecked()) { _staffText->setSwingParameters(0, swingBox->value()); swingBox->setEnabled(false); } else if (swingEighth->isChecked()) { _staffText->setSwingParameters(MScore::division/2, swingBox->value()); swingBox->setEnabled(true); } else if (swingSixteenth->isChecked()) { _staffText->setSwingParameters(MScore::division/4, swingBox->value()); swingBox->setEnabled(true); } } }
void Application::init() { // The very first thing to do is to add the current directory in DynamicObjectManager's list of repositories // In case some modules would need to load some config files shared_ptr<ISource> loadChannel(new SourceFile(".", false)); shared_ptr<ISource> saveChannel(new SourceFile(".", true)); DynamicObjectManager *pom = DynamicObjectManager::getInstancePtr(); SoundManager *soundManager = SoundManager::getInstancePtr(); GNOLL_LOG() << "Adding load/save source for current path to the DynamicObjectManager\n"; pom->addLoadSource(loadChannel); pom->addSaveSource(saveChannel); GNOLL_LOG() << "Adding load/save source for current path to the SoundManager\n"; soundManager->addLoadSource(loadChannel); soundManager->addSaveSource(saveChannel); /** * Now program options have been parsed, * program is initialized */ GNOLL_LOG() << "Instanciating modules...\n"; logModule = CLogModule::getInstancePtr(); graphicmanager = CGraphicModule::getInstancePtr(); timeModule = CTimeModule::getInstancePtr(); messageModule = CMessageModule::getInstancePtr(); soundmanager = CSoundModule::getInstancePtr(); inputEventsTranslator = CInputEventsTranslator::getInstancePtr(); statsModule = CStatsModule::getInstancePtr(); GNOLL_LOG() << "Instanciating modules...[DONE]\n"; try { GNOLL_LOG() << "Initializing message module\n"; messageModule->init(); GNOLL_LOG() << "Initializing message module [DONE]\n"; GNOLL_LOG() << "Initializing graphic module\n"; graphicmanager->init(); GNOLL_LOG() << "Initializing graphic module [DONE]\n"; GNOLL_LOG() << "Initializing input manager\n"; inputmanager.init(); GNOLL_LOG() << "Initializing input manager [DONE]\n"; GNOLL_LOG() << "Initializing sound manager\n"; soundmanager->init(); GNOLL_LOG() << "Initializing sound manager [DONE]\n"; GNOLL_LOG() << "Initializing time module\n"; timeModule->init(); GNOLL_LOG() << "Initializing time module [DONE]\n"; GNOLL_LOG() << "Initializing input event translator\n"; inputEventsTranslator->init(); GNOLL_LOG() << "Initializing input event translator [DONE]\n"; GNOLL_LOG() << "Initializing stats module\n"; statsModule->init(); GNOLL_LOG() << "Initializing stats module [DONE]\n"; } catch (Glib::ustring str) { cout << str << endl; } /* * Define the listener of the application * like the message on quit */ shared_ptr<Gnoll::ApplicationListener> listenerInput = shared_ptr<Gnoll::ApplicationListener>( new Gnoll::ApplicationListener()); messageModule->getMessageManager()->addListener ( listenerInput, Messages::MessageType(Gnoll::Input::ACTION_EVENT_TYPE) ); /** * Define the listener for the button */ CEGUI::PushButton *button_quit; button_quit = (CEGUI::PushButton *) CEGUI::WindowManager::getSingleton().getWindow("buttonQuit"); button_quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Application::quit_OnClick, this)); }