code format
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
/*
|
||||
QGL MaterialMapEditor
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
QGL MaterialMapEditor
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "material_map_editor.h"
|
||||
#include "ui_material_map_editor.h"
|
||||
#include "gltexture_manager.h"
|
||||
|
||||
#include "glmaterial.h"
|
||||
#include "gltexture_manager.h"
|
||||
#include "ui_material_map_editor.h"
|
||||
|
||||
#include <qad_types.h>
|
||||
|
||||
|
||||
@@ -34,11 +36,8 @@ MaterialMapEditor::MaterialMapEditor(QWidget * parent): QWidget(parent) {
|
||||
void MaterialMapEditor::changeEvent(QEvent * e) {
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case QEvent::LanguageChange: ui->retranslateUi(this); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +56,7 @@ void MaterialMapEditor::updateIcon() {
|
||||
|
||||
void MaterialMapEditor::mapChanged() {
|
||||
if (!active || !map) return;
|
||||
active = false;
|
||||
active = false;
|
||||
map->use_bitmap = ui->checkMap->isChecked();
|
||||
if (ui->checkMap->isChecked()) {
|
||||
map->color_amount = ui->sliderAmount->value();
|
||||
@@ -75,7 +74,7 @@ void MaterialMapEditor::mapChanged() {
|
||||
|
||||
void MaterialMapEditor::setMap(Map * m) {
|
||||
active = false;
|
||||
map = m;
|
||||
map = m;
|
||||
setEnabled(m);
|
||||
if (!map) return;
|
||||
ui->stackedWidget->setCurrentIndex(map->use_bitmap ? 1 : 0);
|
||||
@@ -85,7 +84,8 @@ void MaterialMapEditor::setMap(Map * m) {
|
||||
ui->sliderOffset->setValue(map->color_offset);
|
||||
ui->spinScaleX->setValue(map->bitmap_scale.x());
|
||||
ui->spinScaleY->setValue(map->bitmap_scale.y());
|
||||
ui->linePath->setProperty("GLpath", map->bitmap_path); ui->linePath->setText(QFileInfo(map->bitmap_path).fileName());
|
||||
ui->linePath->setProperty("GLpath", map->bitmap_path);
|
||||
ui->linePath->setText(QFileInfo(map->bitmap_path).fileName());
|
||||
updateIcon();
|
||||
active = true;
|
||||
}
|
||||
@@ -110,18 +110,21 @@ QColor MaterialMapEditor::color() const {
|
||||
|
||||
/*
|
||||
Map MaterialMapEditor::map() {
|
||||
Map m;
|
||||
map->color_amount = ui->sliderAmount->value();
|
||||
map->color_offset = ui->sliderOffset->value();
|
||||
map->bitmap_scale.setX(ui->spinScaleX->value());
|
||||
map->bitmap_scale.setY(ui->spinScaleY->value());
|
||||
map->bitmap_path = ui->linePath->property("GLpath").toString();
|
||||
return m;
|
||||
Map m;
|
||||
map->color_amount = ui->sliderAmount->value();
|
||||
map->color_offset = ui->sliderOffset->value();
|
||||
map->bitmap_scale.setX(ui->spinScaleX->value());
|
||||
map->bitmap_scale.setY(ui->spinScaleY->value());
|
||||
map->bitmap_path = ui->linePath->property("GLpath").toString();
|
||||
return m;
|
||||
}
|
||||
*/
|
||||
|
||||
void MaterialMapEditor::on_buttonSelect_clicked() {
|
||||
QString str = QFileDialog::getOpenFileName(this, "Select image", ui->linePath->property("GLpath").toString(), "Images(*.bmp *.jpg *.jpeg *.png *.tif *.tiff *.tga);;All files(*)");
|
||||
QString str = QFileDialog::getOpenFileName(this,
|
||||
"Select image",
|
||||
ui->linePath->property("GLpath").toString(),
|
||||
"Images(*.bmp *.jpg *.jpeg *.png *.tif *.tiff *.tga);;All files(*)");
|
||||
if (str.isEmpty()) return;
|
||||
ui->linePath->setProperty("GLpath", str);
|
||||
ui->linePath->setText(QFileInfo(str).fileName());
|
||||
|
||||
Reference in New Issue
Block a user