コード例 #1
0
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
	if (mRequestedItem != -1) // teleport within the history in progress?
	{
		mCurrentItem = mRequestedItem;
		mRequestedItem = -1;
	}
	else
	{
		//EXT-7034
		//skip initial update if agent avatar is no valid yet
		//this may happen when updateCurrentLocation called while login process
		//sometimes isAgentAvatarValid return false and in this case new_pos
		//(which actually is gAgent.getPositionGlobal() ) is invalid
		//if this position will be saved then teleport back will teleport user to wrong position
		if ( !mGotInitialUpdate && !isAgentAvatarValid() )
		{
			return ;
		}

		// If we're getting the initial location update
		// while we already have a (loaded) non-empty history,
		// there's no need to purge forward items or add a new item.

		if (mGotInitialUpdate || mItems.size() == 0)
		{
			// Purge forward items (if any).
			if(mItems.size())
				mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end());
			
			// Append an empty item to the history and make it current.
			mItems.push_back(LLTeleportHistoryItem("", LLVector3d()));
			mCurrentItem++;
		}

		// Update current history item.
		if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
		{
			llwarns << "Invalid current item. (this should not happen)" << llendl;
			llassert(!"Invalid current teleport histiry item");
			return;
		}
		LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos);
		mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local);
		mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local);
		mItems[mCurrentItem].mGlobalPos	= new_pos;
		mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID();
	}

	dump();
	
	if (!mGotInitialUpdate)
		mGotInitialUpdate = true;

	// Signal the interesting party that we've changed. 
	onHistoryChanged();
}
コード例 #2
0
void LLTeleportHistory::purgeItems()
{
	if (mItems.size() > 0)
	{
		mItems.erase(mItems.begin(), mItems.end()-1);
	}
	// reset the count
	mRequestedItem = -1;
	mCurrentItem = 0;

	onHistoryChanged();
}
コード例 #3
0
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
	if (mRequestedItem != -1) // teleport within the history in progress?
	{
		mCurrentItem = mRequestedItem;
		mRequestedItem = -1;
	}
	else
	{
		// If we're getting the initial location update
		// while we already have a (loaded) non-empty history,
		// there's no need to purge forward items or add a new item.

		if (mGotInitialUpdate || mItems.size() == 0)
		{
			// Purge forward items (if any).
			if(mItems.size())
				mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end());
			
			// Append an empty item to the history and make it current.
			mItems.push_back(LLTeleportHistoryItem("", LLVector3d()));
			mCurrentItem++;
		}

		// Update current history item.
		if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
		{
			llwarns << "Invalid current item. (this should not happen)" << llendl;
			return;
		}
		LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos);
		mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local);
		mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local);
		mItems[mCurrentItem].mGlobalPos	= new_pos;
		mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID();
	}

	dump();
	
	if (!mGotInitialUpdate)
		mGotInitialUpdate = true;

	// Signal the interesting party that we've changed. 
	onHistoryChanged();
}
コード例 #4
0
void LLTeleportHistory::purgeItems()
{
	if (mItems.size() == 0) // no entries yet (we're called before login)
	{
		// If we don't return here the history will get into inconsistent state, hence:
		// 1) updateCurrentLocation() will malfunction,
		//    so further teleports will not properly update the history;
		// 2) mHistoryChangedSignal subscribers will be notified
		//    of such an invalid change. (EXT-6798)
		// Both should not happen.
		return;
	}

	if (mItems.size() > 0)
	{
		mItems.erase(mItems.begin(), mItems.end()-1);
	}
	// reset the count
	mRequestedItem = -1;
	mCurrentItem = 0;

	onHistoryChanged();
}
コード例 #5
0
ファイル: controller.cpp プロジェクト: filesdnd/filesdnd-qt
Controller::Controller() :
    _deviceNeedResolve(0),
    _lastTimeFocused(0),
    _service(&_udpDiscovery, this),
    _udpDiscoveryTimer(this)
{
    _service.moveToThread(&_serviceThread);
    _serviceThread.start();

    _view = new View(&_model);
    _bonjourBrowser = new BonjourServiceBrowser(this);

    connect(&_udpDiscovery, SIGNAL(devicesFound(const QList<Device *> &)), this, SLOT(updateDevices(const QList<Device *> &)));
    connect(&_udpDiscovery, SIGNAL(pongReceived(const QString&)), this, SLOT(onPong(const QString &)));

    connect(_bonjourBrowser, SIGNAL(currentBonjourRecordsChanged(const QList<BonjourRecord> &)),
            this, SLOT(updateRecords(const QList<BonjourRecord> &)));
    connect(_bonjourBrowser, SIGNAL(error(DNSServiceErrorType)),
            this, SLOT(error(DNSServiceErrorType)));

    connect(_view, SIGNAL(sendFile(const QString&, const QList<QUrl>&, DataType)),
            this, SLOT(onSendFile(const QString&, const QList<QUrl>&, DataType)));
    connect(_view, SIGNAL(sendText(const QString&, const QString&, DataType)),
            this, SLOT(onSendText(const QString&, const QString&, DataType)));
    connect(_view, SIGNAL(cancelTransfert(const QString&)),
            this, SLOT(onCancelTransfert(const QString&)));
    connect(_view, SIGNAL(focused()), this, SLOT(onWindowFocused()));
    connect(_view, SIGNAL(forceRefresh()), this, SLOT(onForceRefresh()));

    connect(_view, SIGNAL(registerService()),
            &_service, SLOT(serviceRegister()));
    connect(_view, SIGNAL(unregisterService()),
            &_service, SLOT(serviceUnregister()));
    connect(_view, SIGNAL(deleteFromHistory(int)),
            &_service, SLOT(onDeleteFromHistory(int)));
    connect(_view, SIGNAL(clearHistoryTriggered()),
            &_service, SLOT(onClearHistory()));
    connect(_view, SIGNAL(serviceNameChanged()),
            &_service, SLOT(onTimerOut()));
    connect(_view, SIGNAL(cancelIncomingTransfert()),
            &_service, SLOT(deleteFileReset()));

    connect(&_service, SIGNAL(historyChanged(const QList<HistoryElement>&)),
            _view, SLOT(onHistoryChanged(const QList<HistoryElement>&)));
    connect(&_service, SIGNAL(historyElementProgressUpdated(unsigned)),
            _view, SLOT(historyElementProgressUpdated(unsigned)));

    connect(&_service, SIGNAL(serviceError(ServiceErrorState,bool)),
            _view, SLOT(onServiceError(ServiceErrorState,bool)));
    connect(&_service, SIGNAL(receivingFile(const QString&,int)),
             _view, SLOT(onReceivingFile(const QString&,int)));
    connect(&_service, SIGNAL(receivingFolder(const QString&,int)),
            _view, SLOT(onReceivingFolder(const QString&,int)));
    connect(&_service, SIGNAL(receivingText(const QString&)),
            _view, SLOT(onReceivingText(const QString&)));
    connect(&_service, SIGNAL(receivingUrl(const QString&)),
            _view, SLOT(onReceivingUrl(const QString&)));

    connect(&_model, SIGNAL(newDeviceCreated(Device*)),
            this, SLOT(onNewDeviceCreated(Device*)));
    connect(&_model, SIGNAL(deviceRemoved()),
            _view, SLOT(updateDevices()));

    connect(&_updater, SIGNAL(updateNeeded(const QString&,const QString&)),
            _view, SLOT(onUpdateNeeded(const QString&,const QString&)));

    checkForBonjourState();
    _view->updateDevices();
    _view->onHistoryChanged(_service.getHistory());

    _bonjourBrowser->browseForServiceType(QLatin1String("_fdnd._tcp."));

    connect(&_udpDiscoveryTimer, SIGNAL(timeout()), &_udpDiscovery, SLOT(startDiscovery()));
    _udpDiscoveryTimer.start(UDP_DISCOVERY_INTERVAL);
    _udpDiscovery.startDiscovery();

    createSendTo();
}
コード例 #6
0
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
{
	if (!mTeleportHistoryStorage)
	{
		mTeleportHistoryStorage = LLTeleportHistoryStorage::getInstance();
	}
	if (mRequestedItem != -1) // teleport within the history in progress?
	{
		mCurrentItem = mRequestedItem;
		mRequestedItem = -1;
	}
	else
	{
		//EXT-7034
		//skip initial update if agent avatar is no valid yet
		//this may happen when updateCurrentLocation called while login process
		//sometimes isAgentAvatarValid return false and in this case new_pos
		//(which actually is gAgent.getPositionGlobal() ) is invalid
		//if this position will be saved then teleport back will teleport user to wrong position
		if ( !mGotInitialUpdate && !isAgentAvatarValid() )
		{
			return ;
		}

		// If we're getting the initial location update
		// while we already have a (loaded) non-empty history,
		// there's no need to purge forward items or add a new item.

		if (mGotInitialUpdate || mItems.size() == 0)
		{
			// Purge forward items (if any).
			if(mItems.size())
				mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end());
			
			// Append an empty item to the history and make it current.
//			mItems.push_back(LLTeleportHistoryItem("", LLVector3d()));
//			mCurrentItem++;
// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b
			// Only append a new item if the list is currently empty or if not @showloc=n restricted and the last entry wasn't zero'ed out
			if ( (mItems.size() == 0) || ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!mItems.back().mGlobalPos.isExactlyZero())) )
			{
				mItems.push_back(LLTeleportHistoryItem("", LLVector3d()));
				mCurrentItem++;
			}
// [RLVa:KB]
		}

		// Update current history item.
		if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check
		{
			llwarns << "Invalid current item. (this should not happen)" << llendl;
			llassert(!"Invalid current teleport history item");
			return;
		}

// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b
		if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
		{
// [/RLVa:KB]
			LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos);
			mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local);
			mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local);
			mItems[mCurrentItem].mGlobalPos	= new_pos;
			mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID();
// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b
		}
		else
		{
			mItems[mCurrentItem] = LLTeleportHistoryItem(RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL), LLVector3d::zero);
		}
// [/RLVa:KB]
	}

	dump();
	
	if (!mGotInitialUpdate)
		mGotInitialUpdate = true;

	// Signal the interesting party that we've changed. 
	onHistoryChanged();
}
コード例 #7
0
void HistoryPane::hideEvent(QHideEvent *)
{
	disconnect(TUndoManager::manager(), SIGNAL(historyChanged()), this, SLOT(onHistoryChanged()));
}
コード例 #8
0
void HistoryPane::showEvent(QShowEvent *)
{
	connect(TUndoManager::manager(), SIGNAL(historyChanged()), this, SLOT(onHistoryChanged()));
	onHistoryChanged();
}