Change string connections to functionpointer connections

master
Unknown 2017-03-06 03:33:19 +01:00
parent 99806a01f2
commit adc60b951f
4 changed files with 46 additions and 42 deletions

View File

@ -54,6 +54,7 @@ RESOURCES += \
TRANSLATIONS = translations/gui_de.ts\
translations/gui_en.ts
CONFIG += c++11
GIT_VERSION = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
#something like 0.4.2-55-g123c456

View File

@ -28,9 +28,12 @@ void ColorsTxtAssistant::on_buttonGenerate_clicked()
makeColors->setFileNodesTxt(fileNodesTxt);
makeColors->setTextureSearchDirectorys(getAllSearchDirs());
connect(makeColors,SIGNAL(outputLog(QString, int)), this, SLOT(reciveOuputLog(QString, int)) );
connect(makeColors,SIGNAL(progressChanged(int)), this, SLOT(reciveProgressChanged(int)));
connect(makeColors,SIGNAL(maxProgressChanged(int)) ,this, SLOT(reciveMaxProgressChanged(int)));
connect(makeColors, &MakeColors::outputLog,
this, &ColorsTxtAssistant::reciveOuputLog );
connect(makeColors, &MakeColors::progressChanged,
this, &ColorsTxtAssistant::reciveProgressChanged);
connect(makeColors, &MakeColors::maxProgressChanged,
this, &ColorsTxtAssistant::reciveMaxProgressChanged);
makeColors->startProcess();
}

View File

@ -79,8 +79,8 @@ MainWindow::MainWindow(bool portable, const QString &translationsPath, QTranslat
ui->statusBar->addPermanentWidget(progressBar);
connect(ui->actionAbout_QT, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(ui->actionStart_colors_txt_assistant,SIGNAL(triggered()),this,SLOT(startColorsTxtAssistant()));
connect(ui->actionAbout_QT, &QAction::triggered, qApp, &QApplication::aboutQt);
connect(ui->actionStart_colors_txt_assistant, &QAction::triggered,this,&MainWindow::startColorsTxtAssistant);
createLanguageMenu();
createProfilesMenu();
@ -103,8 +103,8 @@ MainWindow::MainWindow(bool portable, const QString &translationsPath, QTranslat
drawMapFigureTableMapper->addMapping(ui->figure_geometry, 3, "geometry");
drawMapFigureTableMapper->addMapping(ui->figure_color,4);
drawMapFigureTableMapper->addMapping(ui->figure_text,5);
connect(ui->figures_list->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
drawMapFigureTableMapper, SLOT(setCurrentModelIndex(QModelIndex)));
connect(ui->figures_list->selectionModel(), &QItemSelectionModel::currentRowChanged,
drawMapFigureTableMapper, &QDataWidgetMapper::setCurrentModelIndex);
ui->figures_list->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->figures_list->resizeColumnsToContents();
QCompleter *completer = new QCompleter(this);
@ -118,39 +118,39 @@ MainWindow::MainWindow(bool portable, const QString &translationsPath, QTranslat
} else {
minetestMapper = new MinetestMapperExe(currentSettings.mapperPath, this);
}
connect(minetestMapper, SIGNAL(stateChanged(QString)),
ui->statusBar, SLOT(showMessage(QString)));
connect(minetestMapper, SIGNAL(busyStateChanged(bool)),
progressBar, SLOT(setVisible(bool)));
connect(minetestMapper, SIGNAL(progressRangeChanged(int,int)),
progressBar, SLOT(setRange(int,int)));
connect(minetestMapper, SIGNAL(progressChanged(int)),
progressBar, SLOT(setValue(int)));
connect(minetestMapper, SIGNAL(busyStateChanged(bool)),
ui->button_generate, SLOT(setDisabled(bool)));
connect(minetestMapper, SIGNAL(busyStateChanged(bool)),
ui->button_cancel, SLOT(setEnabled(bool)));
connect(minetestMapper, SIGNAL(mappingFinished(int,QProcess::ExitStatus)),
this, SLOT(mapperFinisched(int)));
connect(minetestMapper, &MinetestMapperExe::stateChanged,
[=](const QString &state){ ui->statusBar->showMessage(state); });//ui->statusBar, &QStatusBar::showMessage);
connect(minetestMapper, &MinetestMapperExe::busyStateChanged,
progressBar, &QWidget::setVisible);
connect(minetestMapper, &MinetestMapperExe::progressRangeChanged,
progressBar, &QProgressBar::setRange);
connect(minetestMapper, &MinetestMapperExe::progressChanged,
progressBar, &QProgressBar::setValue);
connect(minetestMapper, &MinetestMapperExe::busyStateChanged,
ui->button_generate, &QWidget::setDisabled);
connect(minetestMapper, &MinetestMapperExe::busyStateChanged,
ui->button_cancel, &QWidget::setEnabled);
connect(minetestMapper, &MinetestMapperExe::mappingFinished,
this, &MainWindow::mapperFinisched);
connect(minetestMapper, SIGNAL(initialisationFinished(bool)),
this, SLOT(mapperInitialized()));
connect(minetestMapper, SIGNAL(mappingStandardOutput(QString)),
ui->standardOutput, SLOT(append(QString)));
connect(minetestMapper, SIGNAL(mappingStandardError(QString)),
this, SLOT(readError(QString)));
connect(minetestMapper, &MinetestMapperExe::initialisationFinished,
this, &MainWindow::mapperInitialized);
connect(minetestMapper, &MinetestMapperExe::mappingStandardOutput,
ui->standardOutput, &QTextEdit::append);
connect(minetestMapper, &MinetestMapperExe::mappingStandardError,
this, &MainWindow::readError);
#ifdef Q_OS_WIN
taskbarButton = new QWinTaskbarButton(this);
taskbarProgress = taskbarButton->progress();
connect(minetestMapper, SIGNAL(progressRangeChanged(int,int)),
taskbarProgress, SLOT(setRange(int,int)));
connect(minetestMapper, SIGNAL(progressChanged(int)),
taskbarProgress, SLOT(setValue(int)));
connect(minetestMapper, SIGNAL(busyStateChanged(bool)),
taskbarProgress, SLOT(setVisible(bool)));
connect(minetestMapper, &MinetestMapperExe::progressRangeChanged,
taskbarProgress, &QWinTaskbarProgress::setRange);
connect(minetestMapper, &MinetestMapperExe::progressChanged,
taskbarProgress, &QWinTaskbarProgress::setValue);
connect(minetestMapper, &MinetestMapperExe::busyStateChanged,
taskbarProgress, &QWinTaskbarProgress::setVisible);
#endif
minetestMapper->init();
}
@ -184,7 +184,7 @@ void MainWindow::createLanguageMenu(void)
QActionGroup* langGroup = new QActionGroup(ui->menuLanguage);
langGroup->setExclusive(true);
connect(langGroup, SIGNAL (triggered(QAction *)), this, SLOT (slotLanguageChanged(QAction *)));
connect(langGroup, &QActionGroup::triggered, this, &MainWindow::slotLanguageChanged);
// format systems language
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
@ -674,7 +674,7 @@ void MainWindow::createProfilesMenu(){
profileGroup = new QActionGroup(ui->menuChoose_profile);
profileGroup->setExclusive(true);
connect(profileGroup, SIGNAL (triggered(QAction *)), this, SLOT (slotProfileChanged(QAction *)));
connect(profileGroup, &QActionGroup::triggered, this, &MainWindow::slotProfileChanged);
QDir dir(pathProfiles);
qDebug()<<pathProfiles;

View File

@ -5,14 +5,14 @@ MinetestMapperExe::MinetestMapperExe(const QString &program, QObject *parent) :
process = new QProcess(this);
setExecutableFile(program);
connect(process, SIGNAL(errorOccurred(QProcess::ProcessError)),
this, SLOT(errorOccured(QProcess::ProcessError)));
connect(process, &QProcess::errorOccurred,
this, &MinetestMapperExe::errorOccured);
connect(process, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(finished(int,QProcess::ExitStatus)));
connect(process, SIGNAL(readyReadStandardOutput()),
this, SLOT(readStandardOutput()));
connect(process, SIGNAL(readyReadStandardError()),
this, SLOT(readStandardError()));
this, SLOT(finished(int,QProcess::ExitStatus))); // TODO: get the pointer of this overloaded function
connect(process, &QProcess::readyReadStandardOutput,
this, &MinetestMapperExe::readStandardOutput);
connect(process, &QProcess::readyReadStandardError,
this, &MinetestMapperExe::readStandardError);
}
void MinetestMapperExe::setExecutableFile(const QString &program)
{