mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
add ability to display domain connection times
This commit is contained in:
parent
d1489c50fe
commit
61029fd0b1
8 changed files with 178 additions and 184 deletions
|
@ -71,14 +71,14 @@ Menu::Menu() {
|
||||||
|
|
||||||
{
|
{
|
||||||
addActionToQMenuAndActionHash(fileMenu, MenuOption::Login);
|
addActionToQMenuAndActionHash(fileMenu, MenuOption::Login);
|
||||||
|
|
||||||
// connect to the appropriate signal of the AccountManager so that we can change the Login/Logout menu item
|
// connect to the appropriate signal of the AccountManager so that we can change the Login/Logout menu item
|
||||||
connect(&accountManager, &AccountManager::profileChanged,
|
connect(&accountManager, &AccountManager::profileChanged,
|
||||||
dialogsManager.data(), &DialogsManager::toggleLoginDialog);
|
dialogsManager.data(), &DialogsManager::toggleLoginDialog);
|
||||||
connect(&accountManager, &AccountManager::logoutComplete,
|
connect(&accountManager, &AccountManager::logoutComplete,
|
||||||
dialogsManager.data(), &DialogsManager::toggleLoginDialog);
|
dialogsManager.data(), &DialogsManager::toggleLoginDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
addDisabledActionAndSeparator(fileMenu, "Scripts");
|
addDisabledActionAndSeparator(fileMenu, "Scripts");
|
||||||
addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScript, Qt::CTRL | Qt::Key_O,
|
addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScript, Qt::CTRL | Qt::Key_O,
|
||||||
qApp, SLOT(loadDialog()));
|
qApp, SLOT(loadDialog()));
|
||||||
|
@ -92,7 +92,7 @@ Menu::Menu() {
|
||||||
|
|
||||||
addDisabledActionAndSeparator(fileMenu, "Location");
|
addDisabledActionAndSeparator(fileMenu, "Location");
|
||||||
qApp->getBookmarks()->setupMenus(this, fileMenu);
|
qApp->getBookmarks()->setupMenus(this, fileMenu);
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(fileMenu,
|
addActionToQMenuAndActionHash(fileMenu,
|
||||||
MenuOption::AddressBar,
|
MenuOption::AddressBar,
|
||||||
Qt::CTRL | Qt::Key_L,
|
Qt::CTRL | Qt::Key_L,
|
||||||
|
@ -148,8 +148,8 @@ Menu::Menu() {
|
||||||
SLOT(setEnabled(bool)));
|
SLOT(setEnabled(bool)));
|
||||||
connect(speechRecognizer.data(), SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool)));
|
connect(speechRecognizer.data(), SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat,
|
addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat,
|
||||||
0, // QML Qt::Key_Backslash,
|
0, // QML Qt::Key_Backslash,
|
||||||
dialogsManager.data(), SLOT(showIRCLink()));
|
dialogsManager.data(), SLOT(showIRCLink()));
|
||||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::AddRemoveFriends, 0,
|
addActionToQMenuAndActionHash(toolsMenu, MenuOption::AddRemoveFriends, 0,
|
||||||
|
@ -175,7 +175,7 @@ Menu::Menu() {
|
||||||
discoverabilityManager.data(), SLOT(setVisibility()));
|
discoverabilityManager.data(), SLOT(setVisibility()));
|
||||||
visibilityGroup->addAction(visibleToNoOne);
|
visibilityGroup->addAction(visibleToNoOne);
|
||||||
|
|
||||||
connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,
|
connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,
|
||||||
discoverabilityManager.data(), &DiscoverabilityManager::visibilityChanged);
|
discoverabilityManager.data(), &DiscoverabilityManager::visibilityChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ Menu::Menu() {
|
||||||
0, // QML Qt::Key_Apostrophe,
|
0, // QML Qt::Key_Apostrophe,
|
||||||
qApp,
|
qApp,
|
||||||
SLOT(resetSensors()));
|
SLOT(resetSensors()));
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0,
|
addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0,
|
||||||
qApp, SLOT(packageModel()));
|
qApp, SLOT(packageModel()));
|
||||||
|
|
||||||
|
@ -245,17 +245,17 @@ Menu::Menu() {
|
||||||
qApp,
|
qApp,
|
||||||
SLOT(setFullscreen(bool)));
|
SLOT(setFullscreen(bool)));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FirstPerson,
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FirstPerson,
|
||||||
0, // QML Qt::Key_P,
|
0, // QML Qt::Key_P,
|
||||||
true, qApp, SLOT(cameraMenuChanged()));
|
true, qApp, SLOT(cameraMenuChanged()));
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Mirror,
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Mirror,
|
||||||
0, //QML Qt::SHIFT | Qt::Key_H,
|
0, //QML Qt::SHIFT | Qt::Key_H,
|
||||||
true);
|
true);
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror,
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror,
|
||||||
0, // QML Qt::Key_H,
|
0, // QML Qt::Key_H,
|
||||||
false, qApp, SLOT(cameraMenuChanged()));
|
false, qApp, SLOT(cameraMenuChanged()));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::HMDTools,
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::HMDTools,
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
Qt::META | Qt::Key_H,
|
Qt::META | Qt::Key_H,
|
||||||
#else
|
#else
|
||||||
|
@ -285,8 +285,8 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false);
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats);
|
||||||
addActionToQMenuAndActionHash(viewMenu, MenuOption::Log,
|
addActionToQMenuAndActionHash(viewMenu, MenuOption::Log,
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
||||||
qApp, SLOT(toggleLogDialog()));
|
qApp, SLOT(toggleLogDialog()));
|
||||||
addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0,
|
addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0,
|
||||||
dialogsManager.data(), SLOT(bandwidthDetails()));
|
dialogsManager.data(), SLOT(bandwidthDetails()));
|
||||||
|
@ -297,8 +297,8 @@ Menu::Menu() {
|
||||||
MenuWrapper* developerMenu = addMenu("Developer");
|
MenuWrapper* developerMenu = addMenu("Developer");
|
||||||
|
|
||||||
MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render");
|
MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render");
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Atmosphere,
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Atmosphere,
|
||||||
0, // QML Qt::SHIFT | Qt::Key_A,
|
0, // QML Qt::SHIFT | Qt::Key_A,
|
||||||
true);
|
true);
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AmbientOcclusion);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AmbientOcclusion);
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DontFadeOnOctreeServerChanges);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DontFadeOnOctreeServerChanges);
|
||||||
|
@ -317,7 +317,7 @@ Menu::Menu() {
|
||||||
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight7, 0, false));
|
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight7, 0, false));
|
||||||
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight8, 0, false));
|
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight8, 0, false));
|
||||||
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight9, 0, false));
|
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight9, 0, false));
|
||||||
|
|
||||||
MenuWrapper* shadowMenu = renderOptionsMenu->addMenu("Shadows");
|
MenuWrapper* shadowMenu = renderOptionsMenu->addMenu("Shadows");
|
||||||
QActionGroup* shadowGroup = new QActionGroup(shadowMenu);
|
QActionGroup* shadowGroup = new QActionGroup(shadowMenu);
|
||||||
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, "None", 0, true));
|
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, "None", 0, true));
|
||||||
|
@ -351,14 +351,14 @@ Menu::Menu() {
|
||||||
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionThird, 0, false));
|
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionThird, 0, false));
|
||||||
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionQuarter, 0, false));
|
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionQuarter, 0, false));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Stars,
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Stars,
|
||||||
0, // QML Qt::Key_Asterisk,
|
0, // QML Qt::Key_Asterisk,
|
||||||
true);
|
true);
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true,
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true,
|
||||||
DependencyManager::get<GlowEffect>().data(), SLOT(toggleGlowEffect(bool)));
|
DependencyManager::get<GlowEffect>().data(), SLOT(toggleGlowEffect(bool)));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
||||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools,
|
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools,
|
||||||
0, // QML Qt::SHIFT | Qt::Key_L,
|
0, // QML Qt::SHIFT | Qt::Key_L,
|
||||||
dialogsManager.data(), SLOT(lodTools()));
|
dialogsManager.data(), SLOT(lodTools()));
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ Menu::Menu() {
|
||||||
faceTrackerGroup->addAction(faceshiftFaceTracker);
|
faceTrackerGroup->addAction(faceshiftFaceTracker);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DDE
|
#ifdef HAVE_DDE
|
||||||
QAction* ddeFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::UseCamera,
|
QAction* ddeFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::UseCamera,
|
||||||
0, true,
|
0, true,
|
||||||
qApp, SLOT(setActiveFaceTracker()));
|
qApp, SLOT(setActiveFaceTracker()));
|
||||||
faceTrackerGroup->addAction(ddeFaceTracker);
|
faceTrackerGroup->addAction(ddeFaceTracker);
|
||||||
|
@ -404,13 +404,13 @@ Menu::Menu() {
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_FACESHIFT) || defined(HAVE_DDE)
|
#if defined(HAVE_FACESHIFT) || defined(HAVE_DDE)
|
||||||
faceTrackingMenu->addSeparator();
|
faceTrackingMenu->addSeparator();
|
||||||
addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::MuteFaceTracking,
|
addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::MuteFaceTracking,
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_F, true, // DDE face tracking is on by default
|
Qt::CTRL | Qt::SHIFT | Qt::Key_F, true, // DDE face tracking is on by default
|
||||||
qApp, SLOT(toggleFaceTrackerMute()));
|
qApp, SLOT(toggleFaceTrackerMute()));
|
||||||
addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::AutoMuteAudio, 0, true);
|
addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::AutoMuteAudio, 0, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AvatarReceiveStats, 0, false,
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AvatarReceiveStats, 0, false,
|
||||||
avatarManager.data(), SLOT(setShouldShowReceiveStats(bool)));
|
avatarManager.data(), SLOT(setShouldShowReceiveStats(bool)));
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHands, 0, true);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHands, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHandTargets, 0, false);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHandTargets, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::ShowIKConstraints, 0, false);
|
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::ShowIKConstraints, 0, false);
|
||||||
|
|
||||||
MenuWrapper* sixenseOptionsMenu = handOptionsMenu->addMenu("Sixense");
|
MenuWrapper* sixenseOptionsMenu = handOptionsMenu->addMenu("Sixense");
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu,
|
||||||
|
@ -472,7 +472,11 @@ Menu::Menu() {
|
||||||
addActionToQMenuAndActionHash(networkMenu, MenuOption::DiskCacheEditor, 0,
|
addActionToQMenuAndActionHash(networkMenu, MenuOption::DiskCacheEditor, 0,
|
||||||
dialogsManager.data(), SLOT(toggleDiskCacheEditor()));
|
dialogsManager.data(), SLOT(toggleDiskCacheEditor()));
|
||||||
|
|
||||||
|
addActionToQMenuAndActionHash(networkMenu, MenuOption::ShowDSConnectTable, 0,
|
||||||
|
dialogsManager.data(), SLOT(showDomainConnectionDialog()));
|
||||||
|
|
||||||
MenuWrapper* timingMenu = developerMenu->addMenu("Timing and Stats");
|
MenuWrapper* timingMenu = developerMenu->addMenu("Timing and Stats");
|
||||||
|
|
||||||
MenuWrapper* perfTimerMenu = timingMenu->addMenu("Performance Timer");
|
MenuWrapper* perfTimerMenu = timingMenu->addMenu("Performance Timer");
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::DisplayDebugTimingDetails, 0, false);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::DisplayDebugTimingDetails, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true);
|
||||||
|
@ -510,7 +514,7 @@ Menu::Menu() {
|
||||||
0,
|
0,
|
||||||
audioIO.data(),
|
audioIO.data(),
|
||||||
SLOT(sendMuteEnvironmentPacket()));
|
SLOT(sendMuteEnvironmentPacket()));
|
||||||
|
|
||||||
auto scope = DependencyManager::get<AudioScope>();
|
auto scope = DependencyManager::get<AudioScope>();
|
||||||
|
|
||||||
MenuWrapper* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope");
|
MenuWrapper* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope");
|
||||||
|
@ -548,7 +552,7 @@ Menu::Menu() {
|
||||||
audioScopeFramesGroup->addAction(twentyFrames);
|
audioScopeFramesGroup->addAction(twentyFrames);
|
||||||
audioScopeFramesGroup->addAction(fiftyFrames);
|
audioScopeFramesGroup->addAction(fiftyFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto statsRenderer = DependencyManager::get<AudioIOStatsRenderer>();
|
auto statsRenderer = DependencyManager::get<AudioIOStatsRenderer>();
|
||||||
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioStats,
|
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioStats,
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_A,
|
Qt::CTRL | Qt::SHIFT | Qt::Key_A,
|
||||||
|
@ -767,7 +771,7 @@ QAction* Menu::getActionFromName(const QString& menuName, MenuWrapper* menu) {
|
||||||
} else {
|
} else {
|
||||||
menuActions = actions();
|
menuActions = actions();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QAction* menuAction, menuActions) {
|
foreach (QAction* menuAction, menuActions) {
|
||||||
QString actionText = menuAction->text();
|
QString actionText = menuAction->text();
|
||||||
if (menuName == menuAction->text()) {
|
if (menuName == menuAction->text()) {
|
||||||
|
@ -868,14 +872,14 @@ MenuWrapper* Menu::addMenu(const QString& menuName) {
|
||||||
}
|
}
|
||||||
addTo = menu;
|
addTo = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenuBar::repaint();
|
QMenuBar::repaint();
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::removeMenu(const QString& menuName) {
|
void Menu::removeMenu(const QString& menuName) {
|
||||||
QAction* action = getMenuAction(menuName);
|
QAction* action = getMenuAction(menuName);
|
||||||
|
|
||||||
// only proceed if the menu actually exists
|
// only proceed if the menu actually exists
|
||||||
if (action) {
|
if (action) {
|
||||||
QString finalMenuPart;
|
QString finalMenuPart;
|
||||||
|
@ -885,14 +889,14 @@ void Menu::removeMenu(const QString& menuName) {
|
||||||
} else {
|
} else {
|
||||||
QMenuBar::removeAction(action);
|
QMenuBar::removeAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenuBar::repaint();
|
QMenuBar::repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Menu::menuExists(const QString& menuName) {
|
bool Menu::menuExists(const QString& menuName) {
|
||||||
QAction* action = getMenuAction(menuName);
|
QAction* action = getMenuAction(menuName);
|
||||||
|
|
||||||
// only proceed if the menu actually exists
|
// only proceed if the menu actually exists
|
||||||
if (action) {
|
if (action) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -937,7 +941,7 @@ void Menu::addMenuItem(const MenuItemProperties& properties) {
|
||||||
if (!properties.shortcutKeySequence.isEmpty()) {
|
if (!properties.shortcutKeySequence.isEmpty()) {
|
||||||
shortcut = new QShortcut(properties.shortcutKeySequence, this);
|
shortcut = new QShortcut(properties.shortcutKeySequence, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for positioning requests
|
// check for positioning requests
|
||||||
int requestedPosition = properties.position;
|
int requestedPosition = properties.position;
|
||||||
if (requestedPosition == UNSPECIFIED_POSITION && !properties.beforeItem.isEmpty()) {
|
if (requestedPosition == UNSPECIFIED_POSITION && !properties.beforeItem.isEmpty()) {
|
||||||
|
@ -951,7 +955,7 @@ void Menu::addMenuItem(const MenuItemProperties& properties) {
|
||||||
requestedPosition = afterPosition + 1;
|
requestedPosition = afterPosition + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* menuItemAction = NULL;
|
QAction* menuItemAction = NULL;
|
||||||
if (properties.isSeparator) {
|
if (properties.isSeparator) {
|
||||||
addDisabledActionAndSeparator(menuObj, properties.menuItemName, requestedPosition);
|
addDisabledActionAndSeparator(menuObj, properties.menuItemName, requestedPosition);
|
||||||
|
|
|
@ -58,15 +58,15 @@ class Menu : public QMenuBar {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static Menu* getInstance();
|
static Menu* getInstance();
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
MenuWrapper* getMenu(const QString& menuName);
|
MenuWrapper* getMenu(const QString& menuName);
|
||||||
|
|
||||||
void triggerOption(const QString& menuOption);
|
void triggerOption(const QString& menuOption);
|
||||||
QAction* getActionForOption(const QString& menuOption);
|
QAction* getActionForOption(const QString& menuOption);
|
||||||
|
|
||||||
QAction* addActionToQMenuAndActionHash(MenuWrapper* destinationMenu,
|
QAction* addActionToQMenuAndActionHash(MenuWrapper* destinationMenu,
|
||||||
const QString& actionName,
|
const QString& actionName,
|
||||||
const QKeySequence& shortcut = 0,
|
const QKeySequence& shortcut = 0,
|
||||||
|
@ -80,9 +80,9 @@ public:
|
||||||
const QKeySequence& shortcut = 0,
|
const QKeySequence& shortcut = 0,
|
||||||
QAction::MenuRole role = QAction::NoRole,
|
QAction::MenuRole role = QAction::NoRole,
|
||||||
int menuItemLocation = UNSPECIFIED_POSITION);
|
int menuItemLocation = UNSPECIFIED_POSITION);
|
||||||
|
|
||||||
void removeAction(MenuWrapper* menu, const QString& actionName);
|
void removeAction(MenuWrapper* menu, const QString& actionName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
MenuWrapper* addMenu(const QString& menuName);
|
MenuWrapper* addMenu(const QString& menuName);
|
||||||
void removeMenu(const QString& menuName);
|
void removeMenu(const QString& menuName);
|
||||||
|
@ -94,21 +94,21 @@ public slots:
|
||||||
bool menuItemExists(const QString& menuName, const QString& menuitem);
|
bool menuItemExists(const QString& menuName, const QString& menuitem);
|
||||||
bool isOptionChecked(const QString& menuOption) const;
|
bool isOptionChecked(const QString& menuOption) const;
|
||||||
void setIsOptionChecked(const QString& menuOption, bool isChecked);
|
void setIsOptionChecked(const QString& menuOption, bool isChecked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Menu* _instance;
|
static Menu* _instance;
|
||||||
Menu();
|
Menu();
|
||||||
|
|
||||||
typedef void(*settingsAction)(Settings&, QAction&);
|
typedef void(*settingsAction)(Settings&, QAction&);
|
||||||
static void loadAction(Settings& settings, QAction& action);
|
static void loadAction(Settings& settings, QAction& action);
|
||||||
static void saveAction(Settings& settings, QAction& action);
|
static void saveAction(Settings& settings, QAction& action);
|
||||||
void scanMenuBar(settingsAction modifySetting);
|
void scanMenuBar(settingsAction modifySetting);
|
||||||
void scanMenu(QMenu& menu, settingsAction modifySetting, Settings& settings);
|
void scanMenu(QMenu& menu, settingsAction modifySetting, Settings& settings);
|
||||||
|
|
||||||
/// helper method to have separators with labels that are also compatible with OS X
|
/// helper method to have separators with labels that are also compatible with OS X
|
||||||
void addDisabledActionAndSeparator(MenuWrapper* destinationMenu, const QString& actionName,
|
void addDisabledActionAndSeparator(MenuWrapper* destinationMenu, const QString& actionName,
|
||||||
int menuItemLocation = UNSPECIFIED_POSITION);
|
int menuItemLocation = UNSPECIFIED_POSITION);
|
||||||
|
|
||||||
QAction* addCheckableActionToQMenuAndActionHash(MenuWrapper* destinationMenu,
|
QAction* addCheckableActionToQMenuAndActionHash(MenuWrapper* destinationMenu,
|
||||||
const QString& actionName,
|
const QString& actionName,
|
||||||
const QKeySequence& shortcut = 0,
|
const QKeySequence& shortcut = 0,
|
||||||
|
@ -116,15 +116,15 @@ private:
|
||||||
const QObject* receiver = NULL,
|
const QObject* receiver = NULL,
|
||||||
const char* member = NULL,
|
const char* member = NULL,
|
||||||
int menuItemLocation = UNSPECIFIED_POSITION);
|
int menuItemLocation = UNSPECIFIED_POSITION);
|
||||||
|
|
||||||
QAction* getActionFromName(const QString& menuName, MenuWrapper* menu);
|
QAction* getActionFromName(const QString& menuName, MenuWrapper* menu);
|
||||||
MenuWrapper* getSubMenuFromName(const QString& menuName, MenuWrapper* menu);
|
MenuWrapper* getSubMenuFromName(const QString& menuName, MenuWrapper* menu);
|
||||||
MenuWrapper* getMenuParent(const QString& menuName, QString& finalMenuPart);
|
MenuWrapper* getMenuParent(const QString& menuName, QString& finalMenuPart);
|
||||||
|
|
||||||
QAction* getMenuAction(const QString& menuName);
|
QAction* getMenuAction(const QString& menuName);
|
||||||
int findPositionOfMenuItem(MenuWrapper* menu, const QString& searchMenuItem);
|
int findPositionOfMenuItem(MenuWrapper* menu, const QString& searchMenuItem);
|
||||||
int positionBeforeSeparatorIfNeeded(MenuWrapper* menu, int requestedPosition);
|
int positionBeforeSeparatorIfNeeded(MenuWrapper* menu, int requestedPosition);
|
||||||
|
|
||||||
QHash<QString, QAction*> _actionHash;
|
QHash<QString, QAction*> _actionHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -262,6 +262,7 @@ namespace MenuOption {
|
||||||
const QString RunTimingTests = "Run Timing Tests";
|
const QString RunTimingTests = "Run Timing Tests";
|
||||||
const QString ScriptEditor = "Script Editor...";
|
const QString ScriptEditor = "Script Editor...";
|
||||||
const QString ScriptedMotorControl = "Enable Scripted Motor Control";
|
const QString ScriptedMotorControl = "Enable Scripted Motor Control";
|
||||||
|
const QString ShowDSConnectTable = "Show Domain Connection Timing";
|
||||||
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
||||||
const QString ShowIKConstraints = "Show IK Constraints";
|
const QString ShowIKConstraints = "Show IK Constraints";
|
||||||
const QString SimpleShadows = "Simple";
|
const QString SimpleShadows = "Simple";
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "BandwidthDialog.h"
|
#include "BandwidthDialog.h"
|
||||||
#include "CachesSizeDialog.h"
|
#include "CachesSizeDialog.h"
|
||||||
#include "DiskCacheEditor.h"
|
#include "DiskCacheEditor.h"
|
||||||
|
#include "DomainConnectionDialog.h"
|
||||||
#include "HMDToolsDialog.h"
|
#include "HMDToolsDialog.h"
|
||||||
#include "LodToolsDialog.h"
|
#include "LodToolsDialog.h"
|
||||||
#include "LoginDialog.h"
|
#include "LoginDialog.h"
|
||||||
|
@ -52,7 +53,7 @@ void DialogsManager::showLoginDialog() {
|
||||||
void DialogsManager::octreeStatsDetails() {
|
void DialogsManager::octreeStatsDetails() {
|
||||||
if (!_octreeStatsDialog) {
|
if (!_octreeStatsDialog) {
|
||||||
_octreeStatsDialog = new OctreeStatsDialog(qApp->getWindow(), qApp->getOcteeSceneStats());
|
_octreeStatsDialog = new OctreeStatsDialog(qApp->getWindow(), qApp->getOcteeSceneStats());
|
||||||
|
|
||||||
if (_hmdToolsDialog) {
|
if (_hmdToolsDialog) {
|
||||||
_hmdToolsDialog->watchWindow(_octreeStatsDialog->windowHandle());
|
_hmdToolsDialog->watchWindow(_octreeStatsDialog->windowHandle());
|
||||||
}
|
}
|
||||||
|
@ -65,7 +66,7 @@ void DialogsManager::octreeStatsDetails() {
|
||||||
void DialogsManager::cachesSizeDialog() {
|
void DialogsManager::cachesSizeDialog() {
|
||||||
if (!_cachesSizeDialog) {
|
if (!_cachesSizeDialog) {
|
||||||
maybeCreateDialog(_cachesSizeDialog);
|
maybeCreateDialog(_cachesSizeDialog);
|
||||||
|
|
||||||
connect(_cachesSizeDialog, SIGNAL(closed()), _cachesSizeDialog, SLOT(deleteLater()));
|
connect(_cachesSizeDialog, SIGNAL(closed()), _cachesSizeDialog, SLOT(deleteLater()));
|
||||||
_cachesSizeDialog->show();
|
_cachesSizeDialog->show();
|
||||||
}
|
}
|
||||||
|
@ -112,11 +113,11 @@ void DialogsManager::bandwidthDetails() {
|
||||||
if (! _bandwidthDialog) {
|
if (! _bandwidthDialog) {
|
||||||
_bandwidthDialog = new BandwidthDialog(qApp->getWindow());
|
_bandwidthDialog = new BandwidthDialog(qApp->getWindow());
|
||||||
connect(_bandwidthDialog, SIGNAL(closed()), _bandwidthDialog, SLOT(deleteLater()));
|
connect(_bandwidthDialog, SIGNAL(closed()), _bandwidthDialog, SLOT(deleteLater()));
|
||||||
|
|
||||||
if (_hmdToolsDialog) {
|
if (_hmdToolsDialog) {
|
||||||
_hmdToolsDialog->watchWindow(_bandwidthDialog->windowHandle());
|
_hmdToolsDialog->watchWindow(_bandwidthDialog->windowHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
_bandwidthDialog->show();
|
_bandwidthDialog->show();
|
||||||
}
|
}
|
||||||
_bandwidthDialog->raise();
|
_bandwidthDialog->raise();
|
||||||
|
@ -125,7 +126,7 @@ void DialogsManager::bandwidthDetails() {
|
||||||
void DialogsManager::lodTools() {
|
void DialogsManager::lodTools() {
|
||||||
if (!_lodToolsDialog) {
|
if (!_lodToolsDialog) {
|
||||||
maybeCreateDialog(_lodToolsDialog);
|
maybeCreateDialog(_lodToolsDialog);
|
||||||
|
|
||||||
connect(_lodToolsDialog, SIGNAL(closed()), _lodToolsDialog, SLOT(deleteLater()));
|
connect(_lodToolsDialog, SIGNAL(closed()), _lodToolsDialog, SLOT(deleteLater()));
|
||||||
_lodToolsDialog->show();
|
_lodToolsDialog->show();
|
||||||
}
|
}
|
||||||
|
@ -172,7 +173,16 @@ void DialogsManager::showIRCLink() {
|
||||||
_ircInfoBox->setAttribute(Qt::WA_DeleteOnClose);
|
_ircInfoBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
_ircInfoBox->show();
|
_ircInfoBox->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
_ircInfoBox->raise();
|
_ircInfoBox->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogsManager::showDomainConnectionDialog() {
|
||||||
|
if (!_domainConnectionDialog) {
|
||||||
|
// if the dialog already exists we delete it so the connection data is refreshed
|
||||||
|
maybeCreateDialog(_domainConnectionDialog);
|
||||||
|
|
||||||
|
_domainConnectionDialog->show();
|
||||||
|
_domainConnectionDialog->raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -34,18 +34,19 @@ class PreferencesDialog;
|
||||||
class ScriptEditorWindow;
|
class ScriptEditorWindow;
|
||||||
class QMessageBox;
|
class QMessageBox;
|
||||||
class AvatarAppearanceDialog;
|
class AvatarAppearanceDialog;
|
||||||
|
class DomainConnectionDialog;
|
||||||
|
|
||||||
class DialogsManager : public QObject, public Dependency {
|
class DialogsManager : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QPointer<BandwidthDialog> getBandwidthDialog() const { return _bandwidthDialog; }
|
QPointer<BandwidthDialog> getBandwidthDialog() const { return _bandwidthDialog; }
|
||||||
QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; }
|
QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; }
|
||||||
QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; }
|
QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; }
|
||||||
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
|
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
|
||||||
QPointer<PreferencesDialog> getPreferencesDialog() const { return _preferencesDialog; }
|
QPointer<PreferencesDialog> getPreferencesDialog() const { return _preferencesDialog; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleAddressBar();
|
void toggleAddressBar();
|
||||||
void toggleDiskCacheEditor();
|
void toggleDiskCacheEditor();
|
||||||
|
@ -62,14 +63,15 @@ public slots:
|
||||||
void showScriptEditor();
|
void showScriptEditor();
|
||||||
void showIRCLink();
|
void showIRCLink();
|
||||||
void changeAvatarAppearance();
|
void changeAvatarAppearance();
|
||||||
|
void showDomainConnectionDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleToolWindow();
|
void toggleToolWindow();
|
||||||
void hmdToolsClosed();
|
void hmdToolsClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DialogsManager() {}
|
DialogsManager() {}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void maybeCreateDialog(QPointer<T>& member) {
|
void maybeCreateDialog(QPointer<T>& member) {
|
||||||
if (!member) {
|
if (!member) {
|
||||||
|
@ -77,13 +79,13 @@ private:
|
||||||
Q_CHECK_PTR(parent);
|
Q_CHECK_PTR(parent);
|
||||||
member = new T(parent);
|
member = new T(parent);
|
||||||
Q_CHECK_PTR(member);
|
Q_CHECK_PTR(member);
|
||||||
|
|
||||||
if (_hmdToolsDialog && member->windowHandle()) {
|
if (_hmdToolsDialog && member->windowHandle()) {
|
||||||
_hmdToolsDialog->watchWindow(member->windowHandle());
|
_hmdToolsDialog->watchWindow(member->windowHandle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<AddressBarDialog> _addressBarDialog;
|
QPointer<AddressBarDialog> _addressBarDialog;
|
||||||
QPointer<AnimationsDialog> _animationsDialog;
|
QPointer<AnimationsDialog> _animationsDialog;
|
||||||
QPointer<AttachmentsDialog> _attachmentsDialog;
|
QPointer<AttachmentsDialog> _attachmentsDialog;
|
||||||
|
@ -98,6 +100,7 @@ private:
|
||||||
QPointer<PreferencesDialog> _preferencesDialog;
|
QPointer<PreferencesDialog> _preferencesDialog;
|
||||||
QPointer<ScriptEditorWindow> _scriptEditor;
|
QPointer<ScriptEditorWindow> _scriptEditor;
|
||||||
QPointer<AvatarAppearanceDialog> _avatarAppearanceDialog;
|
QPointer<AvatarAppearanceDialog> _avatarAppearanceDialog;
|
||||||
|
QPointer<DomainConnectionDialog> _domainConnectionDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_DialogsManager_h
|
#endif // hifi_DialogsManager_h
|
||||||
|
|
74
interface/src/ui/DomainConnectionDialog.cpp
Normal file
74
interface/src/ui/DomainConnectionDialog.cpp
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
//
|
||||||
|
// DomainConnectionDialog.cpp
|
||||||
|
// interface/src/ui
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 05/26/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtCore/QMetaEnum>
|
||||||
|
#include <QtWidgets/QHBoxLayout>
|
||||||
|
#include <QtWidgets/QTableWidget>
|
||||||
|
|
||||||
|
#include <NodeList.h>
|
||||||
|
#include <NumericalConstants.h>
|
||||||
|
|
||||||
|
#include "DomainConnectionDialog.h"
|
||||||
|
|
||||||
|
DomainConnectionDialog::DomainConnectionDialog(QWidget* parent) :
|
||||||
|
QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint)
|
||||||
|
{
|
||||||
|
setWindowTitle("Domain Connection Timing");
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
// setup a QTableWidget so we can populate it with our values
|
||||||
|
QTableWidget* timeTable = new QTableWidget;
|
||||||
|
|
||||||
|
const QStringList TABLE_HEADERS = QStringList() << "Name" << "Timestamp (ms)" << "Delta (ms)" << "Time elapsed (ms)";
|
||||||
|
|
||||||
|
timeTable->setHorizontalHeaderLabels(TABLE_HEADERS);
|
||||||
|
timeTable->setColumnCount(TABLE_HEADERS.size());
|
||||||
|
|
||||||
|
// ask the NodeList for the current values for connection times
|
||||||
|
QMap<NodeList::ConnectionStep, quint64> times = DependencyManager::get<NodeList>()->getLastConnectionTimes();
|
||||||
|
|
||||||
|
timeTable->setRowCount(times.size());
|
||||||
|
|
||||||
|
// setup our data with the values from the NodeList
|
||||||
|
quint64 firstStepTime = times[NodeList::ConnectionStep::LookupAddress] / USECS_PER_MSEC;
|
||||||
|
quint64 lastStepTime = firstStepTime;
|
||||||
|
|
||||||
|
int thisRow = 0;
|
||||||
|
|
||||||
|
const QMetaObject &nodeListMeta = NodeList::staticMetaObject;
|
||||||
|
QMetaEnum stepEnum = nodeListMeta.enumerator(nodeListMeta.indexOfEnumerator("ConnectionStep"));
|
||||||
|
|
||||||
|
for (int i = 0; i < stepEnum.keyCount(); i++) {
|
||||||
|
NodeList::ConnectionStep step = static_cast<NodeList::ConnectionStep>(i);
|
||||||
|
|
||||||
|
if (times.contains(step)) {
|
||||||
|
// When did this step occur, how long since the last step, how long since the start?
|
||||||
|
quint64 stepTime = times[step] / USECS_PER_MSEC;
|
||||||
|
quint64 delta = (stepTime - lastStepTime);
|
||||||
|
quint64 elapsed = stepTime - firstStepTime;
|
||||||
|
|
||||||
|
lastStepTime = stepTime;
|
||||||
|
|
||||||
|
// setup the columns for this row in the table
|
||||||
|
timeTable->setItem(thisRow, 0, new QTableWidgetItem(stepEnum.valueToKey(i)));
|
||||||
|
timeTable->setItem(thisRow, 1, new QTableWidgetItem(QString::number(stepTime)));
|
||||||
|
timeTable->setItem(thisRow, 2, new QTableWidgetItem(QString::number(delta)));
|
||||||
|
timeTable->setItem(thisRow, 3, new QTableWidgetItem(QString::number(elapsed)));
|
||||||
|
|
||||||
|
++thisRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QHBoxLayout* hBoxLayout = new QHBoxLayout;
|
||||||
|
hBoxLayout->addWidget(timeTable);
|
||||||
|
|
||||||
|
setLayout(hBoxLayout);
|
||||||
|
}
|
25
interface/src/ui/DomainConnectionDialog.h
Normal file
25
interface/src/ui/DomainConnectionDialog.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// DomainConnectionDialog.h
|
||||||
|
// interface/src/ui
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 05/26/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_DomainConnectionDialog_h
|
||||||
|
#define hifi_DomainConnectionDialog_h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QtWidgets/QDialog>
|
||||||
|
|
||||||
|
class DomainConnectionDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DomainConnectionDialog(QWidget* parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_DomainConnectionDialog_h
|
|
@ -1,82 +0,0 @@
|
||||||
//
|
|
||||||
// DomainConnectionTableModel.cpp
|
|
||||||
// interface/src/ui
|
|
||||||
//
|
|
||||||
// Created by Stephen Birarda on 05/26/15.
|
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <QtCore/QMetaEnum>
|
|
||||||
|
|
||||||
#include <NodeList.h>
|
|
||||||
#include <NumericalConstants.h>
|
|
||||||
|
|
||||||
#include "DomainConnectionTableModel.h"
|
|
||||||
|
|
||||||
DomainConnectionTableModel::DomainConnectionTableModel(QObject* parent) :
|
|
||||||
QAbstractTableModel(parent)
|
|
||||||
{
|
|
||||||
// ask the NodeList for the current values for connection times
|
|
||||||
QMap<NodeList::ConnectionStep, quint64> times = DependencyManager::get<NodeList>()->getLastConnectionTimes();
|
|
||||||
|
|
||||||
// setup our data with the returned values
|
|
||||||
|
|
||||||
quint64 totalTime = 0;
|
|
||||||
quint64 firstStepTime = times[NodeList::ConnectionStep::LookupAddress] / USECS_PER_MSEC;
|
|
||||||
quint64 lastStepTime = firstStepTime;
|
|
||||||
|
|
||||||
const QMetaObject &nodeListMeta = NodeList::staticMetaObject;
|
|
||||||
QMetaEnum stepEnum = nodeListMeta.enumerator(nodeListMeta.indexOfEnumerator("ConnectionStep"));
|
|
||||||
|
|
||||||
for (int i = 0; i < stepEnum.keyCount(); i++) {
|
|
||||||
NodeList::ConnectionStep step = static_cast<NodeList::ConnectionStep>(i);
|
|
||||||
|
|
||||||
if (times.contains(step)) {
|
|
||||||
// When did this step occur, how long since the last step, how long since the start?
|
|
||||||
_timestamps[_numRows] = times[step] / USECS_PER_MSEC;
|
|
||||||
_deltas[_numRows] = (_timestamps[_numRows] - lastStepTime);
|
|
||||||
_totals[_numRows] = _timestamps[_numRows] - firstStepTime;
|
|
||||||
|
|
||||||
// increment the total time by this delta to keep track
|
|
||||||
totalTime += _deltas[_numRows];
|
|
||||||
|
|
||||||
lastStepTime = _timestamps[_numRows];
|
|
||||||
|
|
||||||
// increment our counted number of rows
|
|
||||||
++_numRows;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DomainConnectionTableModel::headerData(int section, Qt::Orientation orientation, int role) const {
|
|
||||||
switch(section) {
|
|
||||||
case 0:
|
|
||||||
return QVariant("Name");
|
|
||||||
case 1:
|
|
||||||
return QVariant("Timestamp (ms)");
|
|
||||||
case 2:
|
|
||||||
return QVariant("Delta (ms)");
|
|
||||||
case 3:
|
|
||||||
return QVariant("Total Elapsed (ms)");
|
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DomainConnectionTableModel::data(const QModelIndex& index, int role) const {
|
|
||||||
switch(index.column()) {
|
|
||||||
case 0:
|
|
||||||
return _names[index.row()];
|
|
||||||
case 1:
|
|
||||||
return QVariant(_timestamps[index.row()]);
|
|
||||||
case 2:
|
|
||||||
return QVariant(_deltas[index.row()]);
|
|
||||||
case 3:
|
|
||||||
return QVariant(_totals[index.row()]);
|
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
//
|
|
||||||
// DomainConnectionTableModel.h
|
|
||||||
// interface/src/ui
|
|
||||||
//
|
|
||||||
// Created by Stephen Birarda on 05/26/15.
|
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_DomainConnectionTableModel_h
|
|
||||||
#define hifi_DomainConnectionTableModel_h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QtCore/QAbstractTableModel>
|
|
||||||
|
|
||||||
class DomainConnectionTableModel: public QAbstractTableModel {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
DomainConnectionTableModel(QObject* parent = 0);
|
|
||||||
|
|
||||||
const int NUM_COLUMNS = 4; // name, time, delta, since start
|
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const { return _numRows; }
|
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const { return NUM_COLUMNS; }
|
|
||||||
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
|
||||||
private:
|
|
||||||
int _numRows = 0;
|
|
||||||
|
|
||||||
QVariantList _names;
|
|
||||||
QList<quint64> _timestamps;
|
|
||||||
QList<quint64> _deltas;
|
|
||||||
QList<quint64> _totals;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_DomainConnectionTableModel_h
|
|
Loading…
Reference in a new issue