Skip to content

Commit

Permalink
Ported all signals to Qt5 syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcecconi committed Jul 8, 2015
1 parent 181f855 commit 87f3ac6
Show file tree
Hide file tree
Showing 23 changed files with 258 additions and 260 deletions.
114 changes: 57 additions & 57 deletions src/app/actionmanager.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/app/bookmarkmanager.cpp
@@ -1,5 +1,5 @@
/*
Copyright 2012 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2012-2015 Francesco Cecconi <francesco.cecconi@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -186,10 +186,10 @@ void BookmarkManager::startParametersToBookmarksDialog()
return;
}

addParametersToBookmark* dialogParAdd = new addParametersToBookmark(m_ui, parameters);
AddParametersToBookmark* dialogParAdd = new AddParametersToBookmark(m_ui, parameters);

connect(dialogParAdd, SIGNAL(doneParBook(QString,QString)),
this, SLOT(saveParametersToBookmarks(QString,QString)));
connect(dialogParAdd, &AddParametersToBookmark::doneParBook,
this, &BookmarkManager::saveParametersToBookmarks);

dialogParAdd->exec();

Expand Down
5 changes: 0 additions & 5 deletions src/app/bookmarkmanager.h
Expand Up @@ -120,11 +120,6 @@ public slots:
void startParametersToBookmarksDialog();
void saveHostnameItemToBookmark();
void saveServiceItemToBookmark();

private slots:
/**
* Save scan parameters to bookmark
*/
void saveParametersToBookmarks(const QString profileName, const QString profileParameters);

};
Expand Down
62 changes: 32 additions & 30 deletions src/app/mainwindow.cpp
Expand Up @@ -108,21 +108,21 @@ void MainWindow::initObject()
updateComboBook();

// connect slots
connect(m_scanWidget->buttonHostClear, SIGNAL(clicked()),
this, SLOT(clearHostnameCombo()));
connect(m_scanWidget->pushButtonLoadFromFile, SIGNAL(clicked()),
this, SLOT(loadTargetListFromFile()));
connect(m_scanWidget->comboParametersProfiles, SIGNAL(currentIndexChanged(QString)),
this, SLOT(comboParametersSelectedEvent()));
connect(m_scanWidget->comboHostBook, SIGNAL(currentIndexChanged(QString)),
this, SLOT(quickAddressSelectionEvent()));
connect(m_scanWidget->hostEdit->lineEdit(), SIGNAL(returnPressed()),
this, SLOT(startScan()));
connect(m_scanWidget->hostEdit->lineEdit(), SIGNAL(cursorPositionChanged(int,int)),
this, SLOT(updateComboHostnameProperties()));
connect(m_scanWidget->buttonHostClear, &QPushButton::clicked,
this, &MainWindow::clearHostnameCombo);
connect(m_scanWidget->pushButtonLoadFromFile, &QPushButton::clicked,
this, &MainWindow::loadTargetListFromFile);
connect(m_scanWidget->comboParametersProfiles, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
this, &MainWindow::comboParametersSelectedEvent);
connect(m_scanWidget->comboHostBook, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
this, &MainWindow::quickAddressSelectionEvent);
connect(m_scanWidget->hostEdit->lineEdit(), &QLineEdit::returnPressed,
this, &MainWindow::startScan);
connect(m_scanWidget->hostEdit->lineEdit(), &QLineEdit::cursorPositionChanged,
this, &MainWindow::updateComboHostnameProperties);
// monitor events
connect(m_monitor, SIGNAL(monitorUpdated(int)),
this, SLOT(updateScanCounter(int)));
connect(m_monitor, &Monitor::monitorUpdated,
this, &MainWindow::updateScanCounter);

// create welcome qml view
QSpacerItem *verticalSpacer = new QSpacerItem(20, 163, QSizePolicy::Minimum, QSizePolicy::Expanding);
Expand Down Expand Up @@ -166,8 +166,8 @@ void MainWindow::startPreferencesDialog()
{
QPointer<PreferencesDialog> dialogPreference = new PreferencesDialog(this);

connect(dialogPreference, SIGNAL(accepted()),
this, SLOT(syncSettings()));
connect(dialogPreference, &PreferencesDialog::accepted,
this, &MainWindow::syncSettings);

dialogPreference->exec();

Expand All @@ -180,11 +180,11 @@ void MainWindow::newProfile()
{
QPointer<ProfilerManager> pManager = new ProfilerManager(this);

connect(pManager, SIGNAL(doneParBook(QString,QString)),
m_bookmark, SLOT(saveParametersToBookmarks(QString,QString)));
connect(pManager, &ProfilerManager::doneParBook,
m_bookmark, &BookmarkManager::saveParametersToBookmarks);

connect(pManager, SIGNAL(doneQuickProfile(QStringList)),
m_profileHandler, SLOT(updateComboParametersFromList(QStringList)));
connect(pManager, &ProfilerManager::doneQuickProfile,
m_profileHandler, &ProfileHandler::updateComboParametersFromList);

pManager->exec();

Expand All @@ -198,11 +198,11 @@ void MainWindow::editProfile()
QPointer<ProfilerManager> pManager = new ProfilerManager(m_scanWidget->comboParametersProfiles->currentText(),
m_scanWidget->comboAdv->currentText(), this);

connect(pManager, SIGNAL(doneParBook(QString,QString)),
m_bookmark, SLOT(saveParametersToBookmarks(QString,QString)));
connect(pManager, &ProfilerManager::doneParBook,
m_bookmark, &BookmarkManager::saveParametersToBookmarks);

connect(pManager, SIGNAL(doneQuickProfile(QStringList)),
m_profileHandler, SLOT(updateComboParametersFromList(QStringList)));
connect(pManager, &ProfilerManager::doneQuickProfile,
m_profileHandler, &ProfileHandler::updateComboParametersFromList);

pManager->exec();

Expand Down Expand Up @@ -623,11 +623,11 @@ void MainWindow::setDefaultSplitter()
m_mainHorizontalSplitter = new QSplitter(this);
m_mainVerticalSplitter = new QSplitter(this);

connect(m_mainVerticalSplitter, SIGNAL(splitterMoved(int,int)),
this, SLOT(resizeVerticalSplitterEvent()));
connect(m_mainVerticalSplitter, &QSplitter::splitterMoved,
this, &MainWindow::resizeVerticalSplitterEvent);

connect(m_mainHorizontalSplitter, SIGNAL(splitterMoved(int,int)),
this, SLOT(resizeHorizontalSplitterEvent()));
connect(m_mainHorizontalSplitter, &QSplitter::splitterMoved,
this, &MainWindow::resizeHorizontalSplitterEvent);

m_mainHorizontalSplitter->setOrientation(Qt::Horizontal);
m_mainHorizontalSplitter->addWidget(m_scanWidget->frameLeft);
Expand Down Expand Up @@ -668,13 +668,15 @@ void MainWindow::updateComboHostnameProperties()
m_scanWidget->hostEdit->clear();
m_scanWidget->hostEdit->setStyleSheet(QString::fromUtf8(""));
bool signalState = m_scanWidget->hostEdit->lineEdit()->disconnect(SIGNAL(cursorPositionChanged(int,int)));



if (!signalState) {
return;
}

connect(m_scanWidget->hostEdit, SIGNAL(editTextChanged(QString)),
this, SLOT(linkCompleterToHostname()));
connect(m_scanWidget->hostEdit, &QComboBox::editTextChanged,
this, &MainWindow::linkCompleterToHostname);
}

void MainWindow::updateWelcomeSection()
Expand Down
18 changes: 9 additions & 9 deletions src/app/mainwindow.h
Expand Up @@ -128,26 +128,26 @@ public slots:
void updateScanSection();
void updateVulnerabilitySection();
void updateDiscoverSection();

private slots:
void initObject();
void clearAll();
void newProfile();
void editProfile();
void setFullScreen();
void updateMenuBar();
void updateScanCounter(int hostNumber);
void updateWelcomeSection();
void resizeScanListWidgetEvent();
void resizeHostDetailsWidgetEvent();
void startPreferencesDialog();

private slots:
void initObject();
void updateScanCounter(int hostNumber);
void syncSettings();
void linkCompleterToHostname();
void updateWelcomeSection();
void quickAddressSelectionEvent();
void saveSettings();
void newProfile();
void editProfile();
void clearHostnameCombo();
void resizeVerticalSplitterEvent();
void resizeHorizontalSplitterEvent();
void resizeScanListWidgetEvent();
void resizeHostDetailsWidgetEvent();
void resetComboParameters();
void loadTargetListFromFile();

Expand Down
16 changes: 8 additions & 8 deletions src/app/preference/preferencesdialog.cpp
Expand Up @@ -23,12 +23,12 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
setupUi(this);
QSettings settings("nmapsi4", "nmapsi4");

connect(buttonSave, SIGNAL(clicked(bool)),
this, SLOT(quit()));
connect(buttonDefault, SIGNAL(clicked()),
this, SLOT(setDefaults()));
connect(comboLookupType, SIGNAL(currentIndexChanged(int)),
this, SLOT(updateLookupState()));
connect(buttonSave, &QPushButton::clicked,
this, &PreferencesDialog::quit);
connect(buttonDefault, &QPushButton::clicked,
this, &PreferencesDialog::setDefaults);
connect(comboLookupType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &PreferencesDialog::updateLookupState);

// create a read log config
comboLogType->setCurrentIndex(settings.value("logType", 1).toInt());
Expand All @@ -55,8 +55,8 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
comboLookupType->setDisabled(true);
#endif

connect(listViewOptions, SIGNAL(itemSelectionChanged()),
this, SLOT(updateListWidgetItem()));
connect(listViewOptions, &QListWidget::itemSelectionChanged,
this, &PreferencesDialog::updateListWidgetItem);

m_generalItem->setSelected(true);
}
Expand Down
71 changes: 36 additions & 35 deletions src/app/profiler/profilermanager.cpp
@@ -1,5 +1,5 @@
/*
Copyright 2012 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2012-2015 Francesco Cecconi <francesco.cecconi@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -60,43 +60,44 @@ void ProfilerManager::initObject()
m_nseManager = new NseManager(this);
m_profiler = new Profiler(this);

connect(m_dialogUi->optionsListScan, SIGNAL(itemSelectionChanged()),
this, SLOT(optionListUpdate()));
connect(m_dialogUi->portCombo, SIGNAL(activated(QString)),
this, SLOT(updatePortCombo()));
connect(m_dialogUi->optionsListScan, &QListWidget::itemSelectionChanged,
this, &ProfilerManager::optionListUpdate);
connect(m_dialogUi->portCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &ProfilerManager::updatePortCombo);

//Options
connect(m_dialogUi->checkBoxDevice, SIGNAL(toggled(bool)),
this, SLOT(updateOptions()));
connect(m_dialogUi->checkDecoy, SIGNAL(toggled(bool)),
this, SLOT(updateOptions()));
connect(m_dialogUi->checkSpoof, SIGNAL(toggled(bool)),
this, SLOT(updateOptions()));
connect(m_dialogUi->checkSourcePort, SIGNAL(toggled(bool)),
this, SLOT(updateOptions()));
connect(m_dialogUi->comboVerbosity, SIGNAL(activated(QString)),
this, SLOT(updateComboVerbosity()));
connect(m_dialogUi->doneButton, SIGNAL(clicked(bool)),
this, SLOT(exit()));
connect(m_dialogUi->pushButtonQuickProfile, SIGNAL(clicked(bool)),
this, SLOT(exitWithQuickProfile()));
connect(m_dialogUi->cancelButton, SIGNAL(clicked(bool)),
this, SLOT(close()));
connect(m_dialogUi->comboBaseOptions, SIGNAL(activated(QString)),
this, SLOT(updateBaseOptions()));
connect(m_dialogUi->checkBoxDevice, &QAbstractButton::toggled,
this, &ProfilerManager::updateOptions);
connect(m_dialogUi->checkDecoy, &QCheckBox::toggled,
this, &ProfilerManager::updateOptions);
connect(m_dialogUi->checkSpoof, &QCheckBox::toggled,
this, &ProfilerManager::updateOptions);
connect(m_dialogUi->checkSourcePort, &QCheckBox::toggled,
this, &ProfilerManager::updateOptions);
connect(m_dialogUi->comboVerbosity, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &ProfilerManager::updateComboVerbosity);
connect(m_dialogUi->doneButton, &QPushButton::clicked,
this, &ProfilerManager::exit);
connect(m_dialogUi->pushButtonQuickProfile, &QPushButton::clicked,
this, &ProfilerManager::exitWithQuickProfile);
connect(m_dialogUi->cancelButton, &QPushButton::clicked,
this, &ProfilerManager::close);
connect(m_dialogUi->comboBaseOptions, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &ProfilerManager::updateBaseOptions);

// nse slots
connect(m_dialogUi->nseActiveBut, SIGNAL(clicked()),
m_nseManager, SLOT(nseTreeActiveItem()));
connect(m_dialogUi->nseRemoveBut, SIGNAL(clicked()),
m_nseManager, SLOT(nseTreeRemoveItem()));
connect(m_dialogUi->nseResetBut, SIGNAL(clicked()),
m_nseManager, SLOT(nseTreeResetItem()));
connect(m_dialogUi->nseTreeAvail, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
m_nseManager, SLOT(requestNseHelp(QTreeWidgetItem*,int)));
connect(m_dialogUi->nseTreeActive, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
m_nseManager, SLOT(requestNseHelp(QTreeWidgetItem*,int)));
connect(m_dialogUi->searchButtHelp, SIGNAL(clicked()),
m_nseManager, SLOT(requestNseScriptHelp()));
connect(m_dialogUi->nseActiveBut, &QPushButton::clicked,
m_nseManager, &NseManager::nseTreeActiveItem);
connect(m_dialogUi->nseRemoveBut, &QPushButton::clicked,
m_nseManager, &NseManager::nseTreeRemoveItem);
connect(m_dialogUi->nseResetBut, &QPushButton::clicked,
m_nseManager, &NseManager::nseTreeResetItem);
connect(m_dialogUi->nseTreeAvail, &QTreeWidget::itemClicked,
m_nseManager, &NseManager::requestNseHelp);
connect(m_dialogUi->nseTreeActive, &QTreeWidget::itemClicked,
m_nseManager, &NseManager::requestNseHelp);
connect(m_dialogUi->searchButtHelp, &QPushButton::clicked,
m_nseManager, &NseManager::requestNseScriptHelp);

loadDefaultComboValues();
loadDefaultBaseProfile();
Expand Down
2 changes: 1 addition & 1 deletion src/app/profiler/profilermanager.h
@@ -1,5 +1,5 @@
/*
Copyright 2012-2013 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2012-2015 Francesco Cecconi <francesco.cecconi@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down
8 changes: 4 additions & 4 deletions src/common/processthread.cpp
Expand Up @@ -35,10 +35,10 @@ void ProcessThread::run()
m_process = new QProcess();
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");

connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(readFinished()));
connect(m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(readyReadData()));
connect(m_process, static_cast<void (QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished),
this, &ProcessThread::readFinished);
connect(m_process, &QProcess::readyReadStandardOutput,
this, &ProcessThread::readyReadData);

#ifndef THREAD_NO_DEBUG
qDebug() << "ProcessThread::Command:: " << m_ParList;
Expand Down
6 changes: 3 additions & 3 deletions src/platform/about/about.cpp
@@ -1,5 +1,5 @@
/*
Copyright 2008-2013 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2008-2015 Francesco Cecconi <francesco.cecconi@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -31,7 +31,7 @@ About::About(QWidget *parent)

const QString About::description()
{
return QApplication::tr("NmapSi4 is a complete Qt4-based Gui with "
return QApplication::tr("NmapSi4 is a complete Qt5-based Gui with "
"the design goals to provide a complete nmap "
"interface for users, in order to manage al "
"option of this power security net scanner "
Expand All @@ -41,7 +41,7 @@ const QString About::description()

const QString About::copyright()
{
return QApplication::tr("(c) 2007-2013 Francesco Cecconi"
return QApplication::tr("(c) 2007-2015 Francesco Cecconi"
"<br/>License: GNU General Public License Version 2");

}
Expand Down
16 changes: 8 additions & 8 deletions src/platform/addparameterstobookmark.cpp
@@ -1,5 +1,5 @@
/*
Copyright 2011-2012 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2011-2015 Francesco Cecconi <francesco.cecconi@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand All @@ -17,24 +17,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "addparameterstobookmark.h"

addParametersToBookmark::addParametersToBookmark(QWidget* parent, const QString parameters)
AddParametersToBookmark::AddParametersToBookmark(QWidget* parent, const QString parameters)
: QDialog(parent)
{
setupUi(this);

connect(doneButt, SIGNAL(clicked(bool)),
this, SLOT(exit()));
connect(cancelButt, SIGNAL(clicked(bool)),
this, SLOT(close()));
connect(doneButt, &QPushButton::clicked,
this, &AddParametersToBookmark::exit);
connect(cancelButt, &QPushButton::clicked,
this, &AddParametersToBookmark::close);
lineProfilePar->setText(parameters);
}

addParametersToBookmark::~addParametersToBookmark()
AddParametersToBookmark::~AddParametersToBookmark()
{

}

void addParametersToBookmark::exit()
void AddParametersToBookmark::exit()
{
if (!lineProfileName->text().isEmpty() && !lineProfilePar->text().isEmpty()) {
emit doneParBook(lineProfileName->text(), lineProfilePar->text());
Expand Down

0 comments on commit 87f3ac6

Please sign in to comment.