History

small code changes for qt5 compatibility

Stephen Birarda committed 13 years ago

Commit f27eb5e1 parent 9f2b2d04 files · +22 −18Browse files

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

Unified · Split

interface/src/Application.cpp+15−15
@@ -166,9 +166,9 @@ void GLCanvas::wheelEvent(QWheelEvent* event) { · 165 unmodified lines
166166 Application::getInstance()->wheelEvent(event);
167167 }
168168
169−void messageHandler(QtMsgType type, const char* message) {
170− fprintf(stdout, "%s", message);
171− LogDisplay::instance.addMessage(message);
169+void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
170+ fprintf(stdout, "%s", message.toLocal8Bit().constData());
171+ LogDisplay::instance.addMessage(message.toLocal8Bit().constData());
172172 }
173173
174174 Application::Application(int& argc, char** argv, timeval &startup_time) :
@@ -223,7 +223,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 48 unmodified lines
223223 _applicationStartupTime = startup_time;
224224 _window->setWindowTitle("Interface");
225225
226− qInstallMsgHandler(messageHandler);
226+ qInstallMessageHandler(messageHandler);
227227
228228 unsigned int listenPort = 0; // bind to an ephemeral port by default
229229 const char** constArgv = const_cast<const char**>(argv);
@@ -1217,7 +1217,7 @@ void Application::editPreferences() { · 987 unmodified lines
12171217
12181218 if (domainServerHostname->text().size() > 0) {
12191219 // the user input a new hostname, use that
1220− newHostname = domainServerHostname->text().toAscii();
1220+ newHostname = domainServerHostname->text().toLocal8Bit();
12211221 } else {
12221222 // the user left the field blank, use the default hostname
12231223 newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
@@ -1513,12 +1513,12 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { · 289 unmodified lines
15131513 }
15141514
15151515 void Application::exportVoxels() {
1516− QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
1516+ QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
15171517 QString suggestedName = desktopLocation.append("/voxels.svo");
15181518
15191519 QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName,
15201520 tr("Sparse Voxel Octree Files (*.svo)"));
1521− QByteArray fileNameAscii = fileNameString.toAscii();
1521+ QByteArray fileNameAscii = fileNameString.toLocal8Bit();
15221522 const char* fileName = fileNameAscii.data();
15231523 VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
15241524 if (selectedNode) {
@@ -1533,11 +1533,11 @@ void Application::exportVoxels() { · 8 unmodified lines
15331533
15341534 const char* IMPORT_FILE_TYPES = "Sparse Voxel Octree Files, Square PNG, Schematic Files (*.svo *.png *.schematic)";
15351535 void Application::importVoxelsToClipboard() {
1536− QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
1536+ QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
15371537 QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels to Clipboard"), desktopLocation,
15381538 tr(IMPORT_FILE_TYPES));
15391539
1540− QByteArray fileNameAscii = fileNameString.toAscii();
1540+ QByteArray fileNameAscii = fileNameString.toLocal8Bit();
15411541 const char* fileName = fileNameAscii.data();
15421542
15431543 _clipboardTree.eraseAllVoxels();
@@ -1567,11 +1567,11 @@ void Application::importVoxelsToClipboard() { · 23 unmodified lines
15671567 }
15681568
15691569 void Application::importVoxels() {
1570− QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
1570+ QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
15711571 QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels"), desktopLocation,
15721572 tr(IMPORT_FILE_TYPES));
15731573
1574− QByteArray fileNameAscii = fileNameString.toAscii();
1574+ QByteArray fileNameAscii = fileNameString.toLocal8Bit();
15751575 const char* fileName = fileNameAscii.data();
15761576
15771577 VoxelTree importVoxels;
@@ -2005,7 +2005,7 @@ void Application::update(float deltaTime) { · 427 unmodified lines
20052005
20062006 // Set where I am looking based on my mouse ray (so that other people can see)
20072007 glm::vec3 eyePosition;
2008− if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) {
2008+ if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition))) {
20092009 // If the mouse is over another avatar's head...
20102010 glm::vec3 myLookAtFromMouse(eyePosition);
20112011 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
@@ -2270,7 +2270,7 @@ void Application::updateAvatar(float deltaTime) { · 258 unmodified lines
22702270 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
22712271
22722272 glm::vec3 eyePosition;
2273− if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) {
2273+ if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition))) {
22742274 glm::vec3 myLookAtFromMouse(eyePosition);
22752275 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
22762276 }
@@ -3584,7 +3584,7 @@ void Application::saveSettings(QSettings* settings) { · 1307 unmodified lines
35843584 }
35853585
35863586 void Application::importSettings() {
3587− QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation));
3587+ QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
35883588 QString fileName = QFileDialog::getOpenFileName(_window,
35893589 tr("Open .ini config file"),
35903590 locationDir,
@@ -3596,7 +3596,7 @@ void Application::importSettings() { · 5 unmodified lines
35963596 }
35973597
35983598 void Application::exportSettings() {
3599− QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation));
3599+ QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
36003600 QString fileName = QFileDialog::getSaveFileName(_window,
36013601 tr("Save .ini config file"),
36023602 locationDir,

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