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()) {
current = Qt::white;
}
const QColor color = QColorDialog::getColor(current, this, NULL, options);
const QColor color = QColorDialog::getColor(current, this, nullptr, options);
if (color.isValid()) {
this->setText(color.name());

View File

@ -119,8 +119,9 @@ void ConfigDialog::on_browseMapper_clicked()
QString ConfigSettings::getDefaultMapperExecutable()
{
QStringList locations = getMapperExecutables();
if (locations.empty()) return "";
else return locations.at(0);
if (locations.empty())
return QString();
return locations.at(0);
}
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!
return QVariant();
}
else if(role == Qt::DecorationRole && col==4){
else if(role == Qt::DecorationRole && col==4){
return item->getColor();
}
else if(role == Qt::CheckStateRole && col ==1){

View File

@ -207,9 +207,9 @@ void Geometry::computeCorner0()
{
for (int i = 0; i < 2; i++) {
if (dimension[i] < 0)
corner[0][i] = center[i] + (-dimension[i]) / 2;
else
corner[0][i] = center[i] - dimension[i] / 2;
corner[0][i] = center[i] + (-dimension[i]) / 2;
else
corner[0][i] = center[i] - dimension[i] / 2;
}
}
@ -217,9 +217,9 @@ void Geometry::computeCorner1()
{
for (int i = 0; i < 2; i++) {
if (dimension[i] < 0)
corner[1][i] = corner[0][i] + dimension[i] + 1;
else
corner[1][i] = corner[0][i] + dimension[i] - 1;
corner[1][i] = corner[0][i] + dimension[i] + 1;
else
corner[1][i] = corner[0][i] + dimension[i] - 1;
}
}
@ -227,9 +227,9 @@ void Geometry::computeCenter()
{
for (int i = 0; i < 2; i++) {
if (corner[0][i] > corner[1][i])
center[i] = corner[0][i] - (-dimension[i]) / 2;
else
center[i] = corner[0][i] + dimension[i] / 2;
center[i] = corner[0][i] - (-dimension[i]) / 2;
else
center[i] = corner[0][i] + dimension[i] / 2;
}
}
@ -237,8 +237,8 @@ void Geometry::computeDimensions()
{
for (int i = 0; i < 2; i++) {
if (corner[0][i] > corner[1][i])
dimension[i] = corner[1][i] - corner[0][i] - 1;
else
dimension[i] = corner[1][i] - corner[0][i] + 1;
dimension[i] = corner[1][i] - corner[0][i] - 1;
else
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"
"The arguments can be removed, modified, or new arguments can be added."),//label
arguments.join("\n"),//text
&ok,0);
&ok);
if (ok) arguments = parameters.split("\n");
else {
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
void MainWindow::slotProfileChanged(QAction* action)
{
if(action != 0) {
if(action) {
writeProfile();
currentProfile = action->data().toString();
readProfile();
@ -889,7 +889,7 @@ void MainWindow::on_actionNew_Profile_triggered()
tr("Name of the new Profile:"),//label
QLineEdit::Normal,
"",//text
&ok,0);
&ok);
if(ok && !profile.isEmpty()) {
currentProfile = profile;
QAction *action = new QAction(profile, this);