本文整理汇总了C++中Notification::application方法的典型用法代码示例。如果您正苦于以下问题:C++ Notification::application方法的具体用法?C++ Notification::application怎么用?C++ Notification::application使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::application方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
void NotifyWidget::display(const Notification ¬ification)
{
qCDebug(SNORE) << m_id << notification.id() << m_window->isVisible();
m_notification = notification;
QColor color;
QVariant vcolor = notification.application().constHints().privateValue(parent(), "backgroundColor");
if (vcolor.isValid()) {
color = vcolor.value<QColor>();
} else {
color = computeBackgrondColor(notification.application().icon().pixmap(QSize(20, 20)).toImage());
notification.application().hints().setPrivateValue(parent(), "backgroundColor", color);
}
m_appIcon = QUrl::fromLocalFile(notification.application().icon().localUrl(QSize(m_appIconSize, m_appIconSize)));
emit appIconChanged();
m_image = QUrl::fromLocalFile(notification.icon().localUrl(QSize(m_imageSize, m_imageSize)));
emit imageChanged();
m_title = notification.title(Utils::AllMarkup);
emit titleChanged();
m_body = notification.text(Utils::AllMarkup);
emit bodyChanged();
if (!notification.isUpdate()) {
syncSettings();
m_color = color;
m_textColor = compueTextColor(color);
emit colorChanged();
emit textColorChanged();
m_window->show();
Utils::raiseWindowToFront(m_window);
}
}
示例2: slotNotify
void SnoreToast::slotNotify(Notification notification)
{
QProcess *p = new QProcess(this);
p->setReadChannelMode(QProcess::MergedChannels);
connect(p,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(slotToastNotificationClosed(int,QProcess::ExitStatus)));
connect(qApp,SIGNAL(aboutToQuit()),p,SLOT(kill()));
QStringList arguements;
arguements << "-t"
<< Snore::toPlainText(notification.title())
<< "-m"
<< Snore::toPlainText(notification.text());
if(notification.icon().isValid())
{
arguements << "-p"
<< QDir::toNativeSeparators(notification.icon().localUrl());
}
arguements << "-w"
<< "-appID"
<< appId(notification.application())
<< "-id"
<< QString::number(notification.id());
if(notification.hints().value("silent",true).toBool())
{
arguements << "-silent";
}
snoreDebug( SNORE_DEBUG ) << "SnoreToast" << arguements;
p->start("SnoreToast", arguements);
p->setProperty("SNORE_NOTIFICATION_ID",notification.id());
}
示例3: slotNotify
void GrowlBackend::slotNotify(Notification notification)
{
Growl *growl = m_applications.value(notification.application().name());
QString alert = notification.alert().name();
snoreDebug(SNORE_DEBUG) << "Notify Growl:" << notification.application() << alert << notification.title();
GrowlNotificationData data(alert.toUtf8().constData(), notification.id(),
notification.title().toUtf8().constData(),
notification.text().toUtf8().constData());
if (notification.icon().isValid()) {
data.setIcon(notification.icon().localUrl().toUtf8().constData());
}
data.setCallbackData("1");
growl->Notify(data);
slotNotificationDisplayed(notification);
}
示例4: update
void NotifyWidget::update(const Notification ¬ification)
{
snoreDebug( SNORE_DEBUG ) << m_id << notification.id();
m_notification = notification;
QRect desktop = QDesktopWidget().availableGeometry();
resize(computeSize());
int space = 10 * logicalDpiY() / dpisScale();
m_dest = QPoint(desktop.topRight().x() - width(), desktop.topRight().y() + space + (space + height()) * m_id);
m_start = QPoint(desktop.topRight().x(), m_dest.y());
QColor color;
QVariant vcolor = notification.application().constHints().privateValue(parent(), "backgroundColor");
if(vcolor.isValid())
{
color = vcolor.value<QColor>();
}
else
{
color = computeBackgrondColor(notification.application().icon().image().scaled(20,20));
notification.application().constHints().setPrivateValue(parent(), "backgroundColor", color);
}
QRgb gray = qGray(qGray(color.rgb()) - qGray(QColor(Qt::white).rgb()));
QColor textColor = QColor(gray, gray, gray);
QMetaObject::invokeMethod(qmlNotification, "update", Qt::QueuedConnection,
Q_ARG( QVariant, notification.title()),
Q_ARG( QVariant, notification.text()),
Q_ARG( QVariant, QUrl::fromLocalFile(notification.icon().localUrl())),
Q_ARG( QVariant, QUrl::fromLocalFile(notification.application().icon().localUrl())),
Q_ARG( QVariant, color),
Q_ARG( QVariant, textColor));
}