本文整理汇总了C++中Notification类的典型用法代码示例。如果您正苦于以下问题:C++ Notification类的具体用法?C++ Notification怎么用?C++ Notification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Notification
//-----------------------------------------------------------------------------
// <ValueStore::RemoveValue>
// Remove a value from the store
//-----------------------------------------------------------------------------
bool ValueStore::RemoveValue
(
uint32 const& _key
)
{
map<uint32,Value*>::iterator it = m_values.find( _key );
if( it != m_values.end() )
{
Value* value = it->second;
ValueID const& valueId = value->GetID();
// First notify the watchers
if( Driver* driver = Manager::Get()->GetDriver( valueId.GetHomeId() ) )
{
Notification* notification = new Notification( Notification::Type_ValueRemoved );
notification->SetValueId( valueId );
driver->QueueNotification( notification );
}
// Now release and remove the value from the store
value->Release();
m_values.erase( it );
return true;
}
// Value not found in the store
return false;
}
示例2: GetNodeId
//-----------------------------------------------------------------------------
// <Basic::HandleMsg>
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
bool Basic::HandleMsg
(
uint8 const* _data,
uint32 const _length,
uint32 const _instance // = 1
)
{
if( BasicCmd_Report == (BasicCmd)_data[0] )
{
// Level
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic report from node %d: level=%d", GetNodeId(), _data[1] );
if( ValueByte* value = static_cast<ValueByte*>( GetValue( _instance, 0 ) ) )
{
value->OnValueRefreshed( _data[1] );
value->Release();
}
return true;
}
if( BasicCmd_Set == (BasicCmd)_data[0] )
{
// Commmand received from the node. Handle as a notification event
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic set from node %d: level=%d. Sending event notification.", GetNodeId(), _data[1] );
Notification* notification = new Notification( Notification::Type_NodeEvent );
notification->SetHomeNodeIdAndInstance( GetHomeId(), GetNodeId(), _instance );
notification->SetEvent( _data[1] );
GetDriver()->QueueNotification( notification );
return true;
}
return false;
}
示例3: LOG
void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification notification)
{
if (notification.type() != Notification::FunctionType)
LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - notification %s", this, notificationName(notification));
m_queueMutex.lock();
// It is important to always process the properties in the order that we are notified,
// so always go through the queue because notifications happen on different threads.
m_queuedNotifications.append(notification);
#if OS(WINDOWS)
bool delayDispatch = true;
#else
bool delayDispatch = m_delayCallbacks || !isMainThread();
#endif
if (delayDispatch && !m_mainThreadCallPending) {
m_mainThreadCallPending = true;
callOnMainThread(mainThreadCallback, this);
}
m_queueMutex.unlock();
if (delayDispatch) {
if (notification.type() != Notification::FunctionType)
LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - early return", this);
return;
}
dispatchNotification();
}
示例4: foreach
void NotificationManager::syncNotifications()
{
QList<PersonalNotification*> pnList;
QMap<int,int> typeCounts;
QList<QObject*> notifications = Notification::notifications();
foreach (QObject *o, notifications) {
Notification *n = static_cast<Notification*>(o);
if (n->previewBody().isEmpty() && !n->body().isEmpty() && n->hintValue("x-commhistoryd-data").isNull()) {
NotificationGroup *group = new NotificationGroup(n, this);
if (m_Groups.contains(group->type())) {
group->removeGroup();
delete group;
continue;
}
m_Groups.insert(group->type(), group);
} else {
PersonalNotification *pn = new PersonalNotification(this);
if (!pn->restore(n)) {
delete pn;
n->close();
delete n;
continue;
}
typeCounts[pn->eventType()]++;
pnList.append(pn);
}
}
示例5: snoreDebug
GrowlBackend::GrowlBackend()
{
s_instance = this;
auto func = [](growl_callback_data * data)->void {
snoreDebug(SNORE_DEBUG) << data->id << QString::fromUtf8(data->reason) << QString::fromUtf8(data->data);
Notification n = Snore::SnoreCore::instance().getActiveNotificationByID(data->id);
if (!n.isValid())
{
return;
}
Notification::CloseReasons r = Notification::NONE;
std::string reason(data->reason);
if (reason == "TIMEDOUT")
{
r = Notification::TIMED_OUT;
} else if (reason == "CLOSED")
{
r = Notification::DISMISSED;
} else if (reason == "CLICK")
{
r = Notification::ACTIVATED;
s_instance->slotNotificationActionInvoked(n);
}
s_instance->closeNotification(n, r);
};
Growl::init((GROWL_CALLBACK)static_cast<void(*)(growl_callback_data *)>(func));
}
示例6: qDebug
void Bb10Ui::onFullscreen()
{
qDebug() << "xxxxx Bb10Ui::onFullscreen";
m_appState = FullScreen;
Notification* pNotification = new Notification();
pNotification->clearEffects();
}
示例7: while
//-----------------------------------------------------------------------------
// <ValueStore::RemoveCommandClassValues>
// Remove all the values associated with a command class from the store
//-----------------------------------------------------------------------------
void ValueStore::RemoveCommandClassValues
(
uint8 const _commandClassId
)
{
map<uint32,Value*>::iterator it = m_values.begin();
while( it != m_values.end() )
{
Value* value = it->second;
ValueID const& valueId = value->GetID();
if( _commandClassId == valueId.GetCommandClassId() )
{
// The value belongs to the specified command class
// First notify the watchers
if( Driver* driver = Manager::Get()->GetDriver( valueId.GetHomeId() ) )
{
Notification* notification = new Notification( Notification::Type_ValueRemoved );
notification->SetValueId( valueId );
driver->QueueNotification( notification );
}
// Now release and remove the value from the store
value->Release();
m_values.erase( it++ );
}
else
{
++it;
}
}
}
示例8: qDebug
void NotificationLayout::removeNotification(uint key, uint reason)
{
Notification *n = m_notifications.take(key);
if (!n)
{
qDebug() << "Oooook! Expecting instance of notification, got:" << key;
return;
}
int ix = m_layout->indexOf(n);
if (ix == -1)
{
qDebug() << "Qooook! Widget not in layout. Impossible!" << n;
return;
}
delete m_layout->takeAt(ix);
n->deleteLater();
emit notificationClosed(key, reason);
if (m_notifications.count() == 0)
emit allNotificationsClosed();
checkHeight();
}
示例9: ILOG_TRACE_F
bool
NotificationManager::replaceActive(Notification* notification)
{
ILOG_TRACE_F(ILX_NOTIFICATIONMAN);
if (notification->tag().empty())
return false;
pthread_mutex_lock(&_activeMutex);
NotificationList::iterator it = _active.begin();
while (it != _active.end())
{
Notification* old = ((Notification*) *it);
if (old->tag() == notification->tag())
{
it = _active.erase(it);
_active.insert(it, notification);
notification->setGeometry(old->surfaceGeometry());
old->close();
_compositor->removeWidget(old);
notification->show();
pthread_mutex_unlock(&_activeMutex);
return true;
}
++it;
}
pthread_mutex_unlock(&_activeMutex);
return false;
}
示例10: testUpdateActions
void Ut_WidgetNotificationSink::testUpdateActions()
{
// Create notification parameters
Notification notification;
TestNotificationParameters parameters;
parameters.add(NotificationWidgetParameterFactory::createActionParameter("content0 0 0 0"));
notification.setParameters(parameters);
// Create an info banner with one action
MBanner infoBanner;
QAction *action = new QAction(&infoBanner);
infoBanner.addAction(action);
// There shouldn't be any MRemoteActions at this point but the action should be added
QCOMPARE(contents.count(), 0);
QCOMPARE(actions.count(), 1);
QCOMPARE(actions[&infoBanner].at(0), action);
// Update the actions
m_subject->updateActions(&infoBanner, notification);
// There should be a MRemoteAction at this point
QCOMPARE(contents.count(), 1);
QCOMPARE(contents[0], QString("content0 0 0 0"));
QCOMPARE(actions.count(), 1);
QVERIFY(dynamic_cast<MRemoteAction *>(actions[&infoBanner].at(0)) != NULL);
QCOMPARE(dynamic_cast<MRemoteAction *>(actions[&infoBanner].at(0))->toString(), QString("content0 0 0 0"));
}
示例11: ENABLE
const QString NotificationWrapper::title() const
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
if (notification)
return notification->title();
#endif
return QString();
}
示例12: Notification
Notification* Notification::create(ExecutionContext* context, int64_t persistentId, const WebNotificationData& data)
{
Notification* notification = new Notification(context, data);
notification->setPersistentId(persistentId);
notification->setState(NotificationStateShowing);
notification->suspendIfNeeded();
return notification;
}
示例13: ENABLE
const QString NotificationWrapper::message() const
{
#if ENABLE(NOTIFICATIONS)
Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
if (notification)
return notification->contents().body();
#endif
return QString();
}
示例14: Notification
void OptionsDialog::showNotification(QVBoxLayout *layout, int position, const QString &text, bool canClose)
{
Notification* n = new Notification(this);
n->setText(text);
n->setClosable(canClose);
layout->insertWidget(position, n);
n->show();
}
示例15: addNotification
void NotifierNotificationSink::addNotification(const Notification ¬ification)
{
if (!additionsDisabled && notification.type() == Notification::ApplicationEvent && isUnseen(notification)) {
applicationEventIds.insert(notification.notificationId());
if(applicationEventIds.count() == 1) {
setNotifierEnabled(true);
}
}
}