History

use QHostInfo and QHostAddress for DS changes in NodeList

Stephen Birarda committed 13 years ago

Commit ab85c411 parent d6a8a4e10 files · +87 −113Browse files

Showing the changes to interface/src/Menu.cpp (1 of 10 files). Show all

Unified · Split

interface/src/Menu.cpp+26−48
@@ -687,6 +687,30 @@ void Menu::aboutApp() { · 686 unmodified lines
687 InfoView::forcedShow();687 InfoView::forcedShow();
688}688}
689 689
690void updateDSHostname(const QString& domainServerHostname) {
691 QString newHostname(DEFAULT_DOMAIN_HOSTNAME);
692
693 if (domainServerHostname.size() > 0) {
694 // the user input a new hostname, use that
695 newHostname = domainServerHostname;
696 }
697
698 // check if the domain server hostname is new
699 if (NodeList::getInstance()->getDomainHostname() != newHostname) {
700
701 NodeList::getInstance()->clear();
702
703 // kill the local voxels
704 Application::getInstance()->getVoxels()->killLocalVoxels();
705
706 // reset the environment to default
707 Application::getInstance()->getEnvironment()->resetToDefault();
708
709 // set the new hostname
710 NodeList::getInstance()->setDomainHostname(newHostname);
711 }
712}
713
690void Menu::editPreferences() {714void Menu::editPreferences() {
691 Application* applicationInstance = Application::getInstance();715 Application* applicationInstance = Application::getInstance();
692 QDialog dialog(applicationInstance->getGLWidget());716 QDialog dialog(applicationInstance->getGLWidget());
@@ -738,30 +762,7 @@ void Menu::editPreferences() { · 45 unmodified lines
738 return;762 return;
739 }763 }
740 764
741 QByteArray newHostname;765 updateDSHostname(domainServerHostname->text());
742
743 if (domainServerHostname->text().size() > 0) {
744 // the user input a new hostname, use that
745 newHostname = domainServerHostname->text().toLocal8Bit();
746 } else {
747 // the user left the field blank, use the default hostname
748 newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
749 }
750
751 // check if the domain server hostname is new
752 if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
753
754 NodeList::getInstance()->clear();
755
756 // kill the local voxels
757 applicationInstance->getVoxels()->killLocalVoxels();
758
759 // reset the environment to default
760 applicationInstance->getEnvironment()->resetToDefault();
761
762 // set the new hostname
763 NodeList::getInstance()->setDomainHostname(newHostname.constData());
764 }
765 766
766 QUrl url(avatarURL->text());767 QUrl url(avatarURL->text());
767 applicationInstance->getAvatar()->getVoxels()->setVoxelURL(url);768 applicationInstance->getAvatar()->getVoxels()->setVoxelURL(url);
@@ -808,30 +809,7 @@ void Menu::goToDomain() { · 40 unmodified lines
808 return;809 return;
809 }810 }
810 811
811 QByteArray newHostname;812 updateDSHostname(domainServerHostname->text());
812
813 if (domainServerHostname->text().size() > 0) {
814 // the user input a new hostname, use that
815 newHostname = domainServerHostname->text().toLocal8Bit();
816 } else {
817 // the user left the field blank, use the default hostname
818 newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
819 }
820
821 // check if the domain server hostname is new
822 if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
823
824 NodeList::getInstance()->clear();
825
826 // kill the local voxels
827 applicationInstance->getVoxels()->killLocalVoxels();
828
829 // reset the environment to default
830 applicationInstance->getEnvironment()->resetToDefault();
831
832 // set the new hostname
833 NodeList::getInstance()->setDomainHostname(newHostname.constData());
834 }
835}813}
836 814
837void Menu::goToLocation() {815void Menu::goToLocation() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t