mirror of
https://github.com/overte-org/overte.git
synced 2025-04-17 05:30:41 +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>();
|
||||
|
||||
audioIO->setPositionGetter(getPositionForAudio);
|
||||
audioIO->setOrientationGetter(getOrientationForAudio);
|
||||
audioIO->setPositionGetter([]{ return qApp->_myAvatar->getPositionForAudio(); });
|
||||
audioIO->setOrientationGetter([]{ return qApp->_myAvatar->getOrientationForAudio(); });
|
||||
|
||||
audioIO->moveToThread(audioThread);
|
||||
|
||||
|
@ -524,8 +524,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
|
||||
// use our MyAvatar position and quat for address manager path
|
||||
addressManager->setPositionGetter(getPositionForPath);
|
||||
addressManager->setOrientationGetter(getOrientationForPath);
|
||||
addressManager->setPositionGetter([]{ return qApp->_myAvatar->getPosition(); });
|
||||
addressManager->setOrientationGetter([]{ return qApp->_myAvatar->getOrientation(); });
|
||||
|
||||
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
|
||||
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
|
||||
|
|
|
@ -139,10 +139,6 @@ class Application : public QApplication, public AbstractViewStateInterface, publ
|
|||
friend class DatagramProcessor;
|
||||
|
||||
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 shutdownPlugins();
|
||||
|
||||
|
|
|
@ -76,8 +76,6 @@ class QIODevice;
|
|||
|
||||
typedef struct ty_gverb ty_gverb;
|
||||
|
||||
typedef glm::vec3 (*AudioPositionGetter)();
|
||||
typedef glm::quat (*AudioOrientationGetter)();
|
||||
|
||||
class NLPacket;
|
||||
|
||||
|
@ -85,6 +83,8 @@ class AudioClient : public AbstractAudioInterface, public Dependency {
|
|||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
using AudioPositionGetter = std::function<glm::vec3()>;
|
||||
using AudioOrientationGetter = std::function<glm::quat()>;
|
||||
|
||||
class AudioOutputIODevice : public QIODevice {
|
||||
public:
|
||||
|
|
|
@ -28,9 +28,6 @@ const QString INDEX_PATH = "/";
|
|||
|
||||
const QString GET_PLACE = "/api/v1/places/%1";
|
||||
|
||||
typedef const glm::vec3& (*PositionGetter)();
|
||||
typedef glm::quat (*OrientationGetter)();
|
||||
|
||||
class AddressManager : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
|
@ -40,6 +37,8 @@ class AddressManager : public QObject, public Dependency {
|
|||
Q_PROPERTY(QString hostname READ getHost)
|
||||
Q_PROPERTY(QString pathname READ currentPath)
|
||||
public:
|
||||
using PositionGetter = std::function<glm::vec3()>;
|
||||
using OrientationGetter = std::function<glm::quat()>;
|
||||
|
||||
enum LookupTrigger {
|
||||
UserInput,
|
||||
|
@ -130,8 +129,8 @@ private:
|
|||
QString _host;
|
||||
quint16 _port;
|
||||
QUuid _rootPlaceID;
|
||||
PositionGetter _positionGetter { nullptr };
|
||||
OrientationGetter _orientationGetter { nullptr };
|
||||
PositionGetter _positionGetter;
|
||||
OrientationGetter _orientationGetter;
|
||||
|
||||
QStack<QUrl> _backStack;
|
||||
QStack<QUrl> _forwardStack;
|
||||
|
|
Loading…
Reference in a new issue