QGroupBox *ServerDialog::create3v3Box() { QGroupBox *box = new QGroupBox(tr("3v3 options")); box->setEnabled(Config.GameMode == "06_3v3"); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *vlayout = new QVBoxLayout; official_3v3_radiobutton = new QRadioButton(tr("Official mode")); QComboBox *officialComboBox = new QComboBox; officialComboBox->addItem(tr("Classical"), "Classical"); officialComboBox->addItem("2012", "2012"); officialComboBox->addItem("2013", "2013"); official_3v3_ComboBox = officialComboBox; QString rule = Config.value("3v3/OfficialRule", "2012").toString(); if (rule == "2012") officialComboBox->setCurrentIndex(1); else if (rule == "2013") officialComboBox->setCurrentIndex(2); QRadioButton *extend = new QRadioButton(tr("Extension mode")); QPushButton *extend_edit_button = new QPushButton(tr("General selection ...")); extend_edit_button->setEnabled(false); connect(extend, SIGNAL(toggled(bool)), extend_edit_button, SLOT(setEnabled(bool))); connect(extend_edit_button, SIGNAL(clicked()), this, SLOT(select3v3Generals())); exclude_disaster_checkbox = new QCheckBox(tr("Exclude disasters")); exclude_disaster_checkbox->setChecked(Config.value("3v3/ExcludeDisasters", true).toBool()); QComboBox *roleChooseComboBox = new QComboBox; roleChooseComboBox->addItem(tr("Normal"), "Normal"); roleChooseComboBox->addItem(tr("Random"), "Random"); roleChooseComboBox->addItem(tr("All roles"), "AllRoles"); role_choose_ComboBox = roleChooseComboBox; QString scheme = Config.value("3v3/RoleChoose", "Normal").toString(); if (scheme == "Random") roleChooseComboBox->setCurrentIndex(1); else if (scheme == "AllRoles") roleChooseComboBox->setCurrentIndex(2); vlayout->addLayout(HLay(official_3v3_radiobutton, official_3v3_ComboBox)); vlayout->addLayout(HLay(extend, extend_edit_button)); vlayout->addWidget(exclude_disaster_checkbox); vlayout->addLayout(HLay(new QLabel(tr("Role choose")), role_choose_ComboBox)); box->setLayout(vlayout); bool using_extension = Config.value("3v3/UsingExtension", false).toBool(); if (using_extension) extend->setChecked(true); else official_3v3_radiobutton->setChecked(true); return box; }
QWidget *ServerDialog::createAITab(){ QVBoxLayout *layout = new QVBoxLayout; ai_enable_checkbox = new QCheckBox(tr("Enable AI")); ai_enable_checkbox->setChecked(Config.EnableAI); role_predictable_checkbox = new QCheckBox(tr("Role predictable")); role_predictable_checkbox->setChecked(Config.value("RolePredictable", false).toBool()); ai_chat_checkbox = new QCheckBox(tr("AI Chat")); ai_chat_checkbox->setChecked(Config.value("AIChat", true).toBool()); ai_delay_spinbox = new QSpinBox; ai_delay_spinbox->setMinimum(0); ai_delay_spinbox->setMaximum(5000); ai_delay_spinbox->setValue(Config.AIDelay); ai_delay_spinbox->setSuffix(tr(" millisecond")); layout->addWidget(ai_enable_checkbox); layout->addWidget(role_predictable_checkbox); layout->addWidget(ai_chat_checkbox); layout->addLayout(HLay(new QLabel(tr("AI delay")), ai_delay_spinbox)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); return widget; }
QGroupBox *ServerDialog::createXModeBox() { QGroupBox *box = new QGroupBox(tr("XMode options")); box->setEnabled(Config.GameMode == "06_XMode"); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QComboBox *roleChooseComboBox = new QComboBox; roleChooseComboBox->addItem(tr("Normal"), "Normal"); roleChooseComboBox->addItem(tr("Random"), "Random"); roleChooseComboBox->addItem(tr("All roles"), "AllRoles"); role_choose_xmode_ComboBox = roleChooseComboBox; QString scheme = Config.value("XMode/RoleChooseX", "Normal").toString(); if (scheme == "Random") roleChooseComboBox->setCurrentIndex(1); else if (scheme == "AllRoles") roleChooseComboBox->setCurrentIndex(2); box->setLayout(HLay(new QLabel(tr("Role choose")), role_choose_xmode_ComboBox)); return box; }
QLayout *ServerDialog::createLeft(){ server_name_edit = new QLineEdit; server_name_edit->setText(Config.ServerName); timeout_spinbox = new QSpinBox; timeout_spinbox->setMinimum(5); timeout_spinbox->setMaximum(30); timeout_spinbox->setValue(Config.OperationTimeout); timeout_spinbox->setSuffix(tr(" seconds")); nolimit_checkbox = new QCheckBox(tr("No limit")); nolimit_checkbox->setChecked(false); connect(nolimit_checkbox, SIGNAL(toggled(bool)), timeout_spinbox, SLOT(setDisabled(bool))); nolimit_checkbox->setChecked(Config.OperationNoLimit); QFormLayout *form_layout = new QFormLayout; form_layout->addRow(tr("Server name"), server_name_edit); form_layout->addRow(tr("Operation timeout"), HLay(timeout_spinbox, nolimit_checkbox)); form_layout->addRow(createGameModeBox()); return form_layout; }
QGroupBox *ServerDialog::create1v1Box() { QGroupBox *box = new QGroupBox(tr("1v1 options")); box->setEnabled(Config.GameMode == "02_1v1"); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *vlayout = new QVBoxLayout; QComboBox *officialComboBox = new QComboBox; officialComboBox->addItem(tr("Classical"), "Classical"); officialComboBox->addItem("2013", "2013"); officialComboBox->addItem("OL", "OL"); official_1v1_ComboBox = officialComboBox; QString rule = Config.value("1v1/Rule", "Classical").toString(); if (rule == "2013") officialComboBox->setCurrentIndex(1); else if (rule == "OL") officialComboBox->setCurrentIndex(2); kof_using_extension_checkbox = new QCheckBox(tr("General extensions")); kof_using_extension_checkbox->setChecked(Config.value("1v1/UsingExtension", false).toBool()); kof_card_extension_checkbox = new QCheckBox(tr("Card extensions")); kof_card_extension_checkbox->setChecked(Config.value("1v1/UsingCardExtension", false).toBool()); vlayout->addLayout(HLay(new QLabel(tr("Rule option")), official_1v1_ComboBox)); QHBoxLayout *hlayout = new QHBoxLayout; hlayout->addWidget(new QLabel(tr("Extension setting"))); hlayout->addStretch(); hlayout->addWidget(kof_using_extension_checkbox); hlayout->addWidget(kof_card_extension_checkbox); vlayout->addLayout(hlayout); box->setLayout(vlayout); return box; }
QWidget *ServerDialog::createAITab(){ QVBoxLayout *layout = new QVBoxLayout; ai_enable_checkbox = new QCheckBox(tr("Enable AI")); ai_enable_checkbox->setChecked(Config.EnableAI); role_predictable_checkbox = new QCheckBox(tr("Role predictable")); role_predictable_checkbox->setChecked(Config.value("RolePredictable", false).toBool()); ai_nickname_checkbox = new QCheckBox(tr("AI Nick Names")); ai_nickname_checkbox->setChecked(Config.value("AINames", true).toBool()); ai_chat_checkbox = new QCheckBox(tr("AI Chat")); ai_chat_checkbox->setChecked(Config.value("AIChat", true).toBool()); ai_delay_spinbox = new QSpinBox; ai_delay_spinbox->setMinimum(0); ai_delay_spinbox->setMaximum(5000); ai_delay_spinbox->setValue(Config.AIDelay); ai_delay_spinbox->setSuffix(tr(" millisecond")); updateButtonEnablility(mode_group->checkedButton()); connect(mode_group, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(updateButtonEnablility(QAbstractButton*))); //@todo:connect(mode_group, SIGNAL(activated(QAbstractButton*)), this, SLOT(updateButtonEnablility(QAbstractButton*))); layout->addWidget(ai_enable_checkbox); layout->addWidget(role_predictable_checkbox); layout->addLayout(HLay(new QLabel(tr("AI delay")), ai_delay_spinbox)); layout->addWidget(ai_nickname_checkbox); layout->addWidget(ai_chat_checkbox); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); return widget; }
QWidget *ServerDialog::createAdvancedTab(){ QVBoxLayout *layout = new QVBoxLayout; contest_mode_checkbox = new QCheckBox(tr("Contest mode")); contest_mode_checkbox->setChecked(Config.ContestMode); contest_mode_checkbox->setToolTip(tr("Requires password to login, hide screen name and disable kicking")); free_choose_checkbox = new QCheckBox(tr("Choose generals and cards freely")); free_choose_checkbox->setToolTip(tr("This option enables the cheat menu")); free_choose_checkbox->setChecked(Config.FreeChoose); free_assign_checkbox = new QCheckBox(tr("Assign role and seat freely")); free_assign_checkbox->setChecked(Config.value("FreeAssign").toBool()); free_assign_self_checkbox = new QCheckBox(tr("Assign only your own role")); free_assign_self_checkbox->setChecked(Config.FreeAssignSelf); free_assign_self_checkbox->setEnabled(free_assign_checkbox->isChecked()); connect(free_assign_checkbox,SIGNAL(toggled(bool)), free_assign_self_checkbox, SLOT(setEnabled(bool))); maxchoice_spinbox = new QSpinBox; maxchoice_spinbox->setRange(3, 10); maxchoice_spinbox->setValue(Config.value("MaxChoice", 5).toInt()); forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection")); forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC); disable_chat_checkbox = new QCheckBox(tr("Disable chat")); disable_chat_checkbox->setChecked(Config.DisableChat); second_general_checkbox = new QCheckBox(tr("Enable second general")); scene_checkbox = new QCheckBox(tr("Enable Scene")); scene_checkbox->setChecked(Config.EnableScene); //changjing //changjing max_hp_label = new QLabel(tr("Max HP scheme")); max_hp_scheme_combobox = new QComboBox; max_hp_scheme_combobox->addItem(tr("Sum - 3")); max_hp_scheme_combobox->addItem(tr("Minimum")); max_hp_scheme_combobox->addItem(tr("Average")); max_hp_scheme_combobox->setCurrentIndex(Config.MaxHpScheme); second_general_checkbox->setChecked(Config.Enable2ndGeneral); basara_checkbox = new QCheckBox(tr("Enable Basara")); basara_checkbox->setChecked(Config.EnableBasara); updateButtonEnablility(mode_group->checkedButton()); connect(mode_group,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(updateButtonEnablility(QAbstractButton*))); hegemony_checkbox = new QCheckBox(tr("Enable Hegemony")); hegemony_checkbox->setChecked(Config.EnableHegemony); hegemony_checkbox->setEnabled(basara_checkbox->isChecked()); connect(basara_checkbox,SIGNAL(toggled(bool)),hegemony_checkbox, SLOT(setEnabled(bool))); announce_ip_checkbox = new QCheckBox(tr("Annouce my IP in WAN")); announce_ip_checkbox->setChecked(Config.AnnounceIP); announce_ip_checkbox->setEnabled(false); // not support now address_edit = new QLineEdit; address_edit->setText(Config.Address); #if QT_VERSION >= 0x040700 address_edit->setPlaceholderText(tr("Public IP or domain")); #endif QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP")); connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked())); //address_edit->setEnabled(announce_ip_checkbox->isChecked()); // connect(announce_ip_checkbox, SIGNAL(toggled(bool)), address_edit, SLOT(setEnabled(bool))); port_edit = new QLineEdit; port_edit->setText(QString::number(Config.ServerPort)); port_edit->setValidator(new QIntValidator(1, 9999, port_edit)); layout->addWidget(contest_mode_checkbox); layout->addWidget(forbid_same_ip_checkbox); layout->addWidget(disable_chat_checkbox); layout->addLayout(HLay(free_choose_checkbox, free_assign_checkbox)); layout->addWidget(free_assign_self_checkbox); layout->addLayout(HLay(new QLabel(tr("Upperlimit for general")), maxchoice_spinbox)); layout->addWidget(second_general_checkbox); layout->addLayout(HLay(max_hp_label, max_hp_scheme_combobox)); layout->addLayout(HLay(basara_checkbox, hegemony_checkbox)); layout->addWidget(scene_checkbox); //changjing layout->addWidget(announce_ip_checkbox); layout->addLayout(HLay(new QLabel(tr("Address")), address_edit)); layout->addWidget(detect_button); layout->addLayout(HLay(new QLabel(tr("Port")), port_edit)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); max_hp_label->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_label, SLOT(setVisible(bool))); max_hp_scheme_combobox->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_scheme_combobox, SLOT(setVisible(bool))); return widget; }
QWidget *ServerDialog::createMiscTab() { game_start_spinbox = new QSpinBox; game_start_spinbox->setRange(0, 10); game_start_spinbox->setValue(Config.CountDownSeconds); game_start_spinbox->setSuffix(tr(" seconds")); nullification_spinbox = new QSpinBox; nullification_spinbox->setRange(5, 15); nullification_spinbox->setValue(Config.NullificationCountDown); nullification_spinbox->setSuffix(tr(" seconds")); minimize_dialog_checkbox = new QCheckBox(tr("Minimize the dialog when server runs")); minimize_dialog_checkbox->setChecked(Config.EnableMinimizeDialog); surrender_at_death_checkbox = new QCheckBox(tr("Surrender at the time of Death")); surrender_at_death_checkbox->setChecked(Config.SurrenderAtDeath); luck_card_checkbox = new QCheckBox(tr("Enable the luck card")); luck_card_checkbox->setChecked(Config.EnableLuckCard); QGroupBox *ai_groupbox = new QGroupBox(tr("Artificial intelligence")); ai_groupbox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *layout = new QVBoxLayout; ai_enable_checkbox = new QCheckBox(tr("Enable AI")); ai_enable_checkbox->setChecked(Config.EnableAI); ai_enable_checkbox->setEnabled(false); // Force to enable AI for disabling it causes crashes!! ai_chat_checkbox = new QCheckBox(tr("AI Chat")); ai_chat_checkbox->setChecked(Config.value("AIChat", true).toBool()); ai_delay_spinbox = new QSpinBox; ai_delay_spinbox->setMinimum(0); ai_delay_spinbox->setMaximum(5000); ai_delay_spinbox->setValue(Config.OriginAIDelay); ai_delay_spinbox->setSuffix(tr(" millisecond")); ai_delay_altered_checkbox = new QCheckBox(tr("Alter AI Delay After Death")); ai_delay_altered_checkbox->setChecked(Config.AlterAIDelayAD); ai_delay_ad_spinbox = new QSpinBox; ai_delay_ad_spinbox->setMinimum(0); ai_delay_ad_spinbox->setMaximum(5000); ai_delay_ad_spinbox->setValue(Config.AIDelayAD); ai_delay_ad_spinbox->setSuffix(tr(" millisecond")); ai_delay_ad_spinbox->setEnabled(ai_delay_altered_checkbox->isChecked()); connect(ai_delay_altered_checkbox, SIGNAL(toggled(bool)), ai_delay_ad_spinbox, SLOT(setEnabled(bool))); layout->addWidget(ai_enable_checkbox); layout->addWidget(ai_chat_checkbox); layout->addLayout(HLay(new QLabel(tr("AI delay")), ai_delay_spinbox)); layout->addWidget(ai_delay_altered_checkbox); layout->addLayout(HLay(new QLabel(tr("AI delay After Death")), ai_delay_ad_spinbox)); ai_groupbox->setLayout(layout); QVBoxLayout *tablayout = new QVBoxLayout; tablayout->addLayout(HLay(new QLabel(tr("Game start count down")), game_start_spinbox)); tablayout->addLayout(HLay(new QLabel(tr("Nullification count down")), nullification_spinbox)); tablayout->addWidget(minimize_dialog_checkbox); tablayout->addWidget(surrender_at_death_checkbox); tablayout->addWidget(luck_card_checkbox); tablayout->addWidget(ai_groupbox); tablayout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(tablayout); return widget; }
QWidget *ServerDialog::createAdvancedTab() { QVBoxLayout *layout = new QVBoxLayout; random_seat_checkbox = new QCheckBox(tr("Arrange the seats randomly")); random_seat_checkbox->setChecked(Config.RandomSeat); enable_cheat_checkbox = new QCheckBox(tr("Enable cheat")); enable_cheat_checkbox->setToolTip(tr("This option enables the cheat menu")); enable_cheat_checkbox->setChecked(Config.EnableCheat); free_choose_checkbox = new QCheckBox(tr("Choose generals and cards freely")); free_choose_checkbox->setChecked(Config.FreeChoose); free_choose_checkbox->setVisible(Config.EnableCheat); free_assign_checkbox = new QCheckBox(tr("Assign role and seat freely")); free_assign_checkbox->setChecked(Config.value("FreeAssign").toBool()); free_assign_checkbox->setVisible(Config.EnableCheat); free_assign_self_checkbox = new QCheckBox(tr("Assign only your own role")); free_assign_self_checkbox->setChecked(Config.FreeAssignSelf); free_assign_self_checkbox->setEnabled(free_assign_checkbox->isChecked()); free_assign_self_checkbox->setVisible(Config.EnableCheat); connect(enable_cheat_checkbox, SIGNAL(toggled(bool)), free_choose_checkbox, SLOT(setVisible(bool))); connect(enable_cheat_checkbox, SIGNAL(toggled(bool)), free_assign_checkbox, SLOT(setVisible(bool))); connect(enable_cheat_checkbox, SIGNAL(toggled(bool)), free_assign_self_checkbox, SLOT(setVisible(bool))); connect(free_assign_checkbox, SIGNAL(toggled(bool)), free_assign_self_checkbox, SLOT(setEnabled(bool))); pile_swapping_label = new QLabel(tr("Pile-swapping limitation")); pile_swapping_label->setToolTip(tr("-1 means no limitations")); pile_swapping_spinbox = new QSpinBox; pile_swapping_spinbox->setRange(-1, 15); pile_swapping_spinbox->setValue(Config.value("PileSwappingLimitation", 5).toInt()); without_lordskill_checkbox = new QCheckBox(tr("Without Lordskill")); without_lordskill_checkbox->setChecked(Config.value("WithoutLordskill", false).toBool()); sp_convert_checkbox = new QCheckBox(tr("Enable SP Convert")); sp_convert_checkbox->setChecked(Config.value("EnableSPConvert", true).toBool()); maxchoice_spinbox = new QSpinBox; maxchoice_spinbox->setRange(3, 21); maxchoice_spinbox->setValue(Config.value("MaxChoice", 5).toInt()); lord_maxchoice_label = new QLabel(tr("Upperlimit for lord")); lord_maxchoice_label->setToolTip(tr("-1 means that all lords are available")); lord_maxchoice_spinbox = new QSpinBox; lord_maxchoice_spinbox->setRange(-1, 15); lord_maxchoice_spinbox->setValue(Config.value("LordMaxChoice", -1).toInt()); nonlord_maxchoice_spinbox = new QSpinBox; nonlord_maxchoice_spinbox->setRange(0, 15); nonlord_maxchoice_spinbox->setValue(Config.value("NonLordMaxChoice", 2).toInt()); forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection")); forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC); disable_chat_checkbox = new QCheckBox(tr("Disable chat")); disable_chat_checkbox->setChecked(Config.DisableChat); second_general_checkbox = new QCheckBox(tr("Enable second general")); second_general_checkbox->setChecked(Config.Enable2ndGeneral); same_checkbox = new QCheckBox(tr("Enable Same")); same_checkbox->setChecked(Config.EnableSame); max_hp_label = new QLabel(tr("Max HP scheme")); max_hp_scheme_ComboBox = new QComboBox; max_hp_scheme_ComboBox->addItem(tr("Sum - X")); max_hp_scheme_ComboBox->addItem(tr("Minimum")); max_hp_scheme_ComboBox->addItem(tr("Maximum")); max_hp_scheme_ComboBox->addItem(tr("Average")); max_hp_scheme_ComboBox->setCurrentIndex(Config.MaxHpScheme); prevent_awaken_below3_checkbox = new QCheckBox(tr("Prevent maxhp being less than 3 for awaken skills")); prevent_awaken_below3_checkbox->setChecked(Config.PreventAwakenBelow3); prevent_awaken_below3_checkbox->setEnabled(max_hp_scheme_ComboBox->currentIndex() != 0); scheme0_subtraction_label = new QLabel(tr("Subtraction for scheme 0")); scheme0_subtraction_label->setVisible(max_hp_scheme_ComboBox->currentIndex() == 0); scheme0_subtraction_spinbox = new QSpinBox; scheme0_subtraction_spinbox->setRange(-5, 12); scheme0_subtraction_spinbox->setValue(Config.Scheme0Subtraction); scheme0_subtraction_spinbox->setVisible(max_hp_scheme_ComboBox->currentIndex() == 0); connect(max_hp_scheme_ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setMaxHpSchemeBox())); basara_checkbox = new QCheckBox(tr("Enable Basara")); basara_checkbox->setChecked(Config.EnableBasara); updateButtonEnablility(mode_group->checkedButton()); connect(mode_group, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(updateButtonEnablility(QAbstractButton *))); hegemony_checkbox = new QCheckBox(tr("Enable Hegemony")); hegemony_checkbox->setChecked(Config.EnableBasara && Config.EnableHegemony); hegemony_checkbox->setEnabled(basara_checkbox->isChecked()); connect(basara_checkbox, SIGNAL(toggled(bool)), hegemony_checkbox, SLOT(setChecked(bool))); connect(basara_checkbox, SIGNAL(toggled(bool)), hegemony_checkbox, SLOT(setEnabled(bool))); hegemony_maxchoice_label = new QLabel(tr("Upperlimit for hegemony")); hegemony_maxchoice_spinbox = new QSpinBox; hegemony_maxchoice_spinbox->setRange(5, 21); hegemony_maxchoice_spinbox->setValue(Config.value("HegemonyMaxChoice", 7).toInt()); hegemony_maxshown_label = new QLabel(tr("Max shown num for hegemony")); hegemony_maxshown_spinbox = new QSpinBox; hegemony_maxshown_spinbox->setRange(1, 11); hegemony_maxshown_spinbox->setValue(Config.value("HegemonyMaxShown", 2).toInt()); address_edit = new QLineEdit; address_edit->setText(Config.Address); #if QT_VERSION >= 0x040700 address_edit->setPlaceholderText(tr("Public IP or domain")); #endif QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP")); connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked())); port_edit = new QLineEdit; port_edit->setText(QString::number(Config.ServerPort)); port_edit->setValidator(new QIntValidator(1, 9999, port_edit)); layout->addWidget(forbid_same_ip_checkbox); layout->addWidget(disable_chat_checkbox); layout->addWidget(random_seat_checkbox); layout->addWidget(enable_cheat_checkbox); layout->addWidget(free_choose_checkbox); layout->addLayout(HLay(free_assign_checkbox, free_assign_self_checkbox)); layout->addLayout(HLay(pile_swapping_label, pile_swapping_spinbox)); layout->addLayout(HLay(without_lordskill_checkbox, sp_convert_checkbox)); layout->addLayout(HLay(new QLabel(tr("Upperlimit for general")), maxchoice_spinbox)); layout->addLayout(HLay(lord_maxchoice_label, lord_maxchoice_spinbox)); layout->addLayout(HLay(new QLabel(tr("Upperlimit for non-lord")), nonlord_maxchoice_spinbox)); layout->addWidget(second_general_checkbox); layout->addLayout(HLay(max_hp_label, max_hp_scheme_ComboBox)); layout->addLayout(HLay(scheme0_subtraction_label, scheme0_subtraction_spinbox)); layout->addWidget(prevent_awaken_below3_checkbox); layout->addLayout(HLay(basara_checkbox, hegemony_checkbox)); layout->addLayout(HLay(hegemony_maxchoice_label, hegemony_maxchoice_spinbox)); layout->addLayout(HLay(hegemony_maxshown_label, hegemony_maxshown_spinbox)); layout->addWidget(same_checkbox); layout->addLayout(HLay(new QLabel(tr("Address")), address_edit)); layout->addWidget(detect_button); layout->addLayout(HLay(new QLabel(tr("Port")), port_edit)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); max_hp_label->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_label, SLOT(setVisible(bool))); max_hp_scheme_ComboBox->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_scheme_ComboBox, SLOT(setVisible(bool))); if (Config.Enable2ndGeneral) { prevent_awaken_below3_checkbox->setVisible(max_hp_scheme_ComboBox->currentIndex() != 0); scheme0_subtraction_label->setVisible(max_hp_scheme_ComboBox->currentIndex() == 0); scheme0_subtraction_spinbox->setVisible(max_hp_scheme_ComboBox->currentIndex() == 0); } else { prevent_awaken_below3_checkbox->setVisible(false); scheme0_subtraction_label->setVisible(false); scheme0_subtraction_spinbox->setVisible(false); } connect(second_general_checkbox, SIGNAL(toggled(bool)), this, SLOT(setMaxHpSchemeBox())); hegemony_maxchoice_label->setVisible(Config.EnableHegemony); connect(hegemony_checkbox, SIGNAL(toggled(bool)), hegemony_maxchoice_label, SLOT(setVisible(bool))); hegemony_maxchoice_spinbox->setVisible(Config.EnableHegemony); connect(hegemony_checkbox, SIGNAL(toggled(bool)), hegemony_maxchoice_spinbox, SLOT(setVisible(bool))); hegemony_maxshown_label->setVisible(Config.EnableHegemony); connect(hegemony_checkbox, SIGNAL(toggled(bool)), hegemony_maxshown_label, SLOT(setVisible(bool))); hegemony_maxshown_spinbox->setVisible(Config.EnableHegemony); connect(hegemony_checkbox, SIGNAL(toggled(bool)), hegemony_maxshown_spinbox, SLOT(setVisible(bool))); return widget; }
QWidget *ServerDialog::createCheatTab(){ QVBoxLayout *layout = new QVBoxLayout; cheat_enable_checkbox = new QCheckBox(tr("Enable Cheat Menu")); cheat_enable_checkbox->setToolTip(tr("This option enables the cheat menu")); cheat_enable_checkbox->setChecked(Config.value("Cheat/EnableCheatMenu").toBool()); QGroupBox *box = new QGroupBox(tr("cheat options")); box->setEnabled(cheat_enable_checkbox->isChecked()); connect(cheat_enable_checkbox, SIGNAL(toggled(bool)), box, SLOT(setEnabled(bool))); connect(cheat_enable_checkbox, SIGNAL(toggled(bool)), this, SLOT(doCheat(bool))); QVBoxLayout *laybox = new QVBoxLayout; Config.beginGroup("Cheat"); free_choose_generals_checkbox = new QCheckBox(tr("Choose generals freely")); free_choose_generals_checkbox->setChecked(Config.FreeChooseGenerals); free_choose_cards_checkbox = new QCheckBox(tr("Choose cards freely")); free_choose_cards_checkbox->setChecked(Config.FreeChooseCards); free_assign_checkbox = new QCheckBox(tr("Assign role and seat freely")); free_assign_checkbox->setChecked(Config.value("FreeAssign").toBool()); free_assign_self_checkbox = new QCheckBox(tr("Assign only your own role")); free_assign_self_checkbox->setChecked(Config.FreeAssignSelf); free_assign_self_checkbox->setEnabled(free_assign_checkbox->isChecked()); connect(free_assign_checkbox,SIGNAL(toggled(bool)), free_assign_self_checkbox, SLOT(setEnabled(bool))); free_discard_checkbox = new QCheckBox(tr("Regulate freely")); free_discard_checkbox->setChecked(Config.value("FreeRegulate").toBool()); gambling_cards_checkbox = new QCheckBox(tr("Gambling Cards")); gambling_cards_checkbox->setChecked(Config.value("GamblingCards").toBool()); free_change_general_checkbox = new QCheckBox(tr("Change me freely")); free_change_general_checkbox->setChecked(Config.value("FreeChange").toBool()); free_undead_checkbox = new QCheckBox(tr("Undead body")); free_undead_checkbox->setChecked(Config.value("FreeUnDead").toBool()); hands_up_checkbox = new QCheckBox(tr("Hands up")); hands_up_checkbox->setChecked(Config.value("HandsUp").toBool()); Config.endGroup(); laybox->addWidget(free_choose_generals_checkbox); laybox->addWidget(free_choose_cards_checkbox); laybox->addWidget(free_assign_checkbox); laybox->addWidget(free_assign_self_checkbox); laybox->addWidget(free_discard_checkbox); laybox->addWidget(gambling_cards_checkbox); laybox->addWidget(free_change_general_checkbox); laybox->addWidget(free_undead_checkbox); laybox->addWidget(hands_up_checkbox); box->setLayout(laybox); same_checkbox = new QCheckBox(tr("Enable Same")); same_checkbox->setChecked(Config.EnableSame); endless_checkbox = new QCheckBox(tr("Endless Mode")); endless_checkbox->setChecked(Config.EnableEndless); endless_timebox = new QSpinBox; endless_timebox->setRange(1, 100); endless_timebox->setValue(Config.value("EndlessTimes", 3).toInt()); endless_timebox->setToolTip(tr("This box set the swap times")); QLabel *endless_lab = new QLabel(tr("Endless swap")); layout->addWidget(cheat_enable_checkbox); layout->addWidget(box); layout->addWidget(same_checkbox); layout->addLayout(HLay(endless_checkbox, new QLabel, endless_lab, endless_timebox)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); endless_lab->setVisible(Config.EnableEndless); endless_timebox->setVisible(Config.EnableEndless); connect(endless_checkbox, SIGNAL(toggled(bool)), endless_lab, SLOT(setVisible(bool))); connect(endless_checkbox, SIGNAL(toggled(bool)), endless_timebox, SLOT(setVisible(bool))); return widget; }
QWidget *ServerDialog::createAdvancedTab(){ //QVBoxLayout *layout = new QVBoxLayout; QFormLayout *layout = new QFormLayout; contest_mode_checkbox = new QCheckBox(tr("Contest mode")); contest_mode_checkbox->setChecked(Config.ContestMode); contest_mode_checkbox->setToolTip(tr("Requires password to login, hide screen name and disable kicking")); random_seat_checkbox = new QCheckBox(tr("Arrange the seats randomly")); random_seat_checkbox->setChecked(Config.RandomSeat); swap_spinbox = new QSpinBox; swap_spinbox->setRange(1, 1000); swap_spinbox->setFixedWidth(50); swap_spinbox->setValue(Config.value("SwapCount", 6).toInt()); maxchoice_spinbox = new QSpinBox; maxchoice_spinbox->setRange(3, 10); maxchoice_spinbox->setFixedWidth(50); maxchoice_spinbox->setValue(Config.value("MaxChoice", 5).toInt()); forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection")); forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC); disable_chat_checkbox = new QCheckBox(tr("Disable chat")); disable_chat_checkbox->setChecked(Config.DisableChat); second_general_checkbox = new QCheckBox(tr("Enable second general")); nolordskill_checkbox = new QCheckBox(tr("No lord skill")); nolordskill_checkbox->setChecked(Config.NoLordSkill); reincarnation_checkbox = new QCheckBox(tr("Enable Reincarnation")); reincarnation_checkbox->setChecked(Config.EnableReincarnation); reinca_unchange_checkbox = new QCheckBox(tr("Persist general in reincarnation")); reinca_unchange_checkbox->setChecked(Config.value("ReincaPersist").toBool()); scene_checkbox = new QCheckBox(tr("Enable Scene"));//changjing scene_checkbox->setChecked(Config.EnableScene); //changjing max_hp_label = new QLabel(tr("Max HP scheme")); max_hp_scheme_combobox = new QComboBox; max_hp_scheme_combobox->addItem(tr("Sum - 3")); max_hp_scheme_combobox->addItem(tr("Minimum")); max_hp_scheme_combobox->addItem(tr("Average")); max_hp_scheme_combobox->setCurrentIndex(Config.MaxHpScheme); second_general_checkbox->setChecked(Config.Enable2ndGeneral); basara_checkbox = new QCheckBox(tr("Enable Basara")); basara_checkbox->setChecked(Config.EnableBasara); hegemony_checkbox = new QCheckBox(tr("Enable Hegemony")); hegemony_checkbox->setChecked(Config.EnableHegemony); hegemony_checkbox->setEnabled(basara_checkbox->isChecked()); connect(basara_checkbox,SIGNAL(toggled(bool)),hegemony_checkbox, SLOT(setEnabled(bool))); announce_ip_checkbox = new QCheckBox(tr("Annouce my IP in WAN")); announce_ip_checkbox->setChecked(Config.AnnounceIP); announce_ip_checkbox->setEnabled(false); // not support now address_edit = new QLineEdit; address_edit->setText(Config.Address); #if QT_VERSION >= 0x040700 address_edit->setPlaceholderText(tr("Public IP or domain")); #endif QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP")); connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked())); //address_edit->setEnabled(announce_ip_checkbox->isChecked()); // connect(announce_ip_checkbox, SIGNAL(toggled(bool)), address_edit, SLOT(setEnabled(bool))); port_edit = new QLineEdit; port_edit->setText(QString::number(Config.ServerPort)); port_edit->setValidator(new QIntValidator(1, 9999, port_edit)); layout->addRow(HLay(contest_mode_checkbox, random_seat_checkbox)); layout->addRow(HLay(forbid_same_ip_checkbox, disable_chat_checkbox)); layout->addRow(HLay(new QLabel(tr("Upperlimit for general")), maxchoice_spinbox, new QLabel(tr("Swap pile count")), swap_spinbox)); layout->addRow(HLay(second_general_checkbox, nolordskill_checkbox)); layout->addRow(HLay(max_hp_label, max_hp_scheme_combobox)); layout->addRow(HLay(basara_checkbox, hegemony_checkbox)); layout->addRow(scene_checkbox); //changjing layout->addRow(HLay(reincarnation_checkbox, reinca_unchange_checkbox)); layout->addRow(HLay(new QLabel(tr("Address")), address_edit, new QLabel(tr("Port")), port_edit)); layout->addRow(HLay(announce_ip_checkbox, detect_button)); //layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); max_hp_label->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_label, SLOT(setVisible(bool))); max_hp_scheme_combobox->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_scheme_combobox, SLOT(setVisible(bool))); reinca_unchange_checkbox->setVisible(Config.value("ReincaPersist", false).toBool()); connect(reincarnation_checkbox, SIGNAL(toggled(bool)), reinca_unchange_checkbox, SLOT(setVisible(bool))); return widget; }
QWidget *ServerDialog::createMiscTab() { game_start_spinbox = new QSpinBox; game_start_spinbox->setRange(0, 10); game_start_spinbox->setValue(Config.CountDownSeconds); game_start_spinbox->setSuffix(tr(" seconds")); nullification_spinbox = new QSpinBox; nullification_spinbox->setRange(5, 15); nullification_spinbox->setValue(Config.NullificationCountDown); nullification_spinbox->setSuffix(tr(" seconds")); minimize_dialog_checkbox = new QCheckBox(tr("Minimize the dialog when server runs")); minimize_dialog_checkbox->setChecked(Config.EnableMinimizeDialog); surrender_at_death_checkbox = new QCheckBox(tr("Surrender at the time of Death")); surrender_at_death_checkbox->setChecked(Config.SurrenderAtDeath); luck_card_label = new QLabel(tr("Upperlimit for use time of luck card")); luck_card_spinbox = new QSpinBox; luck_card_spinbox->setRange(0, 3); luck_card_spinbox->setValue(Config.LuckCardLimitation); reward_the_first_showing_player_checkbox = new QCheckBox(tr("The first player to show general can draw 2 cards")); reward_the_first_showing_player_checkbox->setChecked(Config.RewardTheFirstShowingPlayer); QGroupBox *ai_groupbox = new QGroupBox(tr("Artificial intelligence")); ai_groupbox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *layout = new QVBoxLayout; forbid_adding_robot_checkbox = new QCheckBox(tr("Forbid adding robot")); forbid_adding_robot_checkbox->setChecked(Config.ForbidAddingRobot); ai_chat_checkbox = new QCheckBox(tr("Enable AI chat")); ai_chat_checkbox->setChecked(Config.value("AIChat", true).toBool()); ai_chat_checkbox->setDisabled(Config.ForbidAddingRobot); connect(forbid_adding_robot_checkbox, SIGNAL(toggled(bool)), ai_chat_checkbox, SLOT(setDisabled(bool))); ai_delay_spinbox = new QSpinBox; ai_delay_spinbox->setMinimum(0); ai_delay_spinbox->setMaximum(5000); ai_delay_spinbox->setValue(Config.OriginAIDelay); ai_delay_spinbox->setSuffix(tr(" millisecond")); ai_delay_spinbox->setDisabled(Config.ForbidAddingRobot); connect(forbid_adding_robot_checkbox, SIGNAL(toggled(bool)), ai_delay_spinbox, SLOT(setDisabled(bool))); ai_delay_altered_checkbox = new QCheckBox(tr("Alter AI Delay After Death")); ai_delay_altered_checkbox->setChecked(Config.AlterAIDelayAD); ai_delay_altered_checkbox->setDisabled(Config.ForbidAddingRobot); connect(forbid_adding_robot_checkbox, SIGNAL(toggled(bool)), ai_delay_altered_checkbox, SLOT(setDisabled(bool))); ai_delay_ad_spinbox = new QSpinBox; ai_delay_ad_spinbox->setMinimum(0); ai_delay_ad_spinbox->setMaximum(5000); ai_delay_ad_spinbox->setValue(Config.AIDelayAD); ai_delay_ad_spinbox->setSuffix(tr(" millisecond")); ai_delay_ad_spinbox->setEnabled(ai_delay_altered_checkbox->isChecked()); ai_delay_ad_spinbox->setDisabled(Config.ForbidAddingRobot); connect(ai_delay_altered_checkbox, SIGNAL(toggled(bool)), ai_delay_ad_spinbox, SLOT(setEnabled(bool))); connect(forbid_adding_robot_checkbox, SIGNAL(toggled(bool)), ai_delay_ad_spinbox, SLOT(setDisabled(bool))); layout->addLayout(HLay(forbid_adding_robot_checkbox, ai_chat_checkbox)); layout->addLayout(HLay(new QLabel(tr("AI delay")), ai_delay_spinbox)); layout->addWidget(ai_delay_altered_checkbox); layout->addLayout(HLay(new QLabel(tr("AI delay After Death")), ai_delay_ad_spinbox)); ai_groupbox->setLayout(layout); QVBoxLayout *tablayout = new QVBoxLayout; tablayout->addLayout(HLay(new QLabel(tr("Game start count down")), game_start_spinbox)); tablayout->addLayout(HLay(new QLabel(tr("Nullification count down")), nullification_spinbox)); tablayout->addLayout(HLay(minimize_dialog_checkbox, surrender_at_death_checkbox)); tablayout->addLayout(HLay(luck_card_label, luck_card_spinbox)); tablayout->addWidget(reward_the_first_showing_player_checkbox); tablayout->addWidget(ai_groupbox); tablayout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(tablayout); return widget; }
QWidget *ServerDialog::createAdvancedTab() { QVBoxLayout *layout = new QVBoxLayout; forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection")); forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC); disable_chat_checkbox = new QCheckBox(tr("Disable chat")); disable_chat_checkbox->setChecked(Config.DisableChat); random_seat_checkbox = new QCheckBox(tr("Arrange the seats randomly")); random_seat_checkbox->setChecked(Config.RandomSeat); enable_cheat_checkbox = new QCheckBox(tr("Enable cheat")); enable_cheat_checkbox->setToolTip(tr("<font color=%1>This option enables the cheat menu</font>").arg(Config.SkillDescriptionInToolTipColor.name())); enable_cheat_checkbox->setChecked(Config.EnableCheat); free_choose_checkbox = new QCheckBox(tr("Choose generals and cards freely")); free_choose_checkbox->setChecked(Config.FreeChoose); free_choose_checkbox->setVisible(Config.EnableCheat); connect(enable_cheat_checkbox, SIGNAL(toggled(bool)), free_choose_checkbox, SLOT(setVisible(bool))); pile_swapping_label = new QLabel(tr("Pile-swapping limitation")); pile_swapping_label->setToolTip(tr("<font color=%1>-1 means no limitations</font>").arg(Config.SkillDescriptionInToolTipColor.name())); pile_swapping_spinbox = new QSpinBox; pile_swapping_spinbox->setRange(-1, 15); pile_swapping_spinbox->setValue(Config.value("PileSwappingLimitation", 5).toInt()); hegemony_maxchoice_label = new QLabel(tr("Upperlimit for hegemony")); hegemony_maxchoice_spinbox = new QSpinBox; hegemony_maxchoice_spinbox->setRange(5, 7); //wait for a new extension hegemony_maxchoice_spinbox->setValue(Config.value("HegemonyMaxChoice", 7).toInt()); address_edit = new QLineEdit; address_edit->setText(Config.Address); #if QT_VERSION >= 0x040700 address_edit->setPlaceholderText(tr("Public IP or domain")); #endif QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP")); connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked())); port_edit = new QLineEdit; port_edit->setText(QString::number(Config.ServerPort)); port_edit->setValidator(new QIntValidator(1, 9999, port_edit)); layout->addLayout(HLay(forbid_same_ip_checkbox, disable_chat_checkbox)); layout->addWidget(random_seat_checkbox); layout->addWidget(enable_cheat_checkbox); layout->addWidget(free_choose_checkbox); layout->addLayout(HLay(pile_swapping_label, pile_swapping_spinbox)); layout->addLayout(HLay(hegemony_maxchoice_label, hegemony_maxchoice_spinbox)); layout->addLayout(HLay(new QLabel(tr("Address")), address_edit)); layout->addWidget(detect_button); layout->addLayout(HLay(new QLabel(tr("Port")), port_edit)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); return widget; }