diff --git a/src/biomecolordialog.cpp b/src/biomecolordialog.cpp
index be02096..fb90977 100644
--- a/src/biomecolordialog.cpp
+++ b/src/biomecolordialog.cpp
@@ -27,7 +27,10 @@ BiomeColorDialog::BiomeColorDialog(MainWindow *parent, QString initrc, int mc, i
, modified()
{
ui->setupUi(this);
- ui->buttonOk->setIcon(style()->standardIcon(QStyle::SP_DialogOkButton));
+ connect(ui->buttonRemove, &QPushButton::clicked, this, &BiomeColorDialog::onRemove);
+ connect(ui->buttonSaveAs, &QPushButton::clicked, this, &BiomeColorDialog::onSaveAs);
+ connect(ui->buttonExport, &QPushButton::clicked, this, &BiomeColorDialog::onExport);
+ connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &BiomeColorDialog::onAccept);
memcpy(colors, g_biomeColors, sizeof(colors));
memset(buttons, 0, sizeof(buttons));
@@ -35,12 +38,13 @@ BiomeColorDialog::BiomeColorDialog(MainWindow *parent, QString initrc, int mc, i
unsigned char coldefault[256][3];
initBiomeColors(coldefault);
- QPushButton *button;
ui->gridLayout->setSpacing(2);
separator = new QLabel(tr("Currently inactive biomes:"), this);
separator->setVisible(false);
+ QPushButton *button;
+
button = new QPushButton(getColorIcon(QColor(0,0,0,0), QPen(Qt::transparent)), tr("Import..."), this);
connect(button, &QPushButton::clicked, this, &BiomeColorDialog::onImport);
ui->gridLayout->addWidget(button, 0, 0);
@@ -277,7 +281,7 @@ void BiomeColorDialog::on_comboColormaps_currentIndexChanged(int index)
if (modified)
{
if (activerc.isEmpty())
- on_buttonSaveAs_clicked();
+ onSaveAs();
else
saveColormap(activerc, "");
}
@@ -286,7 +290,7 @@ void BiomeColorDialog::on_comboColormaps_currentIndexChanged(int index)
loadColormap(activerc, true);
}
-void BiomeColorDialog::on_buttonSaveAs_clicked()
+void BiomeColorDialog::onSaveAs()
{
QString rc;
int n;
@@ -310,7 +314,7 @@ void BiomeColorDialog::on_buttonSaveAs_clicked()
activerc = rc;
}
-void BiomeColorDialog::on_buttonExport_clicked()
+void BiomeColorDialog::onExport()
{
QFileInfo finfo(mainwindow->prevdir);
QString fnam = QFileDialog::getSaveFileName(
@@ -333,7 +337,7 @@ void BiomeColorDialog::on_buttonExport_clicked()
}
}
-void BiomeColorDialog::on_buttonRemove_clicked()
+void BiomeColorDialog::onRemove()
{
QString rc = qvariant_cast
" - "The area can be entered via custom rectangle, that is defined " - "by its two opposing corners, relative to a center point. These bounds " - "are inclusive." - "
" - "Alternatively, the area can be defined as a centered square " - "with a certain side length. In this case the area has the bounds: " - "[-X/2, -X/2] on both axes, rounding down and bounds included. For " - "example a centered square with side 3 will go from -2 to 1 for both " - "the X and Z axes." - "
" - "Important to note is that some filters have a scaling associated with " - "them. This means that the area is not defined in blocks, but on a grid " - "with the given spacing (such as chunks instead of blocks). A scaling " - "of 1:16, for example, means that the aforementioned centered square of " - "side 3 will range from -32 to 31 in block coordinates. (Chunk 1 has " - "blocks 16 to 31.)" - "
" - )); - mb.exec(); -} - -void ConditionDialog::on_checkRadius_toggled(bool) -{ - updateMode(); -} - -void ConditionDialog::on_radioSquare_toggled(bool) -{ - updateMode(); -} - -void ConditionDialog::on_radioCustom_toggled(bool) -{ - updateMode(); -} - -void ConditionDialog::on_lineSquare_editingFinished() -{ - int v = ui->lineSquare->text().toInt(); - int area = (v+1) * (v+1); - for (int i = 0; i < 9; i++) - { - if (tempsboxes[i]) - tempsboxes[i]->setMaximum(area); - } -} - -void ConditionDialog::on_buttonCancel_clicked() -{ - on_comboLua_currentIndexChanged(-1); - close(); -} - static uint16_t tristateFlags(QCheckBox *cb, uint16_t flg) { uint16_t ret = 0; @@ -965,7 +877,14 @@ static uint16_t tristateFlags(QCheckBox *cb, uint16_t flg) return ret; } -void ConditionDialog::on_buttonOk_clicked() + +void ConditionDialog::onReject() +{ + on_comboLua_currentIndexChanged(-1); + close(); +} + +void ConditionDialog::onAccept() { on_pushLuaSave_clicked(); @@ -1110,6 +1029,91 @@ void ConditionDialog::on_buttonOk_clicked() close(); } +void ConditionDialog::on_comboBoxType_activated(int) +{ + updateMode(); +} + +void ConditionDialog::on_comboBoxRelative_activated(int) +{ + QPalette pal; + if (ui->comboBoxRelative->currentText().contains(WARNING_CHAR)) + pal.setColor(QPalette::Normal, QPalette::Button, QColor(255,0,0,127)); + ui->comboBoxRelative->setPalette(pal); +} + +void ConditionDialog::on_buttonUncheck_clicked() +{ + for (const auto& it : biomecboxes) + it.second->setCheckState(Qt::Unchecked); +} + +void ConditionDialog::on_buttonInclude_clicked() +{ + for (const auto& it : biomecboxes) + it.second->setCheckState(it.second->isEnabled() ? Qt::PartiallyChecked : Qt::Unchecked); +} + +void ConditionDialog::on_buttonExclude_clicked() +{ + for (const auto& it : biomecboxes) + it.second->setCheckState(it.second->isEnabled() ? Qt::Checked : Qt::Unchecked); +} + +void ConditionDialog::on_buttonAreaInfo_clicked() +{ + QMessageBox mb(this); + mb.setIcon(QMessageBox::Information); + mb.setWindowTitle(tr("Help: area entry")); + mb.setText(tr( + "" + "The area can be entered via custom rectangle, that is defined " + "by its two opposing corners, relative to a center point. These bounds " + "are inclusive." + "
" + "Alternatively, the area can be defined as a centered square " + "with a certain side length. In this case the area has the bounds: " + "[-X/2, -X/2] on both axes, rounding down and bounds included. For " + "example a centered square with side 3 will go from -2 to 1 for both " + "the X and Z axes." + "
" + "Important to note is that some filters have a scaling associated with " + "them. This means that the area is not defined in blocks, but on a grid " + "with the given spacing (such as chunks instead of blocks). A scaling " + "of 1:16, for example, means that the aforementioned centered square of " + "side 3 will range from -32 to 31 in block coordinates. (Chunk 1 has " + "blocks 16 to 31.)" + "
" + )); + mb.exec(); +} + +void ConditionDialog::on_checkRadius_toggled(bool) +{ + updateMode(); +} + +void ConditionDialog::on_radioSquare_toggled(bool) +{ + updateMode(); +} + +void ConditionDialog::on_radioCustom_toggled(bool) +{ + updateMode(); +} + +void ConditionDialog::on_lineSquare_editingFinished() +{ + int v = ui->lineSquare->text().toInt(); + int area = (v+1) * (v+1); + for (int i = 0; i < 9; i++) + { + if (tempsboxes[i]) + tempsboxes[i]->setMaximum(area); + } +} + void ConditionDialog::on_ConditionDialog_finished(int result) { if (item) diff --git a/src/conditiondialog.h b/src/conditiondialog.h index 8ed3c98..71e80a2 100644 --- a/src/conditiondialog.h +++ b/src/conditiondialog.h @@ -188,6 +188,9 @@ public: void updateBiomeSelection(); int warnIfBad(Condition cond); + void onReject(); + void onAccept(); + void getClimateLimits(int limok[6][2], int limex[6][2]); void getClimateLimits(LabeledRange *ranges[6], int limits[6][2]); void setClimateLimits(LabeledRange *ranges[6], int limits[6][2], bool complete); @@ -213,10 +216,6 @@ private slots: void on_lineSquare_editingFinished(); //void on_lineRadius_editingFinished(); - void on_buttonCancel_clicked(); - - void on_buttonOk_clicked(); - void on_ConditionDialog_finished(int result); void on_comboBoxCat_currentIndexChanged(int); diff --git a/src/conditiondialog.ui b/src/conditiondialog.ui index 7d67923..62a786e 100644 --- a/src/conditiondialog.ui +++ b/src/conditiondialog.ui @@ -1635,40 +1635,9 @@ QPushButton:hover {