mirror of
https://github.com/overte-org/overte.git
synced 2025-07-24 15:43:58 +02:00
Remove 4 Application static methods
- Replace by lambda - Cleaned up global scope
This commit is contained in:
parent
cf3b33a96b
commit
0f18db886c
4 changed files with 10 additions and 15 deletions
|
@ -432,8 +432,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
auto audioIO = DependencyManager::get<AudioClient>();
|
auto audioIO = DependencyManager::get<AudioClient>();
|
||||||
|
|
||||||
audioIO->setPositionGetter(getPositionForAudio);
|
audioIO->setPositionGetter([]{ return qApp->_myAvatar->getPositionForAudio(); });
|
||||||
audioIO->setOrientationGetter(getOrientationForAudio);
|
audioIO->setOrientationGetter([]{ return qApp->_myAvatar->getOrientationForAudio(); });
|
||||||
|
|
||||||
audioIO->moveToThread(audioThread);
|
audioIO->moveToThread(audioThread);
|
||||||
|
|
||||||
|
@ -524,8 +524,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
auto addressManager = DependencyManager::get<AddressManager>();
|
auto addressManager = DependencyManager::get<AddressManager>();
|
||||||
|
|
||||||
// use our MyAvatar position and quat for address manager path
|
// use our MyAvatar position and quat for address manager path
|
||||||
addressManager->setPositionGetter(getPositionForPath);
|
addressManager->setPositionGetter([]{ return qApp->_myAvatar->getPosition(); });
|
||||||
addressManager->setOrientationGetter(getOrientationForPath);
|
addressManager->setOrientationGetter([]{ return qApp->_myAvatar->getOrientation(); });
|
||||||
|
|
||||||
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
|
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
|
||||||
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
|
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
|
||||||
|
|
|
@ -139,10 +139,6 @@ class Application : public QApplication, public AbstractViewStateInterface, publ
|
||||||
friend class DatagramProcessor;
|
friend class DatagramProcessor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const glm::vec3& getPositionForPath() { return qApp->_myAvatar->getPosition(); }
|
|
||||||
static glm::quat getOrientationForPath() { return qApp->_myAvatar->getOrientation(); }
|
|
||||||
static glm::vec3 getPositionForAudio() { return qApp->_myAvatar->getPositionForAudio(); }
|
|
||||||
static glm::quat getOrientationForAudio() { return qApp->_myAvatar->getOrientationForAudio(); }
|
|
||||||
static void initPlugins();
|
static void initPlugins();
|
||||||
static void shutdownPlugins();
|
static void shutdownPlugins();
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,6 @@ class QIODevice;
|
||||||
|
|
||||||
typedef struct ty_gverb ty_gverb;
|
typedef struct ty_gverb ty_gverb;
|
||||||
|
|
||||||
typedef glm::vec3 (*AudioPositionGetter)();
|
|
||||||
typedef glm::quat (*AudioOrientationGetter)();
|
|
||||||
|
|
||||||
class NLPacket;
|
class NLPacket;
|
||||||
|
|
||||||
|
@ -85,6 +83,8 @@ class AudioClient : public AbstractAudioInterface, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
public:
|
public:
|
||||||
|
using AudioPositionGetter = std::function<glm::vec3()>;
|
||||||
|
using AudioOrientationGetter = std::function<glm::quat()>;
|
||||||
|
|
||||||
class AudioOutputIODevice : public QIODevice {
|
class AudioOutputIODevice : public QIODevice {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -28,9 +28,6 @@ const QString INDEX_PATH = "/";
|
||||||
|
|
||||||
const QString GET_PLACE = "/api/v1/places/%1";
|
const QString GET_PLACE = "/api/v1/places/%1";
|
||||||
|
|
||||||
typedef const glm::vec3& (*PositionGetter)();
|
|
||||||
typedef glm::quat (*OrientationGetter)();
|
|
||||||
|
|
||||||
class AddressManager : public QObject, public Dependency {
|
class AddressManager : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
@ -40,6 +37,8 @@ class AddressManager : public QObject, public Dependency {
|
||||||
Q_PROPERTY(QString hostname READ getHost)
|
Q_PROPERTY(QString hostname READ getHost)
|
||||||
Q_PROPERTY(QString pathname READ currentPath)
|
Q_PROPERTY(QString pathname READ currentPath)
|
||||||
public:
|
public:
|
||||||
|
using PositionGetter = std::function<glm::vec3()>;
|
||||||
|
using OrientationGetter = std::function<glm::quat()>;
|
||||||
|
|
||||||
enum LookupTrigger {
|
enum LookupTrigger {
|
||||||
UserInput,
|
UserInput,
|
||||||
|
@ -130,8 +129,8 @@ private:
|
||||||
QString _host;
|
QString _host;
|
||||||
quint16 _port;
|
quint16 _port;
|
||||||
QUuid _rootPlaceID;
|
QUuid _rootPlaceID;
|
||||||
PositionGetter _positionGetter { nullptr };
|
PositionGetter _positionGetter;
|
||||||
OrientationGetter _orientationGetter { nullptr };
|
OrientationGetter _orientationGetter;
|
||||||
|
|
||||||
QStack<QUrl> _backStack;
|
QStack<QUrl> _backStack;
|
||||||
QStack<QUrl> _forwardStack;
|
QStack<QUrl> _forwardStack;
|
||||||
|
|
Loading…
Reference in a new issue