SnoreNotifyPlugin::SnoreNotifyPlugin() : InfoPlugin(), m_defaultIcon( RESPATH "icons/tomahawk-icon-512x512.png" ) { tDebug( LOGVERBOSE ) << Q_FUNC_INFO; m_supportedPushTypes << InfoNotifyUser << InfoNowPlaying << InfoTrackUnresolved << InfoNowStopped << InfoInboxReceived; Snore::SnoreCore &snore = Snore::SnoreCore::instance(); snore.loadPlugins( Snore::SnorePlugin::Backend | Snore::SnorePlugin::SecondaryBackend ); snore.setDefaultSettingsValue("Silent", true, Snore::LocalSetting ); m_application = Snore::Application( qApp->applicationName(), m_defaultIcon ); m_application.hints().setValue( "use-markup", true ); m_application.hints().setValue( "windows-app-id", TOMAHAWK_APPLICATION_PACKAGE_NAME ); m_application.hints().setValue( "desktop-entry", TOMAHAWK_APPLICATION_NAME ); addAlert( InfoNotifyUser, tr( "Notify User" ) ); addAlert( InfoNowPlaying, tr( "Now Playing" ) ); addAlert( InfoTrackUnresolved, tr( "Unresolved track" ) ); addAlert( InfoNowStopped, tr( "Playback Stopped" ) ); addAlert( InfoInboxReceived, tr( "You received a Song recommendation" ) ); snore.registerApplication( m_application ); snore.setDefaultApplication( m_application ); connect( &snore, SIGNAL( actionInvoked( Snore::Notification ) ), this, SLOT( slotActionInvoked( Snore::Notification ) ) ); }
void QtChatWindow::beginCorrection() { boost::optional<AlertID> newCorrectingAlert; if (correctionEnabled_ == Maybe) { newCorrectingAlert = addAlert(Q2PSTRING(tr("This chat may not support message correction. If you send a correction anyway, it may appear as a duplicate message"))); } else if (correctionEnabled_ == No) { newCorrectingAlert = addAlert(Q2PSTRING(tr("This chat does not support message correction. If you send a correction anyway, it will appear as a duplicate message"))); } if (newCorrectingAlert) { if (correctingAlert_) { removeAlert(*correctingAlert_); } correctingAlert_ = newCorrectingAlert; } QTextCursor cursor = input_->textCursor(); cursor.select(QTextCursor::Document); cursor.beginEditBlock(); cursor.insertText(QString(lastSentMessage_)); cursor.endEditBlock(); isCorrection_ = true; correctingLabel_->show(); input_->setStyleSheet(alertStyleSheet_); labelsWidget_->setEnabled(false); }
//-------------------------------------------------------------------- // set landing mode void SeaOfMemes::setLandingMode( BOOL landingMode) { if (m_landingMode == landingMode) return; // nothing to do // if already in landing mode if (m_landingMode) { // switch to space speed m_landingMode = false; m_world->changeCoords(COORDS_SPACE); return; } int obj; double dist = m_world->nearestObject(obj); if (dist > LANDING_DISTANCE) { switch (obj) { case COORDS_PLANET: addAlert("Too far from planet -- %g km", dist/1000); break; case COORDS_MOON: addAlert("Too far from moon -- %g km", dist/1000); break; case COORDS_RING: addAlert("Too far from ring -- %g km", dist/1000); break; } return; // no change to landing mode } // switch coordinate system to nearest object m_landingMode = true; m_world->changeCoords(obj); }
/** * Switch case sur un noeud permettant de définir sa nature et extraire les * champs utiles afin de les ajouter à la liste chainée de rules * \param node le noeud à parser */ void fillRules(xmlNodePtr node) { // Ajout d'une regle if(strcmp((char *)node->name, "rule") == 0) { xmlAttrPtr attr = getAttrByName(node, "name"); if(attr != NULL && attr->children != NULL) { xmlChar *content = xmlNodeGetContent(attr->children); addRule((char *)content); } } // Ajout d'une action if(strcmp((char *)node->name, "activate") == 0) { xmlAttrPtr devicePtr = getAttrByName(node, "device"); xmlAttrPtr fieldPtr = getAttrByName(node, "field"); if(node->children != NULL && node->children->type == XML_TEXT_NODE && devicePtr != NULL && devicePtr->children != NULL && fieldPtr !=NULL && fieldPtr->children != NULL) { xmlChar *state = xmlNodeGetContent(node); xmlChar *device = xmlNodeGetContent(devicePtr->children); xmlChar *field = xmlNodeGetContent(fieldPtr->children); addAction((char *) device, (char *) state, (char *) field); xmlFree(state); xmlFree(device); xmlFree(field); } } // Ajout d'une alerte if(strcmp((char *)node->name, "alert") == 0) { xmlAttrPtr attr = getAttrByName(node, "recipient"); if(attr != NULL && attr->children != NULL && node->children != NULL && node->children->type == XML_TEXT_NODE) { xmlChar *message = xmlNodeGetContent(node); xmlChar *recipient = xmlNodeGetContent(attr->children); addAlert((char *)recipient, (char *) message); xmlFree(recipient); } } // Ajout d'une condition if(strcmp((char *)node->name, "condition") == 0) { xmlAttrPtr devicePtr = getAttrByName(node, "device"); xmlAttrPtr fieldPtr = getAttrByName(node, "field"); xmlAttrPtr typePtr = getAttrByName(node, "type"); if(node->children != NULL && node->children->type == XML_TEXT_NODE && devicePtr != NULL && devicePtr->children != NULL && fieldPtr !=NULL && fieldPtr->children != NULL && typePtr !=NULL && typePtr->children != NULL) { xmlChar *value = xmlNodeGetContent(node); xmlChar *device = xmlNodeGetContent(devicePtr->children); xmlChar *field = xmlNodeGetContent(fieldPtr->children); xmlChar *type = xmlNodeGetContent(typePtr->children); addCondition((char *)device, (char *) field, (char *) type, (char *) value); xmlFree(value); xmlFree(device); xmlFree(field); xmlFree(type); } } }
ManageAlertsDialog::ManageAlertsDialog( int folderId ) : InformationDialog( NULL, Qt::Window ), m_model( NULL ), m_selectedAlertId( 0 ), m_selectedEditable( false ) { m_emailEnabled = dataManager->setting( "email_enabled" ).toInt(); if ( folderId != 0 ) m_canEditPublic = FolderEntity::isAdmin( folderId ); else m_canEditPublic = dataManager->currentUserAccess() == AdminAccess; QAction* action; action = new QAction( IconLoader::icon( "alert-new" ), tr( "&Add Alert..." ), this ); action->setShortcut( QKeySequence::New ); connect( action, SIGNAL( triggered() ), this, SLOT( addAlert() ) ); setAction( "addAlert", action ); if ( m_canEditPublic ) { action = new QAction( IconLoader::overlayedIcon( "alert-new", "overlay-public" ), tr( "Add &Public Alert..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( addPublicAlert() ) ); setAction( "addPublicAlert", action ); } action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Delete Alert" ), this ); action->setShortcut( QKeySequence::Delete ); connect( action, SIGNAL( triggered() ), this, SLOT( editDelete() ) ); setAction( "editDelete", action ); if ( m_emailEnabled ) { action = new QAction( IconLoader::icon( "edit-modify" ), tr( "&Modify Alert..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( editModify() ) ); setAction( "editModify", action ); setDefaultMenuAction( "menuAlert", "editModify" ); } loadXmlUiFile( ":/resources/managealertsdialog.xml" ); XmlUi::Builder* builder = new XmlUi::Builder( this ); builder->addClient( this ); setWindowTitle( tr( "Manage Alerts" ) ); setPromptPixmap( IconLoader::pixmap( "configure-alerts", 22 ) ); QVBoxLayout* layout = new QVBoxLayout(); layout->setSpacing( 4 ); XmlUi::ToolStrip* strip = new XmlUi::ToolStrip( this ); builder->registerToolStrip( "stripAlerts", strip ); layout->addWidget( strip ); m_list = new QTreeView( this ); layout->addWidget( m_list ); TreeViewHelper helper( m_list ); helper.initializeView( TreeViewHelper::NotSortable ); connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( doubleClicked( const QModelIndex& ) ) ); connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( listContextMenu( const QPoint& ) ) ); setContentLayout( layout, false ); setDialogSizeKey( "ManageAlertsDialog" ); resize( 680, 400 ); updateActions(); }