From ef5963b3d49e16c5e947c5295298b79cb7d0f5c7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 27 May 2023 19:52:05 +0300 Subject: [PATCH 30/30] Clear trailing spaces from .cpp files See osdn #48088 Signed-off-by: Marko Lindqvist --- client/dummycxx.cpp | 2 +- client/gui-qt/canvas.cpp | 2 +- client/gui-qt/cityrep.cpp | 12 ++++++------ client/gui-qt/dialogs.cpp | 2 +- client/gui-qt/fc_client.cpp | 4 ++-- client/gui-qt/fonts.cpp | 4 ++-- client/gui-qt/gui_main.cpp | 4 ++-- client/gui-qt/mapview.cpp | 4 ++-- client/gui-qt/menu.cpp | 4 ++-- client/gui-qt/optiondlg.cpp | 2 +- client/gui-qt/pages.cpp | 2 +- client/gui-qt/plrdlg.cpp | 14 +++++++------- client/gui-qt/sidebar.cpp | 2 +- tests/trailing_spaces.sh | 4 +++- tools/fcmp/mpgui_qt.cpp | 2 +- tools/ruledit/req_edit.cpp | 6 +++--- tools/ruledit/tab_building.cpp | 2 +- tools/ruledit/tab_enablers.cpp | 2 +- tools/ruledit/tab_extras.cpp | 2 +- tools/ruledit/tab_good.cpp | 2 +- tools/ruledit/tab_gov.cpp | 2 +- tools/ruledit/tab_tech.cpp | 2 +- tools/ruledit/tab_terrains.cpp | 2 +- tools/ruledit/tab_unit.cpp | 2 +- 24 files changed, 44 insertions(+), 42 deletions(-) diff --git a/client/dummycxx.cpp b/client/dummycxx.cpp index c9a5880327..72fbd4c23a 100644 --- a/client/dummycxx.cpp +++ b/client/dummycxx.cpp @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 2002 - The Freeciv Project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/client/gui-qt/canvas.cpp b/client/gui-qt/canvas.cpp index 9d395e54ea..cc73f38dfc 100644 --- a/client/gui-qt/canvas.cpp +++ b/client/gui-qt/canvas.cpp @@ -380,7 +380,7 @@ QFont *get_font(client_font font) { QFont *qf; int ssize; - + switch (font) { case FONT_CITY_NAME: qf = fc_font::instance()->get_font(fonts::city_names); diff --git a/client/gui-qt/cityrep.cpp b/client/gui-qt/cityrep.cpp index 26f23ff83a..a24f4408a6 100644 --- a/client/gui-qt/cityrep.cpp +++ b/client/gui-qt/cityrep.cpp @@ -223,7 +223,7 @@ bool city_model::setData(const QModelIndex &index, const QVariant &value, /***********************************************************************//** Returns header data for given section(column) ***************************************************************************/ -QVariant city_model::headerData(int section, Qt::Orientation orientation, +QVariant city_model::headerData(int section, Qt::Orientation orientation, int role) const { char buf[64]; @@ -383,9 +383,9 @@ city_widget::city_widget(city_report *ctr): QTreeView() const QItemSelection &)), SLOT(cities_selected(const QItemSelection &, const QItemSelection &))); - connect(this, &QAbstractItemView::doubleClicked, this, + connect(this, &QAbstractItemView::doubleClicked, this, &city_widget::city_doubleclick); - connect(this, &QWidget::customContextMenuRequested, + connect(this, &QWidget::customContextMenuRequested, this, &city_widget::display_list_menu); } @@ -651,7 +651,7 @@ void city_widget::display_list_menu(const QPoint &) city_queue_insert(pcity_mid, 1, &target); break; case CHANGE_PROD_BEF_LAST: - city_queue_insert(pcity_mid, worklist_length(&pcity_mid->worklist), + city_queue_insert(pcity_mid, worklist_length(&pcity_mid->worklist), &target); break; case CHANGE_PROD_LAST: @@ -1150,7 +1150,7 @@ void city_widget::display_header_menu(const QPoint &) fc_assert_ret(col >= 0); setColumnHidden(col, !isColumnHidden(col)); spec = city_report_specs + col; - spec->show = !spec->show; + spec->show = !spec->show; if (!isColumnHidden(col) && columnWidth(col) <= 5) setColumnWidth(col, 100); }); @@ -1175,7 +1175,7 @@ void city_widget::hide_columns() Slot for selecting items in city widget, they are stored in selected_cities until deselected ***************************************************************************/ -void city_widget::cities_selected(const QItemSelection &sl, +void city_widget::cities_selected(const QItemSelection &sl, const QItemSelection &ds) { QModelIndexList indexes = selectionModel()->selectedIndexes(); diff --git a/client/gui-qt/dialogs.cpp b/client/gui-qt/dialogs.cpp index da4fa3756b..9962a204d2 100644 --- a/client/gui-qt/dialogs.cpp +++ b/client/gui-qt/dialogs.cpp @@ -461,7 +461,7 @@ races_dialog::races_dialog(struct player *pplayer, selected_nation_tabs->setEditTriggers(QAbstractItemView::NoEditTriggers); selected_nation_tabs->setShowGrid(false); selected_nation_tabs->setAlternatingRowColors(true); - + nation_tabs->setRowCount(0); nation_tabs->setColumnCount(1); nation_tabs->setSelectionMode(QAbstractItemView::SingleSelection); diff --git a/client/gui-qt/fc_client.cpp b/client/gui-qt/fc_client.cpp index 57375416c0..1363bfc179 100644 --- a/client/gui-qt/fc_client.cpp +++ b/client/gui-qt/fc_client.cpp @@ -190,7 +190,7 @@ void fc_client::init() pages[PAGE_GAME] = new QWidget(central_wdg); init_mapcanvas_and_overview(); create_game_page(); - + pages[PAGE_GAME + 1] = new QWidget(central_wdg); create_loading_page(); @@ -420,7 +420,7 @@ void fc_client::add_server_source(int sock) { server_notifier = new QSocketNotifier(sock, QSocketNotifier::Read); - connect(server_notifier, &QSocketNotifier::activated, this, + connect(server_notifier, &QSocketNotifier::activated, this, &fc_client::server_input); } diff --git a/client/gui-qt/fonts.cpp b/client/gui-qt/fonts.cpp index 7ce9782a2d..361661d6c0 100644 --- a/client/gui-qt/fonts.cpp +++ b/client/gui-qt/fonts.cpp @@ -125,7 +125,7 @@ void fc_font::set_font(QString name, QFont * qf) } /************************************************************************//** - Tries to choose good fonts for freeciv-qt + Tries to choose good fonts for freeciv-qt ****************************************************************************/ void configure_fonts() { @@ -145,7 +145,7 @@ void configure_fonts() default_size = qRound(scale *14); // Default and help label - sl << "Segoe UI" << "Cousine" << "Liberation Sans" << "Droid Sans" + sl << "Segoe UI" << "Cousine" << "Liberation Sans" << "Droid Sans" << "Ubuntu" << "Noto Sans" << "DejaVu Sans" << "Luxi Sans" << "Lucida Sans" << "Trebuchet MS" << "Times New Roman"; font_name = configure_font(fonts::default_font, sl, max); diff --git a/client/gui-qt/gui_main.cpp b/client/gui-qt/gui_main.cpp index 00ef1f7dc0..1646641e15 100644 --- a/client/gui-qt/gui_main.cpp +++ b/client/gui-qt/gui_main.cpp @@ -107,7 +107,7 @@ int main(int argc, char **argv) /**********************************************************************//** Print extra usage information, including one line help on each option, - to stderr. + to stderr. **************************************************************************/ static void print_usage() { @@ -380,7 +380,7 @@ void apply_titlebar(struct option *poption) QWidget *w; Qt::WindowFlags flags = Qt::Window; val = option_bool_get(poption); - + if (gui()->current_page() < PAGE_GAME) { return; } diff --git a/client/gui-qt/mapview.cpp b/client/gui-qt/mapview.cpp index 6ede52fcae..ced8ee57c2 100644 --- a/client/gui-qt/mapview.cpp +++ b/client/gui-qt/mapview.cpp @@ -295,7 +295,7 @@ void map_view::paint(QPainter *painter, QPaintEvent *event) } /**********************************************************************//** - Sets new point for new search + Sets new point for new search **************************************************************************/ void map_view::resume_searching(int pos_x, int pos_y, int &w, int &h, int wdth, int hght, int recursive_nr) @@ -324,7 +324,7 @@ void map_view::resume_searching(int pos_x, int pos_y, int &w, int &h, Returns position as (w,h) Along with resume_searching its recursive function. **************************************************************************/ -void map_view::find_place(int pos_x, int pos_y, int &w, int &h, int wdth, +void map_view::find_place(int pos_x, int pos_y, int &w, int &h, int wdth, int hght, int recursive_nr) { int i; diff --git a/client/gui-qt/menu.cpp b/client/gui-qt/menu.cpp index a373fc77d0..a59937aa40 100644 --- a/client/gui-qt/menu.cpp +++ b/client/gui-qt/menu.cpp @@ -1153,12 +1153,12 @@ void mr_menu::setup_menus() act = main_menu->addAction(_("Same Type on Continent")); act->setShortcut(QKeySequence(tr("shift+c"))); menu_list.insert(STANDARD, act); - connect(act, &QAction::triggered, this, + connect(act, &QAction::triggered, this, &mr_menu::slot_select_same_continent); act = main_menu->addAction(_("Same Type Everywhere")); act->setShortcut(QKeySequence(tr("shift+x"))); menu_list.insert(STANDARD, act); - connect(act, &QAction::triggered, this, + connect(act, &QAction::triggered, this, &mr_menu::slot_select_same_everywhere); main_menu->addSeparator(); act = main_menu->addAction(_("Wait")); diff --git a/client/gui-qt/optiondlg.cpp b/client/gui-qt/optiondlg.cpp index 6042018429..5209b1784d 100644 --- a/client/gui-qt/optiondlg.cpp +++ b/client/gui-qt/optiondlg.cpp @@ -335,7 +335,7 @@ void option_dialog::set_int(struct option *poption, int value) /************************************************************************//** Sets desired font name in button text and sets global font for that option - That function is not executed when user changes font, but when applying or + That function is not executed when user changes font, but when applying or resetting options. ****************************************************************************/ void option_dialog::set_font(struct option* poption, QString s) diff --git a/client/gui-qt/pages.cpp b/client/gui-qt/pages.cpp index c6123d855a..b931f598a0 100644 --- a/client/gui-qt/pages.cpp +++ b/client/gui-qt/pages.cpp @@ -524,7 +524,7 @@ void fc_client::create_load_page() connect(saves_load->selectionModel(), &QItemSelectionModel::selectionChanged, this, &fc_client::slot_selection_changed); - connect(show_preview, &QCheckBox::stateChanged, this, + connect(show_preview, &QCheckBox::stateChanged, this, &fc_client::state_preview); pages_layout[PAGE_LOAD]->addWidget(wdg, 1, 0); pages_layout[PAGE_LOAD]->addWidget(load_save_text, 2, 0, 1, 2); diff --git a/client/gui-qt/plrdlg.cpp b/client/gui-qt/plrdlg.cpp index 3d89f4fd60..a8e006ebef 100644 --- a/client/gui-qt/plrdlg.cpp +++ b/client/gui-qt/plrdlg.cpp @@ -232,7 +232,7 @@ QVariant plr_model::data(const QModelIndex &index, int role) const /**********************************************************************//** Returns header data from model **************************************************************************/ -QVariant plr_model::headerData(int section, Qt::Orientation orientation, +QVariant plr_model::headerData(int section, Qt::Orientation orientation, int role) const { struct player_dlg_column *pcol; @@ -251,14 +251,14 @@ QVariant plr_model::headerData(int section, Qt::Orientation orientation, /**********************************************************************//** Sets data in model **************************************************************************/ -bool plr_model::setData(const QModelIndex &index, const QVariant &value, +bool plr_model::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid() || role != Qt::DisplayRole) { return false; } - if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0 + if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0 && index.column() < columnCount()) { bool change = plr_list[index.row()]->setData(index.column(), value, role); @@ -431,7 +431,7 @@ void plr_widget::display_header_menu(const QPoint &) for (int i = 0; i < list_model->columnCount(); ++i) { QAction *myAct = hideshow_column->addAction( - list_model->headerData(i, Qt::Horizontal, + list_model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString()); myAct->setCheckable(true); myAct->setChecked(!isColumnHidden(i)); @@ -660,7 +660,7 @@ void plr_widget::nation_selected(const QItemSelection &sl, advance_iterate(padvance) { tech_id = advance_number(padvance); if (research_invention_state(my_research, tech_id) == TECH_KNOWN - && (research_invention_state(research, tech_id) + && (research_invention_state(research, tech_id) != TECH_KNOWN)) { a++; sorted_list_a << research_advance_name_translation(research, @@ -923,7 +923,7 @@ void plr_report::call_meeting() **************************************************************************/ void plr_report::req_caancel_threaty() { - dsend_packet_diplomacy_cancel_pact(&client.conn, + dsend_packet_diplomacy_cancel_pact(&client.conn, player_number(other_player), CLAUSE_CEASEFIRE); } @@ -942,7 +942,7 @@ void plr_report::req_meeeting() **************************************************************************/ void plr_report::req_wiithdrw_vision() { - dsend_packet_diplomacy_cancel_pact(&client.conn, + dsend_packet_diplomacy_cancel_pact(&client.conn, player_number(other_player), CLAUSE_VISION); } diff --git a/client/gui-qt/sidebar.cpp b/client/gui-qt/sidebar.cpp index 54b0e56893..d9cf742288 100644 --- a/client/gui-qt/sidebar.cpp +++ b/client/gui-qt/sidebar.cpp @@ -708,7 +708,7 @@ void side_indicators_menu() } /***********************************************************************//** - Right click for diplomacy + Right click for diplomacy Opens diplomacy meeting for player For observer popups menu ***************************************************************************/ diff --git a/tests/trailing_spaces.sh b/tests/trailing_spaces.sh index 122708f959..073b189600 100755 --- a/tests/trailing_spaces.sh +++ b/tests/trailing_spaces.sh @@ -8,7 +8,9 @@ files=$(find $1 -name "*.ruleset" \ -o -name "*.serv" \ -o -name "*.txt" \ -o -name "README*" \ - -o -name "*.xml" | sort) + -o -name "*.xml" \ + -o -name "*.cpp" \ + | sort) echo "# Check for trailing spaces:" for file in $files; do diff --git a/tools/fcmp/mpgui_qt.cpp b/tools/fcmp/mpgui_qt.cpp index 79a8032e5a..46fbf9f71d 100644 --- a/tools/fcmp/mpgui_qt.cpp +++ b/tools/fcmp/mpgui_qt.cpp @@ -274,7 +274,7 @@ void mpgui::setup(QWidget *central, struct fcmp_params *params) msg_dspl->setAlignment(Qt::AlignHCenter); - central->setLayout(main_layout); + central->setLayout(main_layout); } /**********************************************************************//** diff --git a/tools/ruledit/req_edit.cpp b/tools/ruledit/req_edit.cpp index 1149fc0c7b..216d187c38 100644 --- a/tools/ruledit/req_edit.cpp +++ b/tools/ruledit/req_edit.cpp @@ -273,8 +273,8 @@ struct uvb_data static void universal_value_cb(const char *value, bool current, void *cbdata) { struct uvb_data *data = (struct uvb_data *)cbdata; - - if (value == NULL) { + + if (value == nullptr) { int kind, val; universal_extraction(data->univ, &kind, &val); @@ -423,7 +423,7 @@ void req_edit::add_now() } /**********************************************************************//** - User requested requirement deletion + User requested requirement deletion **************************************************************************/ void req_edit::delete_now() { diff --git a/tools/ruledit/tab_building.cpp b/tools/ruledit/tab_building.cpp index 827d9a661c..646f90cccb 100644 --- a/tools/ruledit/tab_building.cpp +++ b/tools/ruledit/tab_building.cpp @@ -206,7 +206,7 @@ void tab_building::name_given() } /**********************************************************************//** - User requested building deletion + User requested building deletion **************************************************************************/ void tab_building::delete_now() { diff --git a/tools/ruledit/tab_enablers.cpp b/tools/ruledit/tab_enablers.cpp index 81dfcbe234..17dcb6edbd 100644 --- a/tools/ruledit/tab_enablers.cpp +++ b/tools/ruledit/tab_enablers.cpp @@ -279,7 +279,7 @@ void tab_enabler::select_enabler() } /**********************************************************************//** - User requested enabler deletion + User requested enabler deletion **************************************************************************/ void tab_enabler::delete_now() { diff --git a/tools/ruledit/tab_extras.cpp b/tools/ruledit/tab_extras.cpp index fee5dd11e6..fe5a94a546 100644 --- a/tools/ruledit/tab_extras.cpp +++ b/tools/ruledit/tab_extras.cpp @@ -207,7 +207,7 @@ void tab_extras::name_given() } /**********************************************************************//** - User requested extra deletion + User requested extra deletion **************************************************************************/ void tab_extras::delete_now() { diff --git a/tools/ruledit/tab_good.cpp b/tools/ruledit/tab_good.cpp index fc6551169d..919869162b 100644 --- a/tools/ruledit/tab_good.cpp +++ b/tools/ruledit/tab_good.cpp @@ -201,7 +201,7 @@ void tab_good::name_given() } /**********************************************************************//** - User requested good deletion + User requested good deletion **************************************************************************/ void tab_good::delete_now() { diff --git a/tools/ruledit/tab_gov.cpp b/tools/ruledit/tab_gov.cpp index 2c5f27a36a..500bf19dfc 100644 --- a/tools/ruledit/tab_gov.cpp +++ b/tools/ruledit/tab_gov.cpp @@ -201,7 +201,7 @@ void tab_gov::name_given() } /**********************************************************************//** - User requested government deletion + User requested government deletion **************************************************************************/ void tab_gov::delete_now() { diff --git a/tools/ruledit/tab_tech.cpp b/tools/ruledit/tab_tech.cpp index a30a651e59..9ac80c71c1 100644 --- a/tools/ruledit/tab_tech.cpp +++ b/tools/ruledit/tab_tech.cpp @@ -373,7 +373,7 @@ void tab_tech::name_given() } /**********************************************************************//** - User requested tech deletion + User requested tech deletion **************************************************************************/ void tab_tech::delete_now() { diff --git a/tools/ruledit/tab_terrains.cpp b/tools/ruledit/tab_terrains.cpp index cd026feb96..ffd48cfe1c 100644 --- a/tools/ruledit/tab_terrains.cpp +++ b/tools/ruledit/tab_terrains.cpp @@ -203,7 +203,7 @@ void tab_terrains::name_given() } /**********************************************************************//** - User requested terrain deletion + User requested terrain deletion **************************************************************************/ void tab_terrains::delete_now() { diff --git a/tools/ruledit/tab_unit.cpp b/tools/ruledit/tab_unit.cpp index 81f7c1c857..8225466d7a 100644 --- a/tools/ruledit/tab_unit.cpp +++ b/tools/ruledit/tab_unit.cpp @@ -203,7 +203,7 @@ void tab_unit::name_given() } /**********************************************************************//** - User requested unit deletion + User requested unit deletion **************************************************************************/ void tab_unit::delete_now() { -- 2.39.2