bool XmlPdf::print(QString file) { QPrinter printer(QPrinter::HighResolution); printer.setPaperSize(paperSize); printer.setOrientation(paperOrientation); printer.setOutputFormat(QPrinter::PdfFormat); printer.setPageMargins(8.53, 8.53, 3.53, 3.53, QPrinter::Millimeter); if (file.isEmpty()) { QPrintDialog *dialog = new QPrintDialog(&printer); dialog->setWindowTitle(QObject::tr("Print Document")); if (dialog->exec() != QDialog::Accepted) { qDebug() << "Printing aborted and no Filename given, canceled printing..."; return false; } } else { printer.setOutputFileName(file); } QPainter *painter = new QPainter(); if (!painter->begin(&printer)) { qDebug() << QString("The File is not writable:\n%1").arg(file); return false; } addDynamics(painter, &printer); addStatics(painter); painter->end(); return true; }
void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) { if (value.isUndefined() || value.asInteger() == 0) { LLAvatarActions::showProfile(mOtherParticipantUUID); return; } int option = value.asInteger(); if (option == 1) onClickHistory(); else if (option == 2) LLAvatarActions::offerTeleport(mOtherParticipantUUID); else if (option == 3) LLAvatarActions::teleportRequest(mOtherParticipantUUID); else if (option == 4) LLAvatarActions::pay(mOtherParticipantUUID); else if (option == 5) LLAvatarActions::inviteToGroup(mOtherParticipantUUID); else if (option == -1) copy_profile_uri(mOtherParticipantUUID); else if (option >= 6) // Options that use dynamic items { // First remove them all removeDynamics(flyout); // Toggle as requested, adjust the strings if (option == 6) mDing = !mDing; else if (option == 7) mRPMode = !mRPMode; else if (option == 8) LLAvatarActions::isFriend(mOtherParticipantUUID) ? LLAvatarActions::removeFriendDialog(mOtherParticipantUUID) : LLAvatarActions::requestFriendshipDialog(mOtherParticipantUUID); //else if (option == 9) LLAvatarActions::toggleBlock(mOtherParticipantUUID); // Last add them back addDynamics(flyout); } }
void MissileSim::_linkModelsToSim( SimState & state ){ addDiscrete(&tstep, 1000); addDynamics(&missile); missile.addSubModels(*this); }
// virtual BOOL LLFloaterIMPanel::postBuild() { requires<LLLineEditor>("chat_editor"); requires<LLTextEditor>("im_history"); if (checkRequirements()) { setTitle(mLogLabel); if (mSessionType == P2P_SESSION && LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID)) LLAvatarNameCache::get(mOtherParticipantUUID, boost::bind(&LLFloaterIMPanel::onAvatarNameLookup, this, _2)); mInputEditor = getChild<LLLineEditor>("chat_editor"); mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); mInputEditor->setFocusReceivedCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusReceived, this) ); mFocusLostSignal = mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMPanel::setTyping, this, false)); mInputEditor->setKeystrokeCallback( boost::bind(&LLFloaterIMPanel::onInputEditorKeystroke, this, _1) ); mInputEditor->setCommitCallback( boost::bind(&LLFloaterIMPanel::onSendMsg,this) ); mInputEditor->setCommitOnFocusLost( FALSE ); mInputEditor->setRevertOnEsc( FALSE ); mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); mInputEditor->setPassDelete( TRUE ); if (LLComboBox* flyout = findChild<LLComboBox>("instant_message_flyout")) { flyout->setCommitCallback(boost::bind(&LLFloaterIMPanel::onFlyoutCommit, this, flyout, _2)); addDynamics(flyout); } if (LLUICtrl* ctrl = findChild<LLUICtrl>("tp_btn")) ctrl->setCommitCallback(boost::bind(static_cast<void(*)(const LLUUID&)>(LLAvatarActions::offerTeleport), mOtherParticipantUUID)); if (LLUICtrl* ctrl = findChild<LLUICtrl>("pay_btn")) ctrl->setCommitCallback(boost::bind(LLAvatarActions::pay, mOtherParticipantUUID)); if (LLButton* btn = findChild<LLButton>("group_info_btn")) btn->setCommitCallback(boost::bind(LLGroupActions::show, mSessionUUID)); if (LLUICtrl* ctrl = findChild<LLUICtrl>("history_btn")) ctrl->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickHistory, this)); getChild<LLButton>("start_call_btn")->setCommitCallback(boost::bind(&LLIMMgr::startCall, gIMMgr, boost::ref(mSessionUUID), LLVoiceChannel::OUTGOING_CALL)); getChild<LLButton>("end_call_btn")->setCommitCallback(boost::bind(&LLIMMgr::endCall, gIMMgr, boost::ref(mSessionUUID))); getChild<LLButton>("send_btn")->setCommitCallback(boost::bind(&LLFloaterIMPanel::onSendMsg,this)); if (LLButton* btn = findChild<LLButton>("toggle_active_speakers_btn")) btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickToggleActiveSpeakers, this, _2)); mHistoryEditor = getChild<LLViewerTextEditor>("im_history"); mHistoryEditor->setParseHTML(TRUE); mHistoryEditor->setParseHighlights(TRUE); sTitleString = getString("title_string"); sTypingStartString = getString("typing_start_string"); sSessionStartString = getString("session_start_string"); if (mSpeakerPanel) { mSpeakerPanel->refreshSpeakers(); } if (mSessionType == P2P_SESSION) { getChild<LLUICtrl>("mute_btn")->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickMuteVoice, this)); getChild<LLUICtrl>("speaker_volume")->setCommitCallback(boost::bind(&LLVoiceClient::setUserVolume, LLVoiceClient::getInstance(), mOtherParticipantUUID, _2)); } setDefaultBtn("send_btn"); mVolumeSlider.connect(this,"speaker_volume"); mEndCallBtn.connect(this,"end_call_btn"); mStartCallBtn.connect(this,"start_call_btn"); mSendBtn.connect(this,"send_btn"); mMuteBtn.connect(this,"mute_btn"); return TRUE; } return FALSE; }
DirectionTypePtr Direction::createDirectionType( std::ostream& message, xml::XElementIterator& subIter, xml::XElementIterator& subIterEnd, bool& isSuccess ) { auto directionType = makeDirectionType(); if( subIter == subIterEnd ) { message << "Direction: well thats weird - should not get here" << std::endl; isSuccess = false; return directionType; } if( subIter->getName() == "wedge" ) { directionType->setChoice( DirectionType::Choice::wedge ); isSuccess &= directionType->getWedge()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "dashes" ) { directionType->setChoice( DirectionType::Choice::dashes ); isSuccess &= directionType->getDashes()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "bracket" ) { directionType->setChoice( DirectionType::Choice::bracket ); isSuccess &= directionType->getBracket()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "pedal" ) { directionType->setChoice( DirectionType::Choice::pedal ); isSuccess &= directionType->getPedal()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "metronome" ) { directionType->setChoice( DirectionType::Choice::metronome ); isSuccess &= directionType->getMetronome()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "octave-shift" ) { directionType->setChoice( DirectionType::Choice::octaveShift ); isSuccess &= directionType->getOctaveShift()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "harp-pedals" ) { directionType->setChoice( DirectionType::Choice::harpPedals ); isSuccess &= directionType->getHarpPedals()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "damp" ) { directionType->setChoice( DirectionType::Choice::damp ); isSuccess &= directionType->getDamp()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "damp-all" ) { directionType->setChoice( DirectionType::Choice::dampAll ); isSuccess &= directionType->getDampAll()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "eyeglasses" ) { directionType->setChoice( DirectionType::Choice::eyeglasses ); isSuccess &= directionType->getEyeglasses()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "string-mute" ) { directionType->setChoice( DirectionType::Choice::stringMute ); isSuccess &= directionType->getStringMute()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "scordatura" ) { directionType->setChoice( DirectionType::Choice::scordatura ); isSuccess &= directionType->getScordatura()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "image" ) { directionType->setChoice( DirectionType::Choice::image ); isSuccess &= directionType->getImage()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "principal-voice" ) { directionType->setChoice( DirectionType::Choice::principalVoice ); isSuccess &= directionType->getPrincipalVoice()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "accordion-registration" ) { directionType->setChoice( DirectionType::Choice::accordionRegistration ); isSuccess &= directionType->getAccordionRegistration()->fromXElement( message, *subIter ); return directionType; } if( subIter->getName() == "other-direction" ) { directionType->setChoice( DirectionType::Choice::otherDirection ); isSuccess &= directionType->getOtherDirection()->fromXElement( message, *subIter ); return directionType; } std::string name = "rehearsal"; if( subIter->getName() == name ) { directionType->setChoice( DirectionType::Choice::rehearsal ); bool isFirstSubItemAdded = false; while( subIter != subIterEnd ) { if( subIter->getName() != name ) { message << "Direction: createDirectionType encountered an unexpected element '" << subIter->getName() << "' while parsing a collection of '" << name << "' elements" << std::endl; isSuccess = false; return directionType; } auto itemToAdd = makeRehearsal(); isSuccess &= itemToAdd->fromXElement( message, *subIter ); if( !isFirstSubItemAdded && directionType->getRehearsalSet().size() == 1 ) { directionType->addRehearsal( itemToAdd ); directionType->removeRehearsal( directionType->getRehearsalSet().cbegin() ); } else { directionType->addRehearsal( itemToAdd ); } isFirstSubItemAdded = true; ++subIter; } // end loop return directionType; } // end rehearsal name = "segno"; if( subIter->getName() == name ) { directionType->setChoice( DirectionType::Choice::segno ); bool isFirstSubItemAdded = false; while( subIter != subIterEnd ) { if( subIter->getName() != name ) { message << "Direction: createDirectionType encountered an unexpected element '" << subIter->getName() << "' while parsing a collection of '" << name << "' elements" << std::endl; isSuccess = false; return directionType; } auto itemToAdd = makeSegno(); isSuccess &= itemToAdd->fromXElement( message, *subIter ); if( !isFirstSubItemAdded && directionType->getSegnoSet().size() == 1 ) { directionType->addSegno( itemToAdd ); directionType->removeSegno( directionType->getSegnoSet().cbegin() ); } else { directionType->addSegno( itemToAdd ); } isFirstSubItemAdded = true; ++subIter; } // end loop return directionType; } // end segno name = "words"; if( subIter->getName() == name ) { directionType->setChoice( DirectionType::Choice::words ); bool isFirstSubItemAdded = false; while( subIter != subIterEnd ) { if( subIter->getName() != name ) { message << "Direction: createDirectionType encountered an unexpected element '" << subIter->getName() << "' while parsing a collection of '" << name << "' elements" << std::endl; isSuccess = false; return directionType; } auto itemToAdd = makeWords(); isSuccess &= itemToAdd->fromXElement( message, *subIter ); if( !isFirstSubItemAdded && directionType->getWordsSet().size() == 1 ) { directionType->addWords( itemToAdd ); directionType->removeWords( directionType->getWordsSet().cbegin() ); } else { directionType->addWords( itemToAdd ); } isFirstSubItemAdded = true; ++subIter; } // end loop return directionType; } // end words name = "coda"; if( subIter->getName() == name ) { directionType->setChoice( DirectionType::Choice::coda ); bool isFirstSubItemAdded = false; while( subIter != subIterEnd ) { if( subIter->getName() != name ) { message << "Direction: createDirectionType encountered an unexpected element '" << subIter->getName() << "' while parsing a collection of '" << name << "' elements" << std::endl; isSuccess = false; return directionType; } auto itemToAdd = makeCoda(); isSuccess &= itemToAdd->fromXElement( message, *subIter ); if( !isFirstSubItemAdded && directionType->getCodaSet().size() == 1 ) { directionType->addCoda( itemToAdd ); directionType->removeCoda( directionType->getCodaSet().cbegin() ); } else { directionType->addCoda( itemToAdd ); } isFirstSubItemAdded = true; ++subIter; } // end loop return directionType; } // end coda name = "dynamics"; if( subIter->getName() == name ) { directionType->setChoice( DirectionType::Choice::dynamics ); bool isFirstSubItemAdded = false; while( subIter != subIterEnd ) { if( subIter->getName() != name ) { message << "Direction: createDirectionType encountered an unexpected element '" << subIter->getName() << "' while parsing a collection of '" << name << "' elements" << std::endl; isSuccess = false; return directionType; } auto itemToAdd = makeDynamics(); isSuccess &= itemToAdd->fromXElement( message, *subIter ); if( !isFirstSubItemAdded && directionType->getDynamicsSet().size() == 1 ) { directionType->addDynamics( itemToAdd ); directionType->removeDynamics( directionType->getDynamicsSet().cbegin() ); } else { directionType->addDynamics( itemToAdd ); } isFirstSubItemAdded = true; ++subIter; } // end loop return directionType; } // end dynamics name = "percussion"; if( subIter->getName() == name ) { directionType->setChoice( DirectionType::Choice::percussion ); bool isFirstSubItemAdded = false; while( subIter != subIterEnd ) { if( subIter->getName() != name ) { message << "Direction: createDirectionType encountered an unexpected element '" << subIter->getName() << "' while parsing a collection of '" << name << "' elements" << std::endl; isSuccess = false; return directionType; } auto itemToAdd = makePercussion(); isSuccess &= itemToAdd->fromXElement( message, *subIter ); if( !isFirstSubItemAdded && directionType->getPercussionSet().size() == 1 ) { directionType->addPercussion( itemToAdd ); directionType->removePercussion( directionType->getPercussionSet().cbegin() ); } else { directionType->addPercussion( itemToAdd ); } isFirstSubItemAdded = true; ++subIter; } // end loop return directionType; } // end percussion return directionType; }