17 #include <QElapsedTimer>
19 #include <QItemDelegate>
21 #include <QListWidget>
22 #include <QProgressBar>
23 #include <QTableWidget>
26 #include <qobjectdefs.h>
30 #define CITIZENS_PER_ROW 20
35 class QContextMenuEvent;
54 class QTableWidgetItem;
131 void paint(QPainter *painter,
const QStyleOptionViewItem &
option,
132 const QModelIndex &index)
const override;
134 const QModelIndex &index)
const override;
143 const QRect &rect)
const override;
156 QVariant
data()
const;
170 bool sb, QObject *parent = 0);
173 rowCount(
const QModelIndex &index = QModelIndex())
const override
178 int columnCount(
const QModelIndex &parent = QModelIndex())
const override
183 QVariant
data(
const QModelIndex &index,
184 int role = Qt::DisplayRole)
const override;
208 int when,
int curr,
bool show_units,
bool buy =
false,
209 bool show_wonders =
true,
bool show_buildings =
true);
213 void prod_selected(
const QItemSelection &sl,
const QItemSelection &ds);
217 bool eventFilter(QObject *obj, QEvent *ev)
override;
278 #include "ui_citydlg.h"
329 void item_selected(
const QItemSelection &sl,
const QItemSelection &ds);
341 void cma_selected(
const QItemSelection &sl,
const QItemSelection &ds);
void city_font_update()
Updates city font.
void destroy_city_dialog()
cityIconInfoLabel(QWidget *parent=0)
void setCity(struct city *pcity)
void setup_ui(struct city *qcity)
Setups whole city dialog, public function.
void worklist_up()
Move current item on worklist up.
void update_nation_table()
Updates nationality table in happiness tab.
void next_city()
Changes city_dialog to next city after pushing next city button.
void cma_double_clicked(int row, int column)
Double click on some row ( column is unused )
void update_disabled()
Updates buttons/widgets which should be enabled/disabled.
Q_DISABLE_COPY(city_dialog)
void update_buy_button()
Enables/disables buy buttons depending on gold.
void update_building()
Updates building improvement/unit.
void save_worklist()
Save worklist.
void worklist_del()
Remove current item on worklist.
void clear_worklist()
Clears worklist in production page.
city_label * lab_table[6]
void showEvent(QShowEvent *event) override
Show event.
void update_info_label()
Updates information label ( food, prod ...
bool eventFilter(QObject *obj, QEvent *event) override
Event filter for catching keybaord events.
city_dialog(QWidget *parent=0)
Constructor for city_dialog, sets layouts, policies ...
void disband_state_changed(bool allow_disband)
Received signal about changed qcheckbox - allow disbanding city.
void update_citizens()
Redraws citizens for city_label (citizens_label)
void cma_context_menu(const QPoint p)
Context menu on governor tab in city worklist.
void worklist_down()
Move current item on worklist down.
void update_title()
Puts city name and people count on title.
void present_units_exp_col()
Slot to expand or collapse the present units list.
void dbl_click_p(QTableWidgetItem *item)
Double clicked item in worklist table in production tab.
void cma_remove()
Removes selected CMA.
void prev_city()
Changes city_dialog to previous city after pushing prev city button.
void city_rename()
City rename dialog input.
void refresh()
Various refresh after getting new info/reply from server.
void update_cma_tab()
Updates cma tab.
void display_worklist_menu(const QPoint)
Context menu on production tab in city worklist.
void show_targets()
Shows customized table widget with available items to produce Shows default targets in overview city ...
void cma_check_agent(const cm_parameter ¶ms)
Triggers a governor update if the parameters changed.
void fill_citizens_pixmap(QPixmap *pixmap, QPainter *painter, const citizen_category *categories, int num_citizens)
Fill a pixmap with citizen sprites.
void cma_enable()
Enables cma slot, triggered by clicked button or changed cma.
void update_improvements()
Updates list of improvements.
~city_dialog() override
City dialog destructor.
void change_production(bool next)
Changes production to next one or previous.
void cma_selected(const QItemSelection &sl, const QItemSelection &ds)
CMA has been selected from list.
void hideEvent(QHideEvent *event) override
Hide event.
void item_selected(const QItemSelection &sl, const QItemSelection &ds)
Selection changed in production tab, in worklist tab.
void show_targets_worklist()
Shows customized table widget with available items to produce Shows customized targets in city produc...
void cma_changed()
Sliders moved and cma has been changed.
void update_units()
Updates layouts for supported and present units in city.
void save_cma()
Save cma dialog input.
void update_prod_buttons()
Update sensitivity of buttons in production tab.
void update_labels(struct city *ci_city)
city_info(QWidget *parent=0)
QSize sizeHint() const override
city_label(QWidget *parent=0)
city_label is used only for showing citizens icons and was created only to catch mouse events
void set_city(struct city *pcity)
Just sets target city for city_label.
void mousePressEvent(QMouseEvent *event) override
Mouse handler for city_label.
QSize minimumSizeHint() const override
QSize get_pixmap_size() const
city_production_delegate(QPoint sh, QObject *parent, struct city *city)
City item delegate constructor.
~city_production_delegate() override=default
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
City item delgate paint event.
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Size hint for city item delegate.
void drawFocus(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const override
Draws focus for given item.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
city_production_model(struct city *pcity, bool f, bool su, bool sw, bool sb, QObject *parent=0)
Constructor for city production model.
QList< production_item * > city_target_list
int rowCount(const QModelIndex &index=QModelIndex()) const override
void populate()
Fills model with data.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns data from model.
~city_production_model() override
Destructor for city production model.
struct universal * target
~production_item() override
Production item destructor.
QVariant data() const
Returns stored data.
production_item(struct universal *ptarget, QObject *parent)
Production item constructor.
progress_bar(QWidget *parent)
Custom progressbar constructor.
void set_pixmap(struct universal *target)
Sets pixmap from given universal for custom progressbar.
~progress_bar() override
Custom progressbar destructor.
void create_region()
Creates region with diagonal lines.
void resizeEvent(QResizeEvent *event) override
Custom progressbar resize event.
void paintEvent(QPaintEvent *event) override
Paint event for custom progress bar.
void mousePressEvent(QMouseEvent *event) override
The base class for options.