mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 20:10:29 +02:00
use DependencyManager to keep track of BandwidthRecorder
This commit is contained in:
parent
b85456b1e9
commit
c0a219678c
8 changed files with 22 additions and 24 deletions
|
@ -201,6 +201,7 @@ bool setupEssentials(int& argc, char** argv) {
|
||||||
auto lodManager = DependencyManager::set<LODManager>();
|
auto lodManager = DependencyManager::set<LODManager>();
|
||||||
auto jsConsole = DependencyManager::set<StandAloneJSConsole>();
|
auto jsConsole = DependencyManager::set<StandAloneJSConsole>();
|
||||||
auto dialogsManager = DependencyManager::set<DialogsManager>();
|
auto dialogsManager = DependencyManager::set<DialogsManager>();
|
||||||
|
auto bandwidthRecorder = DependencyManager::set<BandwidthRecorder>();
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
auto speechRecognizer = DependencyManager::set<SpeechRecognizer>();
|
auto speechRecognizer = DependencyManager::set<SpeechRecognizer>();
|
||||||
#endif
|
#endif
|
||||||
|
@ -434,10 +435,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
|
connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
|
||||||
|
|
||||||
// hook up bandwidth estimator
|
// hook up bandwidth estimator
|
||||||
|
QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||||
connect(nodeList.data(), SIGNAL(dataSent(const quint8, const int)),
|
connect(nodeList.data(), SIGNAL(dataSent(const quint8, const int)),
|
||||||
&_bandwidthRecorder, SLOT(updateOutboundData(const quint8, const int)));
|
&*bandwidthRecorder, SLOT(updateOutboundData(const quint8, const int)));
|
||||||
connect(nodeList.data(), SIGNAL(dataReceived(const quint8, const int)),
|
connect(nodeList.data(), SIGNAL(dataReceived(const quint8, const int)),
|
||||||
&_bandwidthRecorder, SLOT(updateInboundData(const quint8, const int)));
|
&*bandwidthRecorder, SLOT(updateInboundData(const quint8, const int)));
|
||||||
|
|
||||||
// check first run...
|
// check first run...
|
||||||
bool firstRun = SettingHandles::firstRun.get();
|
bool firstRun = SettingHandles::firstRun.get();
|
||||||
|
|
|
@ -202,7 +202,6 @@ public:
|
||||||
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
||||||
|
|
||||||
FaceTracker* getActiveFaceTracker();
|
FaceTracker* getActiveFaceTracker();
|
||||||
BandwidthRecorder* getBandwidthRecorder() { return &_bandwidthRecorder; }
|
|
||||||
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
|
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
|
||||||
ApplicationOverlay& getApplicationOverlay() { return _applicationOverlay; }
|
ApplicationOverlay& getApplicationOverlay() { return _applicationOverlay; }
|
||||||
Overlays& getOverlays() { return _overlays; }
|
Overlays& getOverlays() { return _overlays; }
|
||||||
|
@ -484,9 +483,6 @@ private:
|
||||||
|
|
||||||
OctreeQuery _octreeQuery; // NodeData derived class for querying octee cells from octree servers
|
OctreeQuery _octreeQuery; // NodeData derived class for querying octee cells from octree servers
|
||||||
|
|
||||||
BandwidthRecorder _bandwidthRecorder;
|
|
||||||
|
|
||||||
|
|
||||||
AvatarManager _avatarManager;
|
AvatarManager _avatarManager;
|
||||||
MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be)
|
MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be)
|
||||||
|
|
||||||
|
|
|
@ -904,7 +904,7 @@ void ApplicationOverlay::renderAudioMeter() {
|
||||||
void ApplicationOverlay::renderStatsAndLogs() {
|
void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
BandwidthRecorder* bandwidthRecorder = Application::getInstance()->getBandwidthRecorder();
|
QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||||
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
|
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
|
||||||
|
|
|
@ -52,9 +52,8 @@ void BandwidthChannelDisplay::Paint() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BandwidthDialog::BandwidthDialog(QWidget* parent, BandwidthRecorder* model) :
|
BandwidthDialog::BandwidthDialog(QWidget* parent) :
|
||||||
QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint),
|
QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint) {
|
||||||
_model(model) {
|
|
||||||
|
|
||||||
this->setWindowTitle("Bandwidth Details");
|
this->setWindowTitle("Bandwidth Details");
|
||||||
|
|
||||||
|
@ -62,12 +61,14 @@ BandwidthDialog::BandwidthDialog(QWidget* parent, BandwidthRecorder* model) :
|
||||||
QFormLayout* form = new QFormLayout();
|
QFormLayout* form = new QFormLayout();
|
||||||
this->QDialog::setLayout(form);
|
this->QDialog::setLayout(form);
|
||||||
|
|
||||||
_allChannelDisplays[0] = _audioChannelDisplay = new BandwidthChannelDisplay(&_model->audioChannel, form);
|
QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||||
_allChannelDisplays[1] = _avatarsChannelDisplay = new BandwidthChannelDisplay(&_model->avatarsChannel, form);
|
|
||||||
_allChannelDisplays[2] = _octreeChannelDisplay = new BandwidthChannelDisplay(&_model->octreeChannel, form);
|
_allChannelDisplays[0] = _audioChannelDisplay = new BandwidthChannelDisplay(&bandwidthRecorder->audioChannel, form);
|
||||||
_allChannelDisplays[3] = _metavoxelsChannelDisplay = new BandwidthChannelDisplay(&_model->metavoxelsChannel, form);
|
_allChannelDisplays[1] = _avatarsChannelDisplay = new BandwidthChannelDisplay(&bandwidthRecorder->avatarsChannel, form);
|
||||||
_allChannelDisplays[4] = _otherChannelDisplay = new BandwidthChannelDisplay(&_model->otherChannel, form);
|
_allChannelDisplays[2] = _octreeChannelDisplay = new BandwidthChannelDisplay(&bandwidthRecorder->octreeChannel, form);
|
||||||
_allChannelDisplays[5] = _totalChannelDisplay = new BandwidthChannelDisplay(&_model->totalChannel, form);
|
_allChannelDisplays[3] = _metavoxelsChannelDisplay = new BandwidthChannelDisplay(&bandwidthRecorder->metavoxelsChannel,form);
|
||||||
|
_allChannelDisplays[4] = _otherChannelDisplay = new BandwidthChannelDisplay(&bandwidthRecorder->otherChannel, form);
|
||||||
|
_allChannelDisplays[5] = _totalChannelDisplay = new BandwidthChannelDisplay(&bandwidthRecorder->totalChannel, form);
|
||||||
|
|
||||||
connect(averageUpdateTimer, SIGNAL(timeout()), this, SLOT(updateTimerTimeout()));
|
connect(averageUpdateTimer, SIGNAL(timeout()), this, SLOT(updateTimerTimeout()));
|
||||||
averageUpdateTimer->start(1000);
|
averageUpdateTimer->start(1000);
|
||||||
|
|
|
@ -27,10 +27,8 @@ class BandwidthChannelDisplay : public QObject {
|
||||||
void Paint();
|
void Paint();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BandwidthRecorder::Channel *ch;
|
BandwidthRecorder::Channel *ch;
|
||||||
QLabel* label;
|
QLabel* label;
|
||||||
// std::string strBuf;
|
|
||||||
QString strBuf;
|
QString strBuf;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -41,8 +39,7 @@ class BandwidthChannelDisplay : public QObject {
|
||||||
class BandwidthDialog : public QDialog {
|
class BandwidthDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
// Sets up the UI based on the configuration of the BandwidthRecorder
|
BandwidthDialog(QWidget* parent);
|
||||||
BandwidthDialog(QWidget* parent, BandwidthRecorder* model);
|
|
||||||
~BandwidthDialog();
|
~BandwidthDialog();
|
||||||
|
|
||||||
void paintEvent(QPaintEvent*);
|
void paintEvent(QPaintEvent*);
|
||||||
|
@ -75,7 +72,6 @@ protected:
|
||||||
void closeEvent(QCloseEvent*);
|
void closeEvent(QCloseEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BandwidthRecorder* _model;
|
|
||||||
QTimer *averageUpdateTimer = new QTimer(this);
|
QTimer *averageUpdateTimer = new QTimer(this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,7 +102,7 @@ void DialogsManager::editAnimations() {
|
||||||
|
|
||||||
void DialogsManager::bandwidthDetails() {
|
void DialogsManager::bandwidthDetails() {
|
||||||
if (! _bandwidthDialog) {
|
if (! _bandwidthDialog) {
|
||||||
_bandwidthDialog = new BandwidthDialog(qApp->getWindow(), qApp->getBandwidthRecorder());
|
_bandwidthDialog = new BandwidthDialog(qApp->getWindow());
|
||||||
connect(_bandwidthDialog, SIGNAL(closed()), _bandwidthDialog, SLOT(deleteLater()));
|
connect(_bandwidthDialog, SIGNAL(closed()), _bandwidthDialog, SLOT(deleteLater()));
|
||||||
|
|
||||||
if (_hmdToolsDialog) {
|
if (_hmdToolsDialog) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
#include "BandwidthRecorder.h"
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
@ -216,7 +217,7 @@ void Stats::display(
|
||||||
QLocale locale(QLocale::English);
|
QLocale locale(QLocale::English);
|
||||||
std::stringstream octreeStats;
|
std::stringstream octreeStats;
|
||||||
|
|
||||||
BandwidthRecorder* bandwidthRecorder = Application::getInstance()->getBandwidthRecorder();
|
QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||||
|
|
||||||
if (_lastHorizontalOffset != horizontalOffset) {
|
if (_lastHorizontalOffset != horizontalOffset) {
|
||||||
resetWidth(glCanvas->width(), horizontalOffset);
|
resetWidth(glCanvas->width(), horizontalOffset);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include "DependencyManager.h"
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
#include "SimpleMovingAverage.h"
|
#include "SimpleMovingAverage.h"
|
||||||
|
|
||||||
|
@ -27,8 +28,9 @@ const unsigned int COLOR1 = 0xffef40c0;
|
||||||
const unsigned int COLOR2 = 0xd0d0d0a0;
|
const unsigned int COLOR2 = 0xd0d0d0a0;
|
||||||
|
|
||||||
|
|
||||||
class BandwidthRecorder : public QObject {
|
class BandwidthRecorder : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BandwidthRecorder();
|
BandwidthRecorder();
|
||||||
|
|
Loading…
Reference in a new issue