void SshChannelManager::handleChannelOpenFailure(const SshIncomingPacket &packet)
{
   const SshChannelOpenFailure &failure = packet.extractChannelOpenFailure();
   ChannelIterator it = lookupChannelAsIterator(failure.localChannel);
   try {
       it.value()->handleOpenFailure(failure.reasonString);
   } catch (SshServerException &e) {
       removeChannel(it);
       throw e;
   }
   removeChannel(it);
}
int QLCFixtureMode_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: initTestCase(); break;
        case 1: fixtureDef(); break;
        case 2: name(); break;
        case 3: physical(); break;
        case 4: insertChannel(); break;
        case 5: removeChannel(); break;
        case 6: channelByName(); break;
        case 7: channelByIndex(); break;
        case 8: channels(); break;
        case 9: channelNumber(); break;
        case 10: copy(); break;
        case 11: load(); break;
        case 12: loadWrongRoot(); break;
        case 13: loadNoName(); break;
        case 14: save(); break;
        case 15: cleanupTestCase(); break;
        default: ;
        }
        _id -= 16;
    }
    return _id;
}
int QLCInputProfile_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: manufacturer(); break;
        case 1: model(); break;
        case 2: name(); break;
        case 3: addChannel(); break;
        case 4: removeChannel(); break;
        case 5: remapChannel(); break;
        case 6: channel(); break;
        case 7: channels(); break;
        case 8: channelNumber(); break;
        case 9: copy(); break;
        case 10: assign(); break;
        case 11: load(); break;
        case 12: loadNoProfile(); break;
        case 13: loader(); break;
        case 14: save(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
示例#4
0
void Mixer::pruneRemotes(ValueTree active_users)
{
  // find GUI elements for parted users
  for (int user_n = GUI::FIRST_REMOTE_IDX ; user_n < getNumDynamicMixers() ; ++user_n)
  {
    RemoteChannels* channels        = (RemoteChannels*)getChildComponent(user_n) ;
    Identifier      user_id         = Identifier(channels->getComponentID()) ;
    Array<var>*     active_channels = active_users[user_id].getArray() ;

    if (active_users.hasProperty(user_id))
    {
      // find GUI elements for removed channels of active user (first is master)
      for (int channel_n = 1 ; channel_n < channels->getNumChannels() ; ++channel_n)
      {
        Component* channel    = channels->getChildComponent(channel_n) ;
        var        channel_id = var(channel->getComponentID()) ;

        if (active_channels->contains(channel_id)) continue ;

        // delete orphaned GUI elements for removed channel
        removeChannel(user_id , Identifier(channel_id.toString())) ; --channel_n ;
      }
    }
    // delete orphaned GUI elements for parted user
    else { removeChannels(channels) ; --user_n ; }
  }
}
示例#5
0
文件: FxLine.cpp 项目: Cubiicle/lmms
void FxLine::contextMenuEvent( QContextMenuEvent * )
{
	FxMixer * mix = engine::fxMixer();
	QPointer<captionMenu> contextMenu = new captionMenu( mix->effectChannel( m_channelIndex )->m_name );
	if( m_channelIndex != 0 ) // no move-options in master 
	{
		contextMenu->addAction( tr( "Move &left" ),	this, SLOT( moveChannelLeft() ) );
		contextMenu->addAction( tr( "Move &right" ), this, SLOT( moveChannelRight() ) );
	}
	contextMenu->addAction( tr( "Rename &channel" ), this, SLOT( renameChannel() ) );
	contextMenu->addSeparator();
	
	if( m_channelIndex != 0 ) // no remove-option in master
	{
		contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ),
							this, SLOT( removeChannel() ) );
		contextMenu->addSeparator();
	}
	
	contextMenu->addAction( embed::getIconPixmap( "help" ),
						tr( "&Help" ),
						this, SLOT( displayHelp() ) );
	contextMenu->exec( QCursor::pos() );
	delete contextMenu;
}
示例#6
0
void FModSound::soundEnded(FMOD::Channel *channel)
{
    UInt32 ChannelID(getChannelID(channel));

    if(ChannelID != 0)
    {
        removeChannel(ChannelID);
        produceSoundEnded(ChannelID);
    }
}
void SshChannelManager::handleChannelClose(const SshIncomingPacket &packet)
{
    const quint32 channelId = packet.extractRecipientChannel();

    ChannelIterator it = lookupChannelAsIterator(channelId, true);
    if (it != m_channels.end()) {
        it.value()->handleChannelClose();
        removeChannel(it);
    }
}
示例#8
0
void ServerState::loadChannels() {
    DLOG(INFO) << "Loading channels.";
    string contents = floadFile("./channels.json");
    json_error_t jserror;
    json_t* root = json_loads(contents.c_str(), 0, &jserror);
    if (!root) {
        LOG(ERROR) << "Failed to parse channel json. Error: " << &jserror.text;
        return;
    }

    json_t* pubchans = json_object_get(root, "public");
    if (!json_is_array(pubchans)) {
        LOG(ERROR) << "Failed to find the public channels node.";
        return;
    }
    size_t size = json_array_size(pubchans);
    for (size_t i = 0; i < size; ++i) {
        json_t* chan = json_array_get(pubchans, i);
        string name = json_string_value(json_object_get(chan, "name"));
        removeChannel(name);
        Channel* chanptr = new Channel(name, CT_PUBLIC);
        chanptr->loadChannel(chan);
        addChannel(name, chanptr);
    }
    json_t* privchans = json_object_get(root, "private");
    if (!json_is_array(privchans)) {
        LOG(ERROR) << "Failed to find the private channels node.";
        return;
    }
    size = json_array_size(privchans);
    for (size_t i = 0; i < size; ++i) {
        json_t* chan = json_array_get(privchans, i);
        string name = json_string_value(json_object_get(chan, "name"));
        removeChannel(name);
        Channel* chanptr = new Channel(name, CT_PUBPRIVATE);
        chanptr->loadChannel(chan);
        addChannel(name, chanptr);
    }
    json_decref(root);
}
示例#9
0
void AnimationTarget::destroyAnimation(const char* id)
{
    // Find the animation with the specified ID.
    Animation::Channel* channel = getChannel(id);
    if (channel == NULL)
        return;

    // Remove this target's channel from animation, and from the target's list of channels.
    channel->_animation->removeChannel(channel);
    removeChannel(channel);

    SAFE_DELETE(channel);
}
示例#10
0
bool ModChannelMgr::leaveChannel(const std::string &channel, session_t peer_id)
{
	if (!channelRegistered(channel))
		return false;

	// Remove consumer from channel
	bool consumerRemoved = m_registered_channels[channel]->removeConsumer(peer_id);

	// If channel is empty, remove it
	if (m_registered_channels[channel]->getChannelPeers().empty()) {
		removeChannel(channel);
	}
	return consumerRemoved;
}
示例#11
0
文件: EPGWidget.cpp 项目: qdk0901/vlc
EPGWidget::EPGWidget( QWidget *parent ) : QWidget( parent )
{
    b_input_type_known = false;
    m_rulerWidget = new EPGRuler( this );
    m_epgView = new EPGView( this );
    m_channelsWidget = new EPGChannels( this, m_epgView );

    m_channelsWidget->setMinimumWidth( 100 );

    m_epgView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    setZoom( 1 );

    rootWidget = new QStackedWidget( this );

    QWidget *containerWidget = new QWidget( this );
    QGridLayout* layout = new QGridLayout( this );
    layout->addWidget( m_rulerWidget, 0, 1 );
    layout->addWidget( m_channelsWidget, 1, 0 );
    layout->addWidget( m_epgView, 1, 1 );
    layout->setSpacing( 0 );
    containerWidget->setLayout( layout );
    rootWidget->insertWidget( EPGVIEW_WIDGET, containerWidget );

    QLabel *noepgLabel = new QLabel( qtr("No EPG Data Available"), this );
    noepgLabel->setAlignment( Qt::AlignCenter );
    rootWidget->insertWidget( NOEPG_WIDGET, noepgLabel );

    rootWidget->setCurrentIndex( 1 );
    layout = new QGridLayout( this );
    layout->addWidget( rootWidget );
    setLayout( layout );

    CONNECT( m_epgView, startTimeChanged(QDateTime),
             m_rulerWidget, setStartTime(QDateTime) );
    CONNECT( m_epgView, durationChanged(int),
             m_rulerWidget, setDuration(int) );
    CONNECT( m_epgView->horizontalScrollBar(), valueChanged(int),
             m_rulerWidget, setOffset(int) );
    CONNECT( m_epgView->verticalScrollBar(), valueChanged(int),
             m_channelsWidget, setOffset(int) );
    connect( m_epgView, SIGNAL( itemFocused(EPGItem*)),
             this, SIGNAL(itemSelectionChanged(EPGItem*)) );
    CONNECT( m_epgView, channelAdded(QString), m_channelsWidget, addChannel(QString) );
    CONNECT( m_epgView, channelRemoved(QString), m_channelsWidget, removeChannel(QString) );
}
示例#12
0
void ServerState::removeUnusedChannels() {
    const chanptrmap_t chans = getChannels();
    list<string> toremove;
    time_t timeout = time(NULL)-(60 * 60 * 24);
    for (chanptrmap_t::const_iterator i = chans.begin(); i != chans.end(); ++i) {
        i->second->updateParticipantCount();
        if (i->second->getType() == CT_PUBPRIVATE) {
            if ((i->second->getParticipantCount() <= 0) && (i->second->getLastActivity() < timeout)) {
                toremove.push_back(i->first);
            }
        }
    }
    for (list<string>::const_iterator i = toremove.begin(); i != toremove.end(); ++i) {
        string channel = (*i);
        removeChannel(channel);
    }
    DLOG(INFO) << "Removed " << toremove.size() << " unused channels.";
}
//-----------------------------------------------------------------------------
void SignalBrowserModel::setShownChannels (std::set<ChannelID> const&
                                           new_shown_channels)
{
    unsigned new_channel_height = getSignalViewSettings()->getChannelHeight();
    if (!initialized_)
        new_channel_height = signal_browser_view_->getViewportHeight() / new_shown_channels.size();
    else
        new_channel_height *= static_cast<float>(getShownChannels().size()) / new_shown_channels.size();

    foreach (ChannelID channel, channel2signal_item_.keys())
        if (new_shown_channels.count (channel) == 0)
            removeChannel (channel);

    getSignalViewSettings()->setChannelHeight (std::max<unsigned>(20, new_channel_height));

    foreach (ChannelID channel, new_shown_channels)
    {
        ProgressBar::instance().increaseValue (1, tr("Creating view..."));
        if (channel2signal_item_.count (channel) == 0)
            addChannel (channel);
    }
示例#14
0
/*
 * Recovers connection in case of connection failure.
 */
void recoverConnection()
{
	/* clean up channel */
	if ((rsslConsumerChannel != NULL) && (rsslConsumerChannel->socketId != -1))
	{
		removeChannel(rsslConsumerChannel);
		rsslConsumerChannel = NULL;
	}
	/* set connection recovery flag */
	shouldRecoverConnection = RSSL_TRUE;

	/* if the dictionary stream IDs are non-zero, it indicates we downloaded the dictionaries.  Because of this, we want to free the memory before recovery 
	since we will download them again upon recovery.  If the stream IDs are zero, it implies no dictionary or dictionary was loaded from file, so we only 
	want to release when we are cleaning up the entire app. */
	if (needToDeleteDictionary())
	{
		/* free memory for dictionary */
		freeDictionary();
		resetDictionaryStreamId();
	}
}
示例#15
0
/*
 * Cleans up and exits the application.
 */
void cleanUpAndExit()
{
	/* clean up channel */
	if ((rsslConsumerChannel != NULL) && (rsslConsumerChannel->socketId != -1))
	{
		removeChannel(rsslConsumerChannel);
	}

	/* free memory for dictionary */
	freeDictionary();
	resetDictionaryStreamId();

	rsslUninitialize();

	/* WINDOWS: wait for user to enter something before exiting  */
#ifdef _WIN32
	printf("\nPress Enter or Return key to exit application:");
	getchar();
#endif
	exit(0);
}
示例#16
0
void Session::handleMessage(IrcMessage* message)
{
    // 20s delay since the last message was received
    setPingInterval(20);

    if (message->type() == IrcMessage::Join)
    {
        if (message->isOwn())
            addChannel(static_cast<IrcJoinMessage*>(message)->channel());
    }
    else if (message->type() == IrcMessage::Part)
    {
        if (message->isOwn())
            removeChannel(static_cast<IrcPartMessage*>(message)->channel());
    }
    else if (message->type() == IrcMessage::Pong)
    {
        if (message->parameters().contains("_C_o_m_m_u_n_i_"))
        {
            // slow down to 60s intervals
            setPingInterval(60);

            updateLag(static_cast<int>(m_lagTimer.elapsed()));
            m_lagTimer.invalidate();
        }
    }
    else if (message->type() == IrcMessage::Numeric)
    {
        int code = static_cast<IrcNumericMessage*>(message)->code();
        if (code == Irc::RPL_ISUPPORT)
        {
            foreach (const QString& param, message->parameters().mid(1))
            {
                QStringList keyValue = param.split("=", QString::SkipEmptyParts);
                m_info.insert(keyValue.value(0), keyValue.value(1));
            }
            if (m_info.contains("NETWORK"))
                emit networkChanged(network());
            emit serverInfoReceived();
        }
示例#17
0
int ircInterface::part(std::string channel){
	removeChannel(channel);
	std::string msg = "PART " + channel + "\r\n";
	sendString(msg);
	return 0;
}
示例#18
0
void Sound::onChannelEnd(int channel) {
  removeChannel();
}
示例#19
0
文件: FxLine.cpp 项目: DomClark/lmms
void FxLine::contextMenuEvent( QContextMenuEvent * )
{
	QPointer<CaptionMenu> contextMenu = new CaptionMenu( Engine::fxMixer()->effectChannel( m_channelIndex )->m_name, this );
	if( m_channelIndex != 0 ) // no move-options in master 
	{
		contextMenu->addAction( tr( "Move &left" ),	this, SLOT( moveChannelLeft() ) );
		contextMenu->addAction( tr( "Move &right" ), this, SLOT( moveChannelRight() ) );
	}
	contextMenu->addAction( tr( "Rename &channel" ), this, SLOT( renameChannel() ) );
	contextMenu->addSeparator();

	if( m_channelIndex != 0 ) // no remove-option in master
	{
		contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ), this, SLOT( removeChannel() ) );
		contextMenu->addSeparator();
	}
	contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "Remove &unused channels" ), this, SLOT( removeUnusedChannels() ) );
	contextMenu->addSeparator();
	contextMenu->addHelpAction();
	contextMenu->exec( QCursor::pos() );
	delete contextMenu;
}
示例#20
0
int ircInterface::part(std::string channel, std::string reason){
	removeChannel(channel);
	std::string msg = "PART " + channel + " :" +reason;
	sendString(msg);
	return 0;
}