1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

gcs: fix compilation warnings

This commit is contained in:
U-BAMS\philippe.renon 2022-08-18 21:10:51 +02:00
parent b3f20cd9e3
commit bc18da54de
38 changed files with 55 additions and 60 deletions

View File

@ -50,7 +50,7 @@ public:
template <typename T> T *component()
{
QReadLocker(&lock());
QReadLocker &lock();
foreach(QObject * component, m_components) {
if (T * result = qobject_cast<T *>(component)) {
return result;
@ -61,7 +61,7 @@ public:
template <typename T> QList<T *> components()
{
QReadLocker(&lock());
QReadLocker &lock();
QList<T *> results;
foreach(QObject * component, m_components) {
if (T * result = qobject_cast<T *>(component)) {
@ -99,7 +99,7 @@ template <typename T> T *query(QObject *obj)
}
T *result = qobject_cast<T *>(obj);
if (!result) {
QReadLocker(&lock());
QReadLocker &lock();
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
result = (parentAggregation ? query<T>(parentAggregation) : 0);
}
@ -120,7 +120,7 @@ template <typename T> QList<T *> query_all(QObject *obj)
if (!obj) {
return QList<T *>();
}
QReadLocker(&lock());
QReadLocker &lock();
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
QList<T *> results;
if (parentAggregation) {

View File

@ -730,7 +730,7 @@ void PluginManagerPrivate::readPluginPaths()
}
resolveDependencies();
// ensure deterministic plugin load order by sorting
qSort(pluginSpecs.begin(), pluginSpecs.end(), lessThanByPluginName);
std::sort(pluginSpecs.begin(), pluginSpecs.end(), lessThanByPluginName);
emit q->pluginsChanged();
}

View File

@ -129,7 +129,7 @@ void PluginView::updateList()
item->setToolTip(4, QDir::toNativeSeparators(spec->filePath()));
item->setIcon(0, spec->hasError() ? errorIcon : okIcon);
item->setData(0, Qt::UserRole, qVariantFromValue(spec));
item->setData(0, Qt::UserRole, QVariant::fromValue(spec));
items.append(item);
if (currPlugin == spec) {
currentItem = item;

View File

@ -63,7 +63,7 @@ QString Cache::GetGeocoderFromCache(const QString &urlEnd)
#ifdef DEBUG_GetGeocoderFromCache
qDebug() << "Entered GetGeocoderFromCache";
#endif
QString ret = QString::null;
QString ret = QString();
QString filename = geoCache + QString(urlEnd) + ".geo";
#ifdef DEBUG_GetGeocoderFromCache
qDebug() << "GetGeocoderFromCache: Does file exist?:" << filename;
@ -87,7 +87,7 @@ QString Cache::GetGeocoderFromCache(const QString &urlEnd)
}
void Cache::CacheGeocoder(const QString &urlEnd, const QString &content)
{
QString ret = QString::null;
QString ret = QString();
QString filename = geoCache + QString(urlEnd) + ".geo";
#ifdef DEBUG_CACHE
@ -127,7 +127,7 @@ QString Cache::GetPlacemarkFromCache(const QString &urlEnd)
#ifdef DEBUG_CACHE
qDebug() << "Entered GetPlacemarkFromCache";
#endif // DEBUG_CACHE
QString ret = QString::null;
QString ret = QString();
QString filename = placemarkCache + QString(urlEnd) + ".plc";
#ifdef DEBUG_CACHE
qDebug() << "GetPlacemarkFromCache: Does file exist?:" << filename;
@ -151,7 +151,7 @@ QString Cache::GetPlacemarkFromCache(const QString &urlEnd)
}
void Cache::CachePlacemark(const QString &urlEnd, const QString &content)
{
QString ret = QString::null;
QString ret = QString();
QString filename = placemarkCache + QString(urlEnd) + ".plc";
#ifdef DEBUG_CACHE

View File

@ -465,7 +465,7 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c
break;
}
return QString::null;
return QString();
}
void UrlFactory::GetSecGoogleWords(const Point &pos, QString &sec1, QString &sec2)
{

View File

@ -95,7 +95,7 @@ QMap<double, QString> QwtCompassScaleDraw::labelMap() const
label() looks in the labelMap() for a corresponding label for value
or returns an null text.
\return Label, or QString::null
\return Label, or QString()
\sa labelMap(), setLabelMap()
*/

View File

@ -155,7 +155,7 @@ void QwtCounter::setValid( bool on )
}
else
{
d_data->valueEdit->setText( QString::null );
d_data->valueEdit->setText( QString() );
}
}
}

View File

@ -157,7 +157,7 @@ QString QwtDateScaleDraw::dateFormat(
return d_data->dateFormats[ intervalType ];
}
return QString::null;
return QString();
}
/*!

View File

@ -67,7 +67,7 @@ public:
LegendBarTitles
};
explicit QwtPlotBarChart( const QString &title = QString::null );
explicit QwtPlotBarChart( const QString &title = QString() );
explicit QwtPlotBarChart( const QwtText &title );
virtual ~QwtPlotBarChart();

View File

@ -210,7 +210,7 @@ public:
//! Paint attributes
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotCurve( const QString &title = QString::null );
explicit QwtPlotCurve( const QString &title = QString() );
explicit QwtPlotCurve( const QwtText &title );
virtual ~QwtPlotCurve();

View File

@ -76,7 +76,7 @@ public:
UserStyle = 100
};
explicit QwtPlotHistogram( const QString &title = QString::null );
explicit QwtPlotHistogram( const QString &title = QString() );
explicit QwtPlotHistogram( const QwtText &title );
virtual ~QwtPlotHistogram();

View File

@ -76,7 +76,7 @@ public:
//! Paint attributes
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotIntervalCurve( const QString &title = QString::null );
explicit QwtPlotIntervalCurve( const QString &title = QString() );
explicit QwtPlotIntervalCurve( const QwtText &title );
virtual ~QwtPlotIntervalCurve();

View File

@ -68,7 +68,7 @@ public:
Cross
};
explicit QwtPlotMarker( const QString &title = QString::null );
explicit QwtPlotMarker( const QString &title = QString() );
explicit QwtPlotMarker( const QwtText &title );
virtual ~QwtPlotMarker();

View File

@ -61,7 +61,7 @@ public:
Stacked
};
explicit QwtPlotMultiBarChart( const QString &title = QString::null );
explicit QwtPlotMultiBarChart( const QString &title = QString() );
explicit QwtPlotMultiBarChart( const QwtText &title );
virtual ~QwtPlotMultiBarChart();

View File

@ -83,7 +83,7 @@ public:
//! Paint attributes
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotRasterItem( const QString& title = QString::null );
explicit QwtPlotRasterItem( const QString& title = QString() );
explicit QwtPlotRasterItem( const QwtText& title );
virtual ~QwtPlotRasterItem();

View File

@ -23,7 +23,7 @@ class QWT_EXPORT QwtPlotSeriesItem: public QwtPlotItem,
public virtual QwtAbstractSeriesStore
{
public:
explicit QwtPlotSeriesItem( const QString &title = QString::null );
explicit QwtPlotSeriesItem( const QString &title = QString() );
explicit QwtPlotSeriesItem( const QwtText &title );
virtual ~QwtPlotSeriesItem();

View File

@ -64,7 +64,7 @@ public:
LegendColor
};
explicit QwtPlotShapeItem( const QString &title = QString::null );
explicit QwtPlotShapeItem( const QString &title = QString() );
explicit QwtPlotShapeItem( const QwtText &title );
virtual ~QwtPlotShapeItem();

View File

@ -35,7 +35,7 @@ public:
//! Paint attributes
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotSpectroCurve( const QString &title = QString::null );
explicit QwtPlotSpectroCurve( const QString &title = QString() );
explicit QwtPlotSpectroCurve( const QwtText &title );
virtual ~QwtPlotSpectroCurve();

View File

@ -55,7 +55,7 @@ public:
//! Display modes
typedef QFlags<DisplayMode> DisplayModes;
explicit QwtPlotSpectrogram( const QString &title = QString::null );
explicit QwtPlotSpectrogram( const QString &title = QString() );
virtual ~QwtPlotSpectrogram();
void setDisplayMode( DisplayMode, bool on = true );

View File

@ -27,7 +27,7 @@ class QByteArray;
class QWT_EXPORT QwtPlotSvgItem: public QwtPlotItem
{
public:
explicit QwtPlotSvgItem( const QString& title = QString::null );
explicit QwtPlotSvgItem( const QString& title = QString() );
explicit QwtPlotSvgItem( const QwtText& title );
virtual ~QwtPlotSvgItem();

View File

@ -101,7 +101,7 @@ public:
//! Paint attributes
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotTradingCurve( const QString &title = QString::null );
explicit QwtPlotTradingCurve( const QString &title = QString() );
explicit QwtPlotTradingCurve( const QwtText &title );
virtual ~QwtPlotTradingCurve();

View File

@ -28,7 +28,7 @@ void QwtPlot::applyProperties( const QString & /* xmlDocument */ )
This method is intended for manipulating the plot widget
from a specific editor in the Qwt designer plugin.
\return QString::null
\return QString()
\warning The plot editor has never been implemented.
*/
QString QwtPlot::grabProperties() const
@ -37,6 +37,6 @@ QString QwtPlot::grabProperties() const
// Temporary dummy code, for designer tests
return title().text();
#else
return QString::null;
return QString();
#endif
}

View File

@ -139,7 +139,7 @@ public:
//! Layout attributes
typedef QFlags<LayoutAttribute> LayoutAttributes;
QwtText( const QString & = QString::null,
QwtText( const QString & = QString(),
TextFormat textFormat = AutoText );
QwtText( const QwtText & );
~QwtText();

View File

@ -560,9 +560,9 @@ void QwtThermo::drawLiquid(
QVector<double> values = qwtTickList( scaleDraw()->scaleDiv() );
if ( scaleMap.isInverting() )
qSort( values.begin(), values.end(), qGreater<double>() );
std::sort( values.begin(), values.end(), qGreater<double>() );
else
qSort( values.begin(), values.end(), qLess<double>() );
std::sort( values.begin(), values.end(), qLess<double>() );
int from;
if ( !values.isEmpty() )

View File

@ -52,7 +52,7 @@ class QTCREATOR_UTILS_EXPORT WelcomeModeTreeWidget : public QTreeWidget {
public:
WelcomeModeTreeWidget(QWidget *parent = 0);
~WelcomeModeTreeWidget();
QTreeWidgetItem *addItem(const QString &label, const QString &data, const QString &toolTip = QString::null);
QTreeWidgetItem *addItem(const QString &label, const QString &data, const QString &toolTip = QString());
public slots:
void slotAddNewsItem(const QString &title, const QString &description, const QString &link);

View File

@ -54,7 +54,7 @@ QWidget *AntennaTrackGadgetOptionsPage::createPage(QWidget *parent)
// PORTS
QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts();
qSort(ports.begin(), ports.end(), sortPorts);
std::sort(ports.begin(), ports.end(), sortPorts);
foreach(QSerialPortInfo port, ports) {
qDebug() << "Adding port: " << port.systemLocation() << " (" << port.portName() << ")";
options_page->portComboBox->addItem(port.portName(), port.portName());

View File

@ -168,10 +168,10 @@ Q_DECLARE_METATYPE(::PageData) SettingsDialog::SettingsDialog(QWidget *parent, c
// the plugin options page list is sorted by untranslated category and names
// this is done to facilitate access to the language settings when GCS is not running in a language understood by the user.
qStableSort(pluginPages.begin(), pluginPages.end(), compareOptionsPageByCategoryAndId);
std::stable_sort(pluginPages.begin(), pluginPages.end(), compareOptionsPageByCategoryAndId);
// the plugin options page list is sorted by translated names
qStableSort(gadgetPages.begin(), gadgetPages.end(), compareOptionsPageByCategoryAndNameTr);
std::stable_sort(gadgetPages.begin(), gadgetPages.end(), compareOptionsPageByCategoryAndNameTr);
// will hold the initially selected item if any
QTreeWidgetItem *initialItem = 0;
@ -256,12 +256,12 @@ QTreeWidgetItem *SettingsDialog::addPage(IOptionsPage *page)
categoryItem = new QTreeWidgetItem(pageTree);
categoryItem->setIcon(0, page->icon());
categoryItem->setText(0, page->trCategory());
categoryItem->setData(0, Qt::UserRole, qVariantFromValue(pageData));
categoryItem->setData(0, Qt::UserRole, QVariant::fromValue(pageData));
}
QTreeWidgetItem *item = new QTreeWidgetItem(categoryItem);
item->setText(0, page->trName());
item->setData(0, Qt::UserRole, qVariantFromValue(pageData));
item->setData(0, Qt::UserRole, QVariant::fromValue(pageData));
switch (categoryItemList->size()) {
case 0:
@ -390,7 +390,7 @@ void SettingsDialog::insertPage(IOptionsPage *page)
QTreeWidgetItem *item = new QTreeWidgetItem;
item->setText(0, page->trName());
item->setData(0, Qt::UserRole, qVariantFromValue(pageData));
item->setData(0, Qt::UserRole, QVariant::fromValue(pageData));
categoryItem->addChild(item);
categoryItemList->append(item);

View File

@ -318,7 +318,7 @@ void ShortcutSettings::initialize()
}
item->setText(2, s->m_key.toString());
item->setData(0, Qt::UserRole, qVariantFromValue(s));
item->setData(0, Qt::UserRole, QVariant::fromValue(s));
}
}

View File

@ -108,7 +108,7 @@ void DialGadgetWidget::connectNeedles(QString object1, QString nfield1,
// qDebug() << "Connected Object 1 (" << object1 << ").";
connect(obj1, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateNeedle1(UAVObject *)));
if (nfield1.contains("-")) {
QStringList fieldSubfield = nfield1.split("-", QString::SkipEmptyParts);
QStringList fieldSubfield = nfield1.split("-", Qt::SkipEmptyParts);
field1 = fieldSubfield.at(0);
subfield1 = fieldSubfield.at(1);
haveSubField1 = true;
@ -128,7 +128,7 @@ void DialGadgetWidget::connectNeedles(QString object1, QString nfield1,
// qDebug() << "Connected Object 2 (" << object2 << ").";
connect(obj2, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateNeedle2(UAVObject *)));
if (nfield2.contains("-")) {
QStringList fieldSubfield = nfield2.split("-", QString::SkipEmptyParts);
QStringList fieldSubfield = nfield2.split("-", Qt::SkipEmptyParts);
field2 = fieldSubfield.at(0);
subfield2 = fieldSubfield.at(1);
haveSubField2 = true;
@ -148,7 +148,7 @@ void DialGadgetWidget::connectNeedles(QString object1, QString nfield1,
// qDebug() << "Connected Object 3 (" << object3 << ").";
connect(obj3, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateNeedle3(UAVObject *)));
if (nfield3.contains("-")) {
QStringList fieldSubfield = nfield3.split("-", QString::SkipEmptyParts);
QStringList fieldSubfield = nfield3.split("-", Qt::SkipEmptyParts);
field3 = fieldSubfield.at(0);
subfield3 = fieldSubfield.at(1);
haveSubField3 = true;

View File

@ -55,7 +55,7 @@ QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
// PORTS
QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts();
qSort(ports.begin(), ports.end(), sortPorts);
std::sort(ports.begin(), ports.end(), sortPorts);
foreach(QSerialPortInfo port, ports) {
qDebug() << "Adding port: " << port.systemLocation() << " (" << port.portName() << ")";
options_page->portComboBox->addItem(port.portName(), port.portName());

View File

@ -91,7 +91,7 @@ void LineardialGadgetWidget::connectInput(QString object1, QString nfield1)
if (obj1 != NULL) {
connect(obj1, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateIndex(UAVObject *)));
if (nfield1.contains("-")) {
QStringList fieldSubfield = nfield1.split("-", QString::SkipEmptyParts);
QStringList fieldSubfield = nfield1.split("-", Qt::SkipEmptyParts);
field1 = fieldSubfield.at(0);
subfield1 = fieldSubfield.at(1);
haveSubField1 = true;

View File

@ -460,7 +460,7 @@ void SoundNotifyPlugin::checkNotificationRule(NotificationItem *notification, UA
qNotifyDebug() << "add to pending list - " << notification->toString();
// if audio is busy, start expiration timer
// ms = (notification->getExpiredTimeout()[in sec])*1000
// QxtTimer::singleShot(notification->getExpireTimeout()*1000, this, SLOT(expirationTimerHandler(NotificationItem*)), qVariantFromValue(notification));
// QxtTimer::singleShot(notification->getExpireTimeout()*1000, this, SLOT(expirationTimerHandler(NotificationItem*)), QVariant::fromValue(notification));
_pendingNotifications.append(notification);
notification->startExpireTimer();
connect(notification->getExpireTimer(), SIGNAL(timeout()),

View File

@ -355,7 +355,7 @@ void ScopeGadgetWidget::addCurvePlot(QString objectName, QString fieldPlusSubFie
int element = 0;
if (fieldPlusSubField.contains("-")) {
QStringList fieldSubfield = fieldName.split("-", QString::SkipEmptyParts);
QStringList fieldSubfield = fieldName.split("-", Qt::SkipEmptyParts);
fieldName = fieldSubfield.at(0);
elementName = fieldSubfield.at(1);
}

View File

@ -137,7 +137,7 @@ QList <Core::IConnection::device> SerialConnection::availableDevices()
QList<QSerialPortInfo> ports = availablePorts();
// sort the list by port number (nice idea from PT_Dreamer :))
qSort(ports.begin(), ports.end(), sortPorts);
std::sort(ports.begin(), ports.end(), sortPorts);
foreach(QSerialPortInfo port, ports) {
device d;

View File

@ -606,7 +606,7 @@ QVariant UAVObjectTreeModel::data(const QModelIndex &index, int role) const
case Qt::UserRole:
// UserRole gives access to TreeItem
// cast to void* is necessary
return qVariantFromValue((void *)item);
return QVariant::fromValue((void *)item);
default:
return QVariant();

View File

@ -206,7 +206,7 @@ void UploaderGadgetWidget::getSerialPorts()
QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts();
// sort the list by port number (nice idea from PT_Dreamer :))
qSort(ports.begin(), ports.end(), sortPorts);
std::sort(ports.begin(), ports.end(), sortPorts);
foreach(QSerialPortInfo port, ports) {
list.append(port.portName());
}

View File

@ -76,7 +76,7 @@ struct Context {
struct FieldContext {
FieldContext(FieldInfo *fieldInfo, ObjectInfo *object);
FieldContext(const FieldContext &fieldContext);
FieldContext(const FieldContext &fieldContext) = default;
FieldInfo *field;
// field
@ -617,11 +617,6 @@ bool UAVObjectGeneratorGCS::generate(UAVObjectParser *parser, QString templatepa
return true;
}
FieldContext::FieldContext(const FieldContext &fieldContext)
{
*this = fieldContext;
}
FieldContext::FieldContext(FieldInfo *fieldInfo, ObjectInfo *object)
{
field = fieldInfo;

View File

@ -223,7 +223,7 @@ QString UAVObjectParser::parseXML(QString & xml, QString & filename)
}
// Sort all fields according to size
qStableSort(info->fields.begin(), info->fields.end(), fieldTypeLessThan);
std::stable_sort(info->fields.begin(), info->fields.end(), fieldTypeLessThan);
// Make sure that required elements were found
if (!fieldFound) {
@ -528,7 +528,7 @@ QString UAVObjectParser::processObjectFields(QDomNode & childNode, ObjectInfo *i
return QString("Object:field:elementnames attribute is not allowed for cloned fields");
}
// Get element names
QStringList names = elemAttr.nodeValue().split(",", QString::SkipEmptyParts);
QStringList names = elemAttr.nodeValue().split(",", Qt::SkipEmptyParts);
for (int n = 0; n < names.length(); ++n) {
names[n] = names[n].trimmed();
}
@ -581,7 +581,7 @@ QString UAVObjectParser::processObjectFields(QDomNode & childNode, ObjectInfo *i
QStringList options;
elemAttr = elemAttributes.namedItem("options");
if (!elemAttr.isNull()) {
options = elemAttr.nodeValue().split(",", QString::SkipEmptyParts);
options = elemAttr.nodeValue().split(",", Qt::SkipEmptyParts);
for (int n = 0; n < options.length(); ++n) {
options[n] = options[n].trimmed();
}
@ -623,7 +623,7 @@ QString UAVObjectParser::processObjectFields(QDomNode & childNode, ObjectInfo *i
// Get the default value attribute (required for settings objects, optional for the rest)
elemAttr = elemAttributes.namedItem("defaultvalue");
if (!elemAttr.isNull()) {
QStringList defaults = elemAttr.nodeValue().split(",", QString::SkipEmptyParts);
QStringList defaults = elemAttr.nodeValue().split(",", Qt::SkipEmptyParts);
for (int n = 0; n < defaults.length(); ++n) {
defaults[n] = defaults[n].trimmed();
}