本文整理汇总了C++中Medium类的典型用法代码示例。如果您正苦于以下问题:C++ Medium类的具体用法?C++ Medium怎么用?C++ Medium使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Medium类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kdDebug
bool MediaImpl::statMedium(const QString &name, KIO::UDSEntry &entry)
{
kdDebug(1219) << "MediaImpl::statMedium: " << name << endl;
DCOPRef mediamanager("kded", "mediamanager");
DCOPReply reply = mediamanager.call("properties", name);
if(!reply.isValid())
{
m_lastErrorCode = KIO::ERR_SLAVE_DEFINED;
m_lastErrorMessage = i18n("The KDE mediamanager is not running.");
return false;
}
Medium m = Medium::create(reply);
if(m.id().isEmpty())
{
entry.clear();
return false;
}
createMediumEntry(entry, m);
return true;
}
示例2: ManualDeviceAdder
void
MediumPluginManager::newDevice()
{
DEBUG_BLOCK
ManualDeviceAdder* mda = new ManualDeviceAdder( this );
if( mda->exec() == QDialog::Accepted && mda->successful() && mda->getMedium() != 0 )
{
if( amaroK::config( "MediaBrowser" )->readEntry( mda->getMedium()->id() ) != QString::null )
{
//abort! Can't have the same device defined twice...should never
//happen due to name checking earlier...right?
amaroK::StatusBar::instance()->longMessageThreadSafe( i18n("Sorry, you cannot define two devices\n"
"with the same name and mountpoint!") );
}
else
{
Medium *newdev = mda->getMedium();
amaroK::config( "MediaBrowser" )->writeEntry( newdev->id(), mda->getPlugin() );
DeviceManager::instance()->addManualDevice( newdev );
m_newDevMap[newdev->id()] = newdev;
detectDevices();
}
}
delete mda;
slotChanged();
}
示例3: generateName
bool RemovableBackend::plug(const QString &devNode, const QString &label)
{
QString name = generateName(devNode);
QString id = generateId(devNode);
if(!m_removableIds.contains(id))
{
Medium *medium = new Medium(id, name);
medium->mountableState(devNode, QString::null, QString::null, false);
QStringList words = QStringList::split(" ", label);
QStringList::iterator it = words.begin();
QStringList::iterator end = words.end();
QString tmp = (*it).lower();
tmp[0] = tmp[0].upper();
QString new_label = tmp;
++it;
for(; it != end; ++it)
{
tmp = (*it).lower();
tmp[0] = tmp[0].upper();
new_label += " " + tmp;
}
medium->setLabel(new_label);
medium->setMimeType("media/removable_unmounted");
m_removableIds.append(id);
return !m_mediaList.addMedium(medium).isNull();
}
return false;
}
示例4: load_media
void Scene::load_media(const string& filename)
{
Medium air;
air.get_ior(mono).resize(1);
air.get_ior(mono)[0] = complex<double>(1.0, 0.0);
air.fill_rgb_data();
air.name = "default";
set_medium(air);
for(unsigned int i = 0; i < planes.size(); ++i)
meshes.push_back(planes[i]->get_mesh());
load_mpml(filename, media, interfaces);
for(unsigned int i = 0; i < meshes.size(); ++i)
for(unsigned int j = 0; j < meshes[i]->materials.size(); ++j)
{
const ObjMaterial& mat = meshes[i]->materials[j];
string name = mat.name;
Interface& iface = interfaces[name];
if(!iface.med_in)
{
iface.name = name;
iface.med_in = &media[name];
iface.med_in->name = name;
Color< complex<double> >& ior = iface.med_in->get_ior(mono);
ior.resize(1);
ior[0] = complex<double>(mat.ior, 0.0);
float emissive = 0.0f;
for(unsigned int k = 0; k < 3; ++k)
emissive += mat.ambient[k];
if(emissive > 0.0)
{
iface.med_in->emissive = true;
Color<double>& emission = iface.med_in->get_emission(rgb);
emission.resize(3);
for(unsigned int k = 0; k < emission.size(); ++k)
emission[k] = mat.ambient[k];
}
}
iface.med_in->fill_rgb_data();
iface.med_in->fill_mono_data();
if(iface.med_out)
{
iface.med_out->fill_rgb_data();
iface.med_out->fill_mono_data();
}
if(mat.has_texture)
{
Texture*& tex = textures[mat.tex_name];
tex = new Texture;
string path_and_name = mat.tex_path + mat.tex_name;
tex->load(path_and_name.c_str());
}
}
for(unsigned int i = 0; i < planes.size(); ++i)
meshes.pop_back();
}
示例5: write_disc
void Tag::write_disc(const Release &release, const Medium &medium) {
if (release.is_multidisc()) {
set("DISCNUMBER", medium.get_position());
set("TOTALDISCS", release.get_medium_total_count());
set("DISCSUBTITLE", medium.get_title());
} else {
unset("DISCNUMBER");
unset("TOTALDISCS");
unset("DISCSUBTITLE");
}
}
示例6: CastGlobalPhoton
void PhotonMappingRenderer::CastGlobalPhoton(Scenery& scenery,
MultispectralPhoton& photon,
bool direct, int depth,
Object* last_object_hit) {
if(depth <= 0)
return;
//Computing nearest intersection
Real distance = -1;
Object* nearest_object = 0;
Point intersection;
//If there is no intersection photon is lost
Ray ray;
ray.v = photon.direction;
ray.o = photon.position;
Basis local_basis;
Point2D surface_coordinate;
if(!scenery.getNearestIntersection(ray, distance, nearest_object,
local_basis, surface_coordinate,
last_object_hit))
return;
//Adding photon to global map
photon.position = local_basis.o;
photon.distance = distance * m_scale;
photon.normal = local_basis.k;
//Compute medium absorption
Medium* medium = 0;
if(photon.direction.dot(local_basis.k) < 0) {
medium = nearest_object->getOuterMedium();
} else {
medium = nearest_object->getInnerMedium();
}
if(!medium->transportPhoton(photon))
return;
if(!direct || m_nb_samples > 0) {
if(photon.direction.dot(local_basis.k) < 0) {
m_global_map_out[nearest_object->getIndex()]->addPhoton(photon);
} else {
m_global_map_in[nearest_object->getIndex()]->addPhoton(photon);
}
}
//Photon bounce
bool specular;
if(nearest_object->bouncePhoton(local_basis, surface_coordinate,
photon, specular)) {
CastGlobalPhoton(scenery, photon, false, depth - 1, nearest_object);
}
}
示例7: i18n
bool MediaImpl::ensureMediumMounted(Medium &medium)
{
if(medium.id().isEmpty())
{
m_lastErrorCode = KIO::ERR_COULD_NOT_MOUNT;
m_lastErrorMessage = i18n("No such medium.");
return false;
}
if(medium.needMounting())
{
m_lastErrorCode = 0;
mp_mounting = &medium;
/*
KIO::Job* job = KIO::mount(false, 0,
medium.deviceNode(),
medium.mountPoint());
job->setAutoWarningHandlingEnabled(false);
connect( job, SIGNAL( result( KIO::Job * ) ),
this, SLOT( slotMountResult( KIO::Job * ) ) );
connect( job, SIGNAL( warning( KIO::Job *, const QString & ) ),
this, SLOT( slotWarning( KIO::Job *, const QString & ) ) );
*/
kapp->dcopClient()->connectDCOPSignal("kded", "mediamanager", "mediumChanged(QString, bool)", "mediaimpl", "slotMediumChanged(QString)",
false);
DCOPRef mediamanager("kded", "mediamanager");
DCOPReply reply = mediamanager.call("mount", medium.id());
if(reply.isValid())
reply.get(m_lastErrorMessage);
else
m_lastErrorMessage = i18n("Internal Error");
if(!m_lastErrorMessage.isEmpty())
m_lastErrorCode = KIO::ERR_SLAVE_DEFINED;
else
{
qApp->eventLoop()->enterLoop();
}
mp_mounting = 0L;
kapp->dcopClient()->disconnectDCOPSignal("kded", "mediamanager", "mediumChanged(QString, bool)", "mediaimpl", "slotMediumChanged(QString)");
return m_lastErrorCode == 0;
}
return true;
}
示例8: findMediumByName
bool MediaImpl::realURL(const QString &name, const QString &path, KURL &url)
{
bool ok;
Medium m = findMediumByName(name, ok);
if(!ok)
return false;
ok = ensureMediumMounted(m);
if(!ok)
return false;
url = m.prettyBaseURL();
url.addPath(path);
return true;
}
示例9: lookupByName
Boolean MediaSink::lookupByName(UsageEnvironment& env, char const* sinkName,
MediaSink*& resultSink) {
resultSink = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, sinkName, medium)) return False;
if (!medium->isSink()) {
env.setResultMsg(sinkName, " is not a media sink");
return False;
}
resultSink = (MediaSink*)medium;
return True;
}
示例10: lookupByName
Boolean DarwinInjector::lookupByName(UsageEnvironment& env, char const* name,
DarwinInjector*& result) {
result = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, name, medium)) return False;
if (!medium->isDarwinInjector()) {
env.setResultMsg(name, " is not a 'Darwin injector'");
return False;
}
result = (DarwinInjector*)medium;
return True;
}
示例11: lookupByName
Boolean MediaSession::lookupByName(UsageEnvironment& env,
char const* instanceName,
MediaSession*& resultSession) {
resultSession = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, instanceName, medium)) return False;
if (!medium->isMediaSession()) {
env.setResultMsg(instanceName, " is not a 'MediaSession' object");
return False;
}
resultSession = (MediaSession*)medium;
return True;
}
示例12: lookupByName
Boolean MediaSource::lookupByName(UsageEnvironment& env,
char const* sourceName,
MediaSource*& resultSource) {
resultSource = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, sourceName, medium)) return False;
if (!medium->isSource()) {
env.setResultMsg(sourceName, " is not a media source");
return False;
}
resultSource = (MediaSource*)medium;
return True;
}
示例13: lookupByName
Boolean RTSPServer::lookupByName(UsageEnvironment& env,
char const* name,
RTSPServer*& resultServer) {
resultServer = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, name, medium)) return False;
if (!medium->isRTSPServer()) {
env.setResultMsg(name, " is not a RTSP server");
return False;
}
resultServer = (RTSPServer*)medium;
return True;
}
示例14: lookupByName
Boolean RTCPInstance::lookupByName(UsageEnvironment& env,
char const* instanceName,
RTCPInstance*& resultInstance) {
resultInstance = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, instanceName, medium)) return False;
if (!medium->isRTCPInstance()) {
env.setResultMsg(instanceName, " is not a RTCP instance");
return False;
}
resultInstance = (RTCPInstance*)medium;
return True;
}
示例15: ipifcaddroute
/*
* distribute routes to active interfaces like the
* TRIP linecards
*/
void
ipifcaddroute(Fs *f, int vers, uchar *addr, uchar *mask, uchar *gate, int type)
{
Medium *m;
Conv **cp, **e;
Ipifc *ifc;
e = &f->ipifc->conv[f->ipifc->nc];
for(cp = f->ipifc->conv; cp < e; cp++){
if(*cp != nil) {
ifc = (Ipifc*)(*cp)->ptcl;
m = ifc->m;
if(m && m->addroute)
m->addroute(ifc, vers, addr, mask, gate, type);
}
}
}