Showing the changes to interface/src/Menu.cpp (1 of 10 files). Show all
Unified · Split
| @@ -687,6 +687,30 @@ void Menu::aboutApp() { · 686 unmodified lines | ||
| 687 | 687 | InfoView::forcedShow(); |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | +void 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 | + | |
| 690 | 714 | void Menu::editPreferences() { |
| 691 | 715 | Application* applicationInstance = Application::getInstance(); |
| 692 | 716 | QDialog dialog(applicationInstance->getGLWidget()); |
| @@ -738,30 +762,7 @@ void Menu::editPreferences() { · 45 unmodified lines | ||
| 738 | 762 | return; |
| 739 | 763 | } |
| 740 | 764 | |
| 741 | − QByteArray newHostname; | |
| 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 | + updateDSHostname(domainServerHostname->text()); | |
| 765 | 766 | |
| 766 | 767 | QUrl url(avatarURL->text()); |
| 767 | 768 | applicationInstance->getAvatar()->getVoxels()->setVoxelURL(url); |
| @@ -808,30 +809,7 @@ void Menu::goToDomain() { · 40 unmodified lines | ||
| 808 | 809 | return; |
| 809 | 810 | } |
| 810 | 811 | |
| 811 | − QByteArray newHostname; | |
| 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 | − } | |
| 812 | + updateDSHostname(domainServerHostname->text()); | |
| 835 | 813 | } |
| 836 | 814 | |
| 837 | 815 | void Menu::goToLocation() { |