Use function-pointer based signal/slot connections

parent 05b4d47f
......@@ -22,7 +22,7 @@ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS
Widgets
)
set(KF5_MIN_VERSION "5.25.0")
set(KF5_MIN_VERSION "5.28.0")
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
CoreAddons
Codecs
......
......@@ -200,16 +200,16 @@ void KompareShell::blend( const QUrl& url1, const QUrl& diff )
void KompareShell::setupActions()
{
QAction *a;
a = actionCollection()->addAction(KStandardAction::Open, this, SLOT(slotFileOpen()));
a = KStandardAction::open(this, &KompareShell::slotFileOpen, actionCollection());
a->setText( i18n( "&Open Diff..." ) );
a = actionCollection()->addAction(QStringLiteral("file_compare_files"), this, SLOT(slotFileCompareFiles()));
a = actionCollection()->addAction(QStringLiteral("file_compare_files"), this, &KompareShell::slotFileCompareFiles);
a->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
a->setText(i18n("&Compare Files..."));
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_C));
a = actionCollection()->addAction(QStringLiteral("file_blend_url"), this, SLOT(slotFileBlendURLAndDiff()));
a = actionCollection()->addAction(QStringLiteral("file_blend_url"), this, &KompareShell::slotFileBlendURLAndDiff);
a->setText(i18n("&Blend URL with Diff..."));
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_B));
actionCollection()->addAction(KStandardAction::Quit, this, SLOT( slotFileClose() ));
KStandardAction::quit(this, &KompareShell::slotFileClose, actionCollection());
createStandardStatusBarAction();
setStandardToolBarMenuEnabled(true);
......@@ -217,10 +217,10 @@ void KompareShell::setupActions()
// needs a KGuiItem, also the doc says explicitly not to do this
// m_showTextView->setCheckedState(i18n("Hide T&ext View"));
actionCollection()->addAction(QStringLiteral("options_show_text_view"), m_showTextView);
connect(m_showTextView, SIGNAL(triggered(bool)), SLOT(slotShowTextView()));
connect(m_showTextView, &KToggleAction::triggered, this, &KompareShell::slotShowTextView);
KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
KStandardAction::keyBindings(this, &KompareShell::optionsConfigureKeys, actionCollection());
KStandardAction::configureToolbars(this, &KompareShell::optionsConfigureToolbars, actionCollection());
}
void KompareShell::setupStatusBar()
......@@ -418,7 +418,8 @@ void KompareShell::slotShowTextView()
m_textViewPart->setText( m_diffString );
}
m_textViewWidget->show();
connect( m_textViewWidget, SIGNAL(visibilityChanged(bool)), SLOT(slotVisibilityChanged(bool)) );
connect(m_textViewWidget, &QDockWidget::visibilityChanged,
this, &KompareShell::slotVisibilityChanged);
}
else if ( m_textViewWidget->isVisible() )
m_textViewWidget->hide();
......@@ -458,7 +459,7 @@ void KompareShell::optionsConfigureToolbars()
saveMainWindowSettings(group);
// use the standard toolbar editor
KEditToolBar dlg(factory());
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(newToolbarConfig()));
connect(&dlg, &KEditToolBar::newToolbarConfig, this, &KompareShell::newToolbarConfig);
dlg.exec();
}
......
......@@ -84,14 +84,14 @@ KompareNavTreePart::KompareNavTreePart( QWidget* parentWidget, QObject* parent,
m_changesList->setSortingEnabled( true );
m_changesList->sortByColumn( 0, Qt::AscendingOrder );
connect( m_srcDirTree, SIGNAL(currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* )),
this, SLOT(slotSrcDirTreeSelectionChanged( QTreeWidgetItem* )) );
connect( m_destDirTree, SIGNAL(currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* )),
this, SLOT(slotDestDirTreeSelectionChanged( QTreeWidgetItem* )) );
connect( m_fileList, SIGNAL(currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* )),
this, SLOT(slotFileListSelectionChanged( QTreeWidgetItem* )) );
connect( m_changesList, SIGNAL(currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* )),
this, SLOT(slotChangesListSelectionChanged( QTreeWidgetItem* )) );
connect(m_srcDirTree, &QTreeWidget::currentItemChanged,
this, &KompareNavTreePart::slotSrcDirTreeSelectionChanged);
connect(m_destDirTree, &QTreeWidget::currentItemChanged,
this, &KompareNavTreePart::slotDestDirTreeSelectionChanged);
connect(m_fileList, &QTreeWidget::currentItemChanged,
this, &KompareNavTreePart::slotFileListSelectionChanged);
connect(m_changesList, &QTreeWidget::currentItemChanged,
this, &KompareNavTreePart::slotChangesListSelectionChanged);
}
KompareNavTreePart::~KompareNavTreePart()
......
This diff is collapsed.
......@@ -141,7 +141,7 @@ void KompareConnectWidget::slotSetSelection( const DiffModel* model, const Diffe
void KompareConnectWidget::slotDelayedRepaint()
{
QTimer::singleShot( 0, this, SLOT( repaint() ) );
QTimer::singleShot(0, this, static_cast<void(KompareConnectWidget::*)()>(&KompareConnectWidget::repaint));
}
void KompareConnectWidget::slotSetSelection( const Difference* diff )
......
......@@ -72,12 +72,12 @@ KompareListViewFrame::KompareListViewFrame( bool isSource,
m_layout.addWidget(bottomLine);
m_layout.addWidget(&m_view);
connect( &m_view, SIGNAL(differenceClicked(const Diff2::Difference*)),
parent, SLOT(slotDifferenceClicked(const Diff2::Difference*)) );
connect(&m_view, &KompareListView::differenceClicked,
parent, &KompareSplitter::slotDifferenceClicked);
connect( parent, SIGNAL(scrollViewsToId(int)), &m_view, SLOT(scrollToId(int)) );
connect( parent, SIGNAL(setXOffset(int)), &m_view, SLOT(setXOffset(int)) );
connect( &m_view, SIGNAL(resized()), parent, SLOT(slotUpdateScrollBars()) );
connect(parent, &KompareSplitter::scrollViewsToId, &m_view, &KompareListView::scrollToId);
connect(parent, &KompareSplitter::setXOffset, &m_view, &KompareListView::setXOffset);
connect(&m_view, &KompareListView::resized, parent, &KompareSplitter::slotUpdateScrollBars);
}
void KompareListViewFrame::slotSetModel( const DiffModel* model )
......
......@@ -59,23 +59,24 @@ KompareSaveOptionsWidget::KompareSaveOptionsWidget( QString source, QString dest
m_directoryRequester->setUrl(root);
}
connect( m_SmallerChangesCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_LargeFilesCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_IgnoreCaseCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_ExpandTabsCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_IgnoreEmptyLinesCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_IgnoreWhiteSpaceCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_FunctionNamesCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_RecursiveCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_NewFilesCB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_ContextRB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_EdRB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_NormalRB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_RCSRB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_UnifiedRB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_SideBySideRB, SIGNAL(toggled(bool)), SLOT(updateCommandLine()) );
connect( m_ContextLinesSB, SIGNAL(valueChanged(int)), SLOT(updateCommandLine()) );
connect( m_directoryRequester, SIGNAL(textChanged(const QString&)), SLOT(updateCommandLine()) );
connect(m_SmallerChangesCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_LargeFilesCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_IgnoreCaseCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_ExpandTabsCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_IgnoreEmptyLinesCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_IgnoreWhiteSpaceCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_FunctionNamesCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_RecursiveCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_NewFilesCB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_ContextRB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_EdRB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_NormalRB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_RCSRB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_UnifiedRB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_SideBySideRB, &QCheckBox::toggled, this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_ContextLinesSB, static_cast<void(QSpinBox::*)(const QString&)>(&QSpinBox::valueChanged),
this, &KompareSaveOptionsWidget::updateCommandLine);
connect(m_directoryRequester, &KUrlRequester::textChanged, this, &KompareSaveOptionsWidget::updateCommandLine);
m_FormatBG->setExclusive(true);
m_FormatBG->addButton(m_ContextRB, Kompare::Context);
......
......@@ -77,19 +77,19 @@ KompareSplitter::KompareSplitter( ViewSettings *settings, QWidget *parent ) :
setOpaqueResize( true );
setFocusPolicy( Qt::WheelFocus );
connect( this, SIGNAL(configChanged()), SLOT(slotConfigChanged()) );
connect( this, SIGNAL(configChanged()), SLOT(slotDelayedRepaintHandles()) );
connect( this, SIGNAL(configChanged()), SLOT(slotDelayedUpdateScrollBars()) );
connect(this, &KompareSplitter::configChanged, this, &KompareSplitter::slotConfigChanged);
connect(this, &KompareSplitter::configChanged, this, &KompareSplitter::slotDelayedRepaintHandles);
connect(this, &KompareSplitter::configChanged, this, &KompareSplitter::slotDelayedUpdateScrollBars);
// scrolling
connect( m_vScroll, SIGNAL(valueChanged(int)), SLOT(slotScrollToId(int)) );
connect( m_vScroll, SIGNAL(sliderMoved(int)), SLOT(slotScrollToId(int)) );
connect( m_hScroll, SIGNAL(valueChanged(int)), SIGNAL(setXOffset(int)) );
connect( m_hScroll, SIGNAL(sliderMoved(int)), SIGNAL(setXOffset(int)) );
connect(m_vScroll, &QScrollBar::valueChanged, this, &KompareSplitter::slotScrollToId);
connect(m_vScroll, &QScrollBar::sliderMoved, this, &KompareSplitter::slotScrollToId);
connect(m_hScroll, &QScrollBar::valueChanged, this, &KompareSplitter::setXOffset);
connect(m_hScroll, &QScrollBar::sliderMoved, this, &KompareSplitter::setXOffset);
m_scrollTimer=new QTimer(this);
m_restartTimer = false;
connect (m_scrollTimer, SIGNAL(timeout()), SLOT(timerTimeout()) );
connect(m_scrollTimer, &QTimer::timeout, this, &KompareSplitter::timerTimeout);
// we need to receive childEvents now so that d->list is ready for when
// slotSetSelection(...) arrives
......@@ -110,7 +110,7 @@ QSplitterHandle* KompareSplitter::createHandle()
void KompareSplitter::slotDelayedRepaintHandles()
{
QTimer::singleShot(0, this, SLOT(slotRepaintHandles()));
QTimer::singleShot(0, this, &KompareSplitter::slotRepaintHandles);
}
void KompareSplitter::slotRepaintHandles()
......@@ -156,7 +156,7 @@ void KompareSplitter::slotScrollToId( int id )
void KompareSplitter::slotDelayedUpdateScrollBars()
{
QTimer::singleShot( 0, this, SLOT( slotUpdateScrollBars() ) );
QTimer::singleShot(0, this, &KompareSplitter::slotUpdateScrollBars);
}
void KompareSplitter::slotUpdateScrollBars()
......@@ -208,7 +208,7 @@ void KompareSplitter::slotUpdateScrollBars()
void KompareSplitter::slotDelayedUpdateVScrollValue()
{
QTimer::singleShot( 0, this, SLOT( slotUpdateVScrollValue() ) );
QTimer::singleShot(0, this, &KompareSplitter::slotUpdateVScrollValue);
}
void KompareSplitter::slotUpdateVScrollValue()
......
......@@ -68,10 +68,10 @@ KompareURLDialog::KompareURLDialog( QWidget *parent)
adjustSize();
connect( m_filesPage->firstURLRequester(), SIGNAL( textChanged( const QString& ) ),
this, SLOT( slotEnableOk() ) );
connect( m_filesPage->secondURLRequester(), SIGNAL( textChanged( const QString& ) ),
this, SLOT( slotEnableOk() ) );
connect(m_filesPage->firstURLRequester(), &KUrlRequester::textChanged,
this, &KompareURLDialog::slotEnableOk);
connect(m_filesPage->secondURLRequester(), &KUrlRequester::textChanged,
this, &KompareURLDialog::slotEnableOk);
}
......
......@@ -315,7 +315,7 @@ void DiffPage::addOptionsTab()
ignoreRegExpEditButton->setObjectName(QStringLiteral("regexp_editor_button"));
ignoreRegExpEditButton->setToolTip( i18n( "Clicking this will open a regular expression dialog where\nyou can graphically create regular expressions." ) );
groupLayout->addWidget( ignoreRegExpEditButton );
connect( ignoreRegExpEditButton, SIGNAL( clicked() ), this, SLOT( slotShowRegExpEditor() ) );
connect(ignoreRegExpEditButton, &QPushButton::clicked, this, &DiffPage::slotShowRegExpEditor);
}
QGroupBox* moreOptionButtonGroup = new QGroupBox( page );
......@@ -369,7 +369,7 @@ void DiffPage::addExcludeTab()
layout->addWidget( m_excludeFilePatternGroupBox );
connect( m_excludeFilePatternGroupBox, SIGNAL(toggled(bool)), this, SLOT(slotExcludeFilePatternToggled(bool)));
connect(m_excludeFilePatternGroupBox, &QGroupBox::toggled, this, &DiffPage::slotExcludeFilePatternToggled);
m_excludeFileNameGroupBox = new QGroupBox( page );
m_excludeFileNameGroupBox->setCheckable( true );
......@@ -387,7 +387,7 @@ void DiffPage::addExcludeTab()
m_excludeFileURLRequester->setToolTip( i18n( "Any file you select in the dialog that pops up when you click it will be put in the dialog to the left of this button." ) );
layout->addWidget( m_excludeFileNameGroupBox );
connect( m_excludeFileNameGroupBox, SIGNAL(toggled(bool)), this, SLOT(slotExcludeFileToggled(bool)));
connect(m_excludeFileNameGroupBox, &QGroupBox::toggled, this, &DiffPage::slotExcludeFileToggled);
layout->addStretch( 1 );
......
......@@ -51,7 +51,7 @@ FilesPage::FilesPage() : QFrame()
button->setToolTip( i18n( "Select File" ) );
button->setProperty("combobox", QStringLiteral("SourceURLComboBox"));
button->setProperty( "folder", false );
connect( button, SIGNAL(clicked()), this, SLOT(open()) );
connect(button, &QPushButton::clicked, this, &FilesPage::open);
gb1Layout->addWidget( button );
button = new QPushButton(this);
......@@ -63,7 +63,7 @@ FilesPage::FilesPage() : QFrame()
button->setToolTip( i18n( "Select Folder" ) );
button->setProperty("combobox", QStringLiteral("SourceURLComboBox"));
button->setProperty( "folder", true );
connect( button, SIGNAL(clicked()), this, SLOT(open()) );
connect(button, &QPushButton::clicked, this, &FilesPage::open);
gb1Layout->addWidget( button );
m_secondGB = new QGroupBox(QStringLiteral("This too moron !"), this ); // whut again?
......@@ -80,7 +80,7 @@ FilesPage::FilesPage() : QFrame()
button->setToolTip( i18n( "Select File" ) );
button->setProperty("combobox", QStringLiteral("DestURLComboBox"));
button->setProperty( "folder", false );
connect( button, SIGNAL(clicked()), this, SLOT(open()) );
connect(button, &QPushButton::clicked, this, &FilesPage::open);
gb2Layout->addWidget( button );
button = new QPushButton(this);
......@@ -92,7 +92,7 @@ FilesPage::FilesPage() : QFrame()
button->setToolTip( i18n( "Select Folder" ) );
button->setProperty("combobox", QStringLiteral("DestURLComboBox"));
button->setProperty( "folder", true );
connect( button, SIGNAL(clicked()), this, SLOT(open()) );
connect(button, &QPushButton::clicked, this, &FilesPage::open);
gb2Layout->addWidget( button );
......@@ -127,10 +127,10 @@ void FilesPage::open()
bool selectFolders = button->property( "folder" ).toBool();
KUrlComboBox* urlComboBox = findChild<KUrlComboBox*>( button->property( "combobox" ).toString() );
open( urlComboBox, selectFolders );
doOpen(urlComboBox, selectFolders);
}
void FilesPage::open( KUrlComboBox *urlComboBox, bool selectFolders )
void FilesPage::doOpen(KUrlComboBox *urlComboBox, bool selectFolders)
{
QUrl currentUrl = QUrl::fromUserInput( urlComboBox->currentText() );
......
......@@ -61,6 +61,9 @@ public:
private Q_SLOTS:
void open();
private:
void doOpen(KUrlComboBox* urlComboBox, bool selectFolders);
private:
QGroupBox* m_firstGB;
QGroupBox* m_secondGB;
......@@ -75,9 +78,6 @@ private:
KComboBox* m_encodingComboBox;
FilesSettings* m_settings;
private:
void open(KUrlComboBox* urlComboBox, bool selectFolders);
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment