当前位置: 首页>>代码示例>>C++>>正文


C++ Notification::application方法代码示例

本文整理汇总了C++中Notification::application方法的典型用法代码示例。如果您正苦于以下问题:C++ Notification::application方法的具体用法?C++ Notification::application怎么用?C++ Notification::application使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::application方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: display

void NotifyWidget::display(const Notification &notification)
{
    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);
    }
}
开发者ID:G-VAR,项目名称:snorenotify,代码行数:33,代码来源:notifywidget.cpp

示例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());
}
开发者ID:dschmidt,项目名称:Snorenotify,代码行数:32,代码来源:snoretoast.cpp

示例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);
}
开发者ID:jendas1,项目名称:Snorenotify,代码行数:18,代码来源:growlbackend.cpp

示例4: update

void NotifyWidget::update(const Notification &notification)
{
    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));


}
开发者ID:xhochy,项目名称:Snorenotify,代码行数:37,代码来源:notifywidget.cpp


注:本文中的Notification::application方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。