From 1db08ea8dab11d4767eb92d56b9471e741e38a18 Mon Sep 17 00:00:00 2001 From: adrido Date: Thu, 14 May 2015 09:28:08 +0200 Subject: [PATCH] added color tab and advanced color config --- images/color.svg | 269 ++++++++++++++ mainwindow.cpp | 81 +++- mainwindow.h | 13 + mainwindow.ui | 831 +++++++++++++++++++++++++++++++++++++----- minetestmappergui.qrc | 1 + 5 files changed, 1108 insertions(+), 87 deletions(-) create mode 100644 images/color.svg diff --git a/images/color.svg b/images/color.svg new file mode 100644 index 0000000..6bc2e7f --- /dev/null +++ b/images/color.svg @@ -0,0 +1,269 @@ + + + + + + + + + + unsorted + + + + + Open Clip Art Library, Source: Oxygen Icons, Source: Oxygen Icons, Source: Oxygen Icons, Source: Oxygen Icons + + + + + + + + + + + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 1ee96a5..4c091dd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -146,7 +146,13 @@ void MainWindow::on_button_generate_clicked() <<"--output" << ui->path_OutputImage->text()//"D:\\Users\\Adrian\\Desktop\\test2.png" <<"--colors" << appDir+"\\colors\\colors.txt" <<"--progress" << "--verbose-search-colors=2" //<<"--verbose" - <<"--drawalpha="+ui->drawAlpha->currentText(); + <<"--drawalpha="+ui->drawAlpha->currentText() + <<"--bgcolor" << ui->bgcolor->text() + <<"--blockcolor" << ui->blockcolor->text() + <<"--scalecolor" << ui->scalecolor->text() + <<"--origincolor" << ui->origincolor->text() + <<"--playercolor" << ui->playercolor->text() + <<"--tilebordercolor" << ui->tilebordercolor->text(); if(ui->drawScaleLeft->isChecked() && ui->drawScaleTop->isChecked()){ arguments <<"--drawscale=left,top"; @@ -328,3 +334,76 @@ void MainWindow::on_tabWidget_currentChanged(int index) qDebug()<bgcolor->text(), this, "Select Color",options); + + if (color.isValid()) { + ui->bgcolor->setText(color.name()); + ui->bgcolor->setPalette(QPalette(color)); + //ui->lineEdit_bgcolor->setAutoFillBackground(true); + } +} + +void MainWindow::on_selectBlockColor_clicked() +{ + const QColorDialog::ColorDialogOptions options = QFlag(QColorDialog::DontUseNativeDialog); + const QColor color = QColorDialog::getColor(ui->blockcolor->text(), this, "Select Color",options); + + if (color.isValid()) { + ui->blockcolor->setText(color.name()); + ui->blockcolor->setPalette(QPalette(color)); + //ui->lineEdit_bgcolor->setAutoFillBackground(true); + } +} + +void MainWindow::on_selectScaleColor_clicked() +{ + const QColorDialog::ColorDialogOptions options = QFlag(QColorDialog::DontUseNativeDialog); + const QColor color = QColorDialog::getColor(ui->scalecolor->text(), this, "Select Color",options); + + if (color.isValid()) { + ui->scalecolor->setText(color.name()); + ui->scalecolor->setPalette(QPalette(color)); + //ui->lineEdit_bgcolor->setAutoFillBackground(true); + } +} + +void MainWindow::on_selectOriginColor_clicked() +{ + const QColorDialog::ColorDialogOptions options = QFlag(QColorDialog::DontUseNativeDialog); + const QColor color = QColorDialog::getColor(ui->origincolor->text(), this, "Select Color",options); + + if (color.isValid()) { + ui->origincolor->setText(color.name()); + ui->origincolor->setPalette(QPalette(color)); + //ui->lineEdit_bgcolor->setAutoFillBackground(true); + } +} + + +void MainWindow::on_selectPlayerColor_clicked() +{ + const QColorDialog::ColorDialogOptions options = QFlag(QColorDialog::DontUseNativeDialog); + const QColor color = QColorDialog::getColor(ui->playercolor->text(), this, "Select Color",options); + + if (color.isValid()) { + ui->playercolor->setText(color.name()); + ui->playercolor->setPalette(QPalette(color)); + //ui->lineEdit_bgcolor->setAutoFillBackground(true); + } +} + +void MainWindow::on_selectTileBorderColor_clicked() +{ + const QColorDialog::ColorDialogOptions options = QFlag(QColorDialog::DontUseNativeDialog); + const QColor color = QColorDialog::getColor(ui->tilebordercolor->text(), this, "Select Color",options); + + if (color.isValid()) { + ui->tilebordercolor->setText(color.name()); + ui->tilebordercolor->setPalette(QPalette(color)); + //ui->lineEdit_bgcolor->setAutoFillBackground(true); + } +} diff --git a/mainwindow.h b/mainwindow.h index 97c6580..8f263dd 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -6,6 +6,7 @@ #include #include #include +#include namespace Ui { class MainWindow; @@ -47,6 +48,18 @@ private slots: void on_tabWidget_currentChanged(int index); + void on_selectBgColor_clicked(); + + void on_selectBlockColor_clicked(); + + void on_selectScaleColor_clicked(); + + void on_selectOriginColor_clicked(); + + void on_selectPlayerColor_clicked(); + + void on_selectTileBorderColor_clicked(); + private: Ui::MainWindow *ui; QProgressBar *progressBar; diff --git a/mainwindow.ui b/mainwindow.ui index f740f0e..05f075c 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -146,7 +146,7 @@ - + Map-Limit @@ -307,13 +307,444 @@ - + + + + Heightmap + + + + Generate a height map instead of a regular map + + + Generate a height map instead of a regular map + + + + + false + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + true @@ -332,20 +763,10 @@ 0 0 502 - 390 + 368 - - - - Generate a height map instead of a regular map - - - Generate a height map instead of a regular map - - - @@ -378,7 +799,63 @@ Heightmap colors + + + + If a color is given, a monochrome map is generated in shades of that color, ranging from black at depth -128 to the given color at height 127. + + + Color + + + + + + + If no color is specified, minetestmapper will use a colors file to determine which colors to use at which height level. + + + File + + + true + + + + + + + false + + + a monochrome map is generated in shades of that color, ranging from black at depth -128 to the given color at height 127. + + + + + + e.g. grey,black, #00FF00 + + + + + + false + + + select color + + + + :/color:/color + + + false + + + + @@ -394,7 +871,7 @@ - + @@ -414,58 +891,6 @@ - - - false - - - a monochrome map is generated in shades of that color, ranging from black at depth -128 to the given color at height 127. - - - - - - e.g. grey,black, #00FF00 - - - - - - - false - - - select color - - - false - - - - - - - If a color is given, a monochrome map is generated in shades of that color, ranging from black at depth -128 to the given color at height 127. - - - Color - - - - - - - If no color is specified, minetestmapper will use a colors file to determine which colors to use at which height level. - - - File - - - true - - - - use color or select a heightmap-colors.txt file @@ -594,7 +1019,225 @@ - + + + Colors + + + + + + tilebordercolor + + + + + + + Specify the background color for the image + + + true + + + white + + + + + + + bgcolor + + + + + + + false + + + ./colors/colors.txt + + + + + + + playercolor + + + + + + + Specify the color for empty mapblocks + + + #ffffcc + + + + + + + blockcolor + + + + + + + origincolor + + + + + + + scalecolor + + + + + + + Colors.txt: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + select color + + + + :/color:/color + + + + + + + select color + + + + :/color:/color + + + + + + + select color + + + + :/color:/color + + + + + + + select color + + + + :/color:/color + + + + + + + select color + + + + :/color:/color + + + + + + + select color + + + + :/color:/color + + + + + + + false + + + browse + + + + + + + Specify the color for drawing tile borders + + + black + + + + + + + Specify the color for drawing player locations + + + yellow + + + + + + + Specify the color for drawing the map origin (0,0) + + + red + + + + + + + Specify the color for text in the scales on the side + + + black + + + + + + Map features @@ -753,7 +1396,7 @@ - + MinetestMapper Output @@ -992,8 +1635,8 @@ p, li { white-space: pre-wrap; } -1 - 178 - 363 + 187 + 423 @@ -1020,12 +1663,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 53 - 233 + 73 + 250 - 191 - 232 + 265 + 252 @@ -1036,12 +1679,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 53 - 262 + 73 + 280 - 191 - 261 + 265 + 281 @@ -1056,8 +1699,8 @@ p, li { white-space: pre-wrap; } -1 - 541 - 244 + 759 + 299 @@ -1068,8 +1711,8 @@ p, li { white-space: pre-wrap; } setChecked(bool) - 541 - 244 + 759 + 299 -1 @@ -1088,8 +1731,8 @@ p, li { white-space: pre-wrap; } -1 - 385 - 129 + 528 + 141 @@ -1104,8 +1747,24 @@ p, li { white-space: pre-wrap; } -1 - 385 - 192 + 528 + 204 + + + + + generateHeightmap + toggled(bool) + scrollArea + setEnabled(bool) + + + 201 + 106 + + + 264 + 118 diff --git a/minetestmappergui.qrc b/minetestmappergui.qrc index a98a03c..d80d1b1 100644 --- a/minetestmappergui.qrc +++ b/minetestmappergui.qrc @@ -6,5 +6,6 @@ doc/intro.html doc/manual.html images/help.svg + images/color.svg