本文整理汇总了C++中phonon::MediaObject::setParent方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaObject::setParent方法的具体用法?C++ MediaObject::setParent怎么用?C++ MediaObject::setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phonon::MediaObject
的用法示例。
在下文中一共展示了MediaObject::setParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug() << Phonon::BackendCapabilities::availableMimeTypes();
Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory,
Phonon::MediaSource("../myPhonon1/mysong.mp3"));
music->setParent(this);
music->play();
}
示例2: playSound
void SoundEditWidget::playSound()
{
if (!mHasSound) {
return;
}
Phonon::MediaObject *player = Phonon::createPlayer(Phonon::NotificationCategory);
QBuffer *soundData = new QBuffer(player);
soundData->setData(mSound);
player->setCurrentSource(soundData);
player->setParent(this);
connect(player, &Phonon::MediaObject::finished, player, &Phonon::MediaObject::deleteLater);
player->play();
}
示例3: playSound
void SoundEditWidget::playSound()
{
if ( !mHasSound ) {
return;
}
#ifndef Q_OS_WINCE
Phonon::MediaObject* player = Phonon::createPlayer( Phonon::NotificationCategory );
QBuffer* soundData = new QBuffer( player );
soundData->setData( mSound );
player->setCurrentSource( soundData );
player->setParent( this );
connect( player, SIGNAL(finished()), player, SLOT(deleteLater()) );
player->play();
#endif
}
示例4: eventNotification
void AlarmDialog::eventNotification()
{
bool beeped = false;
bool found = false;
ReminderList list;
QTreeWidgetItemIterator it( mIncidenceTree );
while ( *it ) {
ReminderListItem *item = static_cast<ReminderListItem *>( *it );
++it;
if ( item->isDisabled() || item->mNotified ) {
//skip suspended reminders or reminders that have been notified
continue;
}
found = true;
item->mNotified = true;
Incidence::Ptr incidence = CalendarSupport::incidence( item->mIncidence );
Alarm::List alarms = incidence->alarms();
Alarm::List::ConstIterator ait;
for ( ait = alarms.constBegin(); ait != alarms.constEnd(); ++ait ) {
Alarm::Ptr alarm = *ait;
// FIXME: Check whether this should be done for all multiple alarms
if ( alarm->type() == Alarm::Procedure ) {
// FIXME: Add a message box asking whether the procedure should really be executed
kDebug() << "Starting program: '" << alarm->programFile() << "'";
QString program = alarm->programFile();
// if the program name contains spaces escape it
if ( program.contains( ' ' ) &&
!( program.startsWith( '\"' ) && program.endsWith( '\"' ) ) ) {
program = '\"' + program + '\"';
}
QProcess::startDetached( program + ' ' + alarm->programArguments() );
} else if ( alarm->type() == Alarm::Audio ) {
beeped = true;
Phonon::MediaObject *player =
Phonon::createPlayer( Phonon::NotificationCategory, alarm->audioFile() );
player->setParent( this );
connect( player, SIGNAL(finished()), player, SLOT(deleteLater()) );
player->play();
} else if ( alarm->type() == Alarm::Email ) {
QString from = CalendarSupport::KCalPrefs::instance()->email();
Identity id = KOCore::self()->identityManager()->identityForAddress( from );
QString to;
if ( alarm->mailAddresses().isEmpty() ) {
to = from;
} else {
const Person::List addresses = alarm->mailAddresses();
QStringList add;
for ( Person::List::ConstIterator it = addresses.constBegin();
it != addresses.constEnd(); ++it ) {
add << (*it)->fullName();
}
to = add.join( ", " );
}
QString subject;
Akonadi::Item parentItem = mCalendar->itemForIncidenceUid( alarm->parentUid() );
Incidence::Ptr parent = CalendarSupport::incidence( parentItem );
if ( alarm->mailSubject().isEmpty() ) {
if ( parent->summary().isEmpty() ) {
subject = i18nc( "@title", "Reminder" );
} else {
subject = i18nc( "@title", "Reminder: %1", cleanSummary( parent->summary() ) );
}
} else {
subject = i18nc( "@title", "Reminder: %1", alarm->mailSubject() );
}
QString body =
IncidenceFormatter::mailBodyStr(
parent.staticCast<IncidenceBase>(), KSystemTimeZones::local() );
if ( !alarm->mailText().isEmpty() ) {
body += '\n' + alarm->mailText();
}
//TODO: support attachments
CalendarSupport::MailClient mailer;
mailer.send( id, from, to, QString(), subject, body, true, false, QString(),
MailTransport::TransportManager::self()->defaultTransportName() );
}
}
}
if ( !beeped && found ) {
KNotification::beep();
}
}