Freeciv-3.3
Loading...
Searching...
No Matches
optiondlg.cpp
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18// Qt
19#include <QApplication>
20#include <QCheckBox>
21#include <QColorDialog>
22#include <QComboBox>
23#include <QDialogButtonBox>
24#include <QFontDialog>
25#include <QGroupBox>
26#include <QHBoxLayout>
27#include <QLabel>
28#include <QLineEdit>
29#include <QPainter>
30#include <QPushButton>
31#include <QScrollArea>
32#include <QSpinBox>
33
34// utility
35#include "log.h"
36#include "string_vector.h"
37
38// client
39#include "options.h"
40#include "client_main.h"
41
42// gui-qt
43#include "fc_client.h"
44
45#include "optiondlg.h"
46
47enum {
54};
55
56// Global value to store pointers to opened config dialogs
58
59/************************************************************************/
63{
65 QString st, str, result;
66 int i;
67 int j = 0;
68
69 sl = text.split("\n");
70 foreach (const QString &s, sl) {
71 st = s;
72 while (st.length() >= 80) {
73 str = st.left(80);
74 i = str.lastIndexOf(' ');
75 if (i == -1) {
76 i = 80;
77 }
78 result = result + str.left(i) + '\n';
79 /* Skip last space - at (i + 1)
80 unless there there was no space */
81 if (i != 80) {
82 st.remove(0, i + 1);
83 } else {
84 st.remove(0, i);
85 }
86 }
87 str = st;
88 if (str.left(str.length()) != "") {
89 result = result + str.left(str.length()) + '\n';
90 }
91 j++;
92 if (j >= 12 && cut) {
93 result = result + _("... read more in help") + "\n";
94 break;
95 }
96 }
97 result.remove(result.lastIndexOf('\n'), 1);
98
99 return result;
100}
101
102/************************************************************************/
106{
109
110 // Remove all lines from help which has '*' in first 3 chars
111 sl = text.split('\n');
112 foreach (const QString &s, sl) {
113 if (s.length() > 2) {
114 if (s.at(0) != '*' && s.at(1) != '*' && s.at(2) != '*') {
115 ret_str = ret_str + s + '\n';
116 }
117 } else {
118 ret_str = ret_str + s + '\n';
119 }
120 }
121 return ret_str;
122}
123
124/************************************************************************/
128 const option_set *options, bool client_set,
129 QWidget *parent)
130 : qfc_dialog(parent), client_settings(client_set)
131{
132 QPushButton *but;
133
134 curr_options = options;
136 tab_widget = new QTabWidget;
137
139 but = new QPushButton(style()->standardIcon(QStyle::SP_DialogCancelButton),
140 _("Cancel"));
141 button_box->addButton(but, QDialogButtonBox::ActionRole);
142 QObject::connect(but, &QPushButton::clicked, [this]() {
144 });
145
146 but = new QPushButton(style()->standardIcon(QStyle::SP_DialogResetButton),
147 _("Reset"));
148 button_box->addButton(but, QDialogButtonBox::ResetRole);
149 QObject::connect(but, &QPushButton::clicked, [this]() {
151 });
152
153 but = new QPushButton(QIcon::fromTheme("view-refresh"), _("Refresh"));
154 button_box->addButton(but, QDialogButtonBox::ActionRole);
155 QObject::connect(but, &QPushButton::clicked, [this]() {
157 });
158
159 but = new QPushButton(style()->standardIcon(QStyle::SP_DialogApplyButton),
160 _("Apply"));
161 button_box->addButton(but, QDialogButtonBox::ActionRole);
162 QObject::connect(but, &QPushButton::clicked, [this]() {
164 });
165
166 but = new QPushButton(style()->standardIcon(QStyle::SP_DialogSaveButton),
167 _("Save"));
168 button_box->addButton(but, QDialogButtonBox::ActionRole);
169 QObject::connect(but, &QPushButton::clicked, [this]() {
171 });
172
173 but = new QPushButton(style()->standardIcon(QStyle::SP_DialogOkButton),
174 _("Ok"));
175 button_box->addButton(but, QDialogButtonBox::ActionRole);
176 QObject::connect(but, &QPushButton::clicked, [this]() {
178 });
179
181 main_layout->addWidget(tab_widget);
182 categories.clear();
183 fill(options);
184 main_layout->addWidget(button_box);
186
187 setAttribute(Qt::WA_DeleteOnClose);
188}
189
190/************************************************************************/
194{
197 }
198 destroy();
199}
200
201/************************************************************************/
205{
206 switch (response) {
207 case RESPONSE_APPLY:
209 break;
210 case RESPONSE_CANCEL:
212 close();
213 break;
214 case RESPONSE_OK:
217 close();
218 break;
219 case RESPONSE_SAVE:
221 queue_options_save(nullptr);
222 break;
223 case RESPONSE_RESET:
224 full_reset();
225 break;
226 case RESPONSE_REFRESH:
227 full_refresh();
228 break;
229 }
230}
231
232/************************************************************************/
236 QByteArray &a2)
237{
240 QWidget *w;
241 QPushButton *but;
242
243 w = reinterpret_cast<QPushButton *>(option_get_gui_data(poption));
244 but = w->findChild<QPushButton *>("text_color");
245 pal = but->palette();
246 col1 = pal.color(QPalette::Button);
247 but = w->findChild<QPushButton *>("text_background");
248 pal = but->palette();
249 col2 = pal.color(QPalette::Button);
250 a1 = col1.name().toUtf8();
251 a2 = col2.name().toUtf8();
252}
253
254/************************************************************************/
258{
260
262 switch (option_type(poption)) {
263 case OT_BOOLEAN:
265 break;
266 case OT_INTEGER:
268 break;
269 case OT_STRING:
271 break;
272 case OT_ENUM:
274 break;
275 case OT_BITWISE:
277 break;
278 case OT_FONT:
280 break;
281 case OT_COLOR:
284 break;
285 case OT_VIDEO_MODE:
286 log_error("Option type %s (%d) not supported yet.",
289 break;
290 }
292}
293
294
295/************************************************************************/
298void option_dialog::set_bool(struct option *poption, bool value)
299{
300 QCheckBox *c;
301
302 c = reinterpret_cast<QCheckBox *>(option_get_gui_data(poption));
303 if (value) {
304 c->setCheckState(Qt::Checked);
305 } else {
306 c->setCheckState(Qt::Unchecked);
307 }
308}
309
310/************************************************************************/
314{
315 QCheckBox *c;
316
317 c = reinterpret_cast<QCheckBox *>(option_get_gui_data(poption));
318 if (c->checkState() == Qt::Checked) {
319 return true;
320 } else {
321 return false;
322 }
323}
324
325/************************************************************************/
328void option_dialog::set_int(struct option *poption, int value)
329{
330 QSpinBox *s;
331
332 s = reinterpret_cast<QSpinBox *>(option_get_gui_data(poption));
333 s->setValue(value);
334}
335
336/************************************************************************/
342{
344 QPushButton *qp;
345 QFont *fp;
346
347 fp = new QFont();
348 fp->fromString(s);
349 qApp->processEvents();
350 qp = reinterpret_cast<QPushButton *>(option_get_gui_data(poption));
351 ql = s.split(",");
352 if (!s.isEmpty()) {
353 qp->setText(ql[0] + " " + ql[1]);
354 qp->setFont(*fp);
355 }
356}
357
358/************************************************************************/
362{
363 QSpinBox *s;
364
365 s = reinterpret_cast<QSpinBox *>(option_get_gui_data(poption));
366 return s->value();
367}
368
369/************************************************************************/
372void option_dialog::set_string(struct option *poption, const char *string)
373{
374 int i;
375 QComboBox *cb;
376 QLineEdit *le;
377
378 if (option_str_values(poption) != nullptr) {
379 cb = reinterpret_cast<QComboBox *>(option_get_gui_data(poption));
380 i = cb->findText(string);
381 if (i != -1) {
382 cb->setCurrentIndex(i);
383 }
384 } else {
385 le = reinterpret_cast<QLineEdit *>(option_get_gui_data(poption));
386 le->setText(string);
387 }
388}
389
390/************************************************************************/
394{
395 QComboBox *cb;
396 QLineEdit *le;
397
398 if (option_str_values(poption) != nullptr) {
399 cb = reinterpret_cast<QComboBox *>(option_get_gui_data(poption));
400 return cb->currentText().toUtf8();
401 } else {
402 le = reinterpret_cast<QLineEdit *>(option_get_gui_data(poption));
403 return le->displayText().toUtf8();
404 }
405}
406
407/************************************************************************/
410void option_dialog::set_enum(struct option *poption, int index)
411{
412 QComboBox *cb;
413
414 cb = reinterpret_cast<QComboBox *>(option_get_gui_data(poption));
415 cb->setCurrentIndex(index);
416}
417
418/************************************************************************/
422{
423 QComboBox *cb;
424
425 cb = reinterpret_cast<QComboBox *>(option_get_gui_data(poption));
426 return cb->currentIndex();
427}
428
429/************************************************************************/
432void option_dialog::set_bitwise(struct option *poption, unsigned int value)
433{
434 QGroupBox *gb;
435 int i;
437
438 gb = reinterpret_cast<QGroupBox *>(option_get_gui_data(poption));
439 check_buttons = gb->findChildren <QCheckBox *>();
440
441 for (i = 0; i < check_buttons.count(); i++) {
442 if (value & (1 << i)) {
443 check_buttons[i]->setCheckState(Qt::Checked);
444 } else {
445 check_buttons[i]->setCheckState(Qt::Unchecked);
446 }
447 }
448}
449
450/************************************************************************/
454{
455 QGroupBox *gb;
456 int i;
457 unsigned int value = 0;
459
460 gb = reinterpret_cast<QGroupBox *>(option_get_gui_data(poption));
461 check_buttons = gb->findChildren <QCheckBox *>();
462
463 for (i = 0; i < check_buttons.count(); i++) {
464 if (check_buttons[i]->checkState() == Qt::Checked) {
465 value |= 1 << i;
466 }
467 }
468 return value;
469}
470
471/************************************************************************/
474void option_dialog::set_button_color(QPushButton *button,
475 const char *colorname)
476{
477 if (button != nullptr && colorname != nullptr && colorname[0] != '\0') {
478 QString s1 = "QPushButton { background-color: ";
479 QString s2 = ";}";
480 QColor col;
481
482#ifdef FC_QT6X_MODE
483 // Qt-6.4
484 col = QColor::fromString(colorname);
485#else // FC_QT6X_MODE
486 col.setNamedColor(colorname);
487#endif // FC_QT6X_MODE
488 button->setStyleSheet(s1 + col.name() + s2);
489 }
490}
491
492/************************************************************************/
496{
497 QWidget *w;
498 QPushButton *but;
499
500 w = reinterpret_cast<QPushButton *>(option_get_gui_data(poption));
501 but = w->findChild<QPushButton *>("text_color");
502 set_button_color(but, color.foreground);
503
504 but = w->findChild<QPushButton *>("text_background");
505 set_button_color(but, color.background);
506}
507
508/************************************************************************/
512{
513 switch (option_type(poption)) {
514 case OT_BOOLEAN:
516 break;
517 case OT_INTEGER:
519 break;
520 case OT_STRING:
522 break;
523 case OT_ENUM:
525 break;
526 case OT_BITWISE:
528 break;
529 case OT_FONT:
531 break;
532 case OT_COLOR:
534 break;
535 case OT_VIDEO_MODE:
536 log_error("Option type %s (%d) not supported yet.",
538 break;
539 }
540}
541
542/************************************************************************/
551
552/************************************************************************/
561
562/************************************************************************/
566{
567 switch (option_type(poption)) {
568 case OT_BOOLEAN:
570 break;
571 case OT_INTEGER:
573 break;
574 case OT_STRING:
576 break;
577 case OT_ENUM:
579 break;
580 case OT_BITWISE:
582 break;
583 case OT_FONT:
585 break;
586 case OT_COLOR:
588 break;
589 case OT_VIDEO_MODE:
590 log_error("Option type %s (%d) not supported yet.",
592 break;
593 }
594}
595
596/************************************************************************/
599void option_dialog::fill(const struct option_set *poptset)
600{
604}
605
606/************************************************************************/
610{
611 QWidget *widget;
612 QWidget *lwidget;
613 QWidget *twidget;
614 QString category_name, description, qstr;
615 QStringList qlist, qlist2;
616 const char *str;
617 const struct strvec *values;
621 QLabel *label;
622 QScrollArea *scroll;
623 QSpinBox *spin;
624 QComboBox *combo;
625 QLineEdit *edit;
626 QGroupBox *group;
628 QPushButton *button;
629 QFont qf;
631 int min, max, i;
632 unsigned int j;
633 struct ft_color ft_color;
634 QColor c;
635
636 category_name = option_category_name(poption);
637 widget = nullptr;
638
639 if (!categories.contains(category_name)) {
640 twidget = new QWidget();
641 twidget->setProperty("doomed", true);
642 scroll = new QScrollArea();
643 scroll->setProperty("doomed", true);
644 scroll->setWidgetResizable(true);
645 twidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
647 twidget_layout->setSpacing(0);
648 twidget->setLayout(twidget_layout);
649 scroll->setWidget(twidget);
650 tab_widget->addTab(scroll, category_name);
651 categories.append(category_name);
652 widget_map[category_name] = twidget;
653 } else {
654 twidget = widget_map[category_name];
655 }
656
657 description = option_description(poption);
658 switch (option_type(poption)) {
659 case OT_BOOLEAN:
660 widget = new QCheckBox();
661 break;
662
663 case OT_INTEGER:
664 min = option_int_min(poption);
665 max = option_int_max(poption);
666 spin = new QSpinBox();
667 spin->setMinimum(min);
668 spin->setMaximum(max);
669 spin->setSingleStep(MAX((max - min) / 50, 1));
670 widget = spin;
671 break;
672
673 case OT_STRING:
674 values = option_str_values(poption);
675 if (values != nullptr) {
676 combo = new QComboBox();
677 strvec_iterate(values, value) {
678 combo->addItem(value);
680 widget = combo;
681 } else {
682 edit = new QLineEdit();
683 widget = edit;
684 }
685 break;
686
687 case OT_ENUM:
688 combo = new QComboBox();
689
690 for (i = 0; (str = option_enum_int_to_str(poption, i)); i++) {
691 // We store enum value in QVariant
692 combo->addItem(_(str), i);
693 }
694 widget = combo;
695 break;
696
697 case OT_BITWISE:
698 group = new QGroupBox();
700 vbox_layout = new QVBoxLayout();
701 for (j = 0; j < strvec_size(values); j++) {
702 check = new QCheckBox(_(strvec_get(values, j)));
703 vbox_layout->addWidget(check);
704 }
705 group->setLayout(vbox_layout);
706 widget = group;
707 break;
708
709 case OT_FONT:
710 button = new QPushButton();
713 qstr = qf.toString();
714 qlist = qstr.split(",");
715 button->setFont(qf);
716 button->setText(qlist[0] + " " + qlist[1]);
717 connect(button, SIGNAL(clicked()), this, SLOT(select_font()));
718 widget = button;
719 break;
720
721 case OT_COLOR:
723 button = new QPushButton();
724 button->setToolTip(_("Select the text color"));
725 button->setObjectName("text_color");
726 button->setAutoFillBackground(true);
727 button->setAutoDefault(false);
728#ifdef FC_QT6X_MODE
729 // Qt-6.4
730 c = QColor::fromString(ft_color.foreground);
731#else // FC_QT6X_MODE
732 c.setNamedColor(ft_color.foreground);
733#endif // FC_QT6X_MODE
734 pal = button->palette();
735 pal.setColor(QPalette::Button, c);
736 button->setPalette(pal);
737 connect(button, SIGNAL(clicked()), this, SLOT(select_color()));
738 hbox_layout = new QHBoxLayout();
739 hbox_layout->addWidget(button);
740 button = new QPushButton();
741 button->setToolTip(_("Select the background color"));
742 button->setObjectName("text_background");
743 button->setAutoFillBackground(true);
744 button->setAutoDefault(false);
745#ifdef FC_QT6X_MODE
746 // Qt-6.4
747 c = QColor::fromString(ft_color.background);
748#else // FC_QT6X_MODE
749 c.setNamedColor(ft_color.background);
750#endif // FC_QT6X_MODE
751 pal = button->palette();
752 pal.setColor(QPalette::Button, c);
753 button->setPalette(pal);
754 connect(button, SIGNAL(clicked()), this, SLOT(select_color()));
755 hbox_layout->addWidget(button);
756 widget = new QWidget();
757 widget->setObjectName(option_name(poption));
758 widget->setLayout(hbox_layout);
759 break;
760
761 case OT_VIDEO_MODE:
762 log_error("Option type %s (%d) not supported yet.",
764 break;
765 }
766
767 if (widget != nullptr) {
768 hbox_layout = new QHBoxLayout();
769 hbox_layout->setAlignment(Qt::AlignRight);
770 label = new QLabel(description);
771 label->setToolTip(split_text(option_help_text(poption), false));
772 hbox_layout->addWidget(label, 1, Qt::AlignLeft);
773 hbox_layout->addStretch();
774 hbox_layout->addWidget(widget, 1, Qt::AlignRight);
775 lwidget = new QWidget();
776 lwidget->setLayout(hbox_layout);
778 twidget_layout->addWidget(lwidget);
779
780 widget->setEnabled(option_is_changeable(poption));
781 widget->setToolTip(split_text(option_help_text(poption), false));
782 }
783
784 option_set_gui_data(poption, widget); // May set nullptr as the gui_data
786}
787
788/************************************************************************/
791void option_dialog_popup(QString name, const struct option_set *poptset,
792 bool client_set)
793{
795
796 if (::dialog_list.contains(poptset)) {
797 opt_dialog = dialog_list[poptset];
799 opt_dialog->show();
800 } else {
801 opt_dialog = new option_dialog(name, poptset, client_set,
802 gui()->central_wdg);
803 ::dialog_list.insert(poptset, opt_dialog);
804 opt_dialog->show();
805 }
806}
807
808/************************************************************************/
812{
814 bool ok;
815 QFont qf;
816 QPushButton *pb;
817
818 pb = (QPushButton *) QObject::sender();
819 qf = pb->font();
820 qf = QFontDialog::getFont(&ok, qf, this,
821 _("Select Font"));
822 pb->setFont(qf);
823 ql = qf.toString().split(",");
824 pb->setText(ql[0] + " " + ql[1]);
825 raise();
826}
827
828/************************************************************************/
832{
833 QFont f;
834 QString s;
835
837 f.fromString(s);
838 return f;
839}
840
841/************************************************************************/
845{
846 QPushButton *qp;
847 QFont f;
848
849 qp = reinterpret_cast<QPushButton *>(option_get_gui_data(poption));
850 f = qp->font();
851 return f.toString().toUtf8();
852}
853
854/************************************************************************/
858{
859 QPushButton *but;
862
863 but = qobject_cast<QPushButton *>(QObject::sender());
864
865 pal = but->palette();
866 color = QColorDialog::getColor(pal.color(QPalette::Button), this,
867 _("Select Color"));
868 if (color.isValid()) {
869 pal.setColor(QPalette::Button, color);
870 but->setPalette(pal);
871
872 set_button_color(but, color.name().toUtf8());
873 }
874
875 raise();
876}
877
878/************************************************************************/
882{
883 if (client_settings) {
884 if (!gui()->qt_settings.options_client_geometry.isNull()) {
885 restoreGeometry(gui()->qt_settings.options_client_geometry);
886 }
887 } else {
888 if (!gui()->qt_settings.options_server_geometry.isNull()) {
889 restoreGeometry(gui()->qt_settings.options_server_geometry);
890 }
891 }
892}
893
894/************************************************************************/
898{
899 if (client_settings) {
900 gui()->qt_settings.options_client_geometry = saveGeometry();
901 } else {
902 gui()->qt_settings.options_server_geometry = saveGeometry();
903 }
904}
905
906/************************************************************************/
910{
911 if (client_settings) {
912 gui()->qt_settings.options_client_geometry = saveGeometry();
913 } else {
914 gui()->qt_settings.options_server_geometry = saveGeometry();
915 }
916}
917
918/************************************************************************/
921void option_dialog_popdown(const struct option_set *poptset)
922{
924
925 while (::dialog_list.contains(poptset)) {
926 opt_dialog =::dialog_list[poptset];
927 opt_dialog->close();
928 ::dialog_list.remove(poptset);
929 }
930}
931
932/************************************************************************/
936{
938
942 }
943
945 if (strcmp(option_name(poption), "nationset") == 0) {
947 }
948 if (strcmp(option_name(poption), "aifill") == 0) {
949 gui()->pr_options->set_aifill(option_int_get(poption));
950 }
951 }
952}
953
954/************************************************************************/
958{
963}
964
965/************************************************************************/
969{
974}
#define str
Definition astring.c:76
QString split_text(QString text, bool cut)
Definition optiondlg.cpp:62
void reactivate()
Definition dialogs.cpp:345
char * incite_cost
Definition comments.c:76
void update_nationset_combo()
Definition dialogs.cpp:1272
enum event_type event
Definition events.c:81
#define _(String)
Definition fcintl.h:67
static struct ft_color ft_color_construct(const char *foreground, const char *background)
static struct dialog_list * dialog_list
@ RESPONSE_SAVE
Definition optiondlg.c:66
@ RESPONSE_APPLY
Definition optiondlg.c:63
@ RESPONSE_CANCEL
Definition optiondlg.c:61
@ RESPONSE_OK
Definition optiondlg.c:62
@ RESPONSE_RESET
Definition optiondlg.c:64
@ RESPONSE_REFRESH
Definition optiondlg.c:65
#define edit(pedit)
Definition widget_edit.h:34
const char * name
Definition inputfile.c:127
#define log_error(message,...)
Definition log.h:104
static mpgui * gui
Definition mpgui_qt.cpp:52
void option_gui_remove(struct option *poption)
void option_dialog_popdown(const struct option_set *poptset)
QString split_text(QString text, bool cut)
Definition optiondlg.cpp:62
void option_gui_add(struct option *poption)
QMap< const struct option_set *, option_dialog * > dialog_list
Definition optiondlg.cpp:57
void option_gui_update(struct option *poption)
void option_dialog_popup(QString name, const struct option_set *poptset, bool client_set)
@ RESPONSE_SAVE
Definition optiondlg.cpp:53
@ RESPONSE_APPLY
Definition optiondlg.cpp:50
@ RESPONSE_CANCEL
Definition optiondlg.cpp:48
@ RESPONSE_OK
Definition optiondlg.cpp:49
@ RESPONSE_RESET
Definition optiondlg.cpp:51
@ RESPONSE_REFRESH
Definition optiondlg.cpp:52
QString cut_helptext(QString text)
const struct strvec * option_str_values(const struct option *poption)
Definition options.c:966
unsigned option_bitwise_def(const struct option *poption)
Definition options.c:1136
int option_int_min(const struct option *poption)
Definition options.c:907
bool option_bool_def(const struct option *poption)
Definition options.c:859
const char * option_font_def(const struct option *poption)
Definition options.c:1203
const struct option_set * server_optset
Definition options.c:4369
const char * option_description(const struct option *poption)
Definition options.c:689
const char * option_help_text(const struct option *poption)
Definition options.c:699
struct ft_color option_color_get(const struct option *poption)
Definition options.c:1241
int option_enum_get_int(const struct option *poption)
Definition options.c:1031
bool option_str_set(struct option *poption, const char *str)
Definition options.c:977
const char * option_name(const struct option *poption)
Definition options.c:679
int option_int_get(const struct option *poption)
Definition options.c:885
bool option_color_set(struct option *poption, struct ft_color color)
Definition options.c:1264
bool option_bool_set(struct option *poption, bool val)
Definition options.c:870
bool option_is_changeable(const struct option *poption)
Definition options.c:740
void option_set_gui_data(struct option *poption, void *data)
Definition options.c:818
const char * option_str_get(const struct option *poption)
Definition options.c:944
void * option_get_gui_data(const struct option *poption)
Definition options.c:828
bool option_enum_set_int(struct option *poption, int val)
Definition options.c:1091
bool option_bool_get(const struct option *poption)
Definition options.c:848
enum option_type option_type(const struct option *poption)
Definition options.c:709
const char * option_enum_int_to_str(const struct option *poption, int val)
Definition options.c:1016
const struct option_set * option_optset(const struct option *poption)
Definition options.c:659
const char * option_str_def(const struct option *poption)
Definition options.c:955
int option_int_max(const struct option *poption)
Definition options.c:918
bool option_font_set(struct option *poption, const char *font)
Definition options.c:1225
void queue_options_save(option_save_log_callback log_cb)
Definition options.c:6441
const struct strvec * option_bitwise_values(const struct option *poption)
Definition options.c:1164
bool option_bitwise_set(struct option *poption, unsigned val)
Definition options.c:1175
const char * option_font_get(const struct option *poption)
Definition options.c:1192
struct ft_color option_color_def(const struct option *poption)
Definition options.c:1252
unsigned option_bitwise_get(const struct option *poption)
Definition options.c:1125
int option_enum_def_int(const struct option *poption)
Definition options.c:1055
bool option_int_set(struct option *poption, int val)
Definition options.c:929
const char * option_category_name(const struct option *poption)
Definition options.c:729
int option_int_def(const struct option *poption)
Definition options.c:896
#define options_iterate(poptset, poption)
Definition options.h:602
#define options_iterate_end
Definition options.h:607
#define MAX(x, y)
Definition shared.h:54
const char * strvec_get(const struct strvec *psv, size_t svindex)
size_t strvec_size(const struct strvec *psv)
#define strvec_iterate(psv, str)
#define strvec_iterate_end
Definition colors.h:21
const char * background
const char * foreground
unsigned get_bitwise(struct option *poption)
const option_set * curr_options
Definition optiondlg.h:66
void select_color()
void hideEvent(QHideEvent *event)
QTabWidget * tab_widget
Definition optiondlg.h:48
QMap< QString, QWidget * > widget_map
Definition optiondlg.h:51
QByteArray get_button_font(struct option *poption)
void get_color(struct option *poption, QByteArray &a1, QByteArray &a2)
bool get_bool(struct option *poption)
QDialogButtonBox * button_box
Definition optiondlg.h:49
void set_string(struct option *poption, const char *string)
void set_int(struct option *poption, int value)
void full_reset()
QList< QString > categories
Definition optiondlg.h:50
void showEvent(QShowEvent *event)
QByteArray get_string(struct option *poption)
int get_enum(struct option *poption)
void select_font()
void add_option(struct option *poption)
void set_bool(struct option *poption, bool value)
void set_enum(struct option *poption, int index)
void apply_option(int response)
void closeEvent(QCloseEvent *event)
QVBoxLayout * main_layout
Definition optiondlg.h:47
void apply_options()
void full_refresh()
void set_font(struct option *poption, QString s)
QFont get_font(struct option *poption)
const struct option_set * poptset
Definition optiondlg.c:42
void option_dialog_reset(struct option *poption)
void set_color(struct option *poption, struct ft_color color)
void fill(const struct option_set *poptset)
void option_dialog_refresh(struct option *poption)
int get_int(struct option *poption)
void set_button_color(QPushButton *button, const char *colorname)
void set_bitwise(struct option *poption, unsigned value)
option_dialog(const QString &name, const option_set *options, bool client_set, QWidget *parent=nullptr)
bool client_settings
Definition optiondlg.h:65