Skip to content

Commit

Permalink
some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
julianschick committed Feb 23, 2020
1 parent 875ac0d commit ff0a090
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
6 changes: 4 additions & 2 deletions src/db/interface/DefaultInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,10 @@ QSqlQuery DefaultInterface::doExecuteQuery (const Query &query, bool forwardOnly

query.bindTo (sqlQuery);

if (displayQueries)
std::cout << notr ("..."); std::cout.flush ();
if (displayQueries) {
std::cout << notr ("...");
std::cout.flush ();
}

if (!query.exec (sqlQuery))
{
Expand Down
38 changes: 23 additions & 15 deletions src/gui/windows/FlightWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ void FlightWindow::updateLists ()
// Flight types
for (int i=0, n=ui.flightTypeInput->count (); i<n; ++i)
{
Flight::Type flightType=(Flight::Type)(ui.flightTypeInput->itemData (i).toInt ());
Flight::Type flightType = static_cast<Flight::Type>(ui.flightTypeInput->itemData(i).toInt());
ui.flightTypeInput->setItemText (i, Flight::typeText (flightType, true));
}

// Flight flightModes
for (int i=0, n=ui.flightModeInput->count (); i<n; ++i)
{
Flight::Mode flightMode=(Flight::Mode)(ui.flightModeInput->itemData (i).toInt ());
Flight::Mode flightMode= static_cast<Flight::Mode>(ui.flightModeInput->itemData(i).toInt());
ui.flightModeInput ->setItemText (i, firstToUpper (Flight::modeText (flightMode)));
ui.towflightModeInput->setItemText (i, firstToUpper (Flight::modeText (flightMode)));
}
Expand Down Expand Up @@ -652,7 +652,7 @@ void FlightWindow::updateErrors (bool setFocus)
// Seems like the item background color is not affected by the
// list widget palette
QListWidgetItem *item=new QListWidgetItem (flight.errorDescription (error), ui.errorList);
item->setBackgroundColor (errorColor);
item->setBackground (errorColor);

QWidget *errorWidget=getErrorWidget (error);
if (errorWidget)
Expand Down Expand Up @@ -758,7 +758,7 @@ void FlightWindow::personToFields (dbId id, SkComboBox *lastNameInput, SkComboBo
firstNameInput->setEditText (person.firstName );
ok=true;
}
catch (Cache::NotFoundException &ex) {}
catch (Cache::NotFoundException &e) { (void) e; }
}

if (!ok)
Expand Down Expand Up @@ -841,8 +841,9 @@ void FlightWindow::flightToFields (const Flight &flight, bool repeat, dbId prese
if (cache.getObject<LaunchMethod> (flight.getLaunchMethodId ()).type==LaunchMethod::typeSelf)
copyLaunchMethod=true;
}
catch (Cache::NotFoundException &ex)
catch (Cache::NotFoundException &e)
{
(void) e;
log_error (notr ("Launch method not found in FlightWindow::flightToFields"));
}

Expand Down Expand Up @@ -1805,8 +1806,9 @@ bool FlightWindow::currentIsAirtow ()
{
return getCurrentLaunchMethod ().isAirtow ();
}
catch (Cache::NotFoundException &ex)
catch (Cache::NotFoundException &e)
{
(void) e;
return false;
}
}
Expand All @@ -1820,8 +1822,9 @@ bool FlightWindow::isTowplaneRegistrationActive ()
{
return !getCurrentLaunchMethod ().towplaneKnown ();
}
catch (Cache::NotFoundException &ex)
catch (Cache::NotFoundException &e)
{
(void) e;
return false;
}
}
Expand Down Expand Up @@ -2076,8 +2079,9 @@ void FlightWindow::registrationChanged (const QString &text)
if (plane.selfLaunchOnly () && idInvalid (getCurrentLaunchMethodId ()))
ui.launchMethodInput->setCurrentItemByItemData (cache.getLaunchMethodByType (LaunchMethod::typeSelf));
}
catch (Cache::NotFoundException &ex)
catch (Cache::NotFoundException &e)
{
(void) e;
ui.planeTypeWidget->setText (notr ("?"));
}
}
Expand All @@ -2090,7 +2094,7 @@ void FlightWindow::registrationChanged (const QString &text)

void FlightWindow::flightModeChanged (int index)
{
Flight::Mode flightMode=(Flight::Mode)ui.flightModeInput->itemData (index).toInt ();
Flight::Mode flightMode = static_cast<Flight::Mode>(ui.flightModeInput->itemData(index).toInt());

if (mode==modeCreate)
{
Expand Down Expand Up @@ -2120,7 +2124,7 @@ void FlightWindow::flightModeChanged (int index)

void FlightWindow::launchMethodChanged (int index)
{
dbId launchMethodId=(dbId)ui.launchMethodInput->itemData (index).toLongLong ();;
dbId launchMethodId = static_cast<dbId>(ui.launchMethodInput->itemData(index).toLongLong());

if (idValid (launchMethodId))
{
Expand All @@ -2137,8 +2141,9 @@ void FlightWindow::launchMethodChanged (int index)
Plane towplane=cache.getObject<Plane> (towplaneId);
ui.towplaneTypeWidget->setText (towplane.type);
}
catch (Cache::NotFoundException &ex)
catch (Cache::NotFoundException &e)
{
(void) e;
ui.towplaneTypeWidget->setText (notr ("?"));
}
}
Expand All @@ -2165,9 +2170,10 @@ void FlightWindow::towplaneRegistrationChanged (const QString &text)
// Set the plane type widget
ui.towplaneTypeWidget->setText (towplane.type);
}
catch (Cache::NotFoundException &ex)
{
ui.towplaneTypeWidget->setText (notr ("?"));
catch (Cache::NotFoundException &e)
{
(void) e;
ui.towplaneTypeWidget->setText (notr ("?"));
}
}
else
Expand Down Expand Up @@ -2238,8 +2244,9 @@ void FlightWindow::okButton_clicked()
accept (); // Close the dialog
}
}
catch (AbortedException &e)
catch (AbortedException &e)
{
(void) e;
// User aborted, do nothing
}
}
Expand Down Expand Up @@ -2268,6 +2275,7 @@ void FlightWindow::nowButton_clicked ()
}
catch (AbortedException &e)
{
(void) e;
// User aborted, do nothing
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/windows/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void SettingsWindow::writeSettings ()
s.flarmSerialPort =ui.flarmSerialPortInput ->currentText ();
s.flarmSerialBaudRate=ui.flarmSerialBaudRateInput ->currentText ().toInt ();
s.flarmTcpHost =ui.flarmTcpHostInput ->text ();
s.flarmTcpPort =ui.flarmTcpPortInput ->value ();
s.flarmTcpPort = (uint16_t) ui.flarmTcpPortInput ->value ();
s.flarmFileName =ui.flarmFileNameInput ->text ();
s.flarmFileDelayMs =ui.flarmFileDelayInput ->value ();
s.flarmAutoDepartures=ui.flarmAutoDeparturesCheckbox->isChecked ();
Expand Down
2 changes: 1 addition & 1 deletion src/statistics/PlaneLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ PlaneLog *PlaneLog::createNew (const QList<Flight> &flights, Cache &cache)
if (flight.finished ())
planeIdSet.insert (flight.getPlaneId ());

QList<dbId> planeIds=planeIdSet.toList ();
QList<dbId> planeIds=planeIdSet.values ();
planeIds.removeAll (0);

// Make a list of the planes and sort it
Expand Down

0 comments on commit ff0a090

Please sign in to comment.