diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/canvas.h freeciv-cvs/client/gui-qpe/canvas.h --- freeciv-cvs.orig/client/gui-qpe/canvas.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/canvas.h 2004-12-11 14:17:02.000000000 -0500 @@ -0,0 +1,11 @@ +#include +#include + +struct canvas { + QPixmap *pixmap; +}; + +struct Sprite { + QImage *image; +}; + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/chatline.cpp freeciv-cvs/client/gui-qpe/chatline.cpp --- freeciv-cvs.orig/client/gui-qpe/chatline.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/chatline.cpp 2004-12-05 23:18:22.000000000 -0500 @@ -0,0 +1,41 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +extern "C" { +#include "config_hack.h" + +#include "climisc.h" /* for write_chatline_content */ + +#include "chatline.h" +} + +#include "classes/main_impl.h" + +/************************************************************************** + Appends the string to the chat output window. The string should be + inserted on its own line, although it will have no newline. +**************************************************************************/ +void real_append_output_window(const char *astring, int conn_id) +{ + /* We can be called by save_options() in ui_exit() */ + if (civclient) + civclient->chatMessage(astring); +} + +/************************************************************************** + Clear all text from the output window. +**************************************************************************/ +void clear_output_window(void) +{ + civclient->chatMessage(); +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/chatline.h freeciv-cvs/client/gui-qpe/chatline.h --- freeciv-cvs.orig/client/gui-qpe/chatline.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/chatline.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__CHATLINE_H +#define FC__CHATLINE_H + +#include "chatline_g.h" + + +#endif /* FC__CHATLINE_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/citydlg.cpp freeciv-cvs/client/gui-qpe/citydlg.cpp --- freeciv-cvs.orig/client/gui-qpe/citydlg.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/citydlg.cpp 2004-12-05 09:30:52.000000000 -0500 @@ -0,0 +1,97 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include "classes/main_impl.h" +#include "classes/city_impl.h" +#include "citydlg.h" +#include "qpe_dialog.h" + + +/************************************************************************** + Pop up (or bring to the front) a dialog for the given city. It may or + may not be modal. +**************************************************************************/ +void CivClient::popupCity(struct city *pcity, bool make_modal) +{ + cityDialog->popupCity(pcity); + execDialog(cityDialog, FALSE); +} + +void popup_city_dialog(struct city *pcity, bool make_modal) +{ + civclient->popupCity(pcity, make_modal); +} + +/************************************************************************** + Close the dialog for the given city. +**************************************************************************/ +void CivClient::popdownCity(struct city *pcity) +{ + cityDialog->popdownCity(pcity); +} + +void popdown_city_dialog(struct city *pcity) +{ + civclient->popdownCity(pcity); +} + +/************************************************************************** + Close the dialogs for all cities. +**************************************************************************/ +void CivClient::popdownCity() +{ + cityDialog->popdownCity(); +} + +void popdown_all_city_dialogs(void) +{ + civclient->popdownCity(); +} + +/************************************************************************** + Refresh (update) all data for the given city's dialog. +**************************************************************************/ +void CivClient::refreshCity(struct city *pcity) +{ + cityDialog->refreshCity(pcity); +} + +void refresh_city_dialog(struct city *pcity) +{ + civclient->refreshCity(pcity); +} + +/************************************************************************** + Update city dialogs when the given unit's status changes. This + typically means updating both the unit's home city (if any) and the + city in which it is present (if any). +**************************************************************************/ +void refresh_unit_city_dialogs(struct unit *punit) +{ + civclient->refreshCity( find_city_by_id(punit->homecity) ); + civclient->refreshCity( map_get_city(punit->tile) ); +} + +/************************************************************************** + Return whether the dialog for the given city is open. +**************************************************************************/ +bool CivClient::isCityOpen(struct city *pcity) +{ + return cityDialog->isCity(pcity); +} + +bool city_dialog_is_open(struct city *pcity) +{ + return civclient->isCityOpen(pcity); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/citydlg.h freeciv-cvs/client/gui-qpe/citydlg.h --- freeciv-cvs.orig/client/gui-qpe/citydlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/citydlg.h 2004-12-04 16:38:24.000000000 -0500 @@ -0,0 +1,22 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__CITYDLG_H +#define FC__CITYDLG_H + +extern "C" { +#include "config_hack.h" +#include "citydlg_g.h" +} + +#endif /* FC__CITYDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/cityrep.cpp freeciv-cvs/client/gui-qpe/cityrep.cpp --- freeciv-cvs.orig/client/gui-qpe/cityrep.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/cityrep.cpp 2004-12-18 11:29:11.000000000 -0500 @@ -0,0 +1,257 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include "classes/main_impl.h" +#include "cityrep.h" +#include "listview.h" + +extern "C" { +#include +#include "config_hack.h" +#include "cityrepdata.h" +#include "climisc.h" +#include "map.h" +#include "mapview_common.h" +} + + +#define citiesIterate(x) \ + for ( ListViewItem *(x) = \ + (ListViewItem *) \ + citiesList->firstChild(); \ + (x) != NULL; \ + (x) = (x)->nextSibling() ) + +#define citiesSelectedFirst(x) \ + ListViewItem *(x) = \ + ListViewItem::firstSelection(citiesList) + +#define citiesSelectedIterate(x) \ + for ( ListViewItem *(x) = \ + ListViewItem::firstSelection(citiesList); \ + (x) != NULL; (x) = (x)->nextSelection() ) + + +void CivClient::initCities() +{ + citiesSelectMenu = new QPopupMenu(this); + citiesSelectButton->setPopup(citiesSelectMenu); + + citiesSelectAll->addTo(citiesSelectMenu); /* All Cities */ + citiesSelectNone->addTo(citiesSelectMenu); /* No Cities */ + citiesSelectInvert->addTo(citiesSelectMenu); /* Invert Selection */ + citiesSelectMenu->insertSeparator(); + citiesSelectCoastal->addTo(citiesSelectMenu); /* Coastal Cities */ + citiesSelectContinent->addTo(citiesSelectMenu); /* Same Continent */ + citiesSelectMenu->insertSeparator(); + citiesSelectBuildUnit->addTo(citiesSelectMenu); /* Building Units */ + citiesSelectBuildImprovement->addTo(citiesSelectMenu); /* ... Impr */ + citiesSelectBuildWonder->addTo(citiesSelectMenu); /* ... Wond */ +} + +/************************************************************************** + Update (refresh) the entire city report dialog. +**************************************************************************/ +void CivClient::updateCities() +{ + if (city_report_specs == NULL) + return; + + QList prev_select; + + citiesSelectedIterate(i) + prev_select.append(i->data); + + citiesList->clear(); + citiesSelectButton->setEnabled(FALSE); + citiesRefreshButton->setEnabled(TRUE); + + city_list_iterate ( game.player_ptr->cities, pcity ) + { + ListViewItem *i = + new ListViewItem(citiesList, pcity); + + if ( prev_select.findRef(pcity) != -1 ) + citiesList->setSelected(i, TRUE); + + int j = 0; + i->setText(j++, (city_report_specs[0].func) + (pcity, city_report_specs[0].data) ); + i->setText(j++, (city_report_specs[1].func) + (pcity, city_report_specs[1].data) ); + i->setText(j++, (city_report_specs[2].func) + (pcity, city_report_specs[2].data) ); + i->setText(j++, (city_report_specs[4].func) + (pcity, city_report_specs[4].data) ); + i->setText(j++, (city_report_specs[9].func) + (pcity, city_report_specs[9].data) ); + i->setText(j++, (city_report_specs[14].func) + (pcity, city_report_specs[14].data) ); + i->setText(j++, (city_report_specs[18].func) + (pcity, city_report_specs[18].data) ); + i->setText(j++, (city_report_specs[23].func) + (pcity, city_report_specs[23].data) ); + i->setText(j++, (city_report_specs[24].func) + (pcity, city_report_specs[24].data) ); + i->setText(j++, (city_report_specs[26].func) + (pcity, city_report_specs[26].data) ); + i->setText(j++, (city_report_specs[29].func) + (pcity, city_report_specs[29].data) ); + + citiesSelectButton->setEnabled(TRUE); + } city_list_iterate_end; + + citiesListChanged(); +} + +void city_report_dialog_update(void) +{ + civclient->updateCities(); +} + +/************************************************************************** + Update the city report dialog for a single city. +**************************************************************************/ +void city_report_dialog_update_city(struct city *pcity) +{ + // FIXME + civclient->updateCities(); +} + +/**************************************************************** + After a selection rectangle is defined, make the cities that + are hilited on the canvas exclusively hilited in the + City List window. +*****************************************************************/ +void hilite_cities_from_canvas(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "hilite_cities_from_canvas"); + /* PORTME */ +} + +/**************************************************************** + Toggle a city's hilited status. +*****************************************************************/ +void toggle_city_hilite(struct city *pcity, bool on_off) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "toggle_city_hilite"); + /* PORTME */ +} + +void CivClient::citiesListChanged() +{ + citiesBuyButton->setEnabled(FALSE); + citiesCenterButton->setEnabled(FALSE); + citiesPopupButton->setEnabled(FALSE); + + if ( citiesSelectedFirst(i) ) + { + citiesBuyButton->setEnabled(TRUE); + citiesCenterButton->setEnabled(TRUE); + citiesPopupButton->setEnabled(TRUE); + } +} + +void CivClient::citiesBuyClicked() +{ + citiesSelectedIterate(i) + cityrep_buy(i->data); +} + +void CivClient::citiesCenterClicked() +{ + if ( citiesSelectedFirst(i) ) + center_tile_mapcanvas(i->data->tile); +} + +void CivClient::citiesPopupClicked() +{ + if ( citiesSelectedFirst(i) ) + popupCity(i->data, FALSE); +} + +void CivClient::citiesRefreshClicked() +{ + updateCities(); +} + + +void CivClient::citiesSelectedAll() +{ + citiesIterate(i) + citiesList->setSelected(i, TRUE); +} + +void CivClient::citiesSelectedNone() +{ + citiesList->clearSelection(); +} + +void CivClient::citiesSelectedInvert() +{ + citiesIterate(i) + citiesList->setSelected( i, ! i->isSelected() ); +} + +void CivClient::citiesSelectedCoastal() +{ + citiesIterate(i) + citiesList->setSelected( i, + is_ocean_near_tile( i->data->tile ) ); +} + +void CivClient::citiesSelectedContinent() +{ + QValueList continents; + + citiesSelectedIterate(i) + continents.append( map_get_continent(i->data->tile) ); + + citiesIterate(i) + { + if ( continents.contains( map_get_continent(i->data->tile) ) ) + citiesList->setSelected(i, TRUE); + } +} + +void CivClient::citiesSelectedBuildUnit() +{ + citiesIterate(i) + if ( i->data->is_building_unit ) + citiesList->setSelected(i, TRUE); +} + +void CivClient::citiesSelectedBuildImprovement() +{ + citiesIterate(i) + if ( ! i->data->is_building_unit + && ! is_wonder(i->data->currently_building) ) + citiesList->setSelected(i, TRUE); +} + +void CivClient::citiesSelectedBuildWonder() +{ + citiesIterate(i) + if ( ! i->data->is_building_unit + && is_wonder( i->data->currently_building ) ) + citiesList->setSelected(i, TRUE); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/cityrep.h freeciv-cvs/client/gui-qpe/cityrep.h --- freeciv-cvs.orig/client/gui-qpe/cityrep.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/cityrep.h 2004-12-13 05:46:16.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__CITYREP_H +#define FC__CITYREP_H + +extern "C" { +#include "config_hack.h" +#include "cityrep_g.h" +} + + +#endif /* FC__CITYREP_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/city_base.ui freeciv-cvs/client/gui-qpe/classes/city_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/city_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/city_base.ui 2004-12-11 04:20:40.000000000 -0500 @@ -0,0 +1,637 @@ + +City_Base + + + City_Base + + + + 0 + 0 + 242 + 443 + + + + Form1 + + + + + + unnamed + + + + TabWidget2 + + + Triangular + + + + tab + + + Info + + + + unnamed + + + + layout67 + + + + unnamed + + + + cityMap + + + + + layout66 + + + + unnamed + + + + layout65 + + + + unnamed + + + + textLabel10 + + + Name: + + + + + nameLabel + + + + + textLabel11 + + + Pop.: + + + + + populationLabel + + + + + + + groupBox18 + + + Citizens + + + + unnamed + + + + textLabel12 + + + H/C/U/A: + + + + + happinessLabel + + + + + textLabel13 + + + E/S/T: + + + + + specialistsLabel + + + + + + + + + + + cityInfo + + + + + + + tab + + + Prod + + + + unnamed + + + + productionBox + + + Current Work + + + AlignHCenter + + + + unnamed + + + + productionLabel + + + AlignCenter + + + + + layout34 + + + + unnamed + + + + buyButton + + + Buy + + + + + changeButton + + + Change + + + + + + + + + groupBox7 + + + Present Improvements + + + AlignHCenter + + + + unnamed + + + + upkeepText + + + AlignCenter + + + + + + Improvement + + + true + + + true + + + + + Upkeep + + + true + + + true + + + + + Worth + + + true + + + true + + + + improvementsList + + + true + + + + + sellButton + + + false + + + Sell + + + + + + + + + tab + + + Units + + + + unnamed + + + + + Unit + + + true + + + true + + + + + Veteran + + + true + + + true + + + + + Activity + + + true + + + true + + + + + Home + + + true + + + true + + + + + Location + + + true + + + true + + + + unitsList + + + true + + + 0 + + + + + layout62 + + + + unnamed + + + + readyAllButton + + + Ready All + + + + + sentryAllButton + + + Sentry All + + + + + + + + + tab + + + Happy + + + + unnamed + + + + layout28 + + + + unnamed + + + + happyMap + + + + + + Cause + + + true + + + true + + + + + H/C/U/A + + + true + + + true + + + + + Details + + + true + + + true + + + + happyList + + + NoSelection + + + + + + + happyInfo + + + + + + + TabPage + + + Settings + + + + unnamed + + + + renameButton + + + Rename + + + + + + + + layout36 + + + + unnamed + + + + prevCityButton + + + Prev City + + + + + nextCityButton + + + Next City + + + + + + + + + CityMapWidget +
citymapw.h
+ + 80 + 80 + + 0 + + 0 + 0 + 0 + 0 + + image0 +
+ + CityInfo_Impl +
cityinfo_impl.h
+ + -1 + -1 + + 0 + + 7 + 7 + 0 + 0 + + image0 +
+
+ + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000030149444154388db59531681b5718c77f0e377c070e3c810a3a70e0041eac51852e0a19e45134830a1d9a4c69a04bc8928e990a693a640e1d0c8642b08742321894c1507991b484c890902bb8701a047760c3bd21701fe4201dde49b6a41a32b8df72dcbbeffdbefffbbfefbd5b1b0c07cce266ebe667ae2006c3c1dada0cdc3be87d6e6c35b0d692a409d9c7ec8b20d65ae29398d19b1114e7e3de4ce98b3f5e10dc0053cf0951b4506496e1b964bf7ce6c585d9054c62d01d617ca48be0596553cf496d8f2c8b01c5f795fc93904e85ec4c01a152857a5d9175d0b2805c872080f18595ccc1499a10a225d4e2fbc2877786fe81253ab6c04c8d106e09db5d43ab0d146e5c64d1a23938fb98a185cea1c33eecfd9eba49eb427dcb201e245365f2b7b2fb5b4a3a31dcb927178afe07d86901df870fefa4842aed6f6b74ba42e52b4014d580e1eb9cbd9d94de7e4aad16d2f9be02d805f0b5e532f927a1ffcacea1777f122a8105b164a7c25faf323a5d9f1f1fd600e1e5bec59e2d4b5c7ef5209d0ad17b8b31864e57c0b3e0815ac3ee33253ab664a770ff5185d1a1cb8d2267d3e58aa1dc7d2508cbe597d0e74fdd269aaaf0f52d414c4ea3e9762c996869e42560d7a72e41c4799a2586e74f95e8d8151481fa86efbe7b3398ac58b1a2b8527589f15451ad303ac2293542ad6648a796278f13a27185e4c4754310facb98c53a79e19a3fdc1426ff28c3d7399d1f7cb25343eb96106cf83c790ce9c4f2eb831855c55485663327992eb6dc8a6259874ed700b0b793323cccb9ffa842b30d6133e3e75fea989ac15a8b16ca76b746b0b92278d919774c5b6d48a78697fb29bbcf52468742a32120909c24e899ce67beed5be2db01e22d1e9485bb620e47f9ee9e606a21bd3f5d3744c7e7c54d55e87443867d8b554515ac5db4620e8e4f62263170fd1cdee90aad7640141992891b0f367c9adfe4049bb07d3b7022bd8c687c0978f46684ee084150b65ac1fcca94591b7a90a496e4c095164fb016a2b192a497795cc0f84817aebe25f7bf70ccc54a575c555c03f78ffa5fc0570d1f0c076bff0232285a09643cc7ce0000000049454e44ae426082 + + + + + unitsList + clicked(QListViewItem*) + City_Base + unitClicked(QListViewItem*) + + + prevCityButton + clicked() + City_Base + prevCity() + + + nextCityButton + clicked() + City_Base + nextCity() + + + readyAllButton + clicked() + City_Base + readyAllUnits() + + + sentryAllButton + clicked() + City_Base + sentryAllUnits() + + + buyButton + clicked() + City_Base + buyClicked() + + + sellButton + clicked() + City_Base + sellClicked() + + + changeButton + clicked() + City_Base + changeClicked() + + + improvementsList + selectionChanged(QListViewItem*) + City_Base + improvementSelected(QListViewItem*) + + + renameButton + clicked() + City_Base + renameClicked() + + + + readyAllUnits() + sentryAllUnits() + unitClicked(QListViewItem *) + prevCity() + nextCity() + buyClicked() + sellClicked() + changeClicked() + improvementSelected(QListViewItem *) + renameClicked() + + + + citymapwidget.h + cityinfo_impl.h + citymapwidget.h + cityinfo_impl.h + +
diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/city_build.ui freeciv-cvs/client/gui-qpe/classes/city_build.ui --- freeciv-cvs.orig/client/gui-qpe/classes/city_build.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/city_build.ui 2004-12-10 06:16:20.000000000 -0500 @@ -0,0 +1,83 @@ + +CivClientCityBuildDialog + + + CivClientCityBuildDialog + + + + 0 + 0 + 241 + 277 + + + + Change Production + + + + unnamed + + + + + Type + + + true + + + true + + + + + Info + + + true + + + true + + + + + Cost + + + true + + + true + + + + + Turns + + + true + + + true + + + + buildList + + + StyledPanel + + + Sunken + + + true + + + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/city_impl.cpp freeciv-cvs/client/gui-qpe/classes/city_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/city_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/city_impl.cpp 2005-03-06 21:44:11.000000000 -0500 @@ -0,0 +1,641 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "city_build.h" +#include "city_impl.h" +#include "cityinfo_impl.h" +#include "citymapw.h" +#include "citydlg.h" +#include "canvas.h" +#include "messages.h" +#include "qpe_dialog.h" +#include "listviewunit.h" + +extern "C" { +#include +#include "config_hack.h" +#include "civclient.h" +#include "climisc.h" +#include "control.h" +#include "game.h" +#include "mapview_common.h" +#include "text.h" +#include "government.h" +} + + +class sortedCity +{ + public: + sortedCity( struct city * ); + bool operator<( const sortedCity & ) const; + bool operator==( const sortedCity & ) const; + struct city *pcity; +}; + +sortedCity::sortedCity( struct city *c ) : pcity(c) +{ +} + +bool sortedCity::operator<( const sortedCity &that ) const +{ + return pcity->turn_founded < that.pcity->turn_founded || + ( pcity->turn_founded == that.pcity->turn_founded && + pcity->id < that.pcity->id ); +} + +bool sortedCity::operator==( const sortedCity &that ) const +{ + return pcity->id == that.pcity->id; +} + + +City_Impl::City_Impl( QWidget *parent, const char *name ) + : City_Base( parent, name, TRUE ) +{ + QString tmp[UMENU_SIZE] = { + "Center", + "Activate", + "Activate/Close", + "Sentry", + "Fortify", + "Disband", + "Make homecity", + "Upgrade" + }; + unitsMenu = newMenu( tmp, unitsMenuItems, UMENU_SIZE ); + + happyList->setSorting(-1); + char * tmp2[5] = { "Cities", "Luxury", "Build", "Units", "Wonders" }; + for ( int i = 4; i >= 0; i-- ) + { + happyListItems[i] = new QListViewItem(happyList); + happyListItems[i]->setText( 0, tr( tmp2[i] ) ); + } +} + +QPopupMenu * City_Impl::newMenu( const QString str[], int items[], int size) +{ + QPopupMenu *menu = new QPopupMenu(this); + + for (int i = 0; i < size; i++) + items[i] = menu->insertItem( str[i] ); + + return menu; +} + +bool City_Impl::isCity( const struct city *pcity ) const +{ + return pcity && pcity == this->pcity; +} + +void City_Impl::refreshCity( const struct city *pcity ) +{ + if (isCity(pcity)) + refreshCity(); +} + +void City_Impl::refreshCity() +{ + /* + * This only needs to be done at initialization, but creation time is + * actually too soon. + */ + cityMap->resizeMap( get_citydlg_canvas_width(), + get_citydlg_canvas_height() ); + happyMap->resizeMap( get_citydlg_canvas_width(), + get_citydlg_canvas_height() ); + + cityMap->redrawMap(); + happyMap->redrawMap(); + + char tmp[200]; + + /* + [From gtk] + city_report_dialog_update_city(pcity); + economy_report_dialog_update(); + */ + + /* Window caption */ + + QString caption = tr("%1 - %2").arg(pcity->name). + arg( population_to_text(city_population(pcity)) ); + + if (city_unhappy(pcity)) + caption += " - DISORDER"; + else if (city_celebrating(pcity)) + caption += " - celebrating"; + else if (city_happy(pcity)) + caption += " - happy"; + + setCaption(caption); + + /* Info window */ + + nameLabel->setText(pcity->name); + populationLabel->setText( population_to_text(city_population(pcity)) ); + int index = 4; + happinessLabel->setText( tr("%1 / %2 / %3 / %4"). + arg( pcity->ppl_happy[index] ). + arg( pcity->ppl_content[index] ). + arg( pcity->ppl_unhappy[index] ). + arg( pcity->ppl_angry[index] ) ); + // FIXME: This implies the default ruleset + specialistsLabel->setText( tr("%1 / %2 / %3"). + arg( pcity->specialists[0] ). + arg( pcity->specialists[1] ). + arg( pcity->specialists[2] ) ); + // get_city_citizen_types + // get_citizen_sprite + + cityInfo->refreshInfo(pcity); + happyInfo->refreshInfo(pcity); + + /* Production window - in production */ + + QString build_descr = pcity->is_building_unit ? + get_unit_type(pcity->currently_building)->name : + get_impr_name_ex(pcity, pcity->currently_building); + + if (! worklist_is_empty(&pcity->worklist) ) + build_descr += " (worklist)"; + + productionBox->setTitle(build_descr); + + int cost = pcity->is_building_unit ? + unit_build_shield_cost(pcity->currently_building) : + impr_build_shield_cost(pcity->currently_building); + + if (cost <= 0) + cost = pcity->prod[O_SHIELD]; + + get_city_dialog_production(pcity, tmp, sizeof(tmp)); + // This should eventually be a progress bar + productionLabel->setText(tmp); + + buyButton->setEnabled( city_can_buy(pcity) ); + // Is this test sufficient? + changeButton->setEnabled( !pcity->did_buy ); + + /* Production window - already present */ + + cid cids[U_LAST + B_LAST]; + struct item items[U_LAST + B_LAST]; + + int cids_used = collect_cids5(cids, pcity); + name_and_sort_items(cids, cids_used, items, FALSE, pcity); + improvementsList->clear(); + + int totalUpkeep = 0; + for (int i = 0; i < cids_used; i++) + { + int cid = cid_id(items[i].cid); + int upkeep = improvement_upkeep(pcity, cid); + totalUpkeep += upkeep; + (void) new ListViewItem( improvementsList, cid, + items[i].descr, + QString::number(upkeep), + QString::number(impr_sell_gold(cid)) ); + } + upkeepText->setText( tr("Total upkeep: %1").arg(totalUpkeep) ); + + sellButton->setEnabled(FALSE); + + /* Supported units */ + + unitsList->clear(); + + QListViewItem *supportedUnitsList = new ListViewUnit(unitsList, + "Supported"); + supportedUnitsList->setSelectable(FALSE); + supportedUnitsList->setOpen(TRUE); + + struct unit_list *plist = (pcity->owner == game.player_idx) ? + pcity->units_supported : + pcity->info_units_supported; + + unit_list_iterate( plist, punit ) + { + (void) new ListViewUnit(supportedUnitsList, punit, TRUE); + } unit_list_iterate_end; + + /* Present units */ + + QListViewItem *presentUnitsList = new ListViewUnit(unitsList, + "Present"); + presentUnitsList->setSelectable(FALSE); + presentUnitsList->setOpen(TRUE); + + plist = (pcity->owner == game.player_idx) ? + pcity->tile->units : + pcity->info_units_present; + + unit_list_iterate( plist, punit ) + { + (void) new ListViewUnit(presentUnitsList, punit, TRUE); + } unit_list_iterate_end; + + if ( can_client_issue_orders() && + unit_list_size(pcity->tile->units) > 0 ) + { + readyAllButton->setEnabled(TRUE); + sentryAllButton->setEnabled(TRUE); + } else { + readyAllButton->setEnabled(FALSE); + sentryAllButton->setEnabled(FALSE); + } + + /* Happiness */ + + for ( int i = 0; i < 5; i++ ) + { + happyListItems[i]->setText(1, tr("%1/%2/%3/%4"). + arg( pcity->ppl_happy[i] ). + arg( pcity->ppl_content[i] ). + arg( pcity->ppl_unhappy[i] ). + arg( pcity->ppl_angry[i] ) ); + } + + happyListItems[1]->setText( 2, tr("%1 total"). + arg(pcity->prod[O_LUXURY]) ); + happyListItems[2]->setText( 2, get_happiness_buildings(pcity) ); + happyListItems[4]->setText( 2, get_happiness_wonders(pcity) ); + + { + struct player *pplayer = &game.players[pcity->owner]; + struct government *g = get_gov_pcity(pcity); + + int cities = city_list_size(pplayer->cities); + int content = game.unhappysize; + int basis = game.cityfactor + g->empire_size_mod; + int step = g->empire_size_inc; + int excess = MAX(0, cities - basis); + int penalty = 0; + + if (excess > 0) + { + if (step > 0) + penalty = 1 + (excess - 1) / step; + else + penalty = 1; + } + + happyListItems[0]->setText(2, tr( "%1 total, " + "%2 over threshold of %3 cities. " + "%4 content before penalty with " + "%5 additional unhappy citizens." ). + arg(cities).arg(excess).arg(basis). + arg(content).arg(penalty) ); + } + + { + struct government *g = get_gov_pcity(pcity); + int mlmax = g->martial_law_max; + int uhcfac = g->unit_happy_cost_factor; + + QString str; + if (mlmax > 0) + { + str += "Martial law in effect ("; + + if (mlmax == 100) + str += "no maximum, "; + else + str += tr("%1 unit(s) maximum, ").arg(mlmax); + + str += tr("%1 per unit).").arg(g->martial_law_per); + } else + if (uhcfac > 0) + str += "Military units in the field may cause unhappiness."; + else + str += "Military units have no happiness effect."; + + happyListItems[3]->setText(2, str); + } + + /* + specialists + tradelist + */ + + if ( pcity->owner == game.player_idx && + city_list_size(game.player_ptr->cities) > 1 ) + { + prevCityButton->setEnabled(TRUE); + nextCityButton->setEnabled(TRUE); + } else { + prevCityButton->setEnabled(FALSE); + nextCityButton->setEnabled(FALSE); + } +} + +void City_Impl::popupCity( struct city *pcity ) +{ + /* Do all the closing cleanup */ + + this->pcity = pcity; + cityMap->setCity(pcity); + happyMap->setCity(pcity); + + refreshCity(); +} + +void City_Impl::popdownCity( const struct city *pcity ) +{ + if (isCity(pcity)) + popdownCity(); +} + +void City_Impl::popdownCity() +{ + /* Do all the closing cleanup */ + if (! isHidden()) + reject(); +} + +void City_Impl::readyAllUnits() +{ + activate_all_units(pcity->tile); +} + +void City_Impl::sentryAllUnits() +{ + struct unit_list *punit_list = pcity->tile->units; + + unit_list_iterate( punit_list, punit ) + { + if (punit->owner == game.player_idx && + punit->activity == ACTIVITY_IDLE && + ! punit->ai.control && + can_unit_do_activity(punit, ACTIVITY_SENTRY) ) + { + request_new_unit_activity(punit, ACTIVITY_SENTRY); + } + } unit_list_iterate_end; +} + +void City_Impl::unitClicked( QListViewItem *i ) +{ + struct unit *punit = ((ListViewUnit *) i)->data; + + if (punit == NULL) return; + + for (int i = 0; i < UMENU_SIZE; i++) + unitsMenu->setItemEnabled( unitsMenuItems[i], FALSE ); + + unitsMenu->setItemEnabled( unitsMenuItems[UMENU_ACTIVATE], TRUE ); + unitsMenu->setItemEnabled( unitsMenuItems[UMENU_CLOSE], TRUE ); + + if ( punit->owner == game.player_idx && can_client_issue_orders() ) + { + unitsMenu->setItemEnabled( unitsMenuItems[UMENU_DISBAND], + ! unit_flag(punit, F_UNDISBANDABLE) ); + + if ( punit->tile->index == pcity->tile->index ) + { + unitsMenu->setItemEnabled( + unitsMenuItems[UMENU_SENTRY], + punit->activity != ACTIVITY_SENTRY && + can_unit_do_activity(punit, ACTIVITY_SENTRY) ); + + unitsMenu->setItemEnabled( + unitsMenuItems[UMENU_FORTIFY], + punit->activity != ACTIVITY_FORTIFYING && + can_unit_do_activity(punit, + ACTIVITY_FORTIFYING) ); + + unitsMenu->setItemEnabled( + unitsMenuItems[UMENU_MAKEHOME], + punit->homecity != pcity->id ); + + unitsMenu->setItemEnabled( + unitsMenuItems[UMENU_UPGRADE], + can_upgrade_unittype(game.player_ptr, + punit->type) != -1 ); + } else { + unitsMenu->setItemEnabled( + unitsMenuItems[UMENU_CENTER], TRUE ); + } + } + + int item = unitsMenu->exec(QCursor::pos()); + if (item == -1) return; + + int order = -1; + for (int i = 0; i < UMENU_SIZE; i++) + if (unitsMenuItems[i] == item) order = i; + + switch (order) + { + case UMENU_CENTER: + center_tile_mapcanvas(punit->tile); + break; + case UMENU_ACTIVATE: + set_unit_focus(punit); + break; + case UMENU_CLOSE: + set_unit_focus(punit); + this->accept(); + break; + case UMENU_SENTRY: + request_unit_sentry(punit); + break; + case UMENU_FORTIFY: + request_unit_fortify(punit); + break; + case UMENU_DISBAND: + request_unit_disband(punit); + break; + case UMENU_MAKEHOME: + request_unit_change_homecity(punit); + break; + case UMENU_UPGRADE: + char buf[512]; + if ( get_unit_upgrade_info(buf, sizeof(buf), punit) + == UR_OK ) + { + if ( CivClientMessages::askConfirmation( this, + tr("Upgrade Obsolete Units"), + buf ) ) + request_unit_upgrade(punit); + } else { + CivClientMessages::showMessage( this, + tr("Upgrade Unit!"), buf ); + } + break; + default: + ; + /* Error */ + } +} + +void City_Impl::prevNextCity( bool isNext ) +{ + if( city_list_size(game.player_ptr->cities) == 1 ) + return; + + QSortedList cityList; + cityList.setAutoDelete(TRUE); + + city_list_iterate( game.player_ptr->cities, x ) { + cityList.append( new sortedCity(x) ); + } city_list_iterate_end + + cityList.sort(); + + sortedCity *tmp = new sortedCity(pcity); + cityList.find(tmp); + delete tmp; + + if (isNext) { + if (cityList.next() == NULL) + cityList.first(); + } else { + if (cityList.prev() == NULL) + cityList.last(); + } + + popupCity(cityList.current()->pcity); + center_tile_mapcanvas(pcity->tile); +} + +void City_Impl::prevCity() +{ + prevNextCity(FALSE); +} + +void City_Impl::nextCity() +{ + prevNextCity(TRUE); +} + +void City_Impl::changeClicked() +{ + CivClientCityBuildDialog dialog(this, NULL, TRUE); + + dialog.setCaption( tr("Change Production in %1").arg(pcity->name) ); + + cid cids[U_LAST + B_LAST]; + struct item items[U_LAST + B_LAST]; + + int cids_used = collect_cids4(cids, pcity, 0); + name_and_sort_items(cids, cids_used, items, TRUE, pcity); + + char *row[4]; + char buf[4][64]; + for (int i = 0; i < 4; i++) + row[i] = buf[i]; + + for (int i = 0; i < cids_used; i++) + { + cid cid = items[i].cid; + + get_city_dialog_production_row( row, sizeof(buf[0]), + cid_id(cid), cid_is_unit(cid), pcity); + + (void) new ListViewItem( dialog.buildList, cid, + row[0], row[1], row[2], row[3] ); + } + + if ( execDialog(&dialog, TRUE) == QDialog::Accepted ) + { + ListViewItem *i = (ListViewItem *) + dialog.buildList->selectedItem(); + + if (i) + city_change_production( pcity, cid_is_unit(i->data), + cid_id(i->data) ); + } +} + +void City_Impl::buyClicked() +{ + const char *name = pcity->is_building_unit ? + get_unit_type(pcity->currently_building)->name : + get_impr_name_ex(pcity, pcity->currently_building); + + int value = city_buy_cost(pcity); + + if (game.player_ptr->economic.gold >= value) + { + if ( CivClientMessages::askConfirmation( this, + tr("Buy It!"), + tr("Buy %1 for %2 gold?\n" + "Treasury contains %3 gold."). + arg(name).arg(value). + arg(game.player_ptr->economic.gold) ) ) + { + printf("Buying...\n"); + city_buy_production(pcity); + } + } else + CivClientMessages::showMessage( this, + tr("Buy It!"), + tr("%1 costs %2 gold.\n" + "Treasury contains %3 gold."). + arg(name).arg(value). + arg(game.player_ptr->economic.gold) ); +} + +void City_Impl::improvementSelected( QListViewItem *x ) +{ + ListViewItem *i = (ListViewItem *)x; + + /* FIXME: Shouldn't we filter out wonders as well? */ + /* How about can_issue_orders? */ + if ( i && pcity->owner == game.player_idx && + ! pcity->did_buy && ! pcity->did_sell ) + { + assert( city_got_building(pcity, i->data) ); + sellButton->setEnabled(TRUE); + } else + { + sellButton->setEnabled(FALSE); + } +} + +void City_Impl::sellClicked() +{ + ListViewItem *i = (ListViewItem *) + improvementsList->selectedItem(); + + if (! i) return; + + assert( city_got_building(pcity, i->data) ); + + if ( is_wonder(i->data) ) + return; + + if ( CivClientMessages::askConfirmation( this, + tr("Sell It!"), + tr("Sell %1 for %2 gold?\n"). + arg( get_impr_name_ex(pcity, i->data) ). + arg( impr_sell_gold(i->data) ) ) ) + { + city_sell_improvement(pcity, i->data); + } +} + +void City_Impl::renameClicked() +{ + QString *str = CivClientMessages::askQuestion( this, + tr("Rename City"), + tr("What should we rename the city to?"), + pcity->name ); + + if (str) + { + city_rename(pcity, str->latin1()); + free(str); + } +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/city_impl.h freeciv-cvs/client/gui-qpe/classes/city_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/city_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/city_impl.h 2004-12-11 03:54:25.000000000 -0500 @@ -0,0 +1,53 @@ +#ifndef FC__QPE_CITY_IMPL_H +#define FC__QPE_CITY_IMPL_H + +#include +#include "city_base.h" + +class QPopupMenu; + + +class City_Impl : public City_Base +{ + Q_OBJECT + public: + City_Impl( QWidget *parent = 0, const char *name = 0 ); + bool isCity( const struct city * ) const; + void refreshCity( const struct city * ); + void refreshCity(); + void popupCity( struct city * ); + void popdownCity( const struct city * ); + void popdownCity(); + protected slots: + void readyAllUnits(); + void sentryAllUnits(); + void unitClicked( QListViewItem * ); + void prevCity(); + void nextCity(); + void buyClicked(); + void sellClicked(); + void changeClicked(); + void improvementSelected( QListViewItem * ); + void renameClicked(); + private: + enum unitsMenuEnum { + UMENU_CENTER, + UMENU_ACTIVATE, + UMENU_CLOSE, + UMENU_SENTRY, + UMENU_FORTIFY, + UMENU_DISBAND, + UMENU_MAKEHOME, + UMENU_UPGRADE, + UMENU_SIZE + }; + struct city *pcity; + QPopupMenu *unitsMenu; + int unitsMenuItems[UMENU_SIZE]; + QPopupMenu * newMenu( const QString[], int[], int ); + void prevNextCity(bool); + QListViewItem * happyListItems[5]; +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/cityinfo_base.ui freeciv-cvs/client/gui-qpe/classes/cityinfo_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/cityinfo_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/cityinfo_base.ui 2004-12-05 06:21:05.000000000 -0500 @@ -0,0 +1,171 @@ + +CityInfo_Base + + + CityInfo_Base + + + + 0 + 0 + 155 + 128 + + + + Form3 + + + + unnamed + + + + foodLabel + + + Food: + + + + + foodText + + + + + + + + productionLabel + + + Prod: + + + + + productionText + + + + + tradeLabel + + + Trade: + + + + + tradeText + + + + + goldLabel + + + Gold: + + + + + goldText + + + + + luxuryLabel + + + Luxury: + + + + + luxuryText + + + + + scienceLabel + + + Science: + + + + + scienceText + + + + + granaryLabel + + + Granary: + + + + + granaryText + + + + + growthLabel + + + Change in: + + + + + growthText + + + + + corruptionLabel + + + Corruption: + + + + + corruptionText + + + + + wasteLabel + + + Waste: + + + + + wasteText + + + + + pollutionLabel + + + Pollution: + + + + + pollutionText + + + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/cityinfo_impl.cpp freeciv-cvs/client/gui-qpe/classes/cityinfo_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/cityinfo_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/cityinfo_impl.cpp 2004-12-15 07:07:22.000000000 -0500 @@ -0,0 +1,55 @@ +#include + +#include "cityinfo_impl.h" + +extern "C" { +#include "config_hack.h" +#include "citydlg.h" +} + +CityInfo_Impl::CityInfo_Impl( QWidget *parent, const char *name ) + : CityInfo_Base( parent, name ) +{ +} + +void CityInfo_Impl::refreshInfo( struct city *pcity ) +{ + QString str; + + foodText->setText( str.sprintf("%2d (%+2d)", + pcity->prod[O_FOOD], + pcity->surplus[O_FOOD]) ); + productionText->setText( str.sprintf("%2d (%+2d)", + pcity->prod[O_SHIELD] + pcity->waste[O_SHIELD], + pcity->surplus[O_SHIELD]) ); + tradeText->setText( str.sprintf("%2d (%+2d)", + pcity->surplus[O_TRADE] + pcity->waste[O_TRADE], + pcity->surplus[O_TRADE]) ); + goldText->setText( str.sprintf("%2d (%+2d)", + pcity->prod[O_GOLD], + pcity->surplus[O_GOLD]) ); + + luxuryText->setNum(pcity->prod[O_LUXURY]); + scienceText->setNum(pcity->prod[O_SCIENCE]); + corruptionText->setNum(pcity->waste[O_GOLD]); + wasteText->setNum(pcity->waste[O_SHIELD]); + pollutionText->setNum(pcity->pollution); + + granaryText->setText( str.sprintf("%d/%-d", + pcity->food_stock, + city_granary_size(pcity->size)) ); + + int growthTurns = city_turns_to_grow(pcity); + if (growthTurns == 0) + growthText->setText("blocked"); + else if (growthTurns == FC_INFINITY) + growthText->setText("never"); + else + growthText->setText( tr("%1 turn(s)").arg(abs(growthTurns)) ); + + /* Add warning colors here */ + /* granary: -4 <= granaryTurns <= 0 */ + /* growth: granaryTurns == 0 || pcity->surplus[O_FOOD] < 0 */ + /* pollution: pcity->pollution >= 10 */ +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/cityinfo_impl.h freeciv-cvs/client/gui-qpe/classes/cityinfo_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/cityinfo_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/cityinfo_impl.h 2004-12-04 22:35:22.000000000 -0500 @@ -0,0 +1,15 @@ +#ifndef FC__QPE_CITYINFO_IMPL_H +#define FC__QPE_CITYINFO_IMPL_H + +#include "cityinfo_base.h" + +class CityInfo_Impl : public CityInfo_Base +{ + Q_OBJECT + public: + CityInfo_Impl( QWidget *parent = 0, const char *name = 0 ); + void refreshInfo(struct city *); +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/citymapw.cpp freeciv-cvs/client/gui-qpe/classes/citymapw.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/citymapw.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/citymapw.cpp 2004-12-06 10:00:50.000000000 -0500 @@ -0,0 +1,50 @@ +#include "citymapw.h" +#include "canvas.h" + +extern "C" { +#include "config_hack.h" +#include "city.h" +#include "citydlg_common.h" +} + + +CityMapWidget::CityMapWidget( QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ +} + +void CityMapWidget::setCity( struct city *pcity ) +{ + this->pcity = pcity; +} + +void CityMapWidget::paintEvent( QPaintEvent *e ) +{ + bitBlt(this, QPoint(0, 0), &pixmap, e->rect()); +} + +void CityMapWidget::mousePressEvent( QMouseEvent *e ) +{ + int xtile, ytile; + + /* unless cma_is_city_under_agent(pdialog->pcity, NULL) */ + + if ( canvas_to_city_pos(&xtile, &ytile, e->x(), e->y()) ) + city_toggle_worker(pcity, xtile, ytile); +} + +void CityMapWidget::resizeMap( int w, int h ) +{ + if (pixmap.width() != w || pixmap.height() != h) { + pixmap.resize(w, h); + setFixedSize(w, h); + } +} + +void CityMapWidget::redrawMap() +{ + struct canvas store = { &pixmap }; + city_dialog_redraw_map(pcity, &store); + bitBlt(this, 0, 0, &pixmap); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/citymapw.h freeciv-cvs/client/gui-qpe/classes/citymapw.h --- freeciv-cvs.orig/client/gui-qpe/classes/citymapw.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/citymapw.h 2004-12-05 22:19:14.000000000 -0500 @@ -0,0 +1,24 @@ +#ifndef FC__QPE_CITYMAPW_H +#define FC__QPE_CITYMAPW_H + +#include +#include + +class CityMapWidget : public QWidget +{ + Q_OBJECT + public: + CityMapWidget( QWidget *parent = 0, const char *name = 0 ); + void setCity( struct city * ); + void resizeMap( int w, int h ); + void redrawMap(); + protected: + void paintEvent( QPaintEvent * ); + void mousePressEvent (QMouseEvent * ); + private: + struct city *pcity; + QPixmap pixmap; +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/connect_base.ui freeciv-cvs/client/gui-qpe/classes/connect_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/connect_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/connect_base.ui 2004-12-13 06:00:15.000000000 -0500 @@ -0,0 +1,322 @@ + +CivClientConnect_Base + + + CivClientConnect_Base + + + + 0 + 0 + 230 + 180 + + + + FreeCiv Server Connect + + + + unnamed + + + + tabWidget + + + + tab + + + Server Selection + + + + unnamed + + + + userEdit + + + + + textLabel1 + + + Login: + + + + + hostEdit + + + + + textLabel2 + + + Host: + + + + + textLabel3 + + + Port: + + + + + portEdit + + + + + + + tab + + + Metaserver + + + + unnamed + + + + + Server + + + true + + + true + + + + + Port + + + true + + + true + + + + + Version + + + true + + + true + + + + + Status + + + true + + + true + + + + + Players + + + true + + + true + + + + + Comment + + + true + + + true + + + + metaList + + + true + + + + + metaUpdateButton + + + Update + + + + + + + TabPage + + + Local + + + + unnamed + + + + + Server + + + true + + + true + + + + + Port + + + true + + + true + + + + + Version + + + true + + + true + + + + + Status + + + true + + + true + + + + + Players + + + true + + + true + + + + + Comment + + + true + + + true + + + + localList + + + true + + + + + localUpdateButton + + + Update + + + + + + + + + + metaUpdateButton + clicked() + CivClientConnect_Base + metaUpdate() + + + metaList + clicked(QListViewItem*) + CivClientConnect_Base + metaClicked(QListViewItem*) + + + userEdit + returnPressed() + CivClientConnect_Base + accept() + + + hostEdit + returnPressed() + CivClientConnect_Base + accept() + + + portEdit + returnPressed() + CivClientConnect_Base + accept() + + + localList + clicked(QListViewItem*) + CivClientConnect_Base + localClicked(QListViewItem*) + + + localUpdateButton + clicked() + CivClientConnect_Base + localUpdate() + + + + metaUpdate() + metaClicked(QListViewItem*) + localClicked(QListViewItem *) + localUpdate() + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/connect_impl.cpp freeciv-cvs/client/gui-qpe/classes/connect_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/connect_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/connect_impl.cpp 2005-03-06 21:58:10.000000000 -0500 @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "connect_impl.h" +#include "connectdlg.h" + +extern "C" { +#include +#include "config_hack.h" +#include "support.h" +#include "civclient.h" +#include "clinet.h" +} + +CivClientConnect::CivClientConnect( QWidget *parent, const char *name ) + : CivClientConnect_Base( parent, name, TRUE ), localUpdateTimer(NULL) +{ + portEdit->setValidator( new QIntValidator(0, 65535, portEdit) ); + + userEdit->setText(user_name); + hostEdit->setText(server_host); + portEdit->setText(QString::number(server_port)); +} + +void CivClientConnect::accept() +{ + sz_strlcpy(user_name, userEdit->text()); + sz_strlcpy(server_host, hostEdit->text()); + server_port = portEdit->text().toInt(); + + char errbuf[512]; + if ( connect_to_server(user_name, server_host, server_port, + errbuf, sizeof(errbuf)) == -1 ) + { + emit message(tr(errbuf)); + } + + // QDialog::accept(); +} + +void CivClientConnect::reject() +{ + qApp->quit(); +} + +void CivClientConnect::fillServerList( + QListView *listView, + const struct server_list * serverList ) const +{ + if (serverList) + { + server_list_iterate(serverList, pserver) + { + QListViewItem *i = listView->firstChild(); + for ( ; i != NULL; i = i->nextSibling() ) + { + if ( i->text(0) == pserver->host && + i->text(1) == pserver->port ) + break; + } + + if (i) break; + + (void) new QListViewItem( listView, + pserver->host, + pserver->port, + pserver->version, + pserver->state, + pserver->nplayers, + pserver->message ); + } server_list_iterate_end; + } +} + +void CivClientConnect::metaUpdate() +{ + char errbuf[512]; + struct server_list *server_list; + + emit message(tr("Contacting metaserver...")); + + if (!(server_list = create_server_list(errbuf, sizeof(errbuf)))) { + emit message(QString(errbuf)); + return; + } + + emit message(); + + metaList->clear(); + fillServerList(metaList, server_list); +} + +void CivClientConnect::metaClicked( QListViewItem *item ) +{ + if (item) { + hostEdit->setText(item->text(0)); + portEdit->setText(item->text(1)); + } +} + +void CivClientConnect::localUpdateTick() +{ + struct server_list *server_list = get_lan_server_list(); + + fillServerList(localList, server_list); + + localUpdateCount++; + + if (localUpdateCount == 50) + { + finish_lanserver_scan(); + delete localUpdateTimer; + localUpdateTimer = NULL; + localUpdateButton->setEnabled(TRUE); + emit message(); + } +} + +void CivClientConnect::localUpdate() +{ + localUpdateCount = 0; + + if (! localUpdateTimer) + { + localList->clear(); + + emit message(tr("Broadcasting...")); + if ( begin_lanserver_scan() ) + { + localUpdateButton->setEnabled(FALSE); + localUpdateTimer = new QTimer(this); + connect( localUpdateTimer, SIGNAL(timeout()), + SLOT(localUpdateTick()) ); + localUpdateTimer->start(100); + } else + emit message(tr("Unknown error")); + } +} + +void CivClientConnect::localClicked( QListViewItem *item ) +{ + if (item) { + hostEdit->setText(item->text(0)); + portEdit->setText(item->text(1)); + } +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/connect_impl.h freeciv-cvs/client/gui-qpe/classes/connect_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/connect_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/connect_impl.h 2004-12-06 04:51:33.000000000 -0500 @@ -0,0 +1,31 @@ +#ifndef FC__QPE_CONNECT_IMPL_H +#define FC__QPE_CONNECT_IMPL_H + +#include "connect_base.h" + +class QListViewItem; + +class CivClientConnect : public CivClientConnect_Base +{ + Q_OBJECT + public: + CivClientConnect( QWidget *parent = 0, const char *name = 0 ); + signals: + void message(const QString &); + void message(); + protected slots: + void accept(); + void reject(); + void metaUpdate(); + void metaClicked(QListViewItem*); + void localUpdate(); + void localClicked(QListViewItem*); + private: + void fillServerList( QListView *, const struct server_list * ) const; + QTimer *localUpdateTimer; + int localUpdateCount; + private slots: + void localUpdateTick(); +}; + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/intel_base.ui freeciv-cvs/client/gui-qpe/classes/intel_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/intel_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/intel_base.ui 2004-12-12 09:19:49.000000000 -0500 @@ -0,0 +1,178 @@ + +CivClientIntel_Base + + + CivClientIntel_Base + + + + 0 + 0 + 241 + 206 + + + + Foreign Intelligence Report + + + + unnamed + + + + layout56 + + + + unnamed + + + + govText + + + + + rulerText + + + + + govLabel + + + Government: + + + + + rulerLabel + + + Ruler: + + + + + capitalLabel + + + Capital: + + + + + capitalText + + + + + + + layout57 + + + + unnamed + + + + goldLabel + + + Gold: + + + + + goldText + + + + + taxLabel + + + Tax: + + + + + taxText + + + + + scienceLabel + + + Science: + + + + + scienceText + + + + + luxuryLabel + + + Luxury: + + + + + luxuryText + + + + + + + layout58 + + + + unnamed + + + + researchLabel + + + Researching: + + + + + researchText + + + + + + + + Technology + + + true + + + true + + + + technologyList + + + NoSelection + + + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/intel_impl.cpp freeciv-cvs/client/gui-qpe/classes/intel_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/intel_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/intel_impl.cpp 2004-12-21 23:45:04.000000000 -0500 @@ -0,0 +1,71 @@ +#include +#include + +#include "intel_impl.h" + +extern "C" { +#include +#include "config_hack.h" +#include "game.h" +#include "government.h" +#include "player.h" +} + + +CivClientIntel_Impl::CivClientIntel_Impl( QWidget *parent, const char *name ) + : CivClientIntel_Base( parent, name, TRUE ), pplayer(NULL) +{ + rulerText->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, + QSizePolicy::Preferred ) ); + researchText->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, + QSizePolicy::Preferred ) ); +} + +void CivClientIntel_Impl::setupIntel( const struct player *p ) +{ + pplayer = p; + updateIntel(p); +} + +void CivClientIntel_Impl::updateIntel( const struct player *p ) +{ + if (p != pplayer) return; + + setCaption( tr("%1 Empire Intelligence"). + arg( get_nation_name(p->nation) ) ); + + rulerText->setText( tr("%1 %2"). + arg( get_ruler_title( p->government, + p->is_male, + p->nation ) ). + arg(p->name) ); + + printf("%s:%u\n", __FILE__, __LINE__); + govText->setText( get_government_name(p->government) ); + printf("%s:%u\n", __FILE__, __LINE__); + + const struct city *pcity = find_palace(p); + capitalText->setText( pcity ? pcity->name : tr("Unknown") ); + + goldText->setNum( p->economic.gold ); + taxText->setNum( p->economic.tax ); + scienceText->setNum( p->economic.science ); + luxuryText->setNum( p->economic.luxury ); + + researchText->setText( tr("%1 (%2/%3)"). + arg( get_tech_name(p, p->research.researching) ). + arg( p->research.bulbs_researched ). + arg( total_bulbs_required(p) ) ); + + technologyList->clear(); + for ( int i = A_FIRST; i < game.num_tech_types; i++ ) + { + QString tmp(advances[i].name); + + if ( get_invention(game.player_ptr, i) != TECH_KNOWN ) + tmp += "*"; + + (void) new QListViewItem( technologyList, tmp); + } +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/intel_impl.h freeciv-cvs/client/gui-qpe/classes/intel_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/intel_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/intel_impl.h 2004-12-12 09:01:32.000000000 -0500 @@ -0,0 +1,18 @@ +#ifndef FC__QPE_INTEL_IMPL_H +#define FC__QPE_INTEL_IMPL_H + +#include "intel_base.h" + +class CivClientIntel_Impl : public CivClientIntel_Base +{ + Q_OBJECT + public: + CivClientIntel_Impl( QWidget *parent = 0, const char *name = 0 ); + void setupIntel( const struct player * ); + void updateIntel( const struct player * ); + private: + const struct player *pplayer; +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/listview.h freeciv-cvs/client/gui-qpe/classes/listview.h --- freeciv-cvs.orig/client/gui-qpe/classes/listview.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/listview.h 2004-12-18 08:41:52.000000000 -0500 @@ -0,0 +1,167 @@ +#include + +template +class ListViewItem: public QListViewItem +{ +public: + ListViewItem( QListView * parent, T ); + ListViewItem( QListViewItem * parent, T ); + ListViewItem( QListView * parent, T, QListViewItem * after ); + ListViewItem( QListViewItem * parent, T, QListViewItem * after ); + + ListViewItem( QListView * parent, T, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + ListViewItem( QListViewItem * parent, T, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + + ListViewItem( QListView * parent, T, QListViewItem * after, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + ListViewItem( QListViewItem * parent, T, QListViewItem * after, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + + ListViewItem * firstChild() const; + ListViewItem * nextSibling() const; + ListViewItem * parent() const; + + ListViewItem * itemAbove(); + ListViewItem * itemBelow(); + + static ListViewItem * firstSelection( const QListView * ); + ListViewItem * nextSelection() const; + + T data; + +private: + static ListViewItem * firstSelected( const QListViewItem * i ); +}; + + + +template +ListViewItem::ListViewItem( QListView * parent, T t ) + : QListViewItem( parent ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListViewItem * parent, T t ) + : QListViewItem( parent ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListView * parent, T t, + QListViewItem *after ) + : QListViewItem( parent, after ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListViewItem * parent, T t, + QListViewItem *after ) + : QListViewItem( parent, after ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListView * parent, T t, + QString s1, QString s2, QString s3, QString s4, + QString s5, QString s6, QString s7, QString s8 ) + : QListViewItem( parent, s1, s2, s3, s4, s5, s6, s7, s8 ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListViewItem * parent, T t, + QString s1, QString s2, QString s3, QString s4, + QString s5, QString s6, QString s7, QString s8 ) + : QListViewItem( parent, s1, s2, s3, s4, s5, s6, s7, s8 ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListView * parent, T t, + QListViewItem * after, + QString s1, QString s2, QString s3, QString s4, + QString s5, QString s6, QString s7, QString s8 ) + : QListViewItem( parent, after, s1, s2, s3, s4, s5, s6, s7, s8 ), data(t) +{ +} + +template +ListViewItem::ListViewItem( QListViewItem * parent, T t, + QListViewItem * after, + QString s1, QString s2, QString s3, QString s4, + QString s5, QString s6, QString s7, QString s8 ) + : QListViewItem( parent, after, s1, s2, s3, s4, s5, s6, s7, s8 ), data(t) +{ +} + + +template +ListViewItem * ListViewItem::firstChild() const +{ + return (ListViewItem *) QListViewItem::firstChild(); +} + +template +ListViewItem * ListViewItem::nextSibling() const +{ + return (ListViewItem *) QListViewItem::nextSibling(); +} + +template +ListViewItem * ListViewItem::parent() const +{ + return (ListViewItem *) QListViewItem::parent(); +} + +template +ListViewItem * ListViewItem::itemAbove() +{ + return (ListViewItem *) QListViewItem::itemAbove(); +} + +template +ListViewItem * ListViewItem::itemBelow() +{ + return (ListViewItem *) QListViewItem::itemBelow(); +} + + +template +ListViewItem * ListViewItem::firstSelected( const QListViewItem * i ) +{ + for ( ; i != NULL; i = i->nextSibling() ) + { + if (i->isSelected()) + return (ListViewItem *) i; + } + + return NULL; +} + + +template +ListViewItem * ListViewItem::firstSelection( const QListView * list ) +{ + return firstSelected( list->firstChild() ); +} + +template +ListViewItem * ListViewItem::nextSelection() const { + return firstSelected( nextSibling() ); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/listviewunit.cpp freeciv-cvs/client/gui-qpe/classes/listviewunit.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/listviewunit.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/listviewunit.cpp 2004-12-19 06:31:38.000000000 -0500 @@ -0,0 +1,62 @@ +#include "canvas.h" +#include "listviewunit.h" + +extern "C" { +#include +#include "config_hack.h" +#include "city.h" +#include "climisc.h" +#include "game.h" +#include "mapview_common.h" +#include "unit.h" +#include "text.h" +#include "tilespec.h" +} + + +ListViewUnit::ListViewUnit( QListView *parent, struct unit *punit, + bool printLocation ) + : ListViewItem( parent, punit ) +{ + setupUnit(printLocation); +} + +ListViewUnit::ListViewUnit( QListViewItem *parent, struct unit *punit, + bool printLocation ) + : ListViewItem( parent, punit ) +{ + setupUnit(printLocation); +} + +ListViewUnit::ListViewUnit( QListView *parent, const QString &str ) + : ListViewItem( parent, NULL, str ) +{ +} + + +void ListViewUnit::setupUnit( bool printLocation ) +{ + const struct unit *punit = data; + + struct unit_type *ptype = unit_type(punit); + struct city *pcity = player_find_city_by_id( game.player_ptr, + punit->homecity ); + + int pcity_near_dist; + struct city *pcity_near = get_nearest_city( punit, &pcity_near_dist ); + + int i = 0; + setText( i++, ptype->name ); + setText( i++, ptype->veteran[punit->veteran].name ); + setText( i++, unit_activity_text(punit) ); + setText( i++, pcity ? pcity->name : "" ); + if (printLocation) + setText( i++, get_nearest_city_text( + pcity_near, pcity_near_dist ) ); + + QPixmap pixmap( UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT ); + struct canvas store = { &pixmap }; + put_unit( punit, &store, 0, 0 ); + setPixmap(0, pixmap); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/listviewunit.h freeciv-cvs/client/gui-qpe/classes/listviewunit.h --- freeciv-cvs.orig/client/gui-qpe/classes/listviewunit.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/listviewunit.h 2004-12-19 05:33:01.000000000 -0500 @@ -0,0 +1,17 @@ +#include "listview.h" + +extern "C" { +#include "config_hack.h" +} + + +class ListViewUnit : public ListViewItem +{ + public: + ListViewUnit( QListView *parent, struct unit *, bool printLocation ); + ListViewUnit( QListViewItem *parent, struct unit *, bool printLocation ); + ListViewUnit( QListView *parent, const QString & ); + private: + void setupUnit( bool printLocation ); +}; + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/main_base.ui freeciv-cvs/client/gui-qpe/classes/main_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/main_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/main_base.ui 2004-12-22 00:12:55.000000000 -0500 @@ -0,0 +1,1968 @@ + +CivClient_Base + + + CivClient_Base + + + + 0 + 0 + 440 + 554 + + + + Freeciv + + + + unnamed + + + 0 + + + 0 + + + + tabs + + + NoFocus + + + Triangular + + + + tab + + + Map + + + + unnamed + + + 0 + + + 0 + + + + layout98 + + + + unnamed + + + + mapHScrollBar + + + Horizontal + + + + + map + + + StrongFocus + + + + + mapVScrollBar + + + Vertical + + + + + + + chatWidget + + + + unnamed + + + + chatBox + + + + 0 + 100 + + + + + 32767 + 100 + + + + NoFocus + + + NoWrap + + + true + + + + + chatLine + + + + + + + + + citiesTab + + + Cities + + + + unnamed + + + + + Name + + + true + + + true + + + + + Size + + + true + + + true + + + + + State + + + true + + + true + + + + + H/C/U/A + + + true + + + true + + + + + E/S/T + + + true + + + true + + + + + F/P/T + + + true + + + true + + + + + G/L/S + + + true + + + true + + + + + Food + + + true + + + true + + + + + Pollution + + + true + + + true + + + + + Corruption + + + true + + + true + + + + + Building + + + true + + + true + + + + citiesList + + + Multi + + + true + + + + + layout58 + + + + unnamed + + + + citiesSelectButton + + + Select + + + + + citiesChangeButton + + + false + + + Change + + + + + citiesCenterButton + + + Center + + + + + citiesPopupButton + + + Popup + + + + + citiesBuyButton + + + Buy + + + + + citiesRefreshButton + + + Refresh + + + + + + + + + TabPage + + + Units + + + + + TabPage + + + Players + + + + unnamed + + + 0 + + + 0 + + + + + Name + + + true + + + true + + + + + Nation + + + true + + + true + + + + + Team + + + true + + + true + + + + + Dipl. State + + + true + + + true + + + + + State + + + true + + + true + + + + playersList + + + true + + + + + playerBox + + + false + + + + + + + unnamed + + + 0 + + + 0 + + + + layout47 + + + + unnamed + + + 0 + + + 0 + + + + layout46 + + + + unnamed + + + 0 + + + 0 + + + + flagLabel + + + + + borderLabel + + + + + teamLabel + + + Team: + + + + + teamText + + + + + + + groupBox14 + + + Embassy + + + + unnamed + + + 0 + + + 0 + + + + embassyText + + + + + intelButton + + + Intelligence + + + + + meetButton + + + Meet + + + + + + + groupBox12 + + + Dipl. State + + + + unnamed + + + 0 + + + 0 + + + + diploText + + + + + warButton + + + Cancel Treaty + + + + + + + + + layout48 + + + + unnamed + + + 0 + + + 0 + + + + groupBox13 + + + Vision + + + + unnamed + + + 0 + + + 0 + + + + visionText + + + + + visionButton + + + Withdraw + + + + + + + groupBox11 + + + Misc. + + + + unnamed + + + 0 + + + 0 + + + + reputationLabel + + + Reputation: + + + + + loveLabel + + + AI Love + + + + + stateLabel + + + State: + + + + + reputationText + + + + + loveText + + + + + stateText + + + + + hostLabel + + + Host: + + + + + hostText + + + + + idleLabel + + + Idle: + + + + + idleText + + + + + pingLabel + + + Ping: + + + + + pingText + + + + + + + shipButton + + + Spaceship + + + + + + + + + + + economyTab + + + Economy + + + + unnamed + + + + + Building + + + true + + + true + + + + + Qty + + + true + + + true + + + + + Cost + + + true + + + true + + + + + Total + + + true + + + true + + + + economyList + + + + + economyLabel + + + Total Cost: + + + AlignCenter + + + + + layout81 + + + + unnamed + + + + economySellOldButton + + + false + + + Sell Obsolete + + + + + economySellAllButton + + + false + + + Sell All + + + + + + + + + scienceTab + + + Science + + + + unnamed + + + + layout80 + + + + unnamed + + + + scienceProgressLabel + + + + + + + groupBox69 + + + Researching: + + + + unnamed + + + + scienceNextBox + + + + + scienceNextLabel + + + + + + + groupBox70 + + + Goal: + + + + unnamed + + + + scienceGoalBox + + + + + scienceGoalLabel + + + + + + + groupBox71 + + + Already Discovered: + + + + unnamed + + + + sciencePrevList + + + NoSelection + + + FitToWidth + + + true + + + + + + + + + TabPage + + + Wonders + + + + + TabPage + + + Top 5 + + + + + TabPage + + + Demographics + + + + + + + + + toolbar + + + true + + + Toolbar + + + + btnMenu + + + + + + image0 + + + 0 + + + + + + + + + + + + btnAction + + + + + + image1 + + + 0 + + + + + btnSettler + + + + + + image2 + + + 0 + + + + + + + + + MapWidget +
mapw.h
+ + -1 + -1 + + 0 + + 7 + 7 + 0 + 0 + + image3 +
+
+ + + + actPopupMessages + + + false + + + image4 + + + Messages + + + + + actToggleOverview + + + image5 + + + Overview + + + + + actToggleChat + + + true + + + image6 + + + Chat Window + + + + + actCenter + + + image7 + + + Center + + + + + actCity + + + City + + + + + actRoad + + + Road + + + + + actIrrigate + + + Irrigate + + + + + actMine + + + Mine + + + + + actTransform + + + Transform + + + + + actFortress + + + Fortress + + + + + actAirbase + + + Airbase + + + + + actPollution + + + Pollution + + + + + actFallout + + + Fallout + + + + + actSentry + + + Sentry + + + + + actFortify + + + Fortify + + + + + actPillage + + + Pillage + + + + + actHomecity + + + Homecity + + + + + actUnloadAll + + + UnloadAll + + + + + actLoad + + + Load + + + + + actUnload + + + Unload + + + + + actWake + + + Wake Up + + + + + actAuto + + + Auto + + + + + actExplore + + + Explore + + + + + actConnectRoad + + + ConnectRoad + + + + + actConnectRail + + + ConnectRail + + + + + actConnectIrrigate + + + ConnectIrrigate + + + + + actPatrol + + + Patrol + + + + + actGoto + + + Goto + + + + + actAirlift + + + Airlift + + + + + actReturn + + + Return + + + + + actDisband + + + Disband + + + + + actDiplomat + + + Diplomat + + + + + actNuke + + + Nuke + + + + + actWait + + + image8 + + + Wait + + + + + actDone + + + image9 + + + Done + + + + + actWonder + + + Help Wonder + + + + + actTradeRoute + + + Trade Route + + + + + actParadrop + + + Paradrop + + + + + actEndTurn + + + Turn Done + + + + + citiesSelectAll + + + All Cities + + + + + citiesSelectNone + + + No Cities + + + + + citiesSelectInvert + + + Invert Selection + + + + + citiesSelectCoastal + + + Coastal Cities + + + + + citiesSelectContinent + + + Same Continent + + + + + citiesSelectBuildUnit + + + Building Units + + + + + citiesSelectBuildImprovement + + + Building Improvements + + + + + citiesSelectBuildWonder + + + Building Wonders + + + + + actRates + + + Tax Rates + + + + + actRevolution + + + Revolution + + + + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000704944415428916360187480918181819b8181a18a8181819d818181090933a3b1df33303094c33496303030fc278023d16d5a8747f11a6ccee3676060b88d45f14b060606515c7ed2676060f88aa6219850402420295e4a48310ccc66606078c6c0c02044ac060e0606064b6215e305009b44214dc869ba750000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000534944415428916360a002286060607802c505e8922c5834303330304823b1510013160d5f71b0878d066ca1f48a8181e128121b053062d1c08264d01f28c60bca191818fe437139314e7acfc0c07017898d020035df16b37280ea0f0000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000d349444154289175d1b14a43610c05e0cf9656411c4a41c4419cc4d54570161c7d04571fc0b16eae1d3b38f906be847429ed6a291574141d5c14456ba94b2ea4976be0c0ff27e72427a4ae3a56b1850dfc60fe0fcf29ee82b408fc628c1eea99dc29912681ef945f2bc8ad5478c36e6ab48e333c66c17eeaf28e13344b761bf9d3c44b122df08501ba38ac5af818af2551c60d6a79eb275c631ab61a686325ea071815e436b62ba66ea29fa65cd4a2b0877b5c6227093e629722c6c5e3a8e4f7190ff84cb9db644f0b57185a3ed42c72e7e2ca7f32fd420e9b4cef660000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000034349444154388db59531681b6714c77f361a9e40c327b8e10e1ad04102bed045214b947650a18b6807d1a9f5e4180ac5742a4987d0a1c19d42c6e2c1904c9587901812b825600512594bd1195a7c051b3e0d061dd8a06f38f01b04e970965d51db049abee9eeddbbdff77f8ffff77d73bded1ed3b8ddb8fd8e0f10bdeddedcdc141cbf8cdfb5165a242e413261900fde0be29cc3ee59fabff76172962f4d95f65ef4082a1653f7b1aecf722560e42ca11762734b6842cab90513b27b54bcdbdc125642ba892558179ebfd659304062134cd3a73ffc95f1d892a2448112ff216407c2f3230584aa07cdbad277e057a09b417405e260b69353b0a8605d1f83658c230a84f88d61f8d211ef3860aa4678b6202c2f19a843e429d641e4437c1e78703060b9a26cd902dad984ce5a56a02a42b86090128c0e94e15fca4f3f66b4be367cb324449e12bb0b14872664e452a200e2377202559a5ff8b4dac28d6b6055f125a0b3714c673d23dec8b8b550433eaf129a59f2fcf4c13a4be8417a287437dd2974f15be146e4b0ea3087c2e327635696cadcf9de0784476b8eea046c7e89629ba7947321fdd3618ca1d51642cf6173f031dc7da8a43b8ef121ac3ea8d27f55d4c67d43e4cd8267151b18ec2ba004b593f6a7d07b8e74c7613ce1ab4f8511c7447501603454ac93f3c1854f2134454124c54c8d1aeede53d29d624111e0a332910f94a63021bc4c31065ca928dc3a507ca9d2d9a4506a04df3764078ed5fb23e26e95d15e61c1a056c65ee68adda394665d79765518ee2b9d8d6356bebbcef85059fc52d04a99d5fb900d1dbfac585415e309f5fa3192eb0cf85f33ce26d06a1b003aeb19bf3ddd65f5411553876673cc0f3f8718dfe09c4327ca676d9fc64d2e576c5d8a5f814613cab9e1d15ac6e38719fd5742eb96d05118ed8dd0233dfd73d0756cbd0d883ce16c77fef3ac1826b40c74f78b6d4a5bb82335e2a7851bd29d3335c6135aed1adb5d8753c5178887b3a33805db3d4b3781da95a2add0535a6d61b1dd20eeef22aec8373ebe8eb9b64be326c46f036a1232cc07a4c92c78aeb7dd2b0ef812d43f118280c2529393654b20274e399301a04849700ed24419658acbce51cc0492d74ac245a1ef992b62fec22fff31e6a1b8a3fe17f08786f7b67b737f03c543883fa410a41f0000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000a3494441542891b5d1cf0a01511cc5f18f92227f5212b390853d0f676961ef493c8307b0b193b505cd4691854889853b354d330b0ba76ef777ea9ecef7d7e54795c21da182039a68e5bc7d224ecc166ff4b00873f66ca11c0233b471c512bb9c864b3a10e31610cf38e604ee69b30eb523cc0b90f6e9a5c76860832e06390d0f6c12a40efa81bd8e61512031ab503bc1b400e994468a50f3fd876a68ccea95ecf15f7d0074ef2d5df010f8660000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce70000017749444154289165913f48947118c73faf4bdfc1e1351c0e3448b8a17311c141a1e5c4c1e5201b1a4e976c8a40904310528728a4e186a08620b7fc83c31bbd865b5b8deaa0435058501c0e821072fcd0836fc37b7677f8c0030f3c9fe7cff779223acc7dda673afce819e2c1998123dd652b7c897e7572afc620a5c24239a0ba99b4c1a6df66be7c216b8917c5a85590aa22e74c8a9536616caa639665de142cc7cb0011896ef1bbf09d3f851b52201c8cc3a72700a83a4e887fa2d913c2071a9ad220b21649b1fe0e9b91cfadeed8e4f7ac5add4cbc37399bedf819a46ca85aec04db3d776cbd2c9ac9d796f511599b24b276dba06e5bf92cd63d67da2c932aed0a3be1505310ce7b60a47984d27342e91100e1741d9544982ba31247c8f1006b850bd58ae6ced76cc2c3a759c7d856ce66f9be65354834985dc35a623b36bd57626d26defd5f510b659368b5f587b7b723592b3cae5c5e133dea06895655ab77657f68b75ee7396506186ae60ee93e5be7fce6b72be41f1db0d1e467b5b1260000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000e04944415428919591bd6ac26014861f34e037082698c2770d4e75f34b473b97e215b401af429c3a15712c4510c1a59d2b5dbb14bc8182aba342c1804b1421391d1aa1d5c49f677c799f170e07ce249f92e5000d9480151067c915e0a57a595dfaf7be4c875331351362f10e5ced96eb4aa95066b2c7f8732cdad51170f7579804a360bf9dd0eff50558026a2b2c3add4ea620df22c92de55c220c9c6707e6e9c779371ec01bb0d86616f0a85dbd6eb55bffc64dcd08f00a14d3c62e8066e3b621b211b15d3b069e92c14c6ca55484c517707da808bf0ffb001e80c2b1f249fc00697b8a127b967fe60000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000c44944415428918dd1bf4ac2711405f00f260e0da120d218084ee2eed2abf82c3d406bd003040d896b5b434b0435050e89b4052e11450915b91c7fa07c830e5cb8ff0edc732e658c715d1ad40abd2e7a3848fe271a38c5173eb1c45b7a8d12e10433f4718529dab8ccac420f87f8c628845bcc930ff19a9d3e3ce2f7bfb113614bece3020fe8e00793d44ddce3667d5627a441eab506d8c553762a5b1738c6b94d2bf77096586cbb54c35104bee303cfe995fe55a185bb9cd1da1ed60b8497086c27dfc00abe2f357880437f470000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000bd494441542891b5d03b6a02611405e06f1c0b0976421a576023a902925401f712c802d2dbcc4a2c23960382609b8d881003161212c8a3c81918c426452efc1cee39ff7d9ccb7f47894ede39fe3b7911ae802ac22ce2105fe146e11e93571dac424e82d3a613ee82b7c115f470c42163e7f8c0279eb2da3e7f7acdce75465e61870d9ef18271b45acb6cb3d63d2e93d718e0e1e40fad2eefc16bdc9c70e37641816d847dbc74f11a6edb1ca26c155dc4ec126bbfa7ede30d8bf8fa7bfc000c212e5595aa26f50000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000c14944415428918dd0314a43511085e1ef3d0812431aabd8a50a8890de52218da54b889ddbb014520521b516165a08ea022462676548a56b100b11528c8579702337f80e0cc30ce71fcebd855535304099eca6f890d1e60ef767c48c1813efc421cf68ff356f9df21444ae8e7844ab326fecf3fab5c65cd51eb796599bdbec367321131dd3af805a7a58f612be6b00072950473709f0f9c2e57fc09c8b742e3b4c72bf3323ba9ce78e141d4677c409714d0c7fcd5769f42203f6acbeed0d8b6af801c6224969b0ddeac10000000049454e44ae426082 + + + + + actAirbase + activated() + CivClient_Base + cmdAirbase() + + + actAirlift + activated() + CivClient_Base + cmdAirlift() + + + actAuto + activated() + CivClient_Base + cmdAuto() + + + actCenter + activated() + CivClient_Base + cmdCenter() + + + actCity + activated() + CivClient_Base + cmdCity() + + + actConnectIrrigate + activated() + CivClient_Base + cmdConnectIrrigate() + + + actConnectRail + activated() + CivClient_Base + cmdConnectRail() + + + actConnectRoad + activated() + CivClient_Base + cmdConnectRoad() + + + actDiplomat + activated() + CivClient_Base + cmdDiplomat() + + + actDisband + activated() + CivClient_Base + cmdDisband() + + + actDone + activated() + CivClient_Base + cmdDone() + + + actEndTurn + activated() + CivClient_Base + endTurn() + + + actExplore + activated() + CivClient_Base + cmdExplore() + + + actFallout + activated() + CivClient_Base + cmdFallout() + + + actFortify + activated() + CivClient_Base + cmdFortify() + + + actFortress + activated() + CivClient_Base + cmdFortress() + + + actGoto + activated() + CivClient_Base + cmdGoto() + + + actHomecity + activated() + CivClient_Base + cmdHomecity() + + + actIrrigate + activated() + CivClient_Base + cmdIrrigate() + + + actLoad + activated() + CivClient_Base + cmdLoad() + + + actMine + activated() + CivClient_Base + cmdMine() + + + actNuke + activated() + CivClient_Base + cmdNuke() + + + actParadrop + activated() + CivClient_Base + cmdParadrop() + + + actPatrol + activated() + CivClient_Base + cmdPatrol() + + + actPillage + activated() + CivClient_Base + cmdPillage() + + + actPollution + activated() + CivClient_Base + cmdPollution() + + + actReturn + activated() + CivClient_Base + cmdReturn() + + + actRoad + activated() + CivClient_Base + cmdRoad() + + + actSentry + activated() + CivClient_Base + cmdSentry() + + + actToggleChat + toggled(bool) + CivClient_Base + toggleChat(bool) + + + actToggleOverview + activated() + CivClient_Base + toggleOverview() + + + actTradeRoute + activated() + CivClient_Base + cmdTradeRoute() + + + actTransform + activated() + CivClient_Base + cmdTransform() + + + actUnload + activated() + CivClient_Base + cmdUnload() + + + actUnloadAll + activated() + CivClient_Base + cmdUnloadAll() + + + actWait + activated() + CivClient_Base + cmdWait() + + + actWake + activated() + CivClient_Base + cmdWake() + + + actWonder + activated() + CivClient_Base + cmdWonder() + + + chatLine + returnPressed() + CivClient_Base + sendCmd() + + + citiesBuyButton + clicked() + CivClient_Base + citiesBuyClicked() + + + citiesCenterButton + clicked() + CivClient_Base + citiesCenterClicked() + + + citiesList + selectionChanged() + CivClient_Base + citiesListChanged() + + + intelButton + clicked() + CivClient_Base + intelClicked() + + + mapHScrollBar + valueChanged(int) + CivClient_Base + hScrollBarMoved(int) + + + mapVScrollBar + valueChanged(int) + CivClient_Base + vScrollBarMoved(int) + + + meetButton + clicked() + CivClient_Base + meetClicked() + + + playersList + selectionChanged(QListViewItem*) + CivClient_Base + playerSelected(QListViewItem*) + + + visionButton + clicked() + CivClient_Base + visionClicked() + + + warButton + clicked() + CivClient_Base + warClicked() + + + citiesPopupButton + clicked() + CivClient_Base + citiesPopupClicked() + + + citiesRefreshButton + clicked() + CivClient_Base + citiesRefreshClicked() + + + citiesSelectAll + activated() + CivClient_Base + citiesSelectedAll() + + + citiesSelectInvert + activated() + CivClient_Base + citiesSelectedInvert() + + + citiesSelectNone + activated() + CivClient_Base + citiesSelectedNone() + + + citiesSelectCoastal + activated() + CivClient_Base + citiesSelectedCoastal() + + + citiesSelectContinent + activated() + CivClient_Base + citiesSelectedContinent() + + + citiesSelectBuildImprovement + activated() + CivClient_Base + citiesSelectedBuildImprovement() + + + citiesSelectBuildUnit + activated() + CivClient_Base + citiesSelectedBuildUnit() + + + citiesSelectBuildWonder + activated() + CivClient_Base + citiesSelectedBuildWonder() + + + actRates + activated() + CivClient_Base + popupRates() + + + actRevolution + activated() + CivClient_Base + popupRevolution() + + + scienceNextBox + activated(int) + CivClient_Base + scienceNextChanged(int) + + + scienceGoalBox + activated(int) + CivClient_Base + scienceGoalChanged(int) + + + economyList + selectionChanged(QListViewItem*) + CivClient_Base + economyListSelected(QListViewItem*) + + + economySellOldButton + clicked() + CivClient_Base + economySellOld() + + + economySellAllButton + clicked() + CivClient_Base + economySellAll() + + + + uic_fixes.h + + + toggleChat(bool) + toggleOverview() + cmdCity() + cmdRoad() + cmdIrrigate() + cmdMine() + cmdTransform() + cmdFortress() + cmdAirbase() + cmdPollution() + cmdFallout() + cmdSentry() + cmdFortify() + cmdPillage() + cmdHomecity() + cmdUnloadAll() + cmdLoad() + cmdUnload() + cmdWake() + cmdAuto() + cmdExplore() + cmdConnectRoad() + cmdConnectRail() + cmdConnectIrrigate() + cmdPatrol() + cmdGoto() + cmdAirlift() + cmdReturn() + cmdDisband() + cmdDiplomat() + cmdNuke() + cmdWait() + cmdDone() + cmdWonder() + cmdTradeRoute() + cmdParadrop() + cmdCenter() + sendCmd() + hScrollBarMoved(int) + vScrollBarMoved(int) + playerSelected(QListViewItem *) + meetClicked() + warClicked() + visionClicked() + intelClicked() + endTurn() + citiesBuyClicked() + citiesListChanged() + citiesCenterClicked() + citiesRefreshClicked() + citiesPopupClicked() + citiesSelectedAll() + citiesSelectedNone() + citiesSelectedInvert() + citiesSelectedCoastal() + citiesSelectedContinent() + citiesSelectedBuildUnit() + citiesSelectedBuildImprovement() + citiesSelectedBuildWonder() + popupRates() + popupRevolution() + scienceNextChanged(int) + scienceGoalChanged(int) + economyListSelected(QListViewItem *) + economySellOld() + economySellAll() + + + + mapwidget.h + +
diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/main_base.ui~ freeciv-cvs/client/gui-qpe/classes/main_base.ui~ --- freeciv-cvs.orig/client/gui-qpe/classes/main_base.ui~ 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/main_base.ui~ 2004-12-22 00:12:55.000000000 -0500 @@ -0,0 +1,1954 @@ + +CivClient_Base + + + CivClient_Base + + + + 0 + 0 + 440 + 554 + + + + Freeciv + + + + unnamed + + + 0 + + + 0 + + + + tabs + + + NoFocus + + + Triangular + + + + tab + + + Map + + + + unnamed + + + 0 + + + 0 + + + + layout98 + + + + unnamed + + + + mapHScrollBar + + + Horizontal + + + + + map + + + StrongFocus + + + + + mapVScrollBar + + + Vertical + + + + + + + chatWidget + + + + unnamed + + + + chatBox + + + + 0 + 100 + + + + + 32767 + 100 + + + + NoFocus + + + NoWrap + + + true + + + + + chatLine + + + + + + + + + citiesTab + + + Cities + + + + unnamed + + + + + Name + + + true + + + true + + + + + Size + + + true + + + true + + + + + State + + + true + + + true + + + + + H/C/U/A + + + true + + + true + + + + + E/S/T + + + true + + + true + + + + + F/P/T + + + true + + + true + + + + + G/L/S + + + true + + + true + + + + + Food + + + true + + + true + + + + + Pollution + + + true + + + true + + + + + Corruption + + + true + + + true + + + + + Building + + + true + + + true + + + + citiesList + + + Multi + + + true + + + + + layout58 + + + + unnamed + + + + citiesSelectButton + + + Select + + + + + citiesChangeButton + + + false + + + Change + + + + + citiesCenterButton + + + Center + + + + + citiesPopupButton + + + Popup + + + + + citiesBuyButton + + + Buy + + + + + citiesRefreshButton + + + Refresh + + + + + + + + + TabPage + + + Units + + + + + TabPage + + + Players + + + + unnamed + + + 0 + + + 0 + + + + + Name + + + true + + + true + + + + + Nation + + + true + + + true + + + + + Team + + + true + + + true + + + + + Dipl. State + + + true + + + true + + + + + State + + + true + + + true + + + + playersList + + + true + + + + + playerBox + + + false + + + + + + + unnamed + + + 0 + + + 0 + + + + layout47 + + + + unnamed + + + 0 + + + 0 + + + + layout46 + + + + unnamed + + + 0 + + + 0 + + + + flagLabel + + + + + borderLabel + + + + + teamLabel + + + Team: + + + + + teamText + + + + + + + groupBox14 + + + Embassy + + + + unnamed + + + 0 + + + 0 + + + + embassyText + + + + + intelButton + + + Intelligence + + + + + meetButton + + + Meet + + + + + + + groupBox12 + + + Dipl. State + + + + unnamed + + + 0 + + + 0 + + + + diploText + + + + + warButton + + + Cancel Treaty + + + + + + + + + layout48 + + + + unnamed + + + 0 + + + 0 + + + + groupBox13 + + + Vision + + + + unnamed + + + 0 + + + 0 + + + + visionText + + + + + visionButton + + + Withdraw + + + + + + + groupBox11 + + + Misc. + + + + unnamed + + + 0 + + + 0 + + + + reputationLabel + + + Reputation: + + + + + loveLabel + + + AI Love + + + + + stateLabel + + + State: + + + + + reputationText + + + + + loveText + + + + + stateText + + + + + hostLabel + + + Host: + + + + + hostText + + + + + idleLabel + + + Idle: + + + + + idleText + + + + + pingLabel + + + Ping: + + + + + pingText + + + + + + + shipButton + + + Spaceship + + + + + + + + + + + economyTab + + + Economy + + + + unnamed + + + + + Building + + + true + + + true + + + + + Qty + + + true + + + true + + + + + Cost + + + true + + + true + + + + + Total + + + true + + + true + + + + economyList + + + + + economyLabel + + + Total Cost: + + + AlignCenter + + + + + layout81 + + + + unnamed + + + + economySellOldButton + + + false + + + Sell Obsolete + + + + + economySellAllButton + + + false + + + Sell All + + + + + + + + + scienceTab + + + Science + + + + unnamed + + + + layout80 + + + + unnamed + + + + scienceProgressLabel + + + + + + + groupBox69 + + + Researching: + + + + unnamed + + + + scienceNextBox + + + + + scienceNextLabel + + + + + + + groupBox70 + + + Goal: + + + + unnamed + + + + scienceGoalBox + + + + + scienceGoalLabel + + + + + + + groupBox71 + + + Already Discovered: + + + + unnamed + + + + sciencePrevList + + + NoSelection + + + FitToWidth + + + true + + + + + + + + + TabPage + + + Wonders + + + + + TabPage + + + Top 5 + + + + + TabPage + + + Demographics + + + + + + + + + toolbar + + + true + + + Toolbar + + + + btnMenu + + + + + + image0 + + + 0 + + + + + + + + + + + + btnAction + + + + + + image1 + + + 0 + + + + + btnSettler + + + + + + image2 + + + 0 + + + + + + + + + MapWidget +
mapw.h
+ + -1 + -1 + + 0 + + 7 + 7 + 0 + 0 + + image3 +
+
+ + + + actPopupMessages + + + false + + + image4 + + + Messages + + + + + actToggleOverview + + + image5 + + + Overview + + + + + actToggleChat + + + true + + + image6 + + + Chat Window + + + + + actCenter + + + image7 + + + Center + + + + + actCity + + + City + + + + + actRoad + + + Road + + + + + actIrrigate + + + Irrigate + + + + + actMine + + + Mine + + + + + actTransform + + + Transform + + + + + actFortress + + + Fortress + + + + + actAirbase + + + Airbase + + + + + actPollution + + + Pollution + + + + + actFallout + + + Fallout + + + + + actSentry + + + Sentry + + + + + actFortify + + + Fortify + + + + + actPillage + + + Pillage + + + + + actHomecity + + + Homecity + + + + + actUnloadAll + + + UnloadAll + + + + + actLoad + + + Load + + + + + actUnload + + + Unload + + + + + actWake + + + Wake Up + + + + + actAuto + + + Auto + + + + + actExplore + + + Explore + + + + + actConnectRoad + + + ConnectRoad + + + + + actConnectRail + + + ConnectRail + + + + + actConnectIrrigate + + + ConnectIrrigate + + + + + actPatrol + + + Patrol + + + + + actGoto + + + Goto + + + + + actAirlift + + + Airlift + + + + + actReturn + + + Return + + + + + actDisband + + + Disband + + + + + actDiplomat + + + Diplomat + + + + + actNuke + + + Nuke + + + + + actWait + + + image8 + + + Wait + + + + + actDone + + + image9 + + + Done + + + + + actWonder + + + Help Wonder + + + + + actTradeRoute + + + Trade Route + + + + + actParadrop + + + Paradrop + + + + + actEndTurn + + + Turn Done + + + + + citiesSelectAll + + + All Cities + + + + + citiesSelectNone + + + No Cities + + + + + citiesSelectInvert + + + Invert Selection + + + + + citiesSelectCoastal + + + Coastal Cities + + + + + citiesSelectContinent + + + Same Continent + + + + + citiesSelectBuildUnit + + + Building Units + + + + + citiesSelectBuildImprovement + + + Building Improvements + + + + + citiesSelectBuildWonder + + + Building Wonders + + + + + actRates + + + Tax Rates + + + + + actRevolution + + + Revolution + + + + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000704944415428916360187480918181819b8181a18a8181819d818181090933a3b1df33303094c33496303030fc278023d16d5a8747f11a6ccee3676060b88d45f14b060606515c7ed2676060f88aa6219850402420295e4a48310ccc66606078c6c0c02044ac060e0606064b6215e305009b44214dc869ba750000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000534944415428916360a002286060607802c505e8922c5834303330304823b1510013160d5f71b0878d066ca1f48a8181e128121b053062d1c08264d01f28c60bca191818fe437139314e7acfc0c07017898d020035df16b37280ea0f0000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000d349444154289175d1b14a43610c05e0cf9656411c4a41c4419cc4d54570161c7d04571fc0b16eae1d3b38f906be847429ed6a291574141d5c14456ba94b2ea4976be0c0ff27e72427a4ae3a56b1850dfc60fe0fcf29ee82b408fc628c1eea99dc29912681ef945f2bc8ad5478c36e6ab48e333c66c17eeaf28e13344b761bf9d3c44b122df08501ba38ac5af818af2551c60d6a79eb275c631ab61a686325ea071815e436b62ba66ea29fa65cd4a2b0877b5c6227093e629722c6c5e3a8e4f7190ff84cb9db644f0b57185a3ed42c72e7e2ca7f32fd420e9b4cef660000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000034349444154388db59531681b6714c77f361a9e40c327b8e10e1ad04102bed045214b947650a18b6807d1a9f5e4180ac5742a4987d0a1c19d42c6e2c1904c9587901812b825600512594bd1195a7c051b3e0d061dd8a06f38f01b04e970965d51db049abee9eeddbbdff77f8ffff77d73bded1ed3b8ddb8fd8e0f10bdeddedcdc141cbf8cdfb5165a242e413261900fde0be29cc3ee59fabff76172962f4d95f65ef4082a1653f7b1aecf722560e42ca11762734b6842cab90513b27b54bcdbdc125642ba892558179ebfd659304062134cd3a73ffc95f1d892a2448112ff216407c2f3230584aa07cdbad277e057a09b417405e260b69353b0a8605d1f83658c230a84f88d61f8d211ef3860aa4678b6202c2f19a843e429d641e4437c1e78703060b9a26cd902dad984ce5a56a02a42b86090128c0e94e15fca4f3f66b4be367cb324449e12bb0b14872664e452a200e2377202559a5ff8b4dac28d6b6055f125a0b3714c673d23dec8b8b550433eaf129a59f2fcf4c13a4be8417a287437dd2974f15be146e4b0ea3087c2e327635696cadcf9de0784476b8eea046c7e89629ba7947321fdd3618ca1d51642cf6173f031dc7da8a43b8ef121ac3ea8d27f55d4c67d43e4cd8267151b18ec2ba004b593f6a7d07b8e74c7613ce1ab4f8511c7447501603454ac93f3c1854f2134454124c54c8d1aeede53d29d624111e0a332910f94a63021bc4c31065ca928dc3a507ca9d2d9a4506a04df3764078ed5fb23e26e95d15e61c1a056c65ee68adda394665d79765518ee2b9d8d6356bebbcef85059fc52d04a99d5fb900d1dbfac585415e309f5fa3192eb0cf85f33ce26d06a1b003aeb19bf3ddd65f5411553876673cc0f3f8718dfe09c4327ca676d9fc64d2e576c5d8a5f814613cab9e1d15ac6e38719fd5742eb96d05118ed8dd0233dfd73d0756cbd0d883ce16c77fef3ac1826b40c74f78b6d4a5bb82335e2a7851bd29d3335c6135aed1adb5d8753c5178887b3a33805db3d4b3781da95a2add0535a6d61b1dd20eeef22aec8373ebe8eb9b64be326c46f036a1232cc07a4c92c78aeb7dd2b0ef812d43f118280c2529393654b20274e399301a04849700ed24419658acbce51cc0492d74ac245a1ef992b62fec22fff31e6a1b8a3fe17f08786f7b67b737f03c543883fa410a41f0000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000a3494441542891b5d1cf0a01511cc5f18f92227f5212b390853d0f676961ef493c8307b0b193b505cd4691854889853b354d330b0ba76ef777ea9ecef7d7e54795c21da182039a68e5bc7d224ecc166ff4b00873f66ca11c0233b471c512bb9c864b3a10e31610cf38e604ee69b30eb523cc0b90f6e9a5c76860832e06390d0f6c12a40efa81bd8e61512031ab503bc1b400e994468a50f3fd876a68ccea95ecf15f7d0074ef2d5df010f8660000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce70000017749444154289165913f48947118c73faf4bdfc1e1351c0e3448b8a17311c141a1e5c4c1e5201b1a4e976c8a40904310528728a4e186a08620b7fc83c31bbd865b5b8deaa0435058501c0e821072fcd0836fc37b7677f8c0030f3c9fe7cff779223acc7dda673afce819e2c1998123dd652b7c897e7572afc620a5c24239a0ba99b4c1a6df66be7c216b8917c5a85590aa22e74c8a9536616caa639665de142cc7cb0011896ef1bbf09d3f851b52201c8cc3a72700a83a4e887fa2d913c2071a9ad220b21649b1fe0e9b91cfadeed8e4f7ac5add4cbc37399bedf819a46ca85aec04db3d776cbd2c9ac9d796f511599b24b276dba06e5bf92cd63d67da2c932aed0a3be1505310ce7b60a47984d27342e91100e1741d9544982ba31247c8f1006b850bd58ae6ced76cc2c3a759c7d856ce66f9be65354834985dc35a623b36bd57626d26defd5f510b659368b5f587b7b723592b3cae5c5e133dea06895655ab77657f68b75ee7396506186ae60ee93e5be7fce6b72be41f1db0d1e467b5b1260000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000e04944415428919591bd6ac26014861f34e037082698c2770d4e75f34b473b97e215b401af429c3a15712c4510c1a59d2b5dbb14bc8182aba342c1804b1421391d1aa1d5c49f677c799f170e07ce249f92e5000d9480151067c915e0a57a595dfaf7be4c875331351362f10e5ced96eb4aa95066b2c7f8732cdad51170f7579804a360bf9dd0eff50558026a2b2c3add4ea620df22c92de55c220c9c6707e6e9c779371ec01bb0d86616f0a85dbd6eb55bffc64dcd08f00a14d3c62e8066e3b621b211b15d3b069e92c14c6ca55484c517707da808bf0ffb001e80c2b1f249fc00697b8a127b967fe60000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000c44944415428918dd1bf4ac2711405f00f260e0da120d218084ee2eed2abf82c3d406bd003040d896b5b434b0435050e89b4052e11450915b91c7fa07c830e5cb8ff0edc732e658c715d1ad40abd2e7a3848fe271a38c5173eb1c45b7a8d12e10433f4718529dab8ccac420f87f8c628845bcc930ff19a9d3e3ce2f7bfb113614bece3020fe8e00793d44ddce3667d5627a441eab506d8c553762a5b1738c6b94d2bf77096586cbb54c35104bee303cfe995fe55a185bb9cd1da1ed60b8497086c27dfc00abe2f357880437f470000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000bd494441542891b5d03b6a02611405e06f1c0b0976421a576023a902925401f712c802d2dbcc4a2c23960382609b8d881003161212c8a3c81918c426452efc1cee39ff7d9ccb7f47894ede39fe3b7911ae802ac22ce2105fe146e11e93571dac424e82d3a613ee82b7c115f470c42163e7f8c0279eb2da3e7f7acdce75465e61870d9ef18271b45acb6cb3d63d2e93d718e0e1e40fad2eefc16bdc9c70e37641816d847dbc74f11a6edb1ca26c155dc4ec126bbfa7ede30d8bf8fa7bfc000c212e5595aa26f50000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d494844520000000c0000000c080600000056755ce7000000c14944415428918dd0314a43511085e1ef3d0812431aabd8a50a8890de52218da54b889ddbb014520521b516165a08ea022462676548a56b100b11528c8579702337f80e0cc30ce71fcebd855535304099eca6f890d1e60ef767c48c1813efc421cf68ff356f9df21444ae8e7844ab326fecf3fab5c65cd51eb796599bdbec367321131dd3af805a7a58f612be6b00072950473709f0f9c2e57fc09c8b742e3b4c72bf3323ba9ce78e141d4677c409714d0c7fcd5769f42203f6acbeed0d8b6af801c6224969b0ddeac10000000049454e44ae426082 + + + + + actAirbase + activated() + CivClient_Base + cmdAirbase() + + + actAirlift + activated() + CivClient_Base + cmdAirlift() + + + actAuto + activated() + CivClient_Base + cmdAuto() + + + actCenter + activated() + CivClient_Base + cmdCenter() + + + actCity + activated() + CivClient_Base + cmdCity() + + + actConnectIrrigate + activated() + CivClient_Base + cmdConnectIrrigate() + + + actConnectRail + activated() + CivClient_Base + cmdConnectRail() + + + actConnectRoad + activated() + CivClient_Base + cmdConnectRoad() + + + actDiplomat + activated() + CivClient_Base + cmdDiplomat() + + + actDisband + activated() + CivClient_Base + cmdDisband() + + + actDone + activated() + CivClient_Base + cmdDone() + + + actEndTurn + activated() + CivClient_Base + endTurn() + + + actExplore + activated() + CivClient_Base + cmdExplore() + + + actFallout + activated() + CivClient_Base + cmdFallout() + + + actFortify + activated() + CivClient_Base + cmdFortify() + + + actFortress + activated() + CivClient_Base + cmdFortress() + + + actGoto + activated() + CivClient_Base + cmdGoto() + + + actHomecity + activated() + CivClient_Base + cmdHomecity() + + + actIrrigate + activated() + CivClient_Base + cmdIrrigate() + + + actLoad + activated() + CivClient_Base + cmdLoad() + + + actMine + activated() + CivClient_Base + cmdMine() + + + actNuke + activated() + CivClient_Base + cmdNuke() + + + actParadrop + activated() + CivClient_Base + cmdParadrop() + + + actPatrol + activated() + CivClient_Base + cmdPatrol() + + + actPillage + activated() + CivClient_Base + cmdPillage() + + + actPollution + activated() + CivClient_Base + cmdPollution() + + + actReturn + activated() + CivClient_Base + cmdReturn() + + + actRoad + activated() + CivClient_Base + cmdRoad() + + + actSentry + activated() + CivClient_Base + cmdSentry() + + + actToggleChat + toggled(bool) + CivClient_Base + toggleChat(bool) + + + actToggleOverview + activated() + CivClient_Base + toggleOverview() + + + actTradeRoute + activated() + CivClient_Base + cmdTradeRoute() + + + actTransform + activated() + CivClient_Base + cmdTransform() + + + actUnload + activated() + CivClient_Base + cmdUnload() + + + actUnloadAll + activated() + CivClient_Base + cmdUnloadAll() + + + actWait + activated() + CivClient_Base + cmdWait() + + + actWake + activated() + CivClient_Base + cmdWake() + + + actWonder + activated() + CivClient_Base + cmdWonder() + + + chatLine + returnPressed() + CivClient_Base + sendCmd() + + + citiesBuyButton + clicked() + CivClient_Base + citiesBuyClicked() + + + citiesCenterButton + clicked() + CivClient_Base + citiesCenterClicked() + + + citiesList + selectionChanged() + CivClient_Base + citiesListChanged() + + + intelButton + clicked() + CivClient_Base + intelClicked() + + + mapHScrollBar + valueChanged(int) + CivClient_Base + hScrollBarMoved(int) + + + mapVScrollBar + valueChanged(int) + CivClient_Base + vScrollBarMoved(int) + + + meetButton + clicked() + CivClient_Base + meetClicked() + + + playersList + selectionChanged(QListViewItem*) + CivClient_Base + playerSelected(QListViewItem*) + + + visionButton + clicked() + CivClient_Base + visionClicked() + + + warButton + clicked() + CivClient_Base + warClicked() + + + citiesPopupButton + clicked() + CivClient_Base + citiesPopupClicked() + + + citiesRefreshButton + clicked() + CivClient_Base + citiesRefreshClicked() + + + citiesSelectAll + activated() + CivClient_Base + citiesSelectedAll() + + + citiesSelectInvert + activated() + CivClient_Base + citiesSelectedInvert() + + + citiesSelectNone + activated() + CivClient_Base + citiesSelectedNone() + + + citiesSelectCoastal + activated() + CivClient_Base + citiesSelectedCoastal() + + + citiesSelectContinent + activated() + CivClient_Base + citiesSelectedContinent() + + + citiesSelectBuildImprovement + activated() + CivClient_Base + citiesSelectedBuildImprovement() + + + citiesSelectBuildUnit + activated() + CivClient_Base + citiesSelectedBuildUnit() + + + citiesSelectBuildWonder + activated() + CivClient_Base + citiesSelectedBuildWonder() + + + actRates + activated() + CivClient_Base + popupRates() + + + actRevolution + activated() + CivClient_Base + popupRevolution() + + + scienceNextBox + activated(int) + CivClient_Base + scienceNextChanged(int) + + + scienceGoalBox + activated(int) + CivClient_Base + scienceGoalChanged(int) + + + economyList + selectionChanged(QListViewItem*) + CivClient_Base + economyListSelected(QListViewItem*) + + + + uic_fixes.h + + + toggleChat(bool) + toggleOverview() + cmdCity() + cmdRoad() + cmdIrrigate() + cmdMine() + cmdTransform() + cmdFortress() + cmdAirbase() + cmdPollution() + cmdFallout() + cmdSentry() + cmdFortify() + cmdPillage() + cmdHomecity() + cmdUnloadAll() + cmdLoad() + cmdUnload() + cmdWake() + cmdAuto() + cmdExplore() + cmdConnectRoad() + cmdConnectRail() + cmdConnectIrrigate() + cmdPatrol() + cmdGoto() + cmdAirlift() + cmdReturn() + cmdDisband() + cmdDiplomat() + cmdNuke() + cmdWait() + cmdDone() + cmdWonder() + cmdTradeRoute() + cmdParadrop() + cmdCenter() + sendCmd() + hScrollBarMoved(int) + vScrollBarMoved(int) + playerSelected(QListViewItem *) + meetClicked() + warClicked() + visionClicked() + intelClicked() + endTurn() + citiesBuyClicked() + citiesListChanged() + citiesCenterClicked() + citiesRefreshClicked() + citiesPopupClicked() + citiesSelectedAll() + citiesSelectedNone() + citiesSelectedInvert() + citiesSelectedCoastal() + citiesSelectedContinent() + citiesSelectedBuildUnit() + citiesSelectedBuildImprovement() + citiesSelectedBuildWonder() + popupRates() + popupRevolution() + scienceNextChanged(int) + scienceGoalChanged(int) + economyListSelected(QListViewItem *) + + + + mapwidget.h + +
diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/main_impl.cpp freeciv-cvs/client/gui-qpe/classes/main_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/main_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/main_impl.cpp 2005-03-07 00:08:39.000000000 -0500 @@ -0,0 +1,222 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_QPE +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "main_impl.h" +#include "mapw.h" +#include "overview.h" +#include "city_impl.h" +#include "question_str.h" +#include "qpe_dialog.h" +#include "messages.h" + +extern "C" { +#include "config_hack.h" + +#include "fciconv.h" +#include "mapview_common.h" +#include "tilespec.h" +#include "chatline_common.h" +#include "control.h" +#include "packhand.h" +#include "clinet.h" +} + + +CivClient::CivClient( QWidget * parent, const char *name ) + : CivClient_Base( parent, name ), + connectDialog(NULL), intelDialog(NULL) +{ +#ifdef HAVE_QPE + QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); +#endif + + /* + toolbar = new QToolBar(0, this, vbox); + toolbar->setHorizontalStretchable(1); + */ + + tabLayout->insertWidget(0, toolbar); + toolbar->reparent(tab, 0, QPoint(0,0)); + + initMenus(); + initCities(); + + connect( map, SIGNAL(moveUnit(int)), SLOT(moveUnit(int)) ); + + toggleChat(FALSE); + + statbar = statusBar(); + statbar->setSizeGripEnabled(FALSE); + statbar->message("Freeciv QPE client"); + + statbarLabel = new QLabel(statbar); + statbar->addWidget(statbarLabel, 1); + + timeoutLabel = new QLabel(statbar); + statbar->addWidget(timeoutLabel, 0, true); + + overview = new OverviewWindow(this); + cityDialog = new City_Impl(this); + + tileset_load_tiles(tileset); + + init_mapcanvas_and_overview(); + + QTimer *timer = new QTimer(this); + connect( timer, SIGNAL(timeout()), SLOT(init()) ); + timer->start(0, TRUE); +} + +void CivClient::init() +{ + QTimer *timer = new QTimer(this); + connect( timer, SIGNAL(timeout()), SLOT(timerTicked()) ); + timer->start(TIMER_INTERVAL); + + set_client_state(CLIENT_PRE_GAME_STATE); +} + +void CivClient::closeEvent( QCloseEvent *e ) +{ + if ( aconnection.established ) + { + if ( CivClientMessages::askConfirmation( this, + tr("Really quit?"), + tr("Do you want to quit the game?") ) ) + e->accept(); + else + e->ignore(); + } + else + e->accept(); +} + +void CivClient::statusMsg( const QString & message ) +{ + statbarLabel->setText(message); +} + +void CivClient::statusMsg() +{ + statbarLabel->clear(); +} + +void CivClient::message( const QString & message, int ms ) +{ + if (ms) { + statbar->message(message, ms); + } else { + statbar->message(message); + } +} + +void CivClient::message() +{ + statbar->clear(); +} + +void CivClient::chatMessage( const QString & message ) +{ + chatBox->append(message); + chatBox->setCursorPosition( chatBox->numLines(), 0); + if (message[0] != '/') + statbar->message(message, 2000); +} + +void CivClient::chatMessage() +{ + chatBox->clear(); + this->message(); +} + +void CivClient::updateTimeout( const QString & message ) +{ + timeoutLabel->setText(message); +} + +void CivClient::sendCmd() +{ + send_chat(chatLine->text()); + chatLine->clear(); +} + +void CivClient::toggleChat(bool x) +{ + if (x) { + chatBox->show(); + chatLine->show(); + } + else { + chatBox->hide(); + chatLine->hide(); + } +} + +void CivClient::timerTicked() +{ + real_timer_callback(); + /* FIXME: Where should this go? */ + if (can_client_change_view()) { + refreshOverview(); + } +} + +void CivClient::moveUnit( int m ) +{ + if (client_is_observer()) return; + + switch (m) + { + case MUp: + key_unit_move(DIR8_NORTH); + break; + case MDown: + key_unit_move(DIR8_SOUTH); + break; + case MLeft: + key_unit_move(DIR8_WEST); + break; + case MRight: + key_unit_move(DIR8_EAST); + break; + case MUp | MLeft: + key_unit_move(DIR8_NORTHWEST); + break; + case MUp | MRight: + key_unit_move(DIR8_NORTHEAST); + break; + case MDown | MLeft: + key_unit_move(DIR8_SOUTHWEST); + break; + case MDown | MRight: + key_unit_move(DIR8_SOUTHEAST); + break; + } +} + +void CivClient::endTurn() +{ + user_ended_turn(); +} + +void CivClient::changeGovernment( int g ) +{ + set_government_choice(g); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/main_impl.h freeciv-cvs/client/gui-qpe/classes/main_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/main_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/main_impl.h 2004-12-21 22:38:55.000000000 -0500 @@ -0,0 +1,240 @@ +#ifndef FC__QPE_MAIN_IMPL_H +#define FC__QPE_MAIN_IMPL_H + +#include +#include + +#include "main_base.h" +#include "mapw.h" // This is only for enum movement :( + +extern "C" { +#include "config_hack.h" +#include "civclient.h" +} + +class QCloseEvent; +class QLabel; +class QListViewItem; +class QSocketNotifier; +class QStatusBar; +class QToolButton; +class QWidget; + +class CivClientConnect; +class City_Impl; +class CivClientIntel_Impl; +class OverviewWindow; + +class CivClient : public CivClient_Base +{ + Q_OBJECT + public: + CivClient( QWidget * parent = 0, const char *name = 0 ); + + void updateTimeout( const QString & ); + void statusMsg( const QString & ); + void statusMsg(); + void chatMessage(); + public slots: + void chatMessage( const QString & ); + protected slots: + void closeEvent( QCloseEvent * ); + private: + void sendCmd( const QString & ); + QStatusBar *statbar; + QLabel *statbarLabel; + QLabel *timeoutLabel; + private slots: + void init(); + void timerTicked(); + void toggleChat(bool); + void sendCmd(); + void message( const QString &, int = 0 ); + void message(); + void moveUnit(int); + void endTurn(); + void changeGovernment(int); + + /* citydlg.cpp */ + public: + bool isCityOpen(struct city *); + void popupCity(struct city *, bool make_modal); + void popdownCity(struct city *); + void popdownCity(); + void refreshCity(struct city *); + private: + City_Impl *cityDialog; + + /* cityrep.cpp */ + public: + void updateCities(); + protected slots: + void citiesListChanged(); + // + void citiesBuyClicked(); + void citiesCenterClicked(); + void citiesPopupClicked(); + void citiesRefreshClicked(); + // + void citiesSelectedAll(); + void citiesSelectedNone(); + void citiesSelectedInvert(); + // + void citiesSelectedCoastal(); + void citiesSelectedContinent(); + // + void citiesSelectedBuildUnit(); + void citiesSelectedBuildImprovement(); + void citiesSelectedBuildWonder(); + private: + void initCities(); + QPopupMenu *citiesChangeMenu, *citiesSelectMenu; + int citiesChangeMenuID, citiesSelectMenuID; + + /* connectdlg.cpp */ + public: + void popupConnect(); + void popdownConnect(); + private: + CivClientConnect *connectDialog; + + /* dialogs.cpp */ + public: + void selectRace(); + void popupUnitsList( struct tile * ); + private slots: + void popupRates(); + void popupRevolution(); + + /* gui_main.cpp */ + public: + void addSocket(int); + void delSocket(); + private: + QSocketNotifier *snRead, *snExpt; + private slots: + void readyRead(int); + + /* inteldlg.cpp */ + public: + void popupIntel( const struct player * ); + void updateIntel( const struct player * ); + private: + CivClientIntel_Impl *intelDialog; + + /* mapctrl.cpp */ + public: + void popupNewCity( const struct unit *, QString ); + void toggleTurnDone(bool); + + /* mapview.cpp */ + public: + void updateScrollBars(); + void resizeScrollBars(); + protected slots: + void hScrollBarMoved(int); + void vScrollBarMoved(int); + + /* classes/mapw.cpp */ + public: + void redrawMap(); + void markDirty( int x, int y, int w, int h ); + void markDirty(); + private: + void redrawMap(int, int, int, int); + + /* menu.cpp */ + public: + void updateMenus(); + private slots: + void initMenus(); + static bool isMenuEnabled( const QPopupMenu * ); + static void dynamicEnable( QWidget *, const QPopupMenu * ); + static void dynamicEnable( QPopupMenu *, int, const QPopupMenu * ); + // + void cmdCity(); + void cmdRoad(); + void cmdIrrigate(); + void cmdMine(); + void cmdTransform(); + void cmdFortress(); + void cmdAirbase(); + void cmdPollution(); + void cmdFallout(); + // + void cmdSentry(); + void cmdFortify(); + void cmdPillage(); + // + void cmdHomecity(); + void cmdUnloadAll(); + void cmdLoad(); + void cmdUnload(); + void cmdWake(); + // + void cmdAuto(); + void cmdExplore(); + void cmdConnectRoad(); + void cmdConnectRail(); + void cmdConnectIrrigate(); + void cmdPatrol(); + void cmdGoto(); + void cmdAirlift(); // Goto city + void cmdReturn(); + // + void cmdDisband(); + void cmdDiplomat(); + void cmdNuke(); + // + void cmdWait(); + void cmdDone(); + // + void cmdCenter(); + // + void cmdWonder(); + void cmdTradeRoute(); + void cmdParadrop(); + private: + QPopupMenu *mainMenu, *actionMenu, *action2Menu, *govMenu; + int actionMenuID, action2MenuID, govMenuID; + + /* classes/overview.cpp */ + public: + // This needs to be public for now :( + OverviewWindow *overview; + void resizeOverview( int w, int h ); + private: + void refreshOverview(); + private slots: + void toggleOverview(); + + /* plrdlg.cpp */ + public: + void refreshPlayers(); + protected slots: + void playerSelected(QListViewItem *); + void intelClicked(); + void meetClicked(); + void visionClicked(); + void warClicked(); + + /* repodlgs.cpp */ + public: + void popupEconomy(); + void updateEconomy(); + void popupScience(); + void updateScience(); + protected slots: + void economyListSelected(QListViewItem *); + void economySellOld(); + void economySellAll(); + void scienceNextChanged(int); + void scienceGoalChanged(int); + private: + int scienceNextMap[A_LAST], scienceGoalMap[A_LAST]; +}; + + +extern CivClient *civclient; + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/Makefile.am freeciv-cvs/client/gui-qpe/classes/Makefile.am --- freeciv-cvs.orig/client/gui-qpe/classes/Makefile.am 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/Makefile.am 2004-12-22 16:13:42.000000000 -0500 @@ -0,0 +1,112 @@ +## Process this file with automake to produce Makefile.in + +noinst_LIBRARIES = libguiclientqpe.a +AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../.. -I$(srcdir)/../../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I../../../intl @CLIENT_CFLAGS@ +AM_CXXFLAGS = @CLIENT_CXXFLAGS@ + +## Above, note -I../../../intl instead of -I$(top_srdir)/intl is deliberate. + +libguiclientqpe_a_UI = \ + city_base.h \ + city_base.cpp \ + city_build.h \ + city_build.cpp \ + cityinfo_base.h \ + cityinfo_base.cpp \ + connect_base.h \ + connect_base.cpp \ + intel_base.h \ + intel_base.cpp \ + main_base.h \ + main_base.cpp \ + question_str.h \ + question_str.cpp \ + races_base.h \ + races_base.cpp \ + rates_base.h \ + rates_base.cpp \ + unitslist_base.h \ + unitslist_base.cpp + +libguiclientqpe_a_MOC = \ + city_base.moc.cpp \ + city_impl.moc.cpp \ + city_build.moc.cpp \ + cityinfo_base.moc.cpp \ + cityinfo_impl.moc.cpp \ + citymapw.moc.cpp \ + connect_base.moc.cpp \ + connect_impl.moc.cpp \ + intel_base.moc.cpp \ + intel_impl.moc.cpp \ + main_base.moc.cpp \ + main_impl.moc.cpp \ + mapw.moc.cpp \ + overview.moc.cpp \ + question_str.moc.cpp \ + races_base.moc.cpp \ + races_impl.moc.cpp \ + rates_base.moc.cpp \ + rates_impl.moc.cpp \ + unitslist_base.moc.cpp \ + unitslist_impl.moc.cpp + +libguiclientqpe_a_SOURCES = \ + $(libguiclientqpe_a_UI) \ + $(libguiclientqpe_a_MOC) \ + city_base.ui \ + city_build.ui \ + city_impl.h \ + city_impl.cpp \ + cityinfo_base.ui \ + cityinfo_impl.h \ + cityinfo_impl.cpp \ + citymapw.h \ + citymapw.cpp \ + connect_base.ui \ + connect_impl.h \ + connect_impl.cpp \ + intel_base.ui \ + intel_impl.h \ + intel_impl.cpp \ + listview.h \ + listviewunit.h \ + listviewunit.cpp \ + main_base.ui \ + main_impl.h \ + main_impl.cpp \ + mapwidget.cw \ + mapw.h \ + mapw.cpp \ + messages.h \ + messages.cpp \ + overview.h \ + overview.cpp \ + races_base.ui \ + races_impl.h \ + races_impl.cpp \ + rates_base.ui \ + rates_impl.h \ + rates_impl.cpp \ + uic_fixes.h \ + unitslist_base.ui \ + unitslist_impl.h \ + unitslist_impl.cpp + +BUILT_SOURCES = $(libguiclientqpe_a_MOC) $(libguiclientqpe_a_UI) + +CLEANFILES = $(BUILT_SOURCES) + +#libguiclientqpe_a_DEPENDENCIES = $(MOC_LIST) + +#libguiclientqpe_a_LIBADD = $(MOC_LIST) + +%.moc.cpp: %.h + $(MOC) -o $@ $< + +%.h: %.ui + $(UIC) -o $@ $< + +%.cpp: %.h %.ui + $(UIC) -o $@ -impl $*.h $*.ui + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/mapw.cpp freeciv-cvs/client/gui-qpe/classes/mapw.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/mapw.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/mapw.cpp 2005-03-07 00:12:44.000000000 -0500 @@ -0,0 +1,179 @@ +#include +#include +#include + +#include "main_impl.h" +#include "mapw.h" +#include "canvas.h" +#include "mapctrl.h" + +extern "C" { +#include "config_hack.h" + +#include "support.h" +#include "civclient.h" +#include "mapview.h" +} + + +MapWidget::MapWidget( QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + setSizePolicy(QSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Expanding)); + + connect( &dirtyTimer, SIGNAL(timeout()), SLOT(redrawDirty()) ); + + dirtyQueue.setAutoDelete(true); + + pressedKeys = moveSent = (enum movement) 0; +} + +enum movement MapWidget::keyToMovement( const QKeyEvent *e ) const +{ + enum movement m = (enum movement) 0; + + switch (e->key()) + { + case Key_Up: + m = MUp; + break; + case Key_Down: + m = MDown; + break; + case Key_Left: + m = MLeft; + break; + case Key_Right: + m = MRight; + break; + } + + if (e->isAutoRepeat()) + m = (enum movement) 0; + + return m; +} + +void MapWidget::keyPressEvent( QKeyEvent *e ) +{ + enum movement m = keyToMovement(e); + + if (m) + { + pressedKeys = (enum movement) (pressedKeys | m); + + if ((pressedKeys & ~m) && (! moveSent)) { + moveSent = pressedKeys; + emit moveUnit(pressedKeys); + } + } else + e->ignore(); +} + +void MapWidget::keyReleaseEvent( QKeyEvent *e ) +{ + enum movement m = keyToMovement(e); + + if (m) + { + if (pressedKeys == m) + { + if (moveSent) + moveSent = (enum movement) 0; + else + emit moveUnit(m); + } + + pressedKeys = (enum movement) (pressedKeys & ~m); + } else + e->ignore(); +} + +void MapWidget::resizeEvent( QResizeEvent *e ) +{ + map_canvas_resized(width(), height()); +} + +void MapWidget::paintEvent( QPaintEvent *e ) +{ + redrawMap( e->rect() ); +} + +void MapWidget::redrawMap( int x, int y, int w, int h ) +{ + bitBlt(this, x, y, mapview.store->pixmap, x, y, w, h); +} + +void MapWidget::redrawMap( const QRect &rect ) +{ + redrawMap(rect.x(), rect.y(), rect.width(), rect.height()); +} + +void MapWidget::redrawMap() +{ + dirtyTimer.stop(); + isAllDirty = false; + dirtyQueue.clear(); + + redrawMap(0, 0, width(), height()); +} + +void MapWidget::redrawDirty() +{ + if (isAllDirty) + redrawMap(); + else { + while (QRect *rect = dirtyQueue.head()) { + redrawMap(*rect); + dirtyQueue.dequeue(); + } + } +} + +void MapWidget::startDirtyTimer() +{ + if (!dirtyTimer.isActive()) + dirtyTimer.start(0, true); +} + +void MapWidget::markDirty( int x, int y, int w, int h ) +{ + if (!isAllDirty) + dirtyQueue.enqueue(new QRect(x, y, w, h)); + startDirtyTimer(); +} + +void MapWidget::markDirty() +{ + isAllDirty = true; + dirtyQueue.clear(); + startDirtyTimer(); +} + +void MapWidget::mousePressEvent( QMouseEvent *e ) +{ + action_button_pressed(e->x(), e->y(), SELECT_POPUP); +} + + +void CivClient::redrawMap(int x, int y, int w, int h) +{ + map->redrawMap(x, y, w, h); +} + +void CivClient::redrawMap() +{ + map->redrawMap(); +} + +void CivClient::markDirty(int x, int y, int w, int h) +{ + map->markDirty(x, y, w, h); +} + +void CivClient::markDirty() +{ + map->markDirty(); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/mapw.h freeciv-cvs/client/gui-qpe/classes/mapw.h --- freeciv-cvs.orig/client/gui-qpe/classes/mapw.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/mapw.h 2004-12-05 02:01:36.000000000 -0500 @@ -0,0 +1,43 @@ +#ifndef FC__QPE_MAPW_H +#define FC__QPE_MAPW_H + +#include +#include +#include + +class QRect; + +// This probably belongs elsewhere +enum movement { MLeft = 1, MRight = 2, MUp = 4, MDown = 8 }; + +class MapWidget : public QWidget +{ + Q_OBJECT + public: + MapWidget( QWidget *parent = 0, const char *name = 0 ); + void redrawMap( int x, int y, int w, int h ); + void redrawMap( const QRect & ); + void redrawMap(); + void markDirty( int x, int y, int w, int h ); + void markDirty(); + signals: + void moveUnit( int ); + protected: + void keyPressEvent( QKeyEvent * ); + void keyReleaseEvent( QKeyEvent * ); + void paintEvent( QPaintEvent * ); + void resizeEvent( QResizeEvent * ); + protected slots: + void mousePressEvent( QMouseEvent * ); + private: + enum movement keyToMovement( const QKeyEvent *e ) const; + void startDirtyTimer(); + QTimer dirtyTimer; + QQueue dirtyQueue; + bool isAllDirty; + enum movement pressedKeys, moveSent; + private slots: + void redrawDirty(); +}; + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/mapwidget.cw freeciv-cvs/client/gui-qpe/classes/mapwidget.cw --- freeciv-cvs.orig/client/gui-qpe/classes/mapwidget.cw 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/mapwidget.cw 2004-12-04 23:00:58.000000000 -0500 @@ -0,0 +1,52 @@ + + + + MapWidget +
mapw.h
+ + -1 + -1 + + 0 + + 7 + 7 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003c849444154388dad9541681c6514c77f93acf5ad2cf22d8e30035676a0a59922c8965e1af4b08297450f8b07d19c928228c593b68aad82251e34f422480ed57ab1db43690b0a73296485b6ee4576034a4648f05b21ba0389ec7758dcaf92763cccecc6a044051f7c0cdff0e6f7fddf9bf7bde7a469cad81cc79902a68102300538f9dacfd27cdd0776807b699ade77c6e073ef9c7bb83e537fb56bba0b92c891ceb0f30fbccc8c31e875bdd1feb6dd6487cf805f81bb4e9aa6388e3375e7cb3b6ffa25fde1c815b469e397147da309dc003dd4042aa038d4a002d6b6b3bd1e6a82924fabbbc2cac52ed7bfb64bc0c7c0a0901f3cddd5dd0555f368f73e6130d0c45842df127d27249bc2f56d0b0865176a554bdb8057825602e141887c005e042e0377c7e0825839a24d1b85668021f485e896a2f795215a3580cd5d856b33c2c9790555085d8b36107a10c1e340f9cf8aa73a9b1d4e962c2b3a83366f407339c950252198514801fa9b96de0f9677df4aa8bfa478795e085d4b6426692f0207c6602750017d1313fa10dd921c6aa93de7516f08c70e83b6164f7c9a5746342f264457124ecc549067cb046a429e069ca931581b4de042bc25b46e980974ee15e15868d0d6a0b6844b9f0f38355f64e1750f102e2c1bca3ba08713c50ee08c15e77f39a63814e2ef0d4a29ea0d21700d7a081e8ad34b9678d530d882c5f365da3733dfa8ad08ddbd6538568c369a404167c30216bf92873f869e31c4ab06e50a2f3c2df419115605807ecfa28dfc3d38ab530854e6104a96536515a7cf58e2d5ec4011e0b122a10714c63021d84f310a4c21735cd9b47852a679834ca9123c4f916c1a16cff6895a65faeb5909fa9522daec05efc9f1da764cad6ab97648e86d589a57469c7aed28832dcbdcf3822d15593c0b49cff0c1298db516e50ad5ea0819da3de0bfe438d9817a4301d0bc9870f9ea1a8be7cba82ad46a03de783f40790a630c76c7f24cc363f638fb2bd626c62bc16c0d8a43c585e5844b4b09ed9b42fd84d0b4d05fef63b7ede4cb4ecbb072db277485dddbb90b4ebbbd2e7505ad8dec9ad21016a4427435ab867875578d72857aa3c2372d83b1164f20ea4da029904ec07a5d6fb4ba1caa1cccc20a5c4bbd21cc356689da6b88c9decf3e711475788dd9e310ddf6a948406fd821ee5a805f807b403a6e9b450abc5d7d4adef37db292dac9e32980e495b29b38008b14046320ee5afa89c5245c063e057e246ff40f9075a68f809fd89d0aff76fd0c7c013480278147278d9eac2b958147f26791bca1b0bfa579f823604036410693d1e4384e0178107828871ee0bfcdbcdf73f86f8c47d3d8fecf61fa07cb23c91a55e37d1c0000000049454e44ae426082 + +
+ + CityMapWidget +
citymapw.h
+ + 80 + 80 + + 0 + + 0 + 0 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000038049444154388db5954f681c7514c73fb319eb1b49e53798c20e44d985409393ace025d843725cec610511f5d414a4205eea456c2908b5a2bd09c5433420a4c941680f427a08989e361731814a47487057589d8144e67728ceabdd763cfc667793d4bf071ffc1876f6cde77de7bd37ef7945513030cff32ac018e00315c02bcfdf59519e47401f785814c5236f00bef8fec5a767a667ce596b1792343999ddcbfe81e7cc5a4b67a7b3bbf9ede60a7dbe007e05eefb03a5cb5f2e9f8b9ee56353cfa9a1685f114aedbe8304e535ef9754df69ec7698d245b9b4755b03e053202b5d19b3d62e987a4e6ad7c8b20ea00481923f10d29e90ed2b20841350af2b320e5a0690e31045b005af01d7878a013f49939335b4845a8240b87bc7b0f1b525deb68096ae426d5a986f1966e780bebb2f02c0734078507125bb97a17d1d42db1bb0f259ea1e1a17ead306f121e929dd1f94a58f52d2aee18d337220a8cb18706c00f69c160802b87b474aa832f77295664b084f00a2a846b46fe5ac2ca6acada654ab359aaf86801d80c700af72108c0ff90361e3a61d42df7c4b08230b62c9f6846f6e66345b010bef5401e1c6aac5ee8f0a5cb2bcd1cf129cf684f87b8b3186664bc0b7e0835ac3d25525deb6647b70f67cc8e6baf38d6397a68356e188b9ea2b51ad7cfd127aed8a2ba299105e382588c99969b88a255d2d13f91760d7a7ce41c4e5344b0cd7ae28f1b60b2802f5c9c0fdef0f607230157fae389c708e9d9ea21ab2791ba7d408d5aa21ed592e5f4888b742921dd70d512d388a391c27efbbe6af4d09dd5da57d2ba7f97a40b667983d25449301972f40dab57cf8760755c54c088d464ed23bd4728f2b967168b60c002b8b29edf59cb3e7431a73506b64bcfb411d5335586bd1be32dfaa124d3d26f86866dc673a3b0769cf70633565e96acae6ba3033232090ec24e8be0e9ffc6ec3d2391d21fee10f65002eacb52338ca2b670453adb1f695eb86787b14dc4c08cd568df686c5aaa20ad60ea105500cc19d9dce6eb7c314c747f0664b989d8b886343d275f7a3c980c68b39d114cc9f8e9c483f23de52805f808740e1154581e779013eef355e924b5154b65a9fe1c894411b1e4a9c22be602dc45b4a922a36e53af039f023e5a07f0237993e017e62b415feedf91958065ac0f3c08981e20a6e2a85c033e535a01c28470b7cc48af2f57320c36d906cb89a3ccff3812781a74ae831fedbcefbbd84ff06dcf7feaf65fa072f36954b9888b3c20000000049454e44ae426082 + +
+ + CityInfo_Impl +
cityinfo_impl.h
+ + -1 + -1 + + 0 + + 7 + 7 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000038049444154388db5954f681c7514c73fb319eb1b49e53798c20e44d985409393ace025d843725cec610511f5d414a4205eea456c2908b5a2bd09c5433420a4c941680f427a08989e361731814a47487057589d8144e67728ceabdd763cfc667793d4bf071ffc1876f6cde77de7bd37ef7945513030cff32ac018e00315c02bcfdf59519e47401f785814c5236f00bef8fec5a767a667ce596b1792343999ddcbfe81e7cc5a4b67a7b3bbf9ede60a7dbe007e05eefb03a5cb5f2e9f8b9ee56353cfa9a1685f114aedbe8304e535ef9754df69ec7698d245b9b4755b03e053202b5d19b3d62e987a4e6ad7c8b20ea00481923f10d29e90ed2b20841350af2b320e5a0690e31045b005af01d7878a013f49939335b4845a8240b87bc7b0f1b525deb68096ae426d5a986f1966e780bebb2f02c0734078507125bb97a17d1d42db1bb0f259ea1e1a17ead306f121e929dd1f94a58f52d2aee18d337220a8cb18706c00f69c160802b87b474aa832f77295664b084f00a2a846b46fe5ac2ca6acada654ab359aaf86801d80c700af72108c0ff90361e3a61d42df7c4b08230b62c9f6846f6e66345b010bef5401e1c6aac5ee8f0a5cb2bcd1cf129cf684f87b8b3186664bc0b7e0835ac3d25525deb6647b70f67cc8e6baf38d6397a68356e188b9ea2b51ad7cfd127aed8a2ba299105e382588c99969b88a255d2d13f91760d7a7ce41c4e5344b0cd7ae28f1b60b2802f5c9c0fdef0f607230157fae389c708e9d9ea21ab2791ba7d408d5aa21ed592e5f4888b742921dd70d512d388a391c27efbbe6af4d09dd5da57d2ba7f97a40b667983d25449301972f40dab57cf8760755c54c088d464ed23bd4728f2b967168b60c002b8b29edf59cb3e7431a73506b64bcfb411d5335586bd1be32dfaa124d3d26f86866dc673a3b0769cf70633565e96acae6ba3033232090ec24e8be0e9ffc6ec3d2391d21fee10f65002eacb52338ca2b670453adb1f695eb86787b14dc4c08cd568df686c5aaa20ad60ea105500cc19d9dce6eb7c314c747f0664b989d8b886343d275f7a3c980c68b39d114cc9f8e9c483f23de52805f808740e1154581e779013eef355e924b5154b65a9fe1c894411b1e4a9c22be602dc45b4a922a36e53af039f023e5a07f0237993e017e62b415feedf91958065ac0f3c08981e20a6e2a85c033e535a01c28470b7cc48af2f57320c36d906cb89a3ccff3812781a74ae831fedbcefbbd84ff06dcf7feaf65fa072f36954b9888b3c20000000049454e44ae426082 + +
+
+
diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/messages.cpp freeciv-cvs/client/gui-qpe/classes/messages.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/messages.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/messages.cpp 2004-12-10 05:01:39.000000000 -0500 @@ -0,0 +1,46 @@ +#include +#include +#include + +#include "qpe_dialog.h" +#include "messages.h" +#include "question_str.h" + +extern "C" { +#include +} + +void CivClientMessages::showMessage( QWidget *parent, + const QString &caption, const QString &text ) +{ + QMessageBox::information( parent, caption, text ); +} + +bool CivClientMessages::askConfirmation( QWidget *parent, + const QString &caption, const QString &text ) +{ + return QMessageBox::information( parent, caption, text, + QMessageBox::Yes | QMessageBox::Default, + QMessageBox::No | QMessageBox::Escape ) + == QMessageBox::Yes; +} + +QString * CivClientMessages::askQuestion( QWidget *parent, + const QString &caption, const QString &text, + const QString &prefill ) +{ + CivClientQuestionStr dialog(parent, "questionDialog", TRUE); + QString *str; + + dialog.setCaption(caption); + dialog.questionLabel->setText(text); + dialog.questionLine->setText(prefill); + + if ( execDialog(&dialog, TRUE) == QDialog::Accepted ) + str = new QString(dialog.questionLine->text()); + else + str = NULL; + + return str; +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/messages.h freeciv-cvs/client/gui-qpe/classes/messages.h --- freeciv-cvs.orig/client/gui-qpe/classes/messages.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/messages.h 2004-12-10 04:11:17.000000000 -0500 @@ -0,0 +1,22 @@ +#ifndef FC__QPE_MESSAGES_H +#define FC__QPE_MESSAGES_H + +class QString; +class QWidget; + +class CivClientMessages +{ + public: + static void showMessage( QWidget *parent, + const QString &caption, const QString &text ); + + static bool askConfirmation( QWidget *parent, + const QString &caption, const QString &text ); + + static QString * askQuestion( QWidget *parent, + const QString &caption, const QString &text, + const QString &prefill = QString::null ); +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/overview.cpp freeciv-cvs/client/gui-qpe/classes/overview.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/overview.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/overview.cpp 2004-12-05 08:46:53.000000000 -0500 @@ -0,0 +1,102 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "main_impl.h" +#include "overview.h" +#include "canvas.h" + +extern "C" { +#include "config_hack.h" + +#include "support.h" +#include "civclient.h" +#include "mapview_common.h" +} + + +extern struct canvas overview_canvas; + + +OverviewWidget::OverviewWidget( QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); + + overview_canvas.pixmap = &pixmap; +} + +void OverviewWidget::paintEvent( QPaintEvent *e ) +{ + bitBlt(this, QPoint(0, 0), &pixmap, e->rect()); +} + +void OverviewWidget::mousePressEvent( QMouseEvent *e ) +{ + int tile_x, tile_y; + struct tile *ptile; + + overview_to_map_pos(&tile_x, &tile_y, e->x(), e->y()); + ptile = map_pos_to_tile(tile_x, tile_y); + + if (ptile && can_client_change_view()) + center_tile_mapcanvas(ptile); +} + +void OverviewWidget::refreshOverview() +{ + bitBlt(this, 0, 0, &pixmap); +} + +void OverviewWidget::resizeOverview( int w, int h ) +{ + pixmap.resize(w,h); + setFixedSize(w,h); + refreshOverview(); +} + + +OverviewWindow::OverviewWindow( QWidget *parent, const char *name ) + : QDialog( parent, name ) +{ + // FIXME: This doesn't work at all :( + setSizeGripEnabled(FALSE); + setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); + + widget = new OverviewWidget(this); +} + +void OverviewWindow::refreshOverview() +{ + widget->refreshOverview(); +} + +void OverviewWindow::resizeOverview( int w, int h ) +{ + widget->resizeOverview(w,h); +} + + + +void CivClient::toggleOverview() +{ + if (overview->isHidden()) + overview->show(); + else + overview->hide(); +} + +void CivClient::refreshOverview() +{ + overview->refreshOverview(); +} + +void CivClient::resizeOverview( int w, int h ) +{ + overview->resizeOverview(w,h); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/overview.h freeciv-cvs/client/gui-qpe/classes/overview.h --- freeciv-cvs.orig/client/gui-qpe/classes/overview.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/overview.h 2004-11-27 21:44:40.000000000 -0500 @@ -0,0 +1,36 @@ +#ifndef FC__QPE_OVERVIEW_H +#define FC__QPE_OVERVIEW_H + +#include +#include +#include + +class QPaintEvent; +class QMouseEvent; + +class OverviewWidget : public QWidget +{ + Q_OBJECT + public: + OverviewWidget( QWidget *parent = 0, const char *name = 0 ); + void refreshOverview(); + void resizeOverview( int w, int h ); + protected: + void paintEvent( QPaintEvent * ); + void mousePressEvent( QMouseEvent * ); + private: + QPixmap pixmap; +}; + +class OverviewWindow : public QDialog +{ + Q_OBJECT + public: + OverviewWindow( QWidget *parent = 0, const char *name = 0 ); + void refreshOverview(); + void resizeOverview( int w, int h ); + private: + OverviewWidget *widget; +}; + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/question_str.ui freeciv-cvs/client/gui-qpe/classes/question_str.ui --- freeciv-cvs.orig/client/gui-qpe/classes/question_str.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/question_str.ui 2004-12-09 05:00:56.000000000 -0500 @@ -0,0 +1,43 @@ + +CivClientQuestionStr + + + CivClientQuestionStr + + + + 0 + 0 + 145 + 67 + + + + Question + + + + unnamed + + + + questionLabel + + + + + questionLine + + + + + + + questionLine + returnPressed() + CivClientQuestionStr + accept() + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/races_base.ui freeciv-cvs/client/gui-qpe/classes/races_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/races_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/races_base.ui 2004-11-27 21:56:42.000000000 -0500 @@ -0,0 +1,159 @@ + +RacesDialog_Base + + + RacesDialog_Base + + + + 0 + 0 + 214 + 261 + + + + What Nation Will You Be? + + + + unnamed + + + + GroupBox3 + + + Select your nation + + + + unnamed + + + 11 + + + 6 + + + + nationCombo + + + + + + + GroupBox4 + + + Select or enter your name + + + + unnamed + + + 11 + + + 6 + + + + leaderCombo + + + + + + + ButtonGroup1 + + + Select your sex + + + + unnamed + + + 11 + + + 6 + + + + maleButton + + + Male + + + true + + + + + femaleButton + + + Female + + + + + + + ButtonGroup2 + + + Select your city style + + + + unnamed + + + 11 + + + 6 + + + + styleCombo + + + + + + + + + nationCombo + activated(int) + RacesDialog_Base + nationChanged() + + + leaderCombo + textChanged(const QString&) + RacesDialog_Base + leaderChanged() + + + leaderCombo + activated(int) + RacesDialog_Base + leaderChanged() + + + + nationChanged() + leaderChanged() + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/races_impl.cpp freeciv-cvs/client/gui-qpe/classes/races_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/races_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/races_impl.cpp 2004-12-04 16:42:05.000000000 -0500 @@ -0,0 +1,83 @@ +#include +#include + +#include "races_impl.h" +#include "dialogs.h" + +extern "C" { +#include "config_hack.h" + +#include "support.h" +#include "civclient.h" +#include "clinet.h" +#include "nation.h" +} + + +RacesDialog::RacesDialog( QWidget *parent, const char *name ) + : RacesDialog_Base( parent, name, TRUE ) +{ + for (int i = 0; i < game.playable_nation_count; i++) + nations.append(get_nation_name(i)); + + QStringList sortedNations(nations); + sortedNations.sort(); + nationCombo->insertStringList(sortedNations); + + for (int i = 0; i < game.styles_count; i++) + if (city_styles[i].techreq == A_NONE) + styleCombo->insertItem(city_styles[i].name); + + nationChanged(); +} + +int RacesDialog::currentNation() +{ + return nations.findIndex( nationCombo->currentText() ); +} + +QString RacesDialog::currentLeader() const +{ + return leaderCombo->currentText().latin1(); +} + +bool RacesDialog::currentSex() +{ + return maleButton->isChecked(); +} + +int RacesDialog::currentStyle() +{ + return styleCombo->currentItem(); +} + +void RacesDialog::nationChanged() +{ + int nation = currentNation(); + + if (nation == -1) return; + + leaderCombo->clear(); + + int numLeaders; + struct leader *leaders = get_nation_leaders(nation, &numLeaders); + for (int i = 0; i < numLeaders; i++) + leaderCombo->insertItem(leaders[i].name); + + styleCombo->setCurrentItem(get_nation_city_style(nation)); + + leaderChanged(); +} + +void RacesDialog::leaderChanged() +{ + int nation = currentNation(); + + if (nation == -1) return; + + bool sex = get_nation_leader_sex(nation, currentLeader()); + + maleButton->setChecked(sex); + maleButton->setChecked(!sex); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/races_impl.h freeciv-cvs/client/gui-qpe/classes/races_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/races_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/races_impl.h 2004-11-27 21:23:49.000000000 -0500 @@ -0,0 +1,28 @@ +#ifndef FC__QPE_RACES_IMPL_H +#define FC__QPE_RACES_IMPL_H + +#include +#include + +#include "races_base.h" + +class QComboBox; + +class RacesDialog : public RacesDialog_Base +{ + Q_OBJECT + public: + RacesDialog( QWidget *parent = 0, const char *name = 0 ); + int currentNation(); + QString currentLeader() const; + bool currentSex(); + int currentStyle(); + private slots: + void nationChanged(); + void leaderChanged(); + private: + QStringList nations; +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/rates_base.ui freeciv-cvs/client/gui-qpe/classes/rates_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/rates_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/rates_base.ui 2004-12-18 19:38:43.000000000 -0500 @@ -0,0 +1,112 @@ + +CivClientRates_Base + + + CivClientRates_Base + + + + 0 + 0 + 146 + 127 + + + + Tax Rates + + + + unnamed + + + + headLabel + + + + + layout66 + + + + unnamed + + + + taxSpin + + + % + + + PlusMinus + + + 10 + + + + + textLabel1 + + + NoFrame + + + Plain + + + Tax: + + + + + textLabel3 + + + Luxury: + + + + + textLabel2 + + + Science: + + + + + scienceSpin + + + % + + + PlusMinus + + + 10 + + + + + luxurySpin + + + % + + + PlusMinus + + + 10 + + + + + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/rates_base.ui~ freeciv-cvs/client/gui-qpe/classes/rates_base.ui~ --- freeciv-cvs.orig/client/gui-qpe/classes/rates_base.ui~ 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/rates_base.ui~ 2004-12-18 19:38:43.000000000 -0500 @@ -0,0 +1,112 @@ + +CivClientRates_Base + + + CivClientRates_Base + + + + 0 + 0 + 347 + 220 + + + + Tax Rates + + + + unnamed + + + + headLabel + + + + + layout66 + + + + unnamed + + + + taxSpin + + + % + + + PlusMinus + + + 10 + + + + + textLabel1 + + + NoFrame + + + Plain + + + Tax: + + + + + textLabel3 + + + Luxury: + + + + + textLabel2 + + + Science: + + + + + scienceSpin + + + % + + + PlusMinus + + + 10 + + + + + luxurySpin + + + % + + + PlusMinus + + + 10 + + + + + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/rates_impl.cpp freeciv-cvs/client/gui-qpe/classes/rates_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/rates_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/rates_impl.cpp 2004-12-21 23:44:50.000000000 -0500 @@ -0,0 +1,46 @@ +#include +#include + +#include "rates_impl.h" + +extern "C" { +#include +#include "config_hack.h" +#include "clinet.h" +#include "game.h" +#include "government.h" +#include "packets.h" +} + + +CivClientRates::CivClientRates( QWidget *parent, const char *name ) + : CivClientRates_Base( parent, name, TRUE ) +{ + printf("%s:%u\n", __FILE__, __LINE__); + int max_rate = get_government_max_rate(game.player_ptr->government); + printf("%s:%u\n", __FILE__, __LINE__); + + headLabel->setText( tr("%1 max rate: %2%"). + arg( get_government_name(game.player_ptr->government) ). + arg(max_rate) ); + printf("%s:%u\n", __FILE__, __LINE__); + + taxSpin->setValue( game.player_ptr->economic.tax ); + scienceSpin->setValue( game.player_ptr->economic.science ); + luxurySpin->setValue( game.player_ptr->economic.luxury ); + + taxSpin->setMaxValue(max_rate); + scienceSpin->setMaxValue(max_rate); + luxurySpin->setMaxValue(max_rate); +} + +void CivClientRates::accept() +{ + dsend_packet_player_rates(&aconnection, + taxSpin->value(), + luxurySpin->value(), + scienceSpin->value() ); + + QDialog::accept(); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/rates_impl.h freeciv-cvs/client/gui-qpe/classes/rates_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/rates_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/rates_impl.h 2004-12-19 05:05:26.000000000 -0500 @@ -0,0 +1,16 @@ +#ifndef FC__QPE_RATES_IMPL_H +#define FC__QPE_RATES_IMPL_H + +#include "rates_base.h" + +class CivClientRates : public CivClientRates_Base +{ + Q_OBJECT + public: + CivClientRates( QWidget *parent = 0, const char *name = 0 ); + protected slots: + void accept(); +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/uic_fixes.h freeciv-cvs/client/gui-qpe/classes/uic_fixes.h --- freeciv-cvs.orig/client/gui-qpe/classes/uic_fixes.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/uic_fixes.h 2004-11-29 18:14:49.000000000 -0500 @@ -0,0 +1,2 @@ +#define DockTop QMainWindow::Top +#define setHorizontallyStretchable setHorizontalStretchable diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/unitslist_base.ui freeciv-cvs/client/gui-qpe/classes/unitslist_base.ui --- freeciv-cvs.orig/client/gui-qpe/classes/unitslist_base.ui 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/unitslist_base.ui 2004-12-19 07:22:51.000000000 -0500 @@ -0,0 +1,96 @@ + +CivClientUnitsList_Base + + + CivClientUnitsList_Base + + + + 0 + 0 + 124 + 128 + + + + Unit Selection + + + + unnamed + + + + + Unit + + + true + + + true + + + + + Veteran + + + true + + + true + + + + + Activity + + + true + + + true + + + + + Home + + + true + + + true + + + + unitsList + + + true + + + + + readyAllButton + + + Ready All + + + + + + + readyAllButton + clicked() + CivClientUnitsList_Base + readyAll() + + + + readyAll() + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/unitslist_base.ui~ freeciv-cvs/client/gui-qpe/classes/unitslist_base.ui~ --- freeciv-cvs.orig/client/gui-qpe/classes/unitslist_base.ui~ 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/unitslist_base.ui~ 2004-12-19 07:22:51.000000000 -0500 @@ -0,0 +1,85 @@ + +CivClientUnitsList_Base + + + CivClientUnitsList_Base + + + + 0 + 0 + 124 + 128 + + + + Unit Selection + + + + unnamed + + + + + Unit + + + true + + + true + + + + + Veteran + + + true + + + true + + + + + Activity + + + true + + + true + + + + + Home + + + true + + + true + + + + unitsList + + + true + + + + + readyAllButton + + + Ready All + + + + + + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/unitslist_impl.cpp freeciv-cvs/client/gui-qpe/classes/unitslist_impl.cpp --- freeciv-cvs.orig/client/gui-qpe/classes/unitslist_impl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/unitslist_impl.cpp 2005-03-07 00:13:47.000000000 -0500 @@ -0,0 +1,60 @@ +#include +#include + +#include "unitslist_impl.h" +#include "listviewunit.h" + +extern "C" { +#include +#include "config_hack.h" +#include "map.h" +#include "mapctrl_common.h" +#include "unit.h" +} + + +CivClientUnitsList::CivClientUnitsList( QWidget *parent, const char *name ) + : CivClientUnitsList_Base( parent, name, TRUE ) +{ +} + +void CivClientUnitsList::setTile( const struct tile *ptile ) +{ + int n_units = unit_list_size(ptile->units); + struct unit *unit_list[ n_units ]; + + fill_tile_unit_list(ptile, unit_list); + + readyAllButton->setEnabled(FALSE); + + unitsList->clear(); + + for ( int i = 0; i < n_units; i++ ) + { + (void) new ListViewUnit( unitsList, unit_list[i], FALSE ); + + if ( unit_owner(unit_list[i]) == game.player_ptr ) + readyAllButton->setEnabled(TRUE); + } +} + +void CivClientUnitsList::readyAll() +{ + for ( ListViewUnit *i = (ListViewUnit *) unitsList->firstChild(); + i != NULL; + i = (ListViewUnit *) i->nextSibling() ) + { + set_unit_focus(i->data); + } + + QDialog::accept(); +} + +void CivClientUnitsList::accept() +{ + if ( ListViewUnit *i = (ListViewUnit *) unitsList->selectedItem() ) + set_unit_focus(i->data); + + QDialog::accept(); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/classes/unitslist_impl.h freeciv-cvs/client/gui-qpe/classes/unitslist_impl.h --- freeciv-cvs.orig/client/gui-qpe/classes/unitslist_impl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/classes/unitslist_impl.h 2004-12-19 06:51:06.000000000 -0500 @@ -0,0 +1,19 @@ +#ifndef FC__QPE_UNITSLIST_IMPL_H +#define FC__QPE_UNITSLIST_IMPL_H + +#include "unitslist_base.h" + +class CivClientUnitsList : public CivClientUnitsList_Base +{ + Q_OBJECT + public: + CivClientUnitsList( QWidget *parent = 0, const char *name = 0 ); + void setTile( const struct tile * ); + protected slots: + void accept(); + private slots: + void readyAll(); +}; + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/colors.cpp freeciv-cvs/client/gui-qpe/colors.cpp --- freeciv-cvs.orig/client/gui-qpe/colors.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/colors.cpp 2004-12-04 16:47:46.000000000 -0500 @@ -0,0 +1,45 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include "colors.h" + +extern "C" { +#include "config_hack.h" +} + + +QColor colors_standard[COLOR_STD_LAST] = { + QColor( 0, 0, 0), /* Black */ + QColor(255, 255, 255), /* White */ + QColor(255, 0, 0), /* Red */ + QColor(255, 255, 0), /* Yellow */ + QColor( 0, 255, 200), /* Cyan */ + QColor( 0, 200, 0), /* Ground (green) */ + QColor( 0, 0, 200), /* Ocean (blue) */ + QColor( 86, 86, 86), /* Background (gray) */ + QColor(128, 0, 0), /* race0 */ + QColor(128, 255, 255), /* race1 */ + QColor(255, 0, 0), /* race2 */ + QColor(255, 0, 128), /* race3 */ + QColor( 0, 0, 128), /* race4 */ + QColor(255, 0, 255), /* race5 */ + QColor(255, 128, 0), /* race6 */ + QColor(255, 255, 128), /* race7 */ + QColor(255, 128, 128), /* race8 */ + QColor( 0, 0, 255), /* race9 */ + QColor( 0, 255, 0), /* race10 */ + QColor( 0, 128, 128), /* race11 */ + QColor( 0, 64, 64), /* race12 */ + QColor(198, 198, 198), /* race13 */ +}; + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/colors.h freeciv-cvs/client/gui-qpe/colors.h --- freeciv-cvs.orig/client/gui-qpe/colors.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/colors.h 2004-12-04 16:47:04.000000000 -0500 @@ -0,0 +1,27 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__COLORS_H +#define FC__COLORS_H + +#include + +extern "C" { +#include "config_hack.h" +#include "colors_g.h" +} + +extern QColor colors_standard[COLOR_STD_LAST]; + + +#endif /* FC__COLORS_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/config_hack.h freeciv-cvs/client/gui-qpe/config_hack.h --- freeciv-cvs.orig/client/gui-qpe/config_hack.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/config_hack.h 2004-12-04 16:37:41.000000000 -0500 @@ -0,0 +1,3 @@ +#ifdef HAVE_CONFIG_H +#include +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/connectdlg.cpp freeciv-cvs/client/gui-qpe/connectdlg.cpp --- freeciv-cvs.orig/client/gui-qpe/connectdlg.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/connectdlg.cpp 2004-12-06 00:41:38.000000000 -0500 @@ -0,0 +1,212 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include +#include + +#include "main_impl.h" +#include "connect_impl.h" + +#include "connectdlg.h" +#include "qpe_dialog.h" + +extern "C" { +#include "config_hack.h" + +#include + +#include "fcintl.h" +#include "log.h" +#include "support.h" +#include "chatline_common.h" /* for append_output_window */ +#include "civclient.h" +#include "clinet.h" /* for get_server_address */ +#include "packhand_gen.h" +} + +extern "C" { +#include +} + + +static void try_to_autoconnect(void); + + +/************************************************************************** + really close and destroy the dialog. +**************************************************************************/ +void really_close_connection_dialog(void) +{ + /* What purpose does this actually serve? */ +} + +/************************************************************************** + close and destroy the dialog. +**************************************************************************/ +void CivClient::popdownConnect() +{ + if (connectDialog) { + delete connectDialog; + connectDialog = NULL; + } +} + +void close_connection_dialog() +{ + civclient->popdownConnect(); +} + +/************************************************************************** + configure the dialog depending on what type of authentication request the + server is making. +**************************************************************************/ +void handle_authentication_req(enum authentication_type type, char *message) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_authentication_req"); + switch (type) { + case AUTH_NEWUSER_FIRST: + /* PORTME: switch configs if need be */ + break; + case AUTH_NEWUSER_RETRY: + /* PORTME: switch configs if need be */ + break; + case AUTH_LOGIN_FIRST: + /* if we magically have a password already present in 'password' + * then, use that and skip the password entry dialog */ + if (password[0] != '\0') { + struct packet_authentication_reply reply; + + sz_strlcpy(reply.password, password); + send_packet_authentication_reply(&aconnection, &reply); + return; + } else { + /* PORTME: switch configs if need be */ + } + break; + case AUTH_LOGIN_RETRY: + /* PORTME: switch configs if need be */ + break; + default: + assert(0); + } + + /* PORTME etc. */ +} + +/************************************************************************** + provide a packet handler for packet_game_load +**************************************************************************/ +void handle_game_load(struct packet_game_load *packet) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_game_load"); + /* PORTME */ +} + + +/************************************************************************** + Provide an interface for connecting to a FreeCiv server. +**************************************************************************/ +void CivClient::popupConnect() +{ + if (connectDialog) return; + + connectDialog = new CivClientConnect(this); + + connect(connectDialog, SIGNAL(message(const QString&)), + SLOT(chatMessage(const QString&)) ); + connect(connectDialog, SIGNAL(message()), SLOT(message()) ); + + /* auto_connect */ + execDialog(connectDialog, TRUE); +} + +void gui_server_connect(void) +{ + civclient->popupConnect(); +} + + +/************************************************************************** + Start trying to autoconnect to civserver. + Calls get_server_address(), then arranges for + autoconnect_callback(), which calls try_to_connect(), to be called + roughly every AUTOCONNECT_INTERVAL milliseconds, until success, + fatal error or user intervention. +**************************************************************************/ +void server_autoconnect(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "server_autoconnect"); + char buf[512]; + int outcome; + + my_snprintf(buf, sizeof(buf), + _("Auto-connecting to server \"%s\" at port %d as \"%s\""), + server_host, server_port, user_name); + append_output_window(buf); + outcome = get_server_address(server_host, server_port, buf, sizeof(buf)); + if (outcome < 0) { + freelog(LOG_FATAL, + _("Error contacting server \"%s\" at port %d " + "as \"%s\":\n %s\n"), + server_host, server_port, user_name, buf); + exit(EXIT_FAILURE); + } + try_to_autoconnect(); +} + +/************************************************************************** + Make an attempt to autoconnect to the server. If the server isn't + there yet, arrange for this routine to be called again in about + AUTOCONNECT_INTERVAL milliseconds. If anything else goes wrong, log + a fatal error. + + Return FALSE iff autoconnect succeeds. +**************************************************************************/ +static void try_to_autoconnect(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "try_to_autoconnect"); + char errbuf[512]; + static int count = 0; + + count++; + + /* abort if after 10 seconds the server couldn't be reached */ + + if (AUTOCONNECT_INTERVAL * count >= 10000) { + freelog(LOG_FATAL, + _("Failed to contact server \"%s\" at port " + "%d as \"%s\" after %d attempts"), + server_host, server_port, user_name, count); + exit(EXIT_FAILURE); + } + + switch (try_to_connect(user_name, errbuf, sizeof(errbuf))) { + case 0: + /* Success! */ + return; + case ECONNREFUSED: + /* Server not available (yet) - wait & retry */ +#if 0 + /* PORTME */ + schedule_timer(AUTOCONNECT_INTERVAL, try_to_autoconnect, NULL); +#endif + return; + default: + /* All other errors are fatal */ + freelog(LOG_FATAL, + _("Error contacting server \"%s\" at port %d " + "as \"%s\":\n %s\n"), + server_host, server_port, user_name, errbuf); + exit(EXIT_FAILURE); + } +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/connectdlg.h freeciv-cvs/client/gui-qpe/connectdlg.h --- freeciv-cvs.orig/client/gui-qpe/connectdlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/connectdlg.h 2004-12-04 16:42:41.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__CONNECTDLG_H +#define FC__CONNECTDLG_H + +extern "C" { +#include "config_hack.h" +#include "connectdlg_g.h" +} + + +#endif /* FC__CONNECTDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/dialogs.cpp freeciv-cvs/client/gui-qpe/dialogs.cpp --- freeciv-cvs.orig/client/gui-qpe/dialogs.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/dialogs.cpp 2004-12-19 07:17:11.000000000 -0500 @@ -0,0 +1,244 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include "classes/main_impl.h" +#include "classes/races_impl.h" +#include "classes/rates_impl.h" +#include "classes/unitslist_impl.h" +#include "classes/messages.h" + +#include "dialogs.h" +#include "qpe_dialog.h" + +extern "C" { +#include "config_hack.h" + +#include "game.h" +#include "government.h" + +#include "support.h" +#include "civclient.h" +#include "clinet.h" +#include "nation.h" +#include "packhand.h" +} + +extern "C" { +#include +} + + +/************************************************************************** + Popup a dialog to display information about an event that has a + specific location. The user should be given the option to goto that + location. +**************************************************************************/ +void popup_notify_goto_dialog(const char *headline, const char *lines, + struct tile *ptile) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_notify_goto_dialog"); + /* PORTME */ +} + +/************************************************************************** + Popup a generic dialog to display some generic information. +**************************************************************************/ +void popup_notify_dialog(const char *caption, const char *headline, + const char *lines) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_notify_dialog"); + /* PORTME */ +} + +/************************************************************************** + Popup the nation selection dialog. +**************************************************************************/ +void CivClient::selectRace() +{ + RacesDialog races(this); + + bool isDone = FALSE; + + while (!isDone) { + if (execDialog(&races, TRUE) != QDialog::Accepted ) + { + disconnect_from_server(); + isDone = TRUE; + } else { + // sanity check goes here + isDone = TRUE; + } + } + + dsend_packet_nation_select_req(&aconnection, + races.currentNation(), + races.currentSex(), + races.currentLeader(), + races.currentStyle()); +} + +void popup_races_dialog(void) +{ + civclient->selectRace(); +} + +/************************************************************************** + Close the nation selection dialog. This should allow the user to + (at least) select a unit to activate. +**************************************************************************/ +void popdown_races_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popdown_races_dialog"); + /* PORTME */ +} + +/************************************************************************** + Popup a dialog window to select units on a particular tile. +**************************************************************************/ +void CivClient::popupUnitsList( struct tile *ptile ) +{ + CivClientUnitsList dialog(this); + + dialog.setTile(ptile); + + execDialog(&dialog, TRUE); +} + +void popup_unit_select_dialog(struct tile *ptile) +{ + civclient->popupUnitsList(ptile); +} + +/************************************************************************** + In the nation selection dialog, make already-taken nations unavailable. + This information is contained in the packet_nations_used packet. +**************************************************************************/ +void races_toggles_set_sensitive(bool *nations_used) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "races_toggles_set_sensitive"); + /* PORTME */ +} + +/************************************************************************** + Popup a dialog giving a player choices when their caravan arrives at + a city (other than its home city). Example: + - Establish traderoute. + - Help build wonder. + - Keep moving. +**************************************************************************/ +void popup_caravan_dialog(struct unit *punit, + struct city *phomecity, struct city *pdestcity) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_caravan_dialog"); + /* PORTME */ +} + +/************************************************************************** + Is there currently a caravan dialog open? This is important if there + can be only one such dialog at a time; otherwise return FALSE. +**************************************************************************/ +bool caravan_dialog_is_open(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "caravan_dialog_is_open"); + /* PORTME */ + return FALSE; +} + +/************************************************************************** + Popup a dialog giving a diplomatic unit some options when moving into + the target tile. +**************************************************************************/ +void popup_diplomat_dialog(struct unit *punit, struct tile *ptile) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_diplomat_dialog"); + /* PORTME */ +} + +/************************************************************************** + Return whether a diplomat dialog is open. This is important if there + can be only one such dialog at a time; otherwise return FALSE. +**************************************************************************/ +bool diplomat_dialog_is_open(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "diplomat_dialog_is_open"); + /* PORTME */ + return FALSE; +} + +/************************************************************************** + Popup a window asking a diplomatic unit if it wishes to incite the + given enemy city. +**************************************************************************/ +void popup_incite_dialog(struct city *pcity) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_incite_dialog"); + /* PORTME */ +} + +/************************************************************************** + Popup a dialog asking a diplomatic unit if it wishes to bribe the + given enemy unit. +**************************************************************************/ +void popup_bribe_dialog(struct unit *punit) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_bribe_dialog"); + /* PORTME */ +} + +/************************************************************************** + Popup a dialog asking a diplomatic unit if it wishes to sabotage the + given enemy city. +**************************************************************************/ +void popup_sabotage_dialog(struct city *pcity) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_sabotage_dialog"); + /* PORTME */ +} + +/************************************************************************** + Popup a dialog asking the unit which improvement they would like to + pillage. +**************************************************************************/ +void popup_pillage_dialog(struct unit *punit, + enum tile_special_type may_pillage) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_pillage_dialog"); + /* PORTME */ +} + +/************************************************************************** + This function is called when the client disconnects or the game is + over. It should close all dialog windows for that game. +**************************************************************************/ +void popdown_all_game_dialogs(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popdown_all_game_dialogs"); + /* PORTME */ +} + + +void CivClient::popupRates() +{ + CivClientRates dialog(this); + + execDialog(&dialog, TRUE); +} + +void CivClient::popupRevolution() +{ + if ( CivClientMessages::askConfirmation( this, + tr("Revolution!"), + tr("You say you wanna revolution?") ) ) + start_revolution(); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/dialogs.h freeciv-cvs/client/gui-qpe/dialogs.h --- freeciv-cvs.orig/client/gui-qpe/dialogs.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/dialogs.h 2004-12-04 16:40:02.000000000 -0500 @@ -0,0 +1,22 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__DIALOGS_H +#define FC__DIALOGS_H + +extern "C" { +#include "config_hack.h" +#include "dialogs_g.h" +} + +#endif /* FC__DIALOGS_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/diplodlg.c freeciv-cvs/client/gui-qpe/diplodlg.c --- freeciv-cvs.orig/client/gui-qpe/diplodlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/diplodlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,80 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "diplodlg.h" + +#include + +/************************************************************************** + Update a player's acceptance status of a treaty (traditionally shown + with the thumbs-up/thumbs-down sprite). +**************************************************************************/ +void handle_diplomacy_accept_treaty(int counterpart, bool I_accepted, + bool other_accepted) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_diplomacy_accept_treaty"); + /* PORTME */ +} + +/************************************************************************** + Handle the start of a diplomacy meeting - usually by poping up a + diplomacy dialog. +**************************************************************************/ +void handle_diplomacy_init_meeting(int counterpart, int initiated_from) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_diplomacy_init_meeting"); + /* PORTME */ +} + +/************************************************************************** + Update the diplomacy dialog by adding a clause. +**************************************************************************/ +void handle_diplomacy_create_clause(int counterpart, int giver, + enum clause_type type, int value) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_diplomacy_create_clause"); + /* PORTME */ +} + +/************************************************************************** + Update the diplomacy dialog when the meeting is canceled (the dialog + should be closed). +**************************************************************************/ +void handle_diplomacy_cancel_meeting(int counterpart, int initiated_from) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_diplomacy_cancel_meeting"); + /* PORTME */ +} + +/************************************************************************** + Update the diplomacy dialog by removing a clause. +**************************************************************************/ +void handle_diplomacy_remove_clause(int counterpart, int giver, + enum clause_type type, int value) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "handle_diplomacy_remove_clause"); + /* PORTME */ +} + +/************************************************************************** + Close all open diplomacy dialogs. +**************************************************************************/ +void close_all_diplomacy_dialogs(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "close_all_diplomacy_dialogs"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/diplodlg.h freeciv-cvs/client/gui-qpe/diplodlg.h --- freeciv-cvs.orig/client/gui-qpe/diplodlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/diplodlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__DIPLODLG_H +#define FC__DIPLODLG_H + +#include "diplodlg_g.h" + + +#endif /* FC__DIPLODLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/finddlg.c freeciv-cvs/client/gui-qpe/finddlg.c --- freeciv-cvs.orig/client/gui-qpe/finddlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/finddlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,29 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "finddlg.h" + +#include + +/************************************************************************** + Popup a dialog to ask for a city to find. +**************************************************************************/ +void popup_find_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_find_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/finddlg.h freeciv-cvs/client/gui-qpe/finddlg.h --- freeciv-cvs.orig/client/gui-qpe/finddlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/finddlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 2003 - 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ +#ifndef FC__FINDDLG_H +#define FC__FINDDLG_H + +#include "finddlg_g.h" + +/* nothing to add */ + +#endif /* FC__FINDDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/gotodlg.c freeciv-cvs/client/gui-qpe/gotodlg.c --- freeciv-cvs.orig/client/gui-qpe/gotodlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/gotodlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,40 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "game.h" + +#include "civclient.h" +#include "control.h" + +#include "gotodlg.h" + +#include + +/************************************************************************** + Popup a dialog to have the focus unit goto to a city. +**************************************************************************/ +void popup_goto_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_goto_dialog"); + if (get_client_state() != CLIENT_GAME_RUNNING_STATE) { + return; + } + if (!get_unit_in_focus()) { + return; + } + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/gotodlg.h freeciv-cvs/client/gui-qpe/gotodlg.h --- freeciv-cvs.orig/client/gui-qpe/gotodlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/gotodlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__GOTODLG_H +#define FC__GOTODLG_H + +#include "gotodlg_g.h" + + +#endif /* FC__GOTODLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/graphics.cpp freeciv-cvs/client/gui-qpe/graphics.cpp --- freeciv-cvs.orig/client/gui-qpe/graphics.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/graphics.cpp 2004-12-12 10:31:02.000000000 -0500 @@ -0,0 +1,128 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +extern "C" { +#include "config_hack.h" + +#include + +#include "tilespec.h" + +#include "graphics.h" + +#include +} + +#include "canvas.h" + +struct Sprite *intro_gfx_sprite; +struct Sprite *radar_gfx_sprite; + +/**************************************************************************** + Return whether the client supports isometric view (isometric tilesets). +****************************************************************************/ +bool isometric_view_supported(void) +{ + return FALSE; +} + +/**************************************************************************** + Return whether the client supports "overhead" (non-isometric) view. +****************************************************************************/ +bool overhead_view_supported(void) +{ + return TRUE; +} + +/**************************************************************************** + Load the introductory graphics. +****************************************************************************/ +void load_intro_gfx(void) +{ + /* + intro_gfx_sprite = load_gfxfile(main_intro_filename); + radar_gfx_sprite = load_gfxfile(minimap_intro_filename); + */ +} + +/**************************************************************************** + Frees the introductory sprites. +****************************************************************************/ +void free_intro_radar_sprites(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "free_intro_radar_sprites"); + if (intro_gfx_sprite) { + free_sprite(intro_gfx_sprite); + intro_gfx_sprite = NULL; + } + if (radar_gfx_sprite) { + free_sprite(radar_gfx_sprite); + radar_gfx_sprite = NULL; + } +} + +/**************************************************************************** + Return a NULL-terminated, permanently allocated array of possible + graphics types extensions. Extensions listed first will be checked + first. +****************************************************************************/ +const char **gfx_fileextensions(void) +{ + static const char *ext[] = { "png", "xpm", NULL }; + + return ext; +} + +/**************************************************************************** + Load the given graphics file into a sprite. This function loads an + entire image file, which may later be broken up into individual sprites + with crop_sprite. +****************************************************************************/ +struct Sprite *load_gfxfile(const char *filename) +{ + struct Sprite *sprite = (struct Sprite *)fc_malloc(sizeof(struct Sprite)); + sprite->image = new QImage(filename); + return sprite; +} + +/**************************************************************************** + Create a new sprite by cropping and taking only the given portion of + the image. +****************************************************************************/ +struct Sprite *crop_sprite(struct Sprite *source, + int x, int y, int width, int height, + struct Sprite *mask, + int mask_offset_x, int mask_offset_y) +{ + struct Sprite *dest = (struct Sprite *)fc_malloc(sizeof(struct Sprite)); + dest->image = new QImage(source->image->copy(x,y,width,height)); + return dest; +} + +/**************************************************************************** + Find the dimensions of the sprite. +****************************************************************************/ +void get_sprite_dimensions(struct Sprite *sprite, int *width, int *height) +{ + *width = sprite->image->width(); + *height = sprite->image->height(); +} + +/**************************************************************************** + Free a sprite and all associated image data. +****************************************************************************/ +void free_sprite(struct Sprite *s) +{ + delete s->image; + free(s); +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/graphics.h freeciv-cvs/client/gui-qpe/graphics.h --- freeciv-cvs.orig/client/gui-qpe/graphics.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/graphics.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__GRAPHICS_H +#define FC__GRAPHICS_H + +#include "graphics_g.h" + + +#endif /* FC__GRAPHICS_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/gui_main.cpp freeciv-cvs/client/gui-qpe/gui_main.cpp --- freeciv-cvs.orig/client/gui-qpe/gui_main.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/gui_main.cpp 2005-03-07 00:40:46.000000000 -0500 @@ -0,0 +1,182 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_QPE +#include +#else +#include +#endif +#include + +#include "main_impl.h" + +#include "gui_main.h" + +extern "C" { +#include "config_hack.h" + +#include "civclient.h" +#include "fciconv.h" +#include "options.h" + +#include "clinet.h" +} + +extern "C" { +#include +} + +const char *client_string = "gui-qpe"; + +const char * const gui_character_encoding = NULL; +const bool gui_use_transliteration = FALSE; /* ? */ + +client_option gui_options[] = { + /* None. */ +}; +const int num_gui_options = ARRAY_SIZE(gui_options); + +CivClient *civclient; + + +/************************************************************************** + Do any necessary pre-initialization of the UI, if necessary. +**************************************************************************/ +void ui_init(void) +{ + /* PORTME */ +} + +/************************************************************************** + The main loop for the UI. This is called from main(), and when it + exits the client will exit. +**************************************************************************/ +void ui_main(int argc, char *argv[]) +{ +#ifdef HAVE_QPE + QPEApplication a(argc, argv); +#else + QApplication a(argc, argv); +#endif + + civclient = new CivClient; + +#ifdef HAVE_QPE + a.showMainWidget(civclient); +#else + a.setMainWidget(civclient); + civclient->show(); +#endif + a.exec(); + + delete civclient; + + civclient = NULL; +} + +/************************************************************************** + Update the connected users list at pregame state. +**************************************************************************/ +void update_conn_list_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "update_conn_list_dialog"); + /* PORTME */ +} + +/************************************************************************** + Make a bell noise (beep). This provides low-level sound alerts even + if there is no real sound support. +**************************************************************************/ +void sound_bell(void) +{ + QApplication::beep(); +} + +/************************************************************************** + Wait for data on the given socket. Call input_from_server() when data + is ready to be read. +**************************************************************************/ +void CivClient::readyRead( int s ) +{ + input_from_server(s); +} + +void CivClient::addSocket( int s ) +{ + snRead = new QSocketNotifier(s, QSocketNotifier::Read, this); + connect( snRead, SIGNAL(activated(int)), SLOT(readyRead(int)) ); + snExpt = new QSocketNotifier(s, QSocketNotifier::Exception, this); + connect( snExpt, SIGNAL(activated(int)), SLOT(readyRead(int)) ); + //aconnection.notify_of_writable_data = set_wait_for_writable_socket; +} + +void add_net_input(int sock) +{ + civclient->addSocket(sock); +} + +/************************************************************************** + Stop waiting for any server network data. See add_net_input(). +**************************************************************************/ +void CivClient::delSocket() +{ + delete snRead; + delete snExpt; +} + +void remove_net_input(void) +{ + civclient->delSocket(); +} + +/************************************************************************** + Set one of the unit icons in the information area based on punit. + NULL will be pased to clear the icon. idx==-1 will be passed to + indicate this is the active unit, or idx in [0..num_units_below-1] for + secondary (inactive) units on the same tile. +**************************************************************************/ +void set_unit_icon(int idx, struct unit *punit) +{ +} + +/************************************************************************** + Most clients use an arrow (e.g., sprites.right_arrow) to indicate when + the units_below will not fit. This function is called to activate and + deactivate the arrow. +**************************************************************************/ +void set_unit_icons_more_arrow(bool onoff) +{ +} + +/**************************************************************************** + Enqueue a callback to be called during an idle moment. The 'callback' + function should be called sometimes soon, and passed the 'data' pointer + as its data. +****************************************************************************/ +void add_idle_callback(void (callback)(void *), void *data) +{ + (*callback)(data); +} + +/**************************************************************************** + Called by the tileset code to set the font size that should be used to + draw the city names and productions. +****************************************************************************/ +void set_city_names_font_sizes(int my_city_names_font_size, + int my_city_productions_font_size) +{ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/gui_main.h freeciv-cvs/client/gui-qpe/gui_main.h --- freeciv-cvs.orig/client/gui-qpe/gui_main.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/gui_main.h 2004-12-04 16:40:46.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__GUI_MAIN_H +#define FC__GUI_MAIN_H + +extern "C" { +#include "config_hack.h" +#include "gui_main_g.h" +} + + +#endif /* FC__GUI_MAIN_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/helpdlg.c freeciv-cvs/client/gui-qpe/helpdlg.c --- freeciv-cvs.orig/client/gui-qpe/helpdlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/helpdlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,56 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "fcintl.h" + +#include "helpdlg.h" + +#include + +/************************************************************************** + Popup the help dialog to get help on the given string topic. Note that + the toppic may appear in multiple sections of the help (it may be both + an improvement and a unit, for example). + + The string will be untranslated. +**************************************************************************/ +void popup_help_dialog_string(const char *item) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_help_dialog_string"); + popup_help_dialog_typed(_(item), HELP_ANY); +} + +/************************************************************************** + Popup the help dialog to display help on the given string topic from + the given section. + + The string will be translated. +**************************************************************************/ +void popup_help_dialog_typed(const char *item, enum help_page_type htype) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_help_dialog_typed"); + /* PORTME */ +} + +/************************************************************************** + Close the help dialog. +**************************************************************************/ +void popdown_help_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popdown_help_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/helpdlg.h freeciv-cvs/client/gui-qpe/helpdlg.h --- freeciv-cvs.orig/client/gui-qpe/helpdlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/helpdlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__HELPDLG_H +#define FC__HELPDLG_H + +#include "helpdlg_g.h" + + +#endif /* FC__HELPDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/inteldlg.cpp freeciv-cvs/client/gui-qpe/inteldlg.cpp --- freeciv-cvs.orig/client/gui-qpe/inteldlg.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/inteldlg.cpp 2004-12-12 09:27:49.000000000 -0500 @@ -0,0 +1,51 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include "classes/main_impl.h" +#include "classes/intel_impl.h" + +#include "qpe_dialog.h" + +#include "inteldlg.h" + +#include + + +/************************************************************************** + Popup an intelligence dialog for the given player. +**************************************************************************/ +void CivClient::popupIntel(const struct player *p) +{ + if (! intelDialog) + intelDialog = new CivClientIntel_Impl(this); + + intelDialog->setupIntel(p); + + execDialog(intelDialog, FALSE); +} + +/**************************************************************************** + Update the intelligence dialog for the given player. This is called by + the core client code when that player's information changes. +****************************************************************************/ +void CivClient::updateIntel( const struct player *p ) +{ + if (intelDialog) + intelDialog->updateIntel(p); +} + +void update_intel_dialog(struct player *p) +{ + civclient->updateIntel(p); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/inteldlg.h freeciv-cvs/client/gui-qpe/inteldlg.h --- freeciv-cvs.orig/client/gui-qpe/inteldlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/inteldlg.h 2004-12-12 07:56:17.000000000 -0500 @@ -0,0 +1,22 @@ +/********************************************************************** + Freeciv - Copyright (C) 2003 - 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ +#ifndef FC__INTELDLG_H +#define FC__INTELDLG_H + +extern "C" { +#include "config_hack.h" +#include "inteldlg_g.h" +} + + +#endif /* FC__INTELDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/Makefile.am freeciv-cvs/client/gui-qpe/Makefile.am --- freeciv-cvs.orig/client/gui-qpe/Makefile.am 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/Makefile.am 2004-12-19 09:29:24.000000000 -0500 @@ -0,0 +1,64 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = classes + +noinst_LIBRARIES = libguiclient.a +AM_CPPFLAGS = -I. -I./classes -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I../../intl @CLIENT_CFLAGS@ +AM_CXXFLAGS = @CLIENT_CXXFLAGS@ + +## Above, note -I../../intl instead of -I$(top_srdir)/intl is deliberate. + +libguiclient_a_SOURCES = \ + canvas.h \ + chatline.cpp \ + chatline.h \ + citydlg.cpp \ + citydlg.h \ + cityrep.cpp \ + cityrep.h \ + colors.cpp \ + colors.h \ + config_hack.h \ + connectdlg.cpp \ + connectdlg.h \ + dialogs.cpp \ + dialogs.h \ + diplodlg.c \ + diplodlg.h \ + finddlg.c \ + finddlg.h \ + gotodlg.c \ + gotodlg.h \ + graphics.cpp \ + graphics.h \ + gui_main.h \ + gui_main.cpp \ + helpdlg.c \ + helpdlg.h \ + inteldlg.cpp \ + inteldlg.h \ + mapctrl.cpp \ + mapctrl.h \ + mapview.cpp \ + mapview.h \ + menu.cpp \ + menu.h \ + messagedlg.c \ + messagedlg.h \ + messagewin.c \ + messagewin.h \ + pages.c \ + pages.h \ + plrdlg.cpp \ + plrdlg.h \ + repodlgs.cpp \ + repodlgs.h \ + spaceshipdlg.c \ + spaceshipdlg.h \ + undefbool.h \ + wldlg.c \ + wldlg.h + +libguiclient_a_DEPENDENCIES = classes/libguiclientqpe.a +libguiclient_a_LIBADD = classes/*.o + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/mapctrl.cpp freeciv-cvs/client/gui-qpe/mapctrl.cpp --- freeciv-cvs.orig/client/gui-qpe/mapctrl.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/mapctrl.cpp 2004-12-18 21:33:45.000000000 -0500 @@ -0,0 +1,81 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include + +#include "classes/main_impl.h" +#include "classes/messages.h" +#include "mapctrl.h" + +extern "C" { +#include +#include "config_hack.h" +#include "clinet.h" +#include "packhand.h" +} + + +/************************************************************************** + Popup a dialog to ask for the name of a new city. The given string + should be used as a suggestion. +**************************************************************************/ +void CivClient::popupNewCity( const struct unit *punit, QString suggestname ) +{ + if ( QString *str = CivClientMessages::askQuestion( this, + tr("Build New City"), + tr("What should we call our new city?"), + suggestname ) ) + { + dsend_packet_unit_build_city( &aconnection, punit->id, *str ); + free(str); + } +} + +// FIXME: Shouldn't this be const? (suggestname at the very least) +void popup_newcity_dialog(struct unit *punit, char *suggestname) +{ + civclient->popupNewCity(punit, suggestname); +} + +/************************************************************************** + A turn done button should be provided for the player. This function + is called to toggle it between active/inactive. +**************************************************************************/ +void CivClient::toggleTurnDone(bool state) +{ + actEndTurn->setEnabled(state); +} + +void set_turn_done_button_state(bool state) +{ + civclient->toggleTurnDone(state); +} + +/************************************************************************** + Draw a goto or patrol line at the current mouse position. +**************************************************************************/ +void create_line_at_mouse_pos(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "create_line_at_mouse_pos"); + /* PORTME */ +} + +/************************************************************************** + The Area Selection rectangle. Called by center_tile_mapcanvas() and + when the mouse pointer moves. +**************************************************************************/ +void update_rect_at_mouse_pos(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "update_rect_at_mouse_pos"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/mapctrl.h freeciv-cvs/client/gui-qpe/mapctrl.h --- freeciv-cvs.orig/client/gui-qpe/mapctrl.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/mapctrl.h 2004-12-13 04:04:03.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__MAPCTRL_H +#define FC__MAPCTRL_H + +extern "C" { +#include "config_hack.h" +#include "mapctrl_g.h" +} + + +#endif /* FC__MAPCTRL_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/mapview.cpp freeciv-cvs/client/gui-qpe/mapview.cpp --- freeciv-cvs.orig/client/gui-qpe/mapview.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/mapview.cpp 2004-12-18 20:03:56.000000000 -0500 @@ -0,0 +1,503 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include +#include +#include +#include + +#include "colors.h" +#include "canvas.h" +#include "classes/main_impl.h" +#include "classes/overview.h" + +extern "C" { +#include "config_hack.h" + +#include "fcintl.h" +#include "game.h" +#include "support.h" + +#include "civclient.h" +#include "climisc.h" +#include "control.h" +#include "mapctrl_common.h" + +#include "mapview.h" + +#include "text.h" + +#include +} + + +struct canvas overview_canvas; + +/**************************************************************************** + Typically an info box is provided to tell the player about the state + of their civilization. This function is called when the label is + changed. +****************************************************************************/ +void update_info_label(void) +{ + //printf("%s:%u %s()\n", __FILE__, __LINE__, "update_info_label"); + /* PORTME */ + char buffer[512]; + + my_snprintf(buffer, sizeof(buffer), + _("Population: %s\n" + "Year: %s\n" + "Gold %d\n" + "Tax: %d Lux: %d Sci: %d"), + population_to_text(civ_population(game.player_ptr)), + textyear(game.year), game.player_ptr->economic.gold, + game.player_ptr->economic.tax, + game.player_ptr->economic.luxury, + game.player_ptr->economic.science); + + /* ... */ +} + +/**************************************************************************** + Update the information label which gives info on the current unit and + the square under the current unit, for specified unit. Note that in + practice punit is always the focus unit. + + Clears label if punit is NULL. + + Typically also updates the cursor for the map_canvas (this is related + because the info label may includes "select destination" prompt etc). + And it may call update_unit_pix_label() to update the icons for units + on this square. +****************************************************************************/ +void update_unit_info_label(struct unit *punit) +{ + if (punit && get_client_state() != CLIENT_GAME_OVER_STATE) { + struct unit_type *ptype = unit_type(punit); + QString str = ptype->name; + + if (ptype->veteran[punit->veteran].name[0] != '\0') { + str += " ("; + str += ptype->veteran[punit->veteran].name; + str += ")"; + } + + str += " "; + str += unit_activity_text(punit); + /* + str += " "; + str += map_get_tile_info_text(punit->tile); + + if (enum tile_special_type infrastructure = get_tile_infrastructure_set(punit->tile)) { + str += " "; + str += map_get_infrastructure_text(infrastructure); + } + */ + + if (struct city *pcity = player_find_city_by_id(game.player_ptr, punit->homecity)) { + str += " "; + str += pcity->name; + } + + // if (hover_unit != punit->id) set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST); + + civclient->statusMsg(str); + } else { + civclient->statusMsg(); + } + + update_unit_pix_label(punit); +} + +/**************************************************************************** + Update the timeout in the client window. The timeout is the time until + the turn ends, in seconds. +****************************************************************************/ +void update_timeout_label(void) +{ + civclient->updateTimeout(get_timeout_label_text()); +} + +/**************************************************************************** + If do_restore is FALSE it should change the turn button style (to draw + the user's attention to it). If do_restore is TRUE this should reset + the turn done button to the default style. +****************************************************************************/ +void update_turn_done_button(bool do_restore) +{ + static bool flip = FALSE; + + printf("%s:%u %s()\n", __FILE__, __LINE__, "update_turn_done_button"); + if (!get_turn_done_button_state()) { + return; + } + + if ((do_restore && flip) || !do_restore) { + /* ... */ + + flip = !flip; + } + /* PORTME */ +} + +/**************************************************************************** + Set information for the indicator icons typically shown in the main + client window. The parameters tell which sprite to use for the + indicator. +****************************************************************************/ +void set_indicator_icons(int bulb, int sol, int flake, int gov) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "set_indicator_icons"); + /* PORTME */ +} + +/**************************************************************************** + Called when the map size changes. This may be used to change the + size of the GUI element holding the overview canvas. The + overview.width and overview.height are updated if this function is + called. +****************************************************************************/ +void map_size_changed(void) +{ + civclient->resizeOverview(overview.width, overview.height); +} + +/**************************************************************************** + Draw a description for the given city. This description may include the + name, turns-to-grow, production, and city turns-to-build (depending on + client options). + + (canvas_x, canvas_y) gives the location on the given canvas at which to + draw the description. This is the location of the city itself so the + text must be drawn underneath it. pcity gives the city to be drawn, + while (*width, *height) should be set by show_ctiy_desc to contain the + width and height of the text block (centered directly underneath the + city's tile). +****************************************************************************/ +void show_city_desc(struct canvas *pcanvas, int canvas_x, int canvas_y, + struct city *pcity, int *width, int *height) +{ + char name[512], growth[32]; + enum color_std growth_color; + + get_city_mapview_name_and_growth( pcity, + name, sizeof(name), + growth, sizeof(growth), + &growth_color ); + + QString strName = name; + QString strGrowth; + if (growth[0] != '\0') + strGrowth = QString(" ") + growth; + + const int shadow = 1; + + QPainter p(pcanvas->pixmap); + QRect rect = p.boundingRect( 0, 0, 500, 500, Qt::AlignCenter, + strName + strGrowth ); + + canvas_x += (NORMAL_TILE_WIDTH / 2) - ((rect.width() + shadow) / 2); + canvas_y += NORMAL_TILE_HEIGHT + rect.height(); + + p.setPen(colors_standard[COLOR_STD_BLACK]); + p.drawText( canvas_x + shadow, canvas_y + shadow, strName ); + p.setPen(colors_standard[COLOR_STD_WHITE]); + p.drawText( canvas_x, canvas_y, strName ); + + canvas_x += p.fontMetrics().width(strName); + + p.setPen(colors_standard[COLOR_STD_BLACK]); + p.drawText( canvas_x + shadow, canvas_y + shadow, strGrowth ); + p.setPen(colors_standard[growth_color]); + p.drawText( canvas_x, canvas_y, strGrowth ); + + *width = rect.width() + shadow; + *height = rect.height() + shadow; +} + +/**************************************************************************** + Create a canvas of the given size. +****************************************************************************/ +struct canvas *canvas_create(int width, int height) +{ + struct canvas *result = (struct canvas *)fc_malloc(sizeof(*result)); + + result->pixmap = new QPixmap(width, height); + result->pixmap->fill( Qt::white ); + return result; +} + +/**************************************************************************** + Free any resources associated with this canvas and the canvas struct + itself. +****************************************************************************/ +void canvas_free(struct canvas *store) +{ + delete store->pixmap; + free(store); +} + +/**************************************************************************** + Draw some or all of a sprite onto the mapview or citydialog canvas. +****************************************************************************/ +void canvas_put_sprite(struct canvas *pcanvas, + int canvas_x, int canvas_y, + struct Sprite *sprite, + int offset_x, int offset_y, int width, int height) +{ + QPainter p(pcanvas->pixmap); + p.drawImage(canvas_x, canvas_y, *(sprite->image), + offset_x, offset_y, width, height); +} + +/**************************************************************************** + Draw a full sprite onto the mapview or citydialog canvas. +****************************************************************************/ +void canvas_put_sprite_full(struct canvas *pcanvas, + int canvas_x, int canvas_y, + struct Sprite *sprite) +{ + QPainter p(pcanvas->pixmap); + p.drawImage(canvas_x, canvas_y, *(sprite->image)); +} + +/**************************************************************************** + Draw a full sprite onto the canvas. If "fog" is specified draw it with + fog. +****************************************************************************/ +void canvas_put_sprite_fogged(struct canvas *pcanvas, + int canvas_x, int canvas_y, + struct Sprite *psprite, + bool fog, int fog_x, int fog_y) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "canvas_put_sprite_fogged"); + /* PORTME */ +} + +/**************************************************************************** + Draw a filled-in colored rectangle onto the mapview or citydialog canvas. +****************************************************************************/ +void canvas_put_rectangle(struct canvas *pcanvas, + enum color_std color, + int canvas_x, int canvas_y, int width, int height) +{ + QPainter paint(pcanvas->pixmap); + paint.setPen(colors_standard[color]); + paint.drawRect(canvas_x, canvas_y, width, height); +} + +/**************************************************************************** + Fill the area covered by the sprite with the given color. +****************************************************************************/ +void canvas_fill_sprite_area(struct canvas *pcanvas, + struct Sprite *psprite, enum color_std color, + int canvas_x, int canvas_y) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "canvas_fill_sprite_area"); + /* PORTME */ +} + +/**************************************************************************** + Fill the area covered by the sprite with the given color. +****************************************************************************/ +void canvas_fog_sprite_area(struct canvas *pcanvas, struct Sprite *psprite, + int canvas_x, int canvas_y) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "canvas_fog_sprite_area"); + /* PORTME */ +} + +/**************************************************************************** + Draw a 1-pixel-width colored line onto the mapview or citydialog canvas. +****************************************************************************/ +void canvas_put_line(struct canvas *pcanvas, enum color_std color, + enum line_type ltype, int start_x, int start_y, + int dx, int dy) +{ + QPainter p(pcanvas->pixmap); + p.setPen(colors_standard[color]); + p.drawLine(start_x, start_y, start_x+dx, start_y+dy); +} + +/**************************************************************************** + Copies an area from the source canvas to the destination canvas. +****************************************************************************/ +void canvas_copy(struct canvas *dest, struct canvas *src, + int src_x, int src_y, int dest_x, int dest_y, int width, + int height) +{ + QPainter p(dest->pixmap); + p.drawPixmap(dest_x, dest_y, *(src->pixmap), + src_x, src_y, width, height); +} + +/**************************************************************************** + Return a canvas that is the overview window. +****************************************************************************/ +struct canvas *get_overview_window(void) +{ + return &overview_canvas; +} + +/**************************************************************************** + Mark the rectangular region as 'dirty' so that we know to flush it + later. +****************************************************************************/ +void dirty_rect(int x, int y, int w, int h) +{ + civclient->markDirty(x, y, w, h); +} + +/**************************************************************************** + Mark the entire screen area as "dirty" so that we can flush it later. +****************************************************************************/ +void dirty_all(void) +{ + civclient->markDirty(); +} + +/**************************************************************************** + Flush all regions that have been previously marked as dirty. See + dirty_rect and dirty_all. This function is generally called after we've + processed a batch of drawing operations. +****************************************************************************/ +void flush_dirty(void) +{ + civclient->redrawMap(); +} + +/**************************************************************************** + Do any necessary synchronization to make sure the screen is up-to-date. + The canvas should have already been flushed to screen via flush_dirty - + all this function does is make sure the hardware has caught up. +****************************************************************************/ +void gui_flush(void) +{ +} + +/**************************************************************************** + Update (refresh) the locations of the mapview scrollbars (if it uses + them). +****************************************************************************/ +void CivClient::updateScrollBars() +{ + int x, y; + + get_mapview_scroll_pos(&x, &y); + mapHScrollBar->setValue(x); + mapVScrollBar->setValue(y); +} + +void update_map_canvas_scrollbars(void) +{ + civclient->updateScrollBars(); +} + +/**************************************************************************** + Update the size of the sliders on the scrollbars. +****************************************************************************/ +void CivClient::resizeScrollBars() +{ + int xmin, ymin, xmax, ymax, xsize, ysize, xstep, ystep; + + get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize); + get_mapview_scroll_step(&xstep, &ystep); + + mapHScrollBar->setRange(xmin, xmax); + mapVScrollBar->setRange(ymin, ymax); + + mapHScrollBar->setSteps(xstep, xsize); + mapVScrollBar->setSteps(ystep, ysize); +} + +void update_map_canvas_scrollbars_size(void) +{ + civclient->resizeScrollBars(); +} + +void CivClient::hScrollBarMoved(int x) +{ + if (! can_client_change_view()) + return; + + int tmp, y; + get_mapview_scroll_pos(&tmp, &y); + set_mapview_scroll_pos(x, y); +} + +void CivClient::vScrollBarMoved(int y) +{ + if (! can_client_change_view()) + return; + + int tmp, x; + get_mapview_scroll_pos(&x, &tmp); + set_mapview_scroll_pos(x, y); +} + +/**************************************************************************** + Update (refresh) all of the city descriptions on the mapview. +****************************************************************************/ +void update_city_descriptions(void) +{ + update_map_canvas_visible(); +} + +/**************************************************************************** + If necessary, clear the city descriptions out of the buffer. +****************************************************************************/ +void prepare_show_city_descriptions(void) +{ +} + +/**************************************************************************** + Draw a cross-hair overlay on a tile. +****************************************************************************/ +void put_cross_overlay_tile(struct tile *ptile) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "put_cross_overlay_tile"); + /* PORTME */ +} + +/**************************************************************************** + Draw a single tile of the citymap onto the mapview. The tile is drawn + as the given color with the given worker on it. The exact method of + drawing is left up to the GUI. +****************************************************************************/ +void put_city_worker(struct canvas *pcanvas, + enum color_std color, enum city_tile_type worker, + int canvas_x, int canvas_y) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "put_city_worker"); + /* PORTME */ +} + +/**************************************************************************** + Area Selection +****************************************************************************/ +void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "draw_selection_rectangle"); + /* PORTME */ +} + +/**************************************************************************** + This function is called when the tileset is changed. +****************************************************************************/ +void tileset_changed(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "tileset_changed"); + /* PORTME */ + /* Here you should do any necessary redraws (for instance, the city + * dialogs usually need to be resized). */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/mapview.h freeciv-cvs/client/gui-qpe/mapview.h --- freeciv-cvs.orig/client/gui-qpe/mapview.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/mapview.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__MAPVIEW_H +#define FC__MAPVIEW_H + +#include "mapview_g.h" + + +#endif /* FC__MAPVIEW_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/menu.cpp freeciv-cvs/client/gui-qpe/menu.cpp --- freeciv-cvs.orig/client/gui-qpe/menu.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/menu.cpp 2004-12-18 20:49:19.000000000 -0500 @@ -0,0 +1,319 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include +#include +#include + +#include "classes/main_impl.h" + +extern "C" { +#include "config_hack.h" +#include "menu.h" +#include "control.h" +#include "government.h" +} + +#include + + +void CivClient::initMenus() +{ + actionMenu = new QPopupMenu(this); + btnAction->setPopup(actionMenu); + + actGoto->addTo(actionMenu); /* Goto */ + actAirlift->addTo(actionMenu); /* Airlift */ + actPatrol->addTo(actionMenu); /* Patrol */ + actReturn->addTo(actionMenu); /* Return */ + actParadrop->addTo(actionMenu); /* Paradrop */ + actionMenu->insertSeparator(); /* -------------------- */ + actUnloadAll->addTo(actionMenu); /* Unload All */ + actLoad->addTo(actionMenu); /* Load */ + actUnload->addTo(actionMenu); /* Unload */ + actWake->addTo(actionMenu); /* Wake Up Others */ + actionMenu->insertSeparator(); /* -------------------- */ + actHomecity->addTo(actionMenu); /* Homecity */ + actionMenu->insertSeparator(); /* -------------------- */ + actSentry->addTo(actionMenu); /* Sentry */ + actFortify->addTo(actionMenu); /* Fortify */ + actPillage->addTo(actionMenu); /* Pillage */ + actionMenu->insertSeparator(); /* -------------------- */ + actDisband->addTo(actionMenu); /* Disband */ + actNuke->addTo(actionMenu); /* Nuke */ + actionMenu->insertSeparator(); /* -------------------- */ + actAuto->addTo(actionMenu); /* Auto Attack/Settler */ + actExplore->addTo(actionMenu); /* Auto Explore */ + actionMenu->insertSeparator(); /* -------------------- */ + actWait->addTo(actionMenu); /* Wait */ + actDone->addTo(actionMenu); /* Done */ + + action2Menu = new QPopupMenu(this); + btnSettler->setPopup(action2Menu); + + actRoad->addTo(action2Menu); /* Road */ + actIrrigate->addTo(action2Menu); /* Irrigate */ + actMine->addTo(action2Menu); /* Mine */ + actTransform->addTo(action2Menu); /* Terraform */ + action2Menu->insertSeparator(); /* -------------------- */ + actConnectRoad->addTo(action2Menu); /* Connect Road */ + actConnectRail->addTo(action2Menu); /* Connect Railroad */ + actConnectIrrigate->addTo(action2Menu); /* Connect Irrigation */ + action2Menu->insertSeparator(); /* -------------------- */ + actCity->addTo(action2Menu); /* City */ + actFortress->addTo(action2Menu); /* Fortress */ + actAirbase->addTo(action2Menu); /* Airbase */ + action2Menu->insertSeparator(); /* -------------------- */ + actPollution->addTo(action2Menu); /* Pollution */ + actFallout->addTo(action2Menu); /* Fallout */ + action2Menu->insertSeparator(); /* -------------------- */ + actDiplomat->addTo(action2Menu); /* Diplomat Actions */ + action2Menu->insertSeparator(); /* -------------------- */ + actWonder->addTo(action2Menu); /* Help Wonder */ + actTradeRoute->addTo(action2Menu); /* Trade Route */ + + govMenu = new QPopupMenu(this); + + mainMenu = new QPopupMenu(this); + btnMenu->setPopup(mainMenu); + + actPopupMessages->addTo(mainMenu); /* Messages */ + actToggleOverview->addTo(mainMenu); /* Overview */ + actToggleChat->addTo(mainMenu); /* Chat Window */ + mainMenu->insertSeparator(); /* -------------------- */ + actCenter->addTo(mainMenu); /* Center */ + mainMenu->insertSeparator(); /* -------------------- */ + actionMenuID = /* Actions => */ + mainMenu->insertItem( "Actions", actionMenu ); + action2MenuID = /* Special Actions => */ + mainMenu->insertItem( "Special Actions", action2Menu ); + mainMenu->insertSeparator(); /* -------------------- */ + actRates->addTo(mainMenu); /* Tax Rates */ + govMenuID = /* Change Government */ + mainMenu->insertItem( "Change Government", govMenu ); + mainMenu->insertSeparator(); /* -------------------- */ + actEndTurn->addTo(mainMenu); /* Turn Done */ +} + +/************************************************************************** + Update all of the menus (sensitivity, etc.) based on the current state. +**************************************************************************/ +bool CivClient::isMenuEnabled( const QPopupMenu *menu ) +{ + bool result = FALSE; + + int j = menu->idAt(0); + for ( int i = 0; j != -1; j = menu->idAt(++i) ) + if ( menu->text(j) != QString::null ) + if ( menu->isItemEnabled(j) ) + result = TRUE; + + return result; +} + +void CivClient::dynamicEnable( QWidget *w, const QPopupMenu *menu ) +{ + w->setEnabled( isMenuEnabled(menu) ); +} + +void CivClient::dynamicEnable( QPopupMenu *m, int i, const QPopupMenu *menu ) +{ + m->setItemEnabled( i, isMenuEnabled(menu) ); +} + + +void CivClient::updateMenus() +{ + govMenu->clear(); + actRevolution->addTo(govMenu); + govMenu->insertSeparator(); + + for ( int i = 0; i < game.government_count; i++ ) + { + const struct government *g = &governments[i]; + + if (i != game.government_when_anarchy) + { + int id = govMenu->insertItem( g->name, this, + SLOT(changeGovernment(int)) ); + govMenu->setItemParameter(id, g->index); + + govMenu->setItemEnabled( id, + can_change_to_government(game.player_ptr, i) ); + } + } + + + btnAction->setEnabled(FALSE); + btnSettler->setEnabled(FALSE); + + actCity->setText("Build City"); + actRoad->setText("Road"); + actIrrigate->setText("Irrigate"); + actMine->setText("Mine"); + actTransform->setText("Terraform"); + actAuto->setText("Auto Attack"); + + struct unit *punit = get_unit_in_focus(); + + actCenter->setEnabled( can_client_change_view() && punit ); + + if (! can_client_issue_orders() || ! punit) + { + return; + } + +#define enableActivity(name, activity) \ + act##name->setEnabled( \ + can_unit_do_activity(punit, ACTIVITY_##activity) ) + + actCity->setEnabled( can_unit_add_or_build_city(punit) ); + actRoad->setEnabled( can_unit_do_activity(punit, ACTIVITY_ROAD) + || can_unit_do_activity(punit, ACTIVITY_RAILROAD) ); + enableActivity(Irrigate, IRRIGATE); + enableActivity(Mine, MINE); + enableActivity(Transform, TRANSFORM); + enableActivity(Fortress, FORTRESS); + enableActivity(Airbase, AIRBASE); + enableActivity(Pollution, POLLUTION); + enableActivity(Fallout, FALLOUT); + + enableActivity(Sentry, SENTRY); + enableActivity(Fortify, FORTIFYING); + enableActivity(Pillage, PILLAGE); + + actHomecity->setEnabled( can_unit_change_homecity(punit) ); + actUnloadAll->setEnabled( get_transporter_occupancy(punit) > 0); + actLoad->setEnabled( + can_unit_load( punit, + find_transporter_for_unit(punit, + punit->tile) ) ); + actUnload->setEnabled( + can_unit_unload( punit, + find_unit_by_id(punit->transported_by) ) + && can_unit_exist_at_tile(punit, punit->tile) ); + actWake->setEnabled( + is_unit_activity_on_tile(ACTIVITY_SENTRY, + punit->tile) ); + actAuto->setEnabled( can_unit_do_auto(punit) ); + enableActivity(Explore, EXPLORE); + actConnectRoad->setEnabled( + can_unit_do_connect(punit, ACTIVITY_ROAD) ); + actConnectRail->setEnabled( + can_unit_do_connect(punit, ACTIVITY_RAILROAD) ); + actConnectIrrigate->setEnabled( + can_unit_do_connect(punit, ACTIVITY_IRRIGATE) ); + actReturn->setEnabled( !( is_air_unit(punit) || is_heli_unit(punit) ) ); + actDisband->setEnabled( ! unit_flag(punit, F_UNDISBANDABLE) ); + actDiplomat->setEnabled( + is_diplomat_unit(punit) + && diplomat_can_do_action( punit, + DIPLOMAT_ANY_ACTION, + punit->tile ) ); + actNuke->setEnabled( unit_flag(punit, F_NUCLEAR) ); + + actWonder->setEnabled( unit_can_help_build_wonder_here(punit) ); + actTradeRoute->setEnabled( unit_can_est_traderoute_here(punit) ); + actParadrop->setEnabled( can_unit_paradrop(punit) ); + + // FIXME + actAirlift->setEnabled(FALSE); + + dynamicEnable( btnAction, actionMenu ); + dynamicEnable( btnSettler, action2Menu ); + dynamicEnable( mainMenu, actionMenuID, actionMenu ); + dynamicEnable( mainMenu, action2MenuID, action2Menu ); + + + Terrain_type_id ttype = punit->tile->terrain; + struct tile_type *tinfo = get_tile_type(ttype); + + if ( unit_flag(punit, F_CITIES) && map_get_city(punit->tile) ) + actCity->setText("Add to City"); + + if ( can_unit_do_activity(punit, ACTIVITY_RAILROAD) ) + actRoad->setText("Railroad"); + + if ( ! actIrrigate->isEnabled() ) + actIrrigate->setText("Irrigate"); + else if ( tinfo->irrigation_result != T_NONE + && tinfo->irrigation_result != ttype ) + actIrrigate->setText( tr("Change to %1").arg( + get_tile_type(tinfo->irrigation_result)->terrain_name)); + else if ( map_has_special(punit->tile, S_IRRIGATION) + && player_knows_techs_with_flag( game.player_ptr, + TF_FARMLAND ) ) + actIrrigate->setText("Farmland"); + + if ( actMine->isEnabled() + && tinfo->mining_result != T_NONE + && tinfo->mining_result != ttype ) + actMine->setText( tr("Change to %1").arg( + get_tile_type(tinfo->mining_result)->terrain_name )); + + if ( actTransform->isEnabled() + && tinfo->transform_result != T_NONE + && tinfo->transform_result != ttype ) + actTransform->setText( tr("Change to %1").arg( + get_tile_type(tinfo->transform_result)->terrain_name )); + + if ( unit_flag(punit, F_SETTLERS) ) + actAuto->setText("Auto Settler"); +} + +void update_menus(void) { + civclient->updateMenus(); +} + + +void CivClient::cmdCenter() { request_center_focus_unit(); } + +void CivClient::cmdCity() { key_unit_build_city(); } +void CivClient::cmdRoad() { key_unit_road(); } +void CivClient::cmdIrrigate() { key_unit_irrigate(); } +void CivClient::cmdMine() { key_unit_mine(); } +void CivClient::cmdTransform() { key_unit_transform(); } +void CivClient::cmdFortress() { key_unit_fortress(); } +void CivClient::cmdAirbase() { key_unit_airbase(); } +void CivClient::cmdPollution() { key_unit_pollution(); } +void CivClient::cmdFallout() { key_unit_fallout(); } +void CivClient::cmdSentry() { key_unit_sentry(); } +void CivClient::cmdFortify() { key_unit_fortify(); } +void CivClient::cmdPillage() { key_unit_pillage(); } +void CivClient::cmdHomecity() { key_unit_homecity(); } +void CivClient::cmdUnloadAll() { key_unit_unload_all(); } +void CivClient::cmdLoad() { request_unit_load( + get_unit_in_focus(), NULL ); } +void CivClient::cmdUnload() { request_unit_unload( + get_unit_in_focus() ); } +void CivClient::cmdWake() { key_unit_wakeup_others(); } +void CivClient::cmdAuto() { request_unit_auto( + get_unit_in_focus() ); } +void CivClient::cmdExplore() { key_unit_auto_explore(); } +void CivClient::cmdConnectRoad() { key_unit_connect(ACTIVITY_ROAD); } +void CivClient::cmdConnectRail() { key_unit_connect(ACTIVITY_RAILROAD); } +void CivClient::cmdConnectIrrigate() { key_unit_connect(ACTIVITY_IRRIGATE); } +void CivClient::cmdPatrol() { key_unit_patrol(); } +void CivClient::cmdGoto() { key_unit_goto(); } +void CivClient::cmdAirlift() { /* FIXME */ } +void CivClient::cmdReturn() { request_unit_return( + get_unit_in_focus() ); } +void CivClient::cmdDisband() { key_unit_disband(); } +void CivClient::cmdDiplomat() { key_unit_diplomat_actions(); } +void CivClient::cmdNuke() { key_unit_nuke(); } +void CivClient::cmdWait() { key_unit_wait(); } +void CivClient::cmdDone() { key_unit_done(); } +void CivClient::cmdWonder() { key_unit_build_wonder(); } +void CivClient::cmdTradeRoute() { key_unit_traderoute(); } +void CivClient::cmdParadrop() { key_unit_paradrop(); } + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/menu.h freeciv-cvs/client/gui-qpe/menu.h --- freeciv-cvs.orig/client/gui-qpe/menu.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/menu.h 2004-12-12 14:12:28.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__MENU_H +#define FC__MENU_H + +extern "C" { +#include "config_hack.h" +#include "menu_g.h" +} + + +#endif /* FC__MENU_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/messagedlg.c freeciv-cvs/client/gui-qpe/messagedlg.c --- freeciv-cvs.orig/client/gui-qpe/messagedlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/messagedlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,31 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "options.h" + +#include "messagedlg.h" + +#include + +/************************************************************************** + Popup a window to let the user edit their message options. +**************************************************************************/ +void popup_messageopt_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_messageopt_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/messagedlg.h freeciv-cvs/client/gui-qpe/messagedlg.h --- freeciv-cvs.orig/client/gui-qpe/messagedlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/messagedlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 2003 - 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ +#ifndef FC__MESSAGEDLG_H +#define FC__MESSAGEDLG_H + +#include "messagedlg_g.h" + +/* nothing to add */ + +#endif /* FC__MESSAGEDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/messagewin.c freeciv-cvs/client/gui-qpe/messagewin.c --- freeciv-cvs.orig/client/gui-qpe/messagewin.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/messagewin.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,48 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "messagewin.h" + +#include + +/************************************************************************** + Popup (or raise) the message dialog; typically triggered by F10. +**************************************************************************/ +void popup_meswin_dialog(bool raise) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_meswin_dialog"); + /* PORTME */ +} + +/************************************************************************** + Return whether the message dialog is open. +**************************************************************************/ +bool is_meswin_open(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "is_meswin_open"); + /* PORTME */ + return FALSE; +} + +/************************************************************************** + Do the work of updating (populating) the message dialog. +**************************************************************************/ +void real_update_meswin_dialog() +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "real_update_meswin_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/messagewin.h freeciv-cvs/client/gui-qpe/messagewin.h --- freeciv-cvs.orig/client/gui-qpe/messagewin.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/messagewin.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__MESSAGEWIN_H +#define FC__MESSAGEWIN_H + +#include "messagewin_g.h" + + +#endif /* FC__MESSAGEWIN_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/pages.c freeciv-cvs/client/gui-qpe/pages.c --- freeciv-cvs.orig/client/gui-qpe/pages.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/pages.c 2005-03-07 00:31:16.000000000 -0500 @@ -0,0 +1,42 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996-2004 - The Freeciv Team + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "pages.h" + +#include + +/************************************************************************** + Sets the "page" that the client should show. See documentation in + pages_g.h. +**************************************************************************/ +void set_client_page(enum client_pages page) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "set_client_page"); + /* PORTME */ +} + +/**************************************************************************** + Set the list of available rulesets. The default ruleset should be + "default", and if the user changes this then set_ruleset() should be + called. +****************************************************************************/ +void gui_set_rulesets(char rulesets[][64], int ruleset_count) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "gui_set_rulesets"); + /* PORTME */ +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/pages.h freeciv-cvs/client/gui-qpe/pages.h --- freeciv-cvs.orig/client/gui-qpe/pages.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/pages.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,18 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996-2004 - The Freeciv Team + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ +#ifndef FC__PAGES_H +#define FC__PAGES_H + +#include "pages_g.h" + +#endif /* FC__PAGES_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/plrdlg.cpp freeciv-cvs/client/gui-qpe/plrdlg.cpp --- freeciv-cvs.orig/client/gui-qpe/plrdlg.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/plrdlg.cpp 2005-03-07 00:19:34.000000000 -0500 @@ -0,0 +1,240 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include +#include +#include +#include + +#include "main_impl.h" +#include "canvas.h" + +#include "plrdlg.h" +#include "colors.h" + +extern "C" { +#include +#include "config_hack.h" +#include "climisc.h" +#include "clinet.h" +#include "text.h" +#include "tilespec.h" // For player_color +} + + +class playersListItem : public QListViewItem +{ + public: + playersListItem( QListView *parent, const struct player * ); + static const player * getPlayer( QListViewItem * ); + const struct player *pplayer; + QPixmap flag; + private: + static QString tr( const char * ); +}; + +playersListItem::playersListItem( QListView *parent, const struct player *id ) + : QListViewItem( parent ), pplayer(id) +{ + if ( Sprite *pflag = get_nation_by_plr(pplayer)->flag_sprite ) + flag.convertFromImage(*pflag->image); + + setText( 0, pplayer->name ); + setPixmap(1, flag); + setText( 1, get_nation_name(pplayer->nation) ); + setText( 2, pplayer->team == TEAM_NONE ? + "" : team_get_by_id(pplayer->team)->name ); + + /* Remember that this is used by playerSelected() below */ + if ( pplayer->player_no != game.player_idx ) + { + const struct player_diplstate *pds = + pplayer_get_diplstate(game.player_ptr, pplayer); + if ( pds->type == DS_CEASEFIRE ) + setText( 3, tr("%1 (%2)"). + arg(diplstate_text(pds->type)). + arg(pds->turns_left) ); + else + setText( 3, diplstate_text(pds->type) ); + } + + setText( 4, pplayer->is_alive ? + pplayer->is_connected ? + is_player_phase(pplayer, game.phase) ? + pplayer->phase_done ? + "done" : + "moving" : + "waiting" : + "" : + "R.I.P." ); +} + +const struct player * playersListItem::getPlayer( QListViewItem *i ) +{ + if (i == NULL) + return NULL; + else + return ((playersListItem *) i)->pplayer; +} + +QString playersListItem::tr( const char *str ) +{ + return QListView::tr(str); +} + + +/************************************************************************** + Update all information in the player list dialog. +**************************************************************************/ +void CivClient::refreshPlayers() +{ + /* If we don't check frozen(), we get called with nation == -1 */ + if (! is_plrdlg_frozen()) + { + const struct player *selected = + playersListItem::getPlayer( + playersList->selectedItem() ); + + playersList->clear(); + players_iterate(pplayer) { + int i = pplayer->player_no; + + if ( is_barbarian(&game.players[i]) ) + continue; + + playersList->setSelected( + new playersListItem( playersList, pplayer ), + pplayer == selected ); + } players_iterate_end; + } +} + +void update_players_dialog(void) { + civclient->refreshPlayers(); +} + +void CivClient::playerSelected( QListViewItem *i ) +{ + if (i == NULL) + { + playerBox->setEnabled(FALSE); + return; + } + + const struct player *pplayer = playersListItem::getPlayer(i); + + playerBox->setTitle( QString("%1 (%2) %3").arg(pplayer->name) + .arg(pplayer->ai.control ? "A.I." : "Human") + .arg( get_nation_name(pplayer->nation) ) ); + + QPixmap p = ((playersListItem *)i)->flag; + flagLabel->setPixmap(p); + p.fill( colors_standard[player_color(pplayer)] ); + borderLabel->setPixmap(p); + + teamText->setText( pplayer->team == TEAM_NONE ? + "none" : team_get_by_id(pplayer->team)->name ); + + embassyText->setText( get_embassy_status(game.player_ptr, pplayer) ); + intelButton->setEnabled( can_intel_with_player(pplayer) ); + meetButton->setEnabled( can_meet_with_player(pplayer) ); + + visionText->setText( get_vision_status(game.player_ptr, pplayer) ); + visionButton->setEnabled( + can_client_issue_orders() && + gives_shared_vision(game.player_ptr, pplayer) ); + + diploText->setText( i->text(3) ); + + switch ( pplayer_get_diplstate( game.player_ptr, pplayer )->type ) + { + case DS_WAR: + case DS_NO_CONTACT: + warButton->setEnabled(FALSE); + break; + default: + warButton->setEnabled( + can_client_issue_orders() && + game.player_idx != pplayer->player_no ); + } + + reputationText->setText( reputation_text(pplayer->reputation) ); + + if ( pplayer == game.player_ptr || ! pplayer->ai.control ) + loveText->setText("n/a"); + else + loveText->setText( love_text(pplayer->ai.love[ + game.player_ptr->player_no ]) ); + + stateText->setText( pplayer->is_alive ? + pplayer->is_connected ? + pplayer->phase_done ? + "done" : "moving" : + "" : + "R.I.P." ); + + hostText->setText( player_addr_hack(pplayer) ); + idleText->setText( pplayer->nturns_idle > 3 ? + tr("(idle %1 turns)").arg(pplayer->nturns_idle - 1) : + QString::null ); + pingText->setText( get_ping_time_text(pplayer) ); + + shipButton->setEnabled( pplayer->spaceship.state != SSHIP_NONE ); + + playerBox->setEnabled(TRUE); +} + + +void CivClient::intelClicked() +{ + const struct player *pplayer = + playersListItem::getPlayer( playersList->selectedItem() ); + assert(pplayer != NULL); + + if (can_intel_with_player(pplayer)) + popupIntel(pplayer); +} + +void CivClient::meetClicked() +{ + const struct player *pplayer = + playersListItem::getPlayer( playersList->selectedItem() ); + assert(pplayer != NULL); + + if (can_meet_with_player(pplayer)) + dsend_packet_diplomacy_init_meeting_req( &aconnection, + pplayer->player_no ); +} + +void CivClient::visionClicked() +{ + const struct player *pplayer = + playersListItem::getPlayer( playersList->selectedItem() ); + assert(pplayer != NULL); + + dsend_packet_diplomacy_cancel_pact( &aconnection, + pplayer->player_no, + CLAUSE_VISION ); +} + +void CivClient::warClicked() +{ + const struct player *pplayer = + playersListItem::getPlayer( playersList->selectedItem() ); + assert(pplayer != NULL); + + dsend_packet_diplomacy_cancel_pact( &aconnection, + pplayer->player_no, + CLAUSE_CEASEFIRE ); +} + diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/plrdlg.h freeciv-cvs/client/gui-qpe/plrdlg.h --- freeciv-cvs.orig/client/gui-qpe/plrdlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/plrdlg.h 2004-12-11 10:34:59.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__PLRDLG_H +#define FC__PLRDLG_H + +extern "C" { +#include "config_hack.h" +#include "plrdlg_g.h" +} + + +#endif /* FC__PLRDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/qpe_dialog.h freeciv-cvs/client/gui-qpe/qpe_dialog.h --- freeciv-cvs.orig/client/gui-qpe/qpe_dialog.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/qpe_dialog.h 2004-12-09 05:27:33.000000000 -0500 @@ -0,0 +1,20 @@ +#ifndef FC__EXEC_DIALOG_H +#define FC__EXEC_DIALOG_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_QPE +#include +#define showDialog(dialog, nomax) QPEApplication::showDialog(dialog, nomax) +#define execDialog(dialog, nomax) QPEApplication::execDialog(dialog, nomax) +#else +#define showDialog(dialog, nomax) (dialog)->show() +#define execDialog(dialog, nomax) (dialog)->exec() +#endif + +#undef BORDER_WIDTH + + +#endif diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/repodlgs.cpp freeciv-cvs/client/gui-qpe/repodlgs.cpp --- freeciv-cvs.orig/client/gui-qpe/repodlgs.cpp 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/repodlgs.cpp 2004-12-23 01:35:59.000000000 -0500 @@ -0,0 +1,415 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "classes/main_impl.h" +#include "classes/listview.h" + +#include "repodlgs.h" + +extern "C" { +#include +#include "clinet.h" +#include "config_hack.h" +#include "repodlgs_common.h" +#include "text.h" +} + + +class ScienceItem +{ + public: + ScienceItem(int); + int operator<( const ScienceItem & ) const; + int index; + QString name; +}; + +ScienceItem::ScienceItem( int i ) + : index(i) +{ + if ( is_future_tech(i) ) + name = QObject::tr("Future Tech. %1") + .arg( i - game.num_tech_types ); + else + name = advances[i].name; +} + +int ScienceItem::operator<( const ScienceItem &i ) const +{ + return name.compare(i.name); +} + + +class ScienceList : public QList +{ + public: + ScienceList(); + protected: + int compareItems( QCollection::Item, QCollection::Item ); +}; + +ScienceList::ScienceList() + : QList() +{ +} + +int ScienceList::compareItems( QCollection::Item a, QCollection::Item b ) +{ + return *(ScienceItem *)a < *(ScienceItem *)b; +} + + +/************************************************************************** + Update the science report. +**************************************************************************/ +void CivClient::updateScience() +{ + ScienceList sortedList; + sortedList.setAutoDelete(TRUE); + + scienceProgressLabel->setText( science_dialog_text() ); + + // Set up scienceNext + + sortedList.clear(); + if ( ! is_future_tech(game.player_ptr->research.researching) ) + { + for ( int i = A_FIRST; i < game.num_tech_types; i++ ) + if ( get_invention(game.player_ptr, i) + == TECH_REACHABLE ) + sortedList.append( new ScienceItem(i) ); + } + // FIXME: Future techs + + sortedList.sort(); + + scienceNextBox->clear(); + if ( game.player_ptr->research.researching == A_UNSET ) + { + scienceNextBox->insertItem( advances[A_NONE].name ); + scienceNextMap[0] = A_NONE; + } + + for ( unsigned int i = 0; i < sortedList.count(); i++ ) + { + scienceNextBox->insertItem( sortedList.at(i)->name ); + scienceNextMap[scienceNextBox->count() - 1] = + sortedList.at(i)->index; + + if ( sortedList.at(i)->index == + game.player_ptr->research.researching ) + { + scienceNextBox->setCurrentItem( scienceNextBox->count() + - 1 ); + } + } + + scienceNextLabel->setText( tr("%1/%2") + .arg( game.player_ptr->research.bulbs_researched ) + .arg( total_bulbs_required(game.player_ptr) ) ); + + // Set up scienceGoal + + sortedList.clear(); + for ( int i = A_FIRST; i < game.num_tech_types; i++ ) + { + if ( tech_is_available(game.player_ptr, i) + && get_invention(game.player_ptr, i) + != TECH_KNOWN + && advances[i].req[0] != A_LAST + && advances[i].req[1] != A_LAST + && ( num_unknown_techs_for_goal( + game.player_ptr, i) < 11 + || i == game.player_ptr->ai.tech_goal) ) + { + sortedList.append( new ScienceItem(i) ); + } + } + + sortedList.sort(); + + scienceGoalBox->clear(); + if ( game.player_ptr->ai.tech_goal == A_UNSET ) + { + scienceGoalBox->insertItem( advances[A_NONE].name ); + scienceGoalMap[0] = A_NONE; + } + + for ( unsigned int i = 0; i < sortedList.count(); i++ ) + { + scienceGoalBox->insertItem( sortedList.at(i)->name ); + scienceGoalMap[scienceGoalBox->count() - 1] = + sortedList.at(i)->index; + + if ( sortedList.at(i)->index == + game.player_ptr->ai.tech_goal ) + { + scienceGoalBox->setCurrentItem( scienceNextBox->count() + - 1 ); + } + } + + scienceGoalLabel->setText( tr("(%1 steps)") + .arg( num_unknown_techs_for_goal( game.player_ptr, + game.player_ptr->ai.tech_goal ) ) ); + + // Set up sciencePrev + + sortedList.clear(); + for ( int i = A_FIRST; i < game.num_tech_types; i++ ) + if ( get_invention(game.player_ptr, i) == TECH_KNOWN ) + sortedList.append( new ScienceItem(i) ); + + sortedList.sort(); + + sciencePrevList->clear(); + for ( unsigned int i = 0; i < sortedList.count(); i++ ) + sciencePrevList->insertItem( sortedList.at(i)->name ); + + + scienceNextBox->setEnabled( can_client_issue_orders() ); + scienceGoalBox->setEnabled( can_client_issue_orders() ); +} + +void CivClient::scienceNextChanged(int i) +{ + printf("Choosing next %i => %i\n", i, scienceNextMap[i]); + dsend_packet_player_research( &aconnection, scienceNextMap[i] ); +} + +void CivClient::scienceGoalChanged(int i) +{ + printf("Choosing goal %i => %i\n", i, scienceGoalMap[i]); + dsend_packet_player_tech_goal( &aconnection, scienceGoalMap[i] ); +} + +void science_dialog_update(void) +{ + civclient->updateScience(); +} + +/************************************************************************** + Popup (or raise) the science report(F6). It may or may not be modal. +**************************************************************************/ +void CivClient::popupScience() +{ + tabs->showPage(scienceTab); +} + +void popup_science_dialog(bool make_modal) +{ + civclient->popupScience(); +} + +/************************************************************************** + Update the economy report. +**************************************************************************/ +struct EconomyRow { + bool is_impr; + int type; +}; + +// Tried a specialization instead, but couldn't get the goddamn thing to work :( +class EconomyItem : public ListViewItem +{ + public: + EconomyItem( QListView * parent, struct EconomyRow * row, + QString s1, QString s2 = QString::null, + QString s3 = QString::null, QString s4 = QString::null, + QString s5 = QString::null, QString s6 = QString::null, + QString s7 = QString::null, QString s8 = QString::null ) + : ListViewItem( parent, + row, s1, s2, s3, s4, s5, s6, s7, s8 ) + { + } + ~EconomyItem() + { + delete data; + } +}; + + +void CivClient::updateEconomy() +{ + /* If we don't check this, very bad things happen */ + if ( is_report_dialogs_frozen() || !can_client_change_view() ) return; + + economyList->clear(); + economySellOldButton->setEnabled(FALSE); + economySellAllButton->setEnabled(FALSE); + + int tax, total; + + int n_impr; + struct improvement_entry impr_entries[B_LAST]; + get_economy_report_data(impr_entries, &n_impr, &total, &tax); + + for ( int i = 0; i < n_impr; i++ ) + { + struct improvement_entry *p = &impr_entries[i]; + + EconomyRow *row = new EconomyRow; + row->is_impr = TRUE; + row->type = p->type; + + (void) new EconomyItem( economyList, row, + get_improvement_name(p->type), + QString::number(p->count), + QString::number(p->cost), + QString::number(p->total_cost) ); + } + + int n_units = 0; + struct unit_entry unit_entries[U_LAST]; + get_economy_report_units_data(unit_entries, &n_units, &total); + + for ( int i = 0; i < n_units; i++ ) + { + struct unit_entry *p = &unit_entries[i]; + + EconomyRow *row = new EconomyRow; + row->is_impr = FALSE; + row->type = p->type; + + (void) new EconomyItem( economyList, row, + unit_name(p->type), + QString::number(p->count), + QString::number(p->cost), + QString::number(p->total_cost) ); + } + + economyLabel->setText( tr("Income: %1 Total Costs: %2") + .arg(tax).arg(total) ); +} + +void CivClient::economyListSelected(QListViewItem *tmp) +{ + EconomyRow *i = ((EconomyItem *) tmp)->data; + + if (i->is_impr) + { + bool is_sellable = improvement_exists(i->type) + && can_sell_building(i->type) + && can_client_issue_orders(); + + economySellOldButton->setEnabled( improvement_obsolete( + game.player_ptr, i->type ) + && is_sellable ); + + economySellAllButton->setEnabled(is_sellable); + } else + { + economySellOldButton->setEnabled(FALSE); + economySellAllButton->setEnabled( can_client_issue_orders() ); + } +} + +void CivClient::economySellOld() +{ + EconomyRow *i = ((EconomyItem *) economyList->selectedItem())->data; + + assert(i != NULL); + + char str[1024]; + if (i->is_impr) + { + sell_all_improvements( i->type, TRUE, str, sizeof(str) ); + statusMsg(str); + } +} + +void CivClient::economySellAll() +{ + EconomyRow *i = ((EconomyItem *) economyList->selectedItem())->data; + + assert(i != NULL); + + char str[1024]; + if (i->is_impr) + sell_all_improvements( i->type, FALSE, str, sizeof(str) ); + else + disband_all_units( i->type, FALSE, str, sizeof(str) ); + + statusMsg(str); +} + +void economy_report_dialog_update(void) +{ + civclient->updateEconomy(); +} + +/************************************************************************** + Popup (or raise) the economy report (F5). It may or may not be modal. +**************************************************************************/ +void CivClient::popupEconomy() +{ + tabs->showPage(economyTab); +} + +void popup_economy_report_dialog(bool make_modal) +{ + civclient->popupEconomy(); +} + +/************************************************************************** + Update the units report. +**************************************************************************/ +void activeunits_report_dialog_update(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "activeunits_report_dialog_update"); + /* PORTME */ +} + +/************************************************************************** + Popup (or raise) the units report (F2). It may or may not be modal. +**************************************************************************/ +void popup_activeunits_report_dialog(bool make_modal) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_activeunits_report_dialog"); + /* PORTME */ +} + +void update_report_dialogs(void) +{ + if (is_report_dialogs_frozen()) return; + activeunits_report_dialog_update(); + economy_report_dialog_update(); + // city_report_dialog_update(); + science_dialog_update(); +} + + +/**************************************************************** + Show a dialog with player statistics at endgame. +*****************************************************************/ +void popup_endgame_report_dialog(struct packet_endgame_report *packet) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_endgame_report_dialog"); + /* PORTME */ +} + +/************************************************************************* + Server options dialog +*************************************************************************/ +void popup_settable_options_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_settable_options_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/repodlgs.h freeciv-cvs/client/gui-qpe/repodlgs.h --- freeciv-cvs.orig/client/gui-qpe/repodlgs.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/repodlgs.h 2004-12-19 09:26:27.000000000 -0500 @@ -0,0 +1,23 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__REPODLGS_H +#define FC__REPODLGS_H + +extern "C" { +#include "config_hack.h" +#include "repodlgs_g.h" +} + + +#endif /* FC__REPODLGS_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/spaceshipdlg.c freeciv-cvs/client/gui-qpe/spaceshipdlg.c --- freeciv-cvs.orig/client/gui-qpe/spaceshipdlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/spaceshipdlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,48 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "spaceshipdlg.h" + +#include + + +/************************************************************************** + Popup (or raise) the spaceship dialog for the given player. +**************************************************************************/ +void popup_spaceship_dialog(struct player *pplayer) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popup_spaceship_dialog"); + /* PORTME */ +} + +/************************************************************************** + Close the spaceship dialog for the given player. +**************************************************************************/ +void popdown_spaceship_dialog(struct player *pplayer) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "popdown_spaceship_dialog"); + /* PORTME */ +} + +/************************************************************************** + Refresh (update) the spaceship dialog for the given player. +**************************************************************************/ +void refresh_spaceship_dialog(struct player *pplayer) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "refresh_spaceship_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/spaceshipdlg.h freeciv-cvs/client/gui-qpe/spaceshipdlg.h --- freeciv-cvs.orig/client/gui-qpe/spaceshipdlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/spaceshipdlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,20 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__SPACESHIPDLG_H +#define FC__SPACESHIPDLG_H + +#include "spaceshipdlg_g.h" + + +#endif /* FC__SPACESHIPDLG_H */ diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/wldlg.c freeciv-cvs/client/gui-qpe/wldlg.c --- freeciv-cvs.orig/client/gui-qpe/wldlg.c 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/wldlg.c 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,29 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "wldlg.h" + +#include + +/************************************************************************** + If the worklist report is open, force its contents to be updated. +**************************************************************************/ +void update_worklist_report_dialog(void) +{ + printf("%s:%u %s()\n", __FILE__, __LINE__, "update_worklist_report_dialog"); + /* PORTME */ +} diff -ruN -x '.swp$' -x '~$' freeciv-cvs.orig/client/gui-qpe/wldlg.h freeciv-cvs/client/gui-qpe/wldlg.h --- freeciv-cvs.orig/client/gui-qpe/wldlg.h 1969-12-31 19:00:00.000000000 -0500 +++ freeciv-cvs/client/gui-qpe/wldlg.h 2004-11-27 11:52:18.000000000 -0500 @@ -0,0 +1,19 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +#ifndef FC__WLDLG_H +#define FC__WLDLG_H + +void update_worklist_report_dialog(void); + +#endif /* FC__WLDLG_H */