19#include <QApplication>
47 QHBoxLayout *some_layout;
48 QVBoxLayout *main_layout;
49 QPushButton *cancel_button;
50 QPushButton *ok_button;
51 QPushButton *apply_button;
56 setWindowTitle(
_(
"Tax rates"));
57 main_layout =
new QVBoxLayout;
66 str = QString(
_(
"%1 - max rate: %2%")).
68 QString::number(max));
70 l2 =
new QLabel(
_(
"Select tax, luxury and science rates"));
72 l1->setAlignment(Qt::AlignHCenter);
73 l2->setAlignment(Qt::AlignHCenter);
74 main_layout->addWidget(l2);
75 main_layout->addWidget(l1);
76 main_layout->addSpacing(20);
78 cancel_button =
new QPushButton(
_(
"Cancel"));
79 ok_button =
new QPushButton(
_(
"Ok"));
80 apply_button =
new QPushButton(
_(
"Apply"));
81 some_layout =
new QHBoxLayout;
82 connect(cancel_button, &QAbstractButton::pressed,
84 connect(apply_button, &QAbstractButton::pressed,
86 connect(ok_button, &QAbstractButton::pressed,
88 some_layout->addWidget(cancel_button);
89 some_layout->addWidget(apply_button);
90 some_layout->addWidget(ok_button);
92 main_layout->addWidget(
fcde);
93 main_layout->addSpacing(20);
94 main_layout->addLayout(some_layout);
95 setLayout(main_layout);
134 QGroupBox *group_box;
135 QHBoxLayout *some_layout;
138 QVBoxLayout *main_layout;
143 setWindowTitle(
_(
"Change policies"));
144 main_layout =
new QVBoxLayout;
147 QHBoxLayout *hb =
new QHBoxLayout;
151 slider =
new QSlider(Qt::Horizontal,
this);
155 connect(slider, &QAbstractSlider::valueChanged,
158 label =
new QLabel(QString::number(
mult_to_scale(pmul, val)));
159 hb->addWidget(slider);
161 hb->addWidget(label);
162 group_box->setLayout(hb);
163 slider->setProperty(
"lab", QVariant::fromValue((
void *) label));
164 main_layout->addWidget(group_box);
167 some_layout =
new QHBoxLayout;
172 connect(
ok_button, &QAbstractButton::pressed,
176 main_layout->addSpacing(20);
177 main_layout->addLayout(some_layout);
178 setLayout(main_layout);
187 qo = (QSlider *) QObject::sender();
191 qvar = qo->property(
"lab");
192 lab =
reinterpret_cast<QLabel *
>(qvar.value<
void *>());
193 lab->setText(QString::number(qo->value()));
248 QRect rect = QApplication::primaryScreen()->availableGeometry();
254 p.setY(p.y() - trd->height() / 2);
258 if (p.y() + trd->height() > rect.bottom()) {
259 p.setY(rect.bottom() - trd->height());
261 if (p.x() + trd->width() > rect.right()) {
262 p.setX(rect.right() - trd->width());
310 setMouseTracking(
true);
344 p.setRenderHint(QPainter::TextAntialiasing);
345 p.setBrush(Qt::SolidPattern);
346 p.setPen(Qt::SolidLine);
357 pix_scaled = pix->scaled(s, Qt::IgnoreAspectRatio,
358 Qt::SmoothTransformation);
360 p.drawPixmap(
pos, 0, pix_scaled);
361 pos =
pos + pix_scaled.width();
365 pix_scaled = pix->scaled(s, Qt::IgnoreAspectRatio,
366 Qt::SmoothTransformation);
368 p.drawPixmap(
pos, 0, pix_scaled);
369 pos =
pos + pix_scaled.width();
373 pix_scaled = pix->scaled(s, Qt::IgnoreAspectRatio,
374 Qt::SmoothTransformation);
375 for (i = j; i < 10; i++) {
376 p.drawPixmap(
pos, 0, pix_scaled);
377 pos =
pos + pix_scaled.width();
389 if (
event->buttons() & Qt::LeftButton) {
390 mouse_x =
static_cast<double>(
event->pos().x());
409 float x_min, x_max, x_mouse;
412 setCursor(Qt::SizeHorCursor);
414 setCursor(Qt::ArrowCursor);
417 x_mouse =
static_cast<float>(
event->pos().x());
431 if (
event->buttons() & Qt::LeftButton) {
433 x_min = x_mouse *
width() /
435 if (x_min < 0) x_min = 0;
449 x_max = x_mouse *
width() /
454 if (x_max >
width()) {
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite int int int width
void mouseMoveEvent(QMouseEvent *event)
fc_double_edge(QWidget *parent=NULL)
void paintEvent(QPaintEvent *event)
void mousePressEvent(QMouseEvent *event)
QPixmap * get_pixmap(const QString &id)
static fc_icons * instance()
void slot_cancel_button_pressed()
void slot_set_value(int i)
void slot_ok_button_pressed()
QList< QSlider * > slider_list
QPushButton * cancel_button
multipler_rates_dialog(QWidget *parent=0)
void slot_cancel_button_pressed()
void slot_apply_button_pressed()
void slot_ok_button_pressed()
tax_rates_dialog(QWidget *parent=0)
bool can_client_issue_orders(void)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
const char * government_name_for_player(const struct player *pplayer)
static int scale_to_mult(const struct multiplier *pmul, int scale)
static int mult_to_scale(const struct multiplier *pmul, int val)
Multiplier_type_id multiplier_count(void)
const char * multiplier_name_translation(const struct multiplier *pmul)
bool multiplier_can_be_changed(struct multiplier *pmul, struct player *pplayer)
Multiplier_type_id multiplier_index(const struct multiplier *pmul)
#define multipliers_iterate(_mul_)
#define multipliers_iterate_end
int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
int player_multiplier_target_value(const struct player *pplayer, const struct multiplier *pmul)
static int scale_to_mult(const struct multiplier *pmul, int scale)
void popup_multiplier_dialog(void)
void popup_rates_dialog(void)
void real_multipliers_dialog_update(void *unused)
static int mult_to_scale(const struct multiplier *pmul, int val)
int multipliers[MAX_NUM_MULTIPLIERS]
struct player_economic economic
struct sprite * get_tax_sprite(const struct tileset *t, Output_type_id otype)