Modernize

master
Unknown 2019-03-25 05:18:21 +01:00
parent fd180c9590
commit 0a927fec52
5 changed files with 20 additions and 19 deletions

View File

@ -19,7 +19,7 @@ void ColorLineEdit::selectColor()
if (!current.isValid()) { if (!current.isValid()) {
current = Qt::white; current = Qt::white;
} }
const QColor color = QColorDialog::getColor(current, this, NULL, options); const QColor color = QColorDialog::getColor(current, this, nullptr, options);
if (color.isValid()) { if (color.isValid()) {
this->setText(color.name()); this->setText(color.name());

View File

@ -119,8 +119,9 @@ void ConfigDialog::on_browseMapper_clicked()
QString ConfigSettings::getDefaultMapperExecutable() QString ConfigSettings::getDefaultMapperExecutable()
{ {
QStringList locations = getMapperExecutables(); QStringList locations = getMapperExecutables();
if (locations.empty()) return ""; if (locations.empty())
else return locations.at(0); return QString();
return locations.at(0);
} }
void ConfigSettings::addMapperExecutablesToList(QStringList &existingList, QStringList &pathList) void ConfigSettings::addMapperExecutablesToList(QStringList &existingList, QStringList &pathList)

View File

@ -116,7 +116,7 @@ QVariant DrawMapFigureTableModel::data(const QModelIndex &index, int role) const
// FIXME: Implement me! // FIXME: Implement me!
return QVariant(); return QVariant();
} }
else if(role == Qt::DecorationRole && col==4){ else if(role == Qt::DecorationRole && col==4){
return item->getColor(); return item->getColor();
} }
else if(role == Qt::CheckStateRole && col ==1){ else if(role == Qt::CheckStateRole && col ==1){

View File

@ -207,9 +207,9 @@ void Geometry::computeCorner0()
{ {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (dimension[i] < 0) if (dimension[i] < 0)
corner[0][i] = center[i] + (-dimension[i]) / 2; corner[0][i] = center[i] + (-dimension[i]) / 2;
else else
corner[0][i] = center[i] - dimension[i] / 2; corner[0][i] = center[i] - dimension[i] / 2;
} }
} }
@ -217,9 +217,9 @@ void Geometry::computeCorner1()
{ {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (dimension[i] < 0) if (dimension[i] < 0)
corner[1][i] = corner[0][i] + dimension[i] + 1; corner[1][i] = corner[0][i] + dimension[i] + 1;
else else
corner[1][i] = corner[0][i] + dimension[i] - 1; corner[1][i] = corner[0][i] + dimension[i] - 1;
} }
} }
@ -227,9 +227,9 @@ void Geometry::computeCenter()
{ {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (corner[0][i] > corner[1][i]) if (corner[0][i] > corner[1][i])
center[i] = corner[0][i] - (-dimension[i]) / 2; center[i] = corner[0][i] - (-dimension[i]) / 2;
else else
center[i] = corner[0][i] + dimension[i] / 2; center[i] = corner[0][i] + dimension[i] / 2;
} }
} }
@ -237,8 +237,8 @@ void Geometry::computeDimensions()
{ {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (corner[0][i] > corner[1][i]) if (corner[0][i] > corner[1][i])
dimension[i] = corner[1][i] - corner[0][i] - 1; dimension[i] = corner[1][i] - corner[0][i] - 1;
else else
dimension[i] = corner[1][i] - corner[0][i] + 1; dimension[i] = corner[1][i] - corner[0][i] + 1;
} }
} }

View File

@ -431,7 +431,7 @@ void MainWindow::on_button_generate_clicked()
tr("MinetestMapper will be executed using this arguments. \n" tr("MinetestMapper will be executed using this arguments. \n"
"The arguments can be removed, modified, or new arguments can be added."),//label "The arguments can be removed, modified, or new arguments can be added."),//label
arguments.join("\n"),//text arguments.join("\n"),//text
&ok,0); &ok);
if (ok) arguments = parameters.split("\n"); if (ok) arguments = parameters.split("\n");
else { else {
ui->button_generate->setDisabled(false); ui->button_generate->setDisabled(false);
@ -560,7 +560,7 @@ void MainWindow::createProfilesMenu(){
// Called every time, when a menu entry of the profile menu is called // Called every time, when a menu entry of the profile menu is called
void MainWindow::slotProfileChanged(QAction* action) void MainWindow::slotProfileChanged(QAction* action)
{ {
if(action != 0) { if(action) {
writeProfile(); writeProfile();
currentProfile = action->data().toString(); currentProfile = action->data().toString();
readProfile(); readProfile();
@ -889,7 +889,7 @@ void MainWindow::on_actionNew_Profile_triggered()
tr("Name of the new Profile:"),//label tr("Name of the new Profile:"),//label
QLineEdit::Normal, QLineEdit::Normal,
"",//text "",//text
&ok,0); &ok);
if(ok && !profile.isEmpty()) { if(ok && !profile.isEmpty()) {
currentProfile = profile; currentProfile = profile;
QAction *action = new QAction(profile, this); QAction *action = new QAction(profile, this);