mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
small code changes for qt5 compatibility
This commit is contained in:
parent
9f2b2d09a9
commit
f27eb5e1d8
4 changed files with 22 additions and 18 deletions
4
interface/external/fervor/CMakeLists.txt
vendored
4
interface/external/fervor/CMakeLists.txt
vendored
|
@ -9,6 +9,10 @@ add_definitions(-DFV_GUI)
|
||||||
file(GLOB FERVOR_SOURCES *.cpp)
|
file(GLOB FERVOR_SOURCES *.cpp)
|
||||||
file(GLOB FERVOR_HEADERS *.h)
|
file(GLOB FERVOR_HEADERS *.h)
|
||||||
|
|
||||||
|
file(GLOB FERVOR_UI *.ui)
|
||||||
|
|
||||||
|
qt5_wrap_ui(FERVOR_WRAPPED_UI ${FERVOR_UI})
|
||||||
|
|
||||||
LIST(GET FERVOR_HEADERS 1 FIRST_HEADER)
|
LIST(GET FERVOR_HEADERS 1 FIRST_HEADER)
|
||||||
GET_FILENAME_COMPONENT(HEADER_PATH ${FIRST_HEADER} PATH)
|
GET_FILENAME_COMPONENT(HEADER_PATH ${FIRST_HEADER} PATH)
|
||||||
list(REMOVE_ITEM FERVOR_HEADERS ${HEADER_PATH}/fvversioncomparator.h)
|
list(REMOVE_ITEM FERVOR_HEADERS ${HEADER_PATH}/fvversioncomparator.h)
|
||||||
|
|
|
@ -166,9 +166,9 @@ void GLCanvas::wheelEvent(QWheelEvent* event) {
|
||||||
Application::getInstance()->wheelEvent(event);
|
Application::getInstance()->wheelEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void messageHandler(QtMsgType type, const char* message) {
|
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
|
||||||
fprintf(stdout, "%s", message);
|
fprintf(stdout, "%s", message.toLocal8Bit().constData());
|
||||||
LogDisplay::instance.addMessage(message);
|
LogDisplay::instance.addMessage(message.toLocal8Bit().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::Application(int& argc, char** argv, timeval &startup_time) :
|
Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
|
@ -223,7 +223,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
_applicationStartupTime = startup_time;
|
_applicationStartupTime = startup_time;
|
||||||
_window->setWindowTitle("Interface");
|
_window->setWindowTitle("Interface");
|
||||||
|
|
||||||
qInstallMsgHandler(messageHandler);
|
qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
unsigned int listenPort = 0; // bind to an ephemeral port by default
|
unsigned int listenPort = 0; // bind to an ephemeral port by default
|
||||||
const char** constArgv = const_cast<const char**>(argv);
|
const char** constArgv = const_cast<const char**>(argv);
|
||||||
|
@ -1217,7 +1217,7 @@ void Application::editPreferences() {
|
||||||
|
|
||||||
if (domainServerHostname->text().size() > 0) {
|
if (domainServerHostname->text().size() > 0) {
|
||||||
// the user input a new hostname, use that
|
// the user input a new hostname, use that
|
||||||
newHostname = domainServerHostname->text().toAscii();
|
newHostname = domainServerHostname->text().toLocal8Bit();
|
||||||
} else {
|
} else {
|
||||||
// the user left the field blank, use the default hostname
|
// the user left the field blank, use the default hostname
|
||||||
newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
|
newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
|
||||||
|
@ -1513,12 +1513,12 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::exportVoxels() {
|
void Application::exportVoxels() {
|
||||||
QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
|
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QString suggestedName = desktopLocation.append("/voxels.svo");
|
QString suggestedName = desktopLocation.append("/voxels.svo");
|
||||||
|
|
||||||
QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName,
|
QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName,
|
||||||
tr("Sparse Voxel Octree Files (*.svo)"));
|
tr("Sparse Voxel Octree Files (*.svo)"));
|
||||||
QByteArray fileNameAscii = fileNameString.toAscii();
|
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||||
const char* fileName = fileNameAscii.data();
|
const char* fileName = fileNameAscii.data();
|
||||||
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||||
if (selectedNode) {
|
if (selectedNode) {
|
||||||
|
@ -1533,11 +1533,11 @@ void Application::exportVoxels() {
|
||||||
|
|
||||||
const char* IMPORT_FILE_TYPES = "Sparse Voxel Octree Files, Square PNG, Schematic Files (*.svo *.png *.schematic)";
|
const char* IMPORT_FILE_TYPES = "Sparse Voxel Octree Files, Square PNG, Schematic Files (*.svo *.png *.schematic)";
|
||||||
void Application::importVoxelsToClipboard() {
|
void Application::importVoxelsToClipboard() {
|
||||||
QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
|
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels to Clipboard"), desktopLocation,
|
QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels to Clipboard"), desktopLocation,
|
||||||
tr(IMPORT_FILE_TYPES));
|
tr(IMPORT_FILE_TYPES));
|
||||||
|
|
||||||
QByteArray fileNameAscii = fileNameString.toAscii();
|
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||||
const char* fileName = fileNameAscii.data();
|
const char* fileName = fileNameAscii.data();
|
||||||
|
|
||||||
_clipboardTree.eraseAllVoxels();
|
_clipboardTree.eraseAllVoxels();
|
||||||
|
@ -1567,11 +1567,11 @@ void Application::importVoxelsToClipboard() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::importVoxels() {
|
void Application::importVoxels() {
|
||||||
QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
|
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels"), desktopLocation,
|
QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels"), desktopLocation,
|
||||||
tr(IMPORT_FILE_TYPES));
|
tr(IMPORT_FILE_TYPES));
|
||||||
|
|
||||||
QByteArray fileNameAscii = fileNameString.toAscii();
|
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||||
const char* fileName = fileNameAscii.data();
|
const char* fileName = fileNameAscii.data();
|
||||||
|
|
||||||
VoxelTree importVoxels;
|
VoxelTree importVoxels;
|
||||||
|
@ -2005,7 +2005,7 @@ void Application::update(float deltaTime) {
|
||||||
|
|
||||||
// Set where I am looking based on my mouse ray (so that other people can see)
|
// Set where I am looking based on my mouse ray (so that other people can see)
|
||||||
glm::vec3 eyePosition;
|
glm::vec3 eyePosition;
|
||||||
if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) {
|
if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition))) {
|
||||||
// If the mouse is over another avatar's head...
|
// If the mouse is over another avatar's head...
|
||||||
glm::vec3 myLookAtFromMouse(eyePosition);
|
glm::vec3 myLookAtFromMouse(eyePosition);
|
||||||
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
||||||
|
@ -2270,7 +2270,7 @@ void Application::updateAvatar(float deltaTime) {
|
||||||
_viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
|
_viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
|
||||||
|
|
||||||
glm::vec3 eyePosition;
|
glm::vec3 eyePosition;
|
||||||
if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) {
|
if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition))) {
|
||||||
glm::vec3 myLookAtFromMouse(eyePosition);
|
glm::vec3 myLookAtFromMouse(eyePosition);
|
||||||
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
||||||
}
|
}
|
||||||
|
@ -3584,7 +3584,7 @@ void Application::saveSettings(QSettings* settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::importSettings() {
|
void Application::importSettings() {
|
||||||
QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation));
|
QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
|
||||||
QString fileName = QFileDialog::getOpenFileName(_window,
|
QString fileName = QFileDialog::getOpenFileName(_window,
|
||||||
tr("Open .ini config file"),
|
tr("Open .ini config file"),
|
||||||
locationDir,
|
locationDir,
|
||||||
|
@ -3596,7 +3596,7 @@ void Application::importSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::exportSettings() {
|
void Application::exportSettings() {
|
||||||
QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation));
|
QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
|
||||||
QString fileName = QFileDialog::getSaveFileName(_window,
|
QString fileName = QFileDialog::getSaveFileName(_window,
|
||||||
tr("Save .ini config file"),
|
tr("Save .ini config file"),
|
||||||
locationDir,
|
locationDir,
|
||||||
|
|
|
@ -121,7 +121,7 @@ void AvatarVoxelSystem::setVoxelURL(const QUrl& url) {
|
||||||
// handle "file://" urls...
|
// handle "file://" urls...
|
||||||
if (url.isLocalFile()) {
|
if (url.isLocalFile()) {
|
||||||
QString pathString = url.path();
|
QString pathString = url.path();
|
||||||
QByteArray pathAsAscii = pathString.toAscii();
|
QByteArray pathAsAscii = pathString.toLocal8Bit();
|
||||||
const char* path = pathAsAscii.data();
|
const char* path = pathAsAscii.data();
|
||||||
readFromSVOFile(path);
|
readFromSVOFile(path);
|
||||||
return;
|
return;
|
||||||
|
@ -255,7 +255,7 @@ void AvatarVoxelSystem::handleVoxelDownloadProgress(qint64 bytesReceived, qint64
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarVoxelSystem::handleVoxelReplyError() {
|
void AvatarVoxelSystem::handleVoxelReplyError() {
|
||||||
qDebug("%s\n", _voxelReply->errorString().toAscii().constData());
|
qDebug("%s\n", _voxelReply->errorString().toLocal8Bit().constData());
|
||||||
|
|
||||||
_voxelReply->disconnect(this);
|
_voxelReply->disconnect(this);
|
||||||
_voxelReply->deleteLater();
|
_voxelReply->deleteLater();
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool ChatEntry::keyPressEvent(QKeyEvent* event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_contents.size() < MAX_CONTENT_LENGTH) {
|
if (_contents.size() < MAX_CONTENT_LENGTH) {
|
||||||
_contents.insert(_cursorPos, 1, text.at(0).toAscii());
|
_contents.insert(_cursorPos, 1, text.at(0).toLatin1());
|
||||||
_cursorPos++;
|
_cursorPos++;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue