Exemplo n.º 1
0
void QHtspDvrEntryModel::_addRow(QHtspDvrEntry *dvrEntry)
{
    int rows = rowCount() - 1;
    beginInsertRows(QModelIndex(), rows, rows);
    endInsertRows();

    connect(dvrEntry, SIGNAL(idChanged()), this, SLOT(_updateId()));
    connect(dvrEntry, SIGNAL(channelChanged()), this, SLOT(_updateChannel()));
    connect(dvrEntry, SIGNAL(stateChanged()), this, SLOT(_updateState()));
    connect(dvrEntry, SIGNAL(startChanged()), this, SLOT(_updateStart()));
    connect(dvrEntry, SIGNAL(stopChanged()), this, SLOT(_updateStop()));
    connect(dvrEntry, SIGNAL(titleChanged()), this, SLOT(_updateTitle()));
    if(dvrEntry->channel())
        connect(dvrEntry->channel(), SIGNAL(nameChanged()), this, SLOT(_updateChannel()));
}
Exemplo n.º 2
0
void QHtspDvrEntryModel::_removeRow(QHtspDvrEntry *dvrEntry)
{
    disconnect(dvrEntry, SIGNAL(idChanged()), this, SLOT(_updateId()));
    disconnect(dvrEntry, SIGNAL(channelChanged()), this, SLOT(_updateChannel()));
    disconnect(dvrEntry, SIGNAL(stateChanged()), this, SLOT(_updateState()));
    disconnect(dvrEntry, SIGNAL(startChanged()), this, SLOT(_updateStart()));
    disconnect(dvrEntry, SIGNAL(stopChanged()), this, SLOT(_updateStop()));
    disconnect(dvrEntry, SIGNAL(titleChanged()), this, SLOT(_updateTitle()));
    if(dvrEntry->channel())
        disconnect(dvrEntry->channel(), SIGNAL(nameChanged()), this, SLOT(_updateChannel()));

    int row = m_dvrEntries->indexOf(dvrEntry);
    beginRemoveRows(QModelIndex(), row, row);
    endRemoveRows();
}
Exemplo n.º 3
0
void ControlMethod::updateState(PlayerSlot &slot, PlayerState &state, const float dt) {
	_updateState(slot, state, dt);
	
	int dirs = 0;
	dirs += state.left;
	dirs += state.right;
	dirs += state.up;
	dirs += state.down;

	int old_dirs = 0;
	old_dirs += _old_state.left;
	old_dirs += _old_state.right;
	old_dirs += _old_state.up;
	old_dirs += _old_state.down;
	
	if (state.compare_directions(_old_state) || (old_dirs != 2 || dirs != 1)) {
		_old_state = state;
		return;
	}
	
	if (!_release_set) {
		//LOG_DEBUG(("setting release timer"));
		_release_timer.reset();
		_release_set = true;
		state = _old_state;
		return;
	} else if (_release_timer.tick(dt)) {
		//LOG_DEBUG(("release timer stopped"));
		_old_state = state;
		_release_set = false;	
	} else {
		if ((!state.left && _old_state.left) || (!state.right && _old_state.right)) {
			if ((!state.up && _old_state.up) || (!state.down && _old_state.down)) {
				LOG_DEBUG(("atomically update diagonal"));
				_old_state = state;
				_release_set = false;
				return;
			}
		}
		state = _old_state;
		return;
	}
}
Exemplo n.º 4
0
 bool Timer::isExpired() {
   _updateState();
   return _state == EXPIRED;
 }
Exemplo n.º 5
0
 bool Timer::isActive() {
   _updateState();
   return _state == ACTIVE;
 }