mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #937 Resolved clazy warnings: miscellaneous.
This commit is contained in:
@@ -27,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
Client client(&app);
|
||||
LineReader reader;
|
||||
QObject::connect(&reader, SIGNAL(command(const QString&)), &client, SLOT(command(const QString&)));
|
||||
QObject::connect(&client, SIGNAL(quit()), &reader, SLOT(terminate()));
|
||||
QObject::connect(&client, SIGNAL(quit()), &app, SLOT(quit()));
|
||||
QObject::connect(&reader, &LineReader::command, &client, &Client::command);
|
||||
QObject::connect(&client, &Client::quit, &reader, &LineReader::terminate);
|
||||
QObject::connect(&client, &Client::quit, &app, &QCoreApplication::quit);
|
||||
|
||||
reader.start();
|
||||
app.exec();
|
||||
|
||||
@@ -1022,9 +1022,9 @@ namespace BlackCore
|
||||
{
|
||||
if (msgs.isEmpty()) { return; }
|
||||
if (!msgs.hasErrorMessages()) { return; }
|
||||
return CApplication::cmdLineErrorMessage(
|
||||
msgs.toFormattedQString(true)
|
||||
);
|
||||
CApplication::cmdLineErrorMessage(
|
||||
msgs.toFormattedQString(true)
|
||||
);
|
||||
}
|
||||
|
||||
void CApplication::cmdLineHelpMessage()
|
||||
|
||||
@@ -389,6 +389,7 @@ namespace BlackCore
|
||||
|
||||
//! Startup has been completed
|
||||
//! \remark needs to be triggered by application when it think it is done
|
||||
//! \fixme http://doc.qt.io/qt-5/signalsandslots.html#signals recommends signals be only emitted by their own class
|
||||
void startUpCompleted(bool success);
|
||||
|
||||
//! Facade started
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace BlackCore
|
||||
|
||||
void CContextAudioProxy::setMute(bool muted)
|
||||
{
|
||||
return this->m_dBusInterface->callDBus(QLatin1String("setMute"), muted);
|
||||
this->m_dBusInterface->callDBus(QLatin1String("setMute"), muted);
|
||||
}
|
||||
|
||||
bool CContextAudioProxy::isMuted() const
|
||||
|
||||
@@ -292,6 +292,7 @@ namespace BlackCore
|
||||
std::function<const char **()> CNetworkVatlib::toFSD(const QStringList &qstrList) const
|
||||
{
|
||||
QVector<QByteArray> bytesVec;
|
||||
bytesVec.reserve(qstrList.size());
|
||||
for (auto i = qstrList.cbegin(); i != qstrList.cend(); ++i)
|
||||
{
|
||||
bytesVec.push_back(toFSD(*i));
|
||||
@@ -299,7 +300,7 @@ namespace BlackCore
|
||||
|
||||
return [ cstrVec = QVector<const char *>(), bytesVec = std::move(bytesVec) ]() mutable
|
||||
{
|
||||
Q_ASSERT(cstrVec.isEmpty());
|
||||
Q_ASSERT_X(cstrVec.isEmpty(), Q_FUNC_INFO, "toFSD lambda called twice");
|
||||
for (auto i = bytesVec.cbegin(); i != bytesVec.cend(); ++i)
|
||||
{
|
||||
cstrVec.push_back(i->constData());
|
||||
@@ -317,6 +318,7 @@ namespace BlackCore
|
||||
QStringList CNetworkVatlib::fromFSD(const char **cstrArray, int size) const
|
||||
{
|
||||
QStringList qstrList;
|
||||
qstrList.reserve(size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
qstrList.push_back(fromFSD(cstrArray[i]));
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace BlackGui
|
||||
|
||||
const bool hasIcon = !action->icon().isNull();
|
||||
CGuiActionBindHandler *bindHandler = new CGuiActionBindHandler(action);
|
||||
CActionBinding actionBinding(new CActionBind(pathNew, hasIcon ? action->icon().pixmap(CIcons::empty16().size()) : CIcons::empty16(), bindHandler, &CGuiActionBindHandler::boundFunction, [bindHandler]() { CGuiActionBindHandler::actionBindWasDestroyed(bindHandler); }));
|
||||
CActionBinding actionBinding(CActionBinding::create(pathNew, hasIcon ? action->icon().pixmap(CIcons::empty16().size()) : CIcons::empty16(), bindHandler, &CGuiActionBindHandler::boundFunction, [bindHandler]() { CGuiActionBindHandler::actionBindWasDestroyed(bindHandler); }));
|
||||
bindHandler->m_index = actionBinding->getIndex();
|
||||
boundActions.append(actionBinding); // takes ownership
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace BlackGui
|
||||
CGuiActionBindHandler::appendPath(path, button->text()).remove('&'); // remove E&xit key codes
|
||||
CGuiActionBindHandler *bindHandler = new CGuiActionBindHandler(button);
|
||||
const bool hasIcon = !button->icon().isNull();
|
||||
CActionBinding actionBinding(new CActionBind(pathNew, hasIcon ? button->icon().pixmap(CIcons::empty16().size()) : CIcons::empty16(), bindHandler, &CGuiActionBindHandler::boundFunction, [bindHandler]() { CGuiActionBindHandler::actionBindWasDestroyed(bindHandler); }));
|
||||
CActionBinding actionBinding(CActionBinding::create(pathNew, hasIcon ? button->icon().pixmap(CIcons::empty16().size()) : CIcons::empty16(), bindHandler, &CGuiActionBindHandler::boundFunction, [bindHandler]() { CGuiActionBindHandler::actionBindWasDestroyed(bindHandler); }));
|
||||
bindHandler->m_index = actionBinding->getIndex();
|
||||
return actionBinding;
|
||||
}
|
||||
|
||||
@@ -14,51 +14,55 @@ using namespace BlackMisc::Input;
|
||||
namespace BlackInput
|
||||
{
|
||||
|
||||
static QHash<int, KeyCode> keyMapping
|
||||
static const auto &keyMapping()
|
||||
{
|
||||
{ '0', Key_0 },
|
||||
{ '1', Key_1 },
|
||||
{ '2', Key_2 },
|
||||
{ '3', Key_3 },
|
||||
{ '4', Key_4 },
|
||||
{ '5', Key_5 },
|
||||
{ '6', Key_6 },
|
||||
{ '7', Key_7 },
|
||||
{ '8', Key_8 },
|
||||
{ '9', Key_9 },
|
||||
{ 'A', Key_A },
|
||||
{ 'B', Key_B },
|
||||
{ 'C', Key_C },
|
||||
{ 'D', Key_D },
|
||||
{ 'E', Key_E },
|
||||
{ 'F', Key_F },
|
||||
{ 'G', Key_G },
|
||||
{ 'H', Key_H },
|
||||
{ 'I', Key_I },
|
||||
{ 'J', Key_J },
|
||||
{ 'K', Key_K },
|
||||
{ 'L', Key_L },
|
||||
{ 'M', Key_M },
|
||||
{ 'N', Key_N },
|
||||
{ 'O', Key_O },
|
||||
{ 'P', Key_P },
|
||||
{ 'Q', Key_Q },
|
||||
{ 'R', Key_R },
|
||||
{ 'S', Key_S },
|
||||
{ 'T', Key_T },
|
||||
{ 'U', Key_U },
|
||||
{ 'V', Key_V },
|
||||
{ 'W', Key_W },
|
||||
{ 'X', Key_X },
|
||||
{ 'Y', Key_Y },
|
||||
{ 'Z', Key_Z },
|
||||
{ VK_LSHIFT, Key_ShiftLeft },
|
||||
{ VK_RSHIFT, Key_ShiftRight },
|
||||
{ VK_LCONTROL, Key_ControlLeft },
|
||||
{ VK_RCONTROL, Key_ControlRight },
|
||||
{ VK_LMENU, Key_AltLeft },
|
||||
{ VK_RMENU, Key_AltRight },
|
||||
};
|
||||
static const QHash<int, KeyCode> hash
|
||||
{
|
||||
{ '0', Key_0 },
|
||||
{ '1', Key_1 },
|
||||
{ '2', Key_2 },
|
||||
{ '3', Key_3 },
|
||||
{ '4', Key_4 },
|
||||
{ '5', Key_5 },
|
||||
{ '6', Key_6 },
|
||||
{ '7', Key_7 },
|
||||
{ '8', Key_8 },
|
||||
{ '9', Key_9 },
|
||||
{ 'A', Key_A },
|
||||
{ 'B', Key_B },
|
||||
{ 'C', Key_C },
|
||||
{ 'D', Key_D },
|
||||
{ 'E', Key_E },
|
||||
{ 'F', Key_F },
|
||||
{ 'G', Key_G },
|
||||
{ 'H', Key_H },
|
||||
{ 'I', Key_I },
|
||||
{ 'J', Key_J },
|
||||
{ 'K', Key_K },
|
||||
{ 'L', Key_L },
|
||||
{ 'M', Key_M },
|
||||
{ 'N', Key_N },
|
||||
{ 'O', Key_O },
|
||||
{ 'P', Key_P },
|
||||
{ 'Q', Key_Q },
|
||||
{ 'R', Key_R },
|
||||
{ 'S', Key_S },
|
||||
{ 'T', Key_T },
|
||||
{ 'U', Key_U },
|
||||
{ 'V', Key_V },
|
||||
{ 'W', Key_W },
|
||||
{ 'X', Key_X },
|
||||
{ 'Y', Key_Y },
|
||||
{ 'Z', Key_Z },
|
||||
{ VK_LSHIFT, Key_ShiftLeft },
|
||||
{ VK_RSHIFT, Key_ShiftRight },
|
||||
{ VK_LCONTROL, Key_ControlLeft },
|
||||
{ VK_RCONTROL, Key_ControlRight },
|
||||
{ VK_LMENU, Key_AltLeft },
|
||||
{ VK_RMENU, Key_AltRight },
|
||||
};
|
||||
return hash;
|
||||
}
|
||||
|
||||
static CKeyboardWindows *g_keyboardWindows = nullptr;
|
||||
|
||||
@@ -87,13 +91,13 @@ namespace BlackInput
|
||||
BlackMisc::Input::CHotkeyCombination oldCombination(m_keyCombination);
|
||||
if ((event == WM_KEYDOWN) || (event == WM_SYSKEYDOWN))
|
||||
{
|
||||
auto key = keyMapping.value(vkcode);
|
||||
auto key = keyMapping().value(vkcode);
|
||||
if (key == Key_Unknown) { return; }
|
||||
m_keyCombination.addKeyboardKey(CKeyboardKey(key));
|
||||
}
|
||||
else if ((event == WM_KEYUP) || (event == WM_SYSKEYUP) )
|
||||
{
|
||||
auto key = keyMapping.value(vkcode);
|
||||
auto key = keyMapping().value(vkcode);
|
||||
if (key == Key_Unknown) { return; }
|
||||
m_keyCombination.removeKeyboardKey(CKeyboardKey(key));
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace BlackMisc
|
||||
QStringList CApplicationInfoList::processNames() const
|
||||
{
|
||||
QStringList names;
|
||||
names.reserve(size());
|
||||
for (const CApplicationInfo &info : *this)
|
||||
{
|
||||
names.append(info.processInfo().processName());
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace BlackMisc
|
||||
|
||||
//! Elevation
|
||||
//! \sa setGeodeticHeight
|
||||
void setElevation(const BlackMisc::Aviation::CAltitude &elevation) { return this->m_position.setGeodeticHeight(elevation); }
|
||||
void setElevation(const BlackMisc::Aviation::CAltitude &elevation) { this->m_position.setGeodeticHeight(elevation); }
|
||||
|
||||
//! Is the airport still active?
|
||||
bool isOperating() const { return m_operating; }
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace BlackMisc
|
||||
this->m_telephonyDesignator = variant.toQString();
|
||||
break;
|
||||
default:
|
||||
return CValueObject::setPropertyByIndex(index, variant);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace BlackMisc
|
||||
{
|
||||
QList<CFrequency> f;
|
||||
if (!CSelcal::isValidCode(this->m_code)) return f;
|
||||
f.reserve(this->m_code.length());
|
||||
for (int pos = 0; pos < this->m_code.length(); pos++)
|
||||
{
|
||||
f.append(CSelcal::audioFrequencyEquivalent(this->m_code.at(pos)));
|
||||
|
||||
@@ -107,9 +107,14 @@ namespace BlackMisc
|
||||
this->setEntity(static_cast<CEntityFlags::Entity>(variant.toInt()));
|
||||
break;
|
||||
default:
|
||||
return (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) ?
|
||||
IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant) :
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index))
|
||||
{
|
||||
IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant);
|
||||
}
|
||||
else
|
||||
{
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackMisc
|
||||
QStringList list;
|
||||
for (const auto scope : BlackMisc::as_const(jsonStack()))
|
||||
{
|
||||
list.push_back(scope->m_string ? *scope->m_string : scope->m_latin1);
|
||||
list.push_back(scope->m_string ? *scope->m_string : scope->m_latin1); // clazy:exclude=reserve-candidates
|
||||
if (scope->m_index >= 0) { list.back() += "[" % QString::number(scope->m_index) % "]"; }
|
||||
}
|
||||
return list.isEmpty() ? QStringLiteral("<document root>") : list.join('.');
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace BlackMisc
|
||||
QString CRoleList::namesAsString(const QString &separator) const
|
||||
{
|
||||
QStringList rolesString;
|
||||
rolesString.reserve(size());
|
||||
for (const CRole &role : (*this))
|
||||
{
|
||||
rolesString.append(role.getName());
|
||||
|
||||
@@ -605,6 +605,7 @@ namespace BlackMisc
|
||||
QStringList CAircraftModelList::toCompleterStrings(bool sorted) const
|
||||
{
|
||||
QStringList c;
|
||||
c.reserve(size());
|
||||
for (const CAircraftModel &model : *this)
|
||||
{
|
||||
c.append(model.getModelString());
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace BlackMisc
|
||||
QStringList CVPilotModelRuleSet::toUpper(const QStringList &stringList)
|
||||
{
|
||||
QStringList upper;
|
||||
upper.reserve(stringList.size());
|
||||
for (const QString &s : stringList)
|
||||
{
|
||||
upper.append(s.toUpper());
|
||||
@@ -61,6 +62,7 @@ namespace BlackMisc
|
||||
QStringList CVPilotModelRuleSet::getSortedModelNames() const
|
||||
{
|
||||
QStringList ms;
|
||||
ms.reserve(size());
|
||||
for (const CVPilotModelRule &rule : (*this))
|
||||
{
|
||||
ms.append(rule.getModelName());
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace BlackMisc
|
||||
void CRemoteAircraftAware::updateMarkAllAsNotRendered()
|
||||
{
|
||||
Q_ASSERT_X(this->m_remoteAircraftProvider, Q_FUNC_INFO, "No object available");
|
||||
return this->m_remoteAircraftProvider->updateMarkAllAsNotRendered();
|
||||
this->m_remoteAircraftProvider->updateMarkAllAsNotRendered();
|
||||
}
|
||||
|
||||
bool CRemoteAircraftAware::isRemoteAircraftSupportingParts(const CCallsign &callsign) const
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace BlackMisc
|
||||
while (!ts.atEnd())
|
||||
{
|
||||
QString pathToCheck = ts.readLine();
|
||||
if (QFileInfo(pathToCheck).exists()) { lastLine = pathToCheck; }
|
||||
if (QFileInfo::exists(pathToCheck)) { lastLine = pathToCheck; }
|
||||
}
|
||||
return lastLine;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace BlackMisc
|
||||
{
|
||||
CTestBase::CTestBase(int argc, const char *const *argv)
|
||||
{
|
||||
m_arguments.reserve(argc);
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
m_arguments.append(argv[i]);
|
||||
|
||||
@@ -344,6 +344,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (m_verbose) out() << "Pid: " << CTestService::getPid() << " getObjectPaths" << endl;
|
||||
QList<QDBusObjectPath> paths;
|
||||
paths.reserve(n);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
paths.append(QDBusObjectPath(ObjectPath()));
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace BlackMisc
|
||||
const BlackMisc::CSlot<void(const BlackMisc::Weather::CWeatherGrid &)> &callback)
|
||||
{
|
||||
Q_ASSERT_X(this->m_weatherGridProvider, Q_FUNC_INFO, "No object available");
|
||||
return this->m_weatherGridProvider->requestWeatherGrid(weatherGrid, callback);
|
||||
this->m_weatherGridProvider->requestWeatherGrid(weatherGrid, callback);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -181,6 +181,7 @@ namespace BlackWxPlugin
|
||||
directory = directory.arg(hourLastPublishedCycle, 2, 10, QLatin1Char('0'));
|
||||
|
||||
QStringList params;
|
||||
params.reserve(grib2Levels.size() + grib2Variables.size() + 6);
|
||||
params.append("file=" + filename);
|
||||
for (const auto &level : grib2Levels)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
// clazy:excludeall=reserve-candidates
|
||||
|
||||
namespace XBus
|
||||
{
|
||||
|
||||
|
||||
@@ -215,6 +215,7 @@ namespace XBus
|
||||
QList<double> getEngineN1Percentage() const
|
||||
{
|
||||
QList<double> list;
|
||||
list.reserve(getNumberOfEngines());
|
||||
for (int engineNumber = 0; engineNumber < getNumberOfEngines(); ++engineNumber)
|
||||
list.append(m_enginesN1Percentage.getAt(engineNumber));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user