Browse Source

Merge pull request #722 from Susurrus/qt5_fixes

Qt5 fixes
QGC4.4
Lorenz Meier 11 years ago
parent
commit
d85733f9bc
  1. 2
      src/GAudioOutput.cc
  2. 4
      src/apps/qgcvideo/QGCVideoWidget.cc
  3. 2
      src/comm/QGCFlightGearLink.cc
  4. 2
      src/comm/QGCJSBSimLink.cc
  5. 2
      src/comm/QGCParamID.h
  6. 5
      src/comm/QGCXPlaneLink.cc
  7. 2
      src/comm/XbeeLink.cpp
  8. 6
      src/uas/UAS.cc
  9. 6
      src/ui/CameraView.cc
  10. 4
      src/ui/HUD.cc
  11. 37
      src/ui/MainWindow.cc
  12. 2
      src/ui/QGCSettingsWidget.cc
  13. 4
      src/ui/map3D/Q3DWidget.cc
  14. 6
      src/ui/mavlink/QGCMAVLinkMessageSender.cc

2
src/GAudioOutput.cc

@ -223,7 +223,7 @@ bool GAudioOutput::say(QString text, int severity)
text = "\\" + text; text = "\\" + text;
QStdWString str = text.toStdWString(); QStdWString str = text.toStdWString();
unsigned char str2[1024] = {}; unsigned char str2[1024] = {};
memcpy(str2, text.toAscii().data(), str.length()); memcpy(str2, text.toLatin1().data(), str.length());
SpeakString(str2); SpeakString(str2);
res = true; res = true;
#endif // Q_OS_MAC #endif // Q_OS_MAC

4
src/apps/qgcvideo/QGCVideoWidget.cc

@ -151,7 +151,7 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent)
// Fill with black background // Fill with black background
QImage fill = QImage(640, 480, QImage::Format_Indexed8); QImage fill = QImage(640, 480, QImage::Format_Indexed8);
fill.setNumColors(3); fill.setColorCount(3);
fill.setColor(0, qRgb(0, 0, 0)); fill.setColor(0, qRgb(0, 0, 0));
fill.setColor(1, qRgb(0, 0, 0)); fill.setColor(1, qRgb(0, 0, 0));
fill.setColor(2, qRgb(0, 0, 0)); fill.setColor(2, qRgb(0, 0, 0));
@ -1136,7 +1136,7 @@ void QGCVideoWidget::commitRawDataToGL()
QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format);
if (format == QImage::Format_Indexed8) { if (format == QImage::Format_Indexed8) {
// Create matching color table // Create matching color table
newImage->setNumColors(256); newImage->setColorCount(256);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
newImage->setColor(i, qRgb(i, i, i)); newImage->setColor(i, qRgb(i, i, i));
//qDebug() << __FILE__ << __LINE__ << std::hex << i; //qDebug() << __FILE__ << __LINE__ << std::hex << i;

2
src/comm/QGCFlightGearLink.cc

@ -236,7 +236,7 @@ void QGCFlightGearLink::updateControls(quint64 time, float rollAilerons, float p
{ {
QString state("%1\t%2\t%3\t%4\t%5\n"); QString state("%1\t%2\t%3\t%4\t%5\n");
state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle); state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle);
writeBytes(state.toAscii().constData(), state.length()); writeBytes(state.toLatin1().constData(), state.length());
//qDebug() << "Updated controls" << rollAilerons << pitchElevator << yawRudder << throttle; //qDebug() << "Updated controls" << rollAilerons << pitchElevator << yawRudder << throttle;
//qDebug() << "Updated controls" << state; //qDebug() << "Updated controls" << state;
} }

2
src/comm/QGCJSBSimLink.cc

@ -257,7 +257,7 @@ void QGCJSBSimLink::updateControls(quint64 time, float rollAilerons, float pitch
{ {
QString state("%1\t%2\t%3\t%4\t%5\n"); QString state("%1\t%2\t%3\t%4\t%5\n");
state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle); state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle);
writeBytes(state.toAscii().constData(), state.length()); writeBytes(state.toLatin1().constData(), state.length());
} }
else else
{ {

2
src/comm/QGCParamID.h

@ -72,7 +72,7 @@ public:
return static_cast<const QString>(data); return static_cast<const QString>(data);
} }
int8_t* toInt8_t() const { int8_t* toInt8_t() const {
return (int8_t*)data.toAscii().data(); return (int8_t*)data.toLatin1().data();
} }
protected: protected:

5
src/comm/QGCXPlaneLink.cc

@ -226,8 +226,8 @@ void QGCXPlaneLink::run()
} }
ip.index = 0; ip.index = 0;
strncpy(ip.str_ipad_them, localAddrStr.toAscii(), qMin((int)sizeof(ip.str_ipad_them), 16)); strncpy(ip.str_ipad_them, localAddrStr.toLatin1(), qMin((int)sizeof(ip.str_ipad_them), 16));
strncpy(ip.str_port_them, localPortStr.toAscii(), qMin((int)sizeof(ip.str_port_them), 6)); strncpy(ip.str_port_them, localPortStr.toLatin1(), qMin((int)sizeof(ip.str_port_them), 6));
ip.use_ip = 1; ip.use_ip = 1;
writeBytes((const char*)&ip, sizeof(ip)); writeBytes((const char*)&ip, sizeof(ip));
@ -261,7 +261,6 @@ void QGCXPlaneLink::run()
emit simulationDisconnected(); emit simulationDisconnected();
emit simulationConnected(false); emit simulationConnected(false);
emit finished();
} }
void QGCXPlaneLink::setPort(int localPort) void QGCXPlaneLink::setPort(int localPort)

2
src/comm/XbeeLink.cpp

@ -73,7 +73,7 @@ bool XbeeLink::setPortName(QString portName)
m_portName = new char[this->m_portNameLength]; m_portName = new char[this->m_portNameLength];
for(int i=0;i<list[0].size();i++) for(int i=0;i<list[0].size();i++)
{ {
this->m_portName[i]=list[0][i].toAscii(); this->m_portName[i]=list[0][i].toLatin1();
} }
this->m_portName[list[0].size()] = '\0'; this->m_portName[list[0].size()] = '\0';
} }

6
src/uas/UAS.cc

@ -2563,7 +2563,7 @@ void UAS::setParameter(const int compId, const QString& paramId, const QVariant&
switch ((int)value.type()) switch ((int)value.type())
{ {
case QVariant::Char: case QVariant::Char:
union_value.param_float = (unsigned char)value.toChar().toAscii(); union_value.param_float = (unsigned char)value.toChar().toLatin1();
p.param_type = MAV_PARAM_TYPE_INT8; p.param_type = MAV_PARAM_TYPE_INT8;
break; break;
case QVariant::Int: case QVariant::Int:
@ -2588,7 +2588,7 @@ void UAS::setParameter(const int compId, const QString& paramId, const QVariant&
switch ((int)value.type()) switch ((int)value.type())
{ {
case QVariant::Char: case QVariant::Char:
union_value.param_int8 = (unsigned char)value.toChar().toAscii(); union_value.param_int8 = (unsigned char)value.toChar().toLatin1();
p.param_type = MAV_PARAM_TYPE_INT8; p.param_type = MAV_PARAM_TYPE_INT8;
break; break;
case QVariant::Int: case QVariant::Int:
@ -2621,7 +2621,7 @@ void UAS::setParameter(const int compId, const QString& paramId, const QVariant&
// String characters // String characters
if ((int)i < paramId.length()) if ((int)i < paramId.length())
{ {
p.param_id[i] = paramId.toAscii()[i]; p.param_id[i] = paramId.toLatin1()[i];
} }
else else
{ {

6
src/ui/CameraView.cc

@ -49,7 +49,7 @@ CameraView::CameraView(int width, int height, int depth, int channels, QWidget*
// Fill with black background // Fill with black background
QImage fill = QImage(width, height, QImage::Format_Indexed8); QImage fill = QImage(width, height, QImage::Format_Indexed8);
fill.setNumColors(1); fill.setColorCount(1);
fill.setColor(0, qRgb(70, 200, 70)); fill.setColor(0, qRgb(70, 200, 70));
fill.fill(CameraView::initialColor); fill.fill(CameraView::initialColor);
glImage = QGLWidget::convertToGLFormat(fill); glImage = QGLWidget::convertToGLFormat(fill);
@ -104,7 +104,7 @@ void CameraView::setImageSize(int width, int height, int depth, int channels)
if (depth <= 8 && channels == 1) { if (depth <= 8 && channels == 1) {
image = new QImage(receivedWidth, receivedHeight, QImage::Format_Indexed8); image = new QImage(receivedWidth, receivedHeight, QImage::Format_Indexed8);
// Create matching color table // Create matching color table
image->setNumColors(256); image->setColorCount(256);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
image->setColor(i, qRgb(i, i, i)); image->setColor(i, qRgb(i, i, i));
//qDebug() << __FILE__ << __LINE__ << std::hex << i; //qDebug() << __FILE__ << __LINE__ << std::hex << i;
@ -162,7 +162,7 @@ void CameraView::commitRawDataToGL()
QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format);
if (format == QImage::Format_Indexed8) { if (format == QImage::Format_Indexed8) {
// Create matching color table // Create matching color table
newImage->setNumColors(256); newImage->setColorCount(256);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
newImage->setColor(i, qRgb(i, i, i)); newImage->setColor(i, qRgb(i, i, i));
//qDebug() << __FILE__ << __LINE__ << std::hex << i; //qDebug() << __FILE__ << __LINE__ << std::hex << i;

4
src/ui/HUD.cc

@ -1212,7 +1212,7 @@ void HUD::setImageSize(int width, int height, int depth, int channels)
if (depth <= 8 && channels == 1) { if (depth <= 8 && channels == 1) {
image = new QImage(receivedWidth, receivedHeight, QImage::Format_Indexed8); image = new QImage(receivedWidth, receivedHeight, QImage::Format_Indexed8);
// Create matching color table // Create matching color table
image->setNumColors(256); image->setColorCount(256);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
image->setColor(i, qRgb(i, i, i)); image->setColor(i, qRgb(i, i, i));
//qDebug() << __FILE__ << __LINE__ << std::hex << i; //qDebug() << __FILE__ << __LINE__ << std::hex << i;
@ -1277,7 +1277,7 @@ void HUD::commitRawDataToGL()
QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format);
if (format == QImage::Format_Indexed8) { if (format == QImage::Format_Indexed8) {
// Create matching color table // Create matching color table
newImage->setNumColors(256); newImage->setColorCount(256);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
newImage->setColor(i, qRgb(i, i, i)); newImage->setColor(i, qRgb(i, i, i));
//qDebug() << __FILE__ << __LINE__ << std::hex << i; //qDebug() << __FILE__ << __LINE__ << std::hex << i;

37
src/ui/MainWindow.cc

@ -71,6 +71,7 @@ This file is part of the QGROUNDCONTROL project
#include "SerialSettingsDialog.h" #include "SerialSettingsDialog.h"
#include "terminalconsole.h" #include "terminalconsole.h"
#include "menuactionhelper.h" #include "menuactionhelper.h"
#include <QDesktopWidget>
// Add support for the MAVLink generator UI if it's been requested. // Add support for the MAVLink generator UI if it's been requested.
#ifdef QGC_MAVGEN_ENABLED #ifdef QGC_MAVGEN_ENABLED
@ -366,23 +367,23 @@ void MainWindow::init()
// Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui // Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui
#ifdef Q_OS_MACX #ifdef Q_OS_MACX
ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0, QApplication::UnicodeUTF8)); ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0));
ui.actionMissionView->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0, QApplication::UnicodeUTF8)); ui.actionMissionView->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0));
ui.actionHardwareConfig->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0, QApplication::UnicodeUTF8)); ui.actionHardwareConfig->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0));
ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Meta+4", 0, QApplication::UnicodeUTF8)); ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Meta+4", 0));
ui.actionEngineersView->setShortcut(QApplication::translate("MainWindow", "Meta+5", 0, QApplication::UnicodeUTF8)); ui.actionEngineersView->setShortcut(QApplication::translate("MainWindow", "Meta+5", 0));
ui.actionMavlinkView->setShortcut(QApplication::translate("MainWindow", "Meta+M", 0, QApplication::UnicodeUTF8)); ui.actionMavlinkView->setShortcut(QApplication::translate("MainWindow", "Meta+M", 0));
ui.actionUnconnectedView->setShortcut(QApplication::translate("MainWindow", "Meta+U", 0, QApplication::UnicodeUTF8)); ui.actionUnconnectedView->setShortcut(QApplication::translate("MainWindow", "Meta+U", 0));
ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Meta+Return", 0, QApplication::UnicodeUTF8)); ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Meta+Return", 0));
#else #else
ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Ctrl+1", 0, QApplication::UnicodeUTF8)); ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Ctrl+1", 0));
ui.actionMissionView->setShortcut(QApplication::translate("MainWindow", "Ctrl+2", 0, QApplication::UnicodeUTF8)); ui.actionMissionView->setShortcut(QApplication::translate("MainWindow", "Ctrl+2", 0));
ui.actionHardwareConfig->setShortcut(QApplication::translate("MainWindow", "Ctrl+3", 0, QApplication::UnicodeUTF8)); ui.actionHardwareConfig->setShortcut(QApplication::translate("MainWindow", "Ctrl+3", 0));
ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Ctrl+4", 0, QApplication::UnicodeUTF8)); ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Ctrl+4", 0));
ui.actionEngineersView->setShortcut(QApplication::translate("MainWindow", "Ctrl+5", 0, QApplication::UnicodeUTF8)); ui.actionEngineersView->setShortcut(QApplication::translate("MainWindow", "Ctrl+5", 0));
ui.actionMavlinkView->setShortcut(QApplication::translate("MainWindow", "Ctrl+M", 0, QApplication::UnicodeUTF8)); ui.actionMavlinkView->setShortcut(QApplication::translate("MainWindow", "Ctrl+M", 0));
ui.actionUnconnectedView->setShortcut(QApplication::translate("MainWindow", "Ctrl+U", 0, QApplication::UnicodeUTF8)); ui.actionUnconnectedView->setShortcut(QApplication::translate("MainWindow", "Ctrl+U", 0));
ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0, QApplication::UnicodeUTF8)); ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0));
#endif #endif
connect(&windowNameUpdateTimer, SIGNAL(timeout()), this, SLOT(configureWindowName())); connect(&windowNameUpdateTimer, SIGNAL(timeout()), this, SLOT(configureWindowName()));
@ -899,7 +900,7 @@ void MainWindow::addToCentralStackedWidget(QWidget* widget, VIEW_SECTIONS viewSe
void MainWindow::showCentralWidget() void MainWindow::showCentralWidget()
{ {
QAction* act = qobject_cast<QAction *>(sender()); QAction* act = qobject_cast<QAction *>(sender());
QWidget* widget = qVariantValue<QWidget *>(act->data()); QWidget* widget = act->data().value<QWidget *>();
centerStack->setCurrentWidget(widget); centerStack->setCurrentWidget(widget);
} }
@ -1185,7 +1186,7 @@ void MainWindow::saveScreen()
if (!screenFileName.isEmpty()) if (!screenFileName.isEmpty())
{ {
window.save(screenFileName, format.toAscii()); window.save(screenFileName, format.toLatin1());
} }
} }
void MainWindow::enableDockWidgetTitleBars(bool enabled) void MainWindow::enableDockWidgetTitleBars(bool enabled)

2
src/ui/QGCSettingsWidget.cc

@ -20,7 +20,7 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
// Center the window on the screen. // Center the window on the screen.
QRect position = frameGeometry(); QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center()); position.moveCenter(QApplication::desktop()->availableGeometry().center());
move(position.topLeft()); move(position.topLeft());
// Add all protocols // Add all protocols

4
src/ui/map3D/Q3DWidget.cc

@ -254,7 +254,7 @@ Q3DWidget::handleKeyPressEvent(QKeyEvent* event)
{ {
mOsgGW->getEventQueue()->keyPress( mOsgGW->getEventQueue()->keyPress(
static_cast<osgGA::GUIEventAdapter::KeySymbol>( static_cast<osgGA::GUIEventAdapter::KeySymbol>(
*(event->text().toAscii().data()))); *(event->text().toLatin1().data())));
} }
} }
@ -274,7 +274,7 @@ Q3DWidget::handleKeyReleaseEvent(QKeyEvent* event)
{ {
mOsgGW->getEventQueue()->keyRelease( mOsgGW->getEventQueue()->keyRelease(
static_cast<osgGA::GUIEventAdapter::KeySymbol>( static_cast<osgGA::GUIEventAdapter::KeySymbol>(
*(event->text().toAscii().data()))); *(event->text().toLatin1().data())));
} }
} }

6
src/ui/mavlink/QGCMAVLinkMessageSender.cc

@ -81,7 +81,7 @@ bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid)
{ {
// Single char // Single char
char* b = ((char*)(m+messageInfo[msgid].fields[fieldid].wire_offset)); char* b = ((char*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
*b = field->data(1, Qt::DisplayRole).toChar().toAscii(); *b = field->data(1, Qt::DisplayRole).toChar().toLatin1();
} }
break; break;
case MAVLINK_TYPE_UINT8_T: case MAVLINK_TYPE_UINT8_T:
@ -100,7 +100,7 @@ bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid)
{ {
// Single value // Single value
uint8_t* u = (m+messageInfo[msgid].fields[fieldid].wire_offset); uint8_t* u = (m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toChar().toAscii(); *u = field->data(1, Qt::DisplayRole).toChar().toLatin1();
} }
break; break;
case MAVLINK_TYPE_INT8_T: case MAVLINK_TYPE_INT8_T:
@ -119,7 +119,7 @@ bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid)
{ {
// Single value // Single value
int8_t* u = reinterpret_cast<int8_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); int8_t* u = reinterpret_cast<int8_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toChar().toAscii(); *u = field->data(1, Qt::DisplayRole).toChar().toLatin1();
} }
break; break;
case MAVLINK_TYPE_INT16_T: case MAVLINK_TYPE_INT16_T:

Loading…
Cancel
Save