Commit d06ea239 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

Use Q_EMIT instead of emit

In C++20 there are new classes that have member functions named emit().
c.f.:
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit

A similar change was done in the Frameworks:
frameworks/kio!315
parent e57b6ea8
......@@ -60,12 +60,12 @@ BookmarkHandler::~BookmarkHandler() = default;
void BookmarkHandler::openBookmark(const KBookmark &bm, Qt::MouseButtons, Qt::KeyboardModifiers)
{
emit openUrl(bm.url());
Q_EMIT openUrl(bm.url());
}
void BookmarkHandler::openFolderinTabs(const KBookmarkGroup &group)
{
emit openUrls(group.groupUrlList());
Q_EMIT openUrls(group.groupUrlList());
}
bool BookmarkHandler::enableOption(BookmarkOption option) const
......
......@@ -59,7 +59,7 @@ bool CheckableSessionModel::setData(const QModelIndex &index, const QVariant &va
_checkedSessions.remove(session);
}
emit dataChanged(index, index);
Q_EMIT dataChanged(index, index);
return true;
}
return SessionListModel::setData(index, value, role);
......
......@@ -87,13 +87,13 @@ ScreenWindow *Emulation::createWindow()
void Emulation::checkScreenInUse()
{
emit primaryScreenInUse(_currentScreen == _screen[0]);
Q_EMIT primaryScreenInUse(_currentScreen == _screen[0]);
}
void Emulation::checkSelectedText()
{
QString text = _currentScreen->selectedText(Screen::PreserveLineBreaks);
emit selectionChanged(text);
Q_EMIT selectionChanged(text);
}
Emulation::~Emulation()
......@@ -114,7 +114,7 @@ void Emulation::setPeekPrimary(const bool doPeek)
}
_peekingPrimary = doPeek;
setScreenInternal(doPeek ? 0 : _activeScreenIndex);
emit outputChanged();
Q_EMIT outputChanged();
}
void Emulation::setScreen(int index)
......@@ -164,7 +164,7 @@ void Emulation::setCodec(const QTextCodec *codec)
delete _decoder;
_decoder = _codec->makeDecoder();
emit useUtf8Request(utf8());
Q_EMIT useUtf8Request(utf8());
} else {
setCodec(LocaleCodec);
}
......@@ -211,7 +211,7 @@ void Emulation::receiveChar(uint c)
_currentScreen->toStartOfLine();
break;
case 0x07:
emit bell();
Q_EMIT bell();
break;
default:
_currentScreen->displayCharacter(c);
......@@ -225,7 +225,7 @@ void Emulation::sendKeyEvent(QKeyEvent *ev)
// A block of text
// Note that the text is proper unicode.
// We should do a conversion here
emit sendData(ev->text().toLocal8Bit());
Q_EMIT sendData(ev->text().toLocal8Bit());
}
}
......@@ -244,9 +244,9 @@ void Emulation::receiveData(const char *text, int length)
for (int i = 0; i < length - 4; i++) {
if (text[i] == '\030') {
if (qstrncmp(text + i + 1, "B00", 3) == 0) {
emit zmodemDownloadDetected();
Q_EMIT zmodemDownloadDetected();
} else if (qstrncmp(text + i + 1, "B01", 3) == 0) {
emit zmodemUploadDetected();
Q_EMIT zmodemUploadDetected();
}
}
}
......@@ -268,7 +268,7 @@ void Emulation::showBulk()
_bulkTimer1.stop();
_bulkTimer2.stop();
emit outputChanged();
Q_EMIT outputChanged();
_currentScreen->resetScrolledLines();
_currentScreen->resetDroppedLines();
......@@ -311,13 +311,13 @@ void Emulation::setImageSize(int lines, int columns)
// SIGNAL(imageSizeChange()), even if the new size is the same as the
// current size. See #176902
if (!_imageSizeInitialized) {
emit imageSizeChanged(lines, columns);
Q_EMIT imageSizeChanged(lines, columns);
}
} else {
_screen[0]->resizeImage(lines, columns);
_screen[1]->resizeImage(lines, columns);
emit imageSizeChanged(lines, columns);
Q_EMIT imageSizeChanged(lines, columns);
bufferedUpdate();
}
......@@ -325,7 +325,7 @@ void Emulation::setImageSize(int lines, int columns)
if (!_imageSizeInitialized) {
_imageSizeInitialized = true;
emit imageSizeInitialized();
Q_EMIT imageSizeInitialized();
}
}
......
......@@ -306,10 +306,10 @@ void KeyBindingEditor::accept()
const QString &currentTranslatorName = newTranslator->name();
emit updateKeyBindingsListRequest(currentTranslatorName);
Q_EMIT updateKeyBindingsListRequest(currentTranslatorName);
if (currentTranslatorName == _currentProfileTranslator) {
emit updateTempProfileKeyBindingsRequest(Profile::KeyBindings, currentTranslatorName);
Q_EMIT updateTempProfileKeyBindingsRequest(Profile::KeyBindings, currentTranslatorName);
}
QDialog::accept();
......
......@@ -547,7 +547,7 @@ void MainWindow::setFocus()
void MainWindow::newWindow()
{
Profile::Ptr defaultProfile = ProfileManager::instance()->defaultProfile();
emit newWindowRequest(defaultProfile, activeSessionDir());
Q_EMIT newWindowRequest(defaultProfile, activeSessionDir());
}
bool MainWindow::queryClose()
......
......@@ -288,12 +288,12 @@ void Part::overrideTerminalShortcut(QKeyEvent *event, bool &override)
// override all shortcuts in the embedded terminal by default
override = true;
emit overrideShortcut(event, override);
Q_EMIT overrideShortcut(event, override);
}
void Part::activeViewTitleChanged(ViewProperties *properties)
{
emit setWindowCaption(properties->title());
Q_EMIT setWindowCaption(properties->title());
}
void Part::showManageProfilesDialog(QWidget *parent)
......@@ -348,14 +348,14 @@ void Part::changeSessionSettings(const QString &text)
bool Part::openUrl(const QUrl &url)
{
if (KParts::ReadOnlyPart::url() == url) {
emit completed();
Q_EMIT completed();
return true;
}
setUrl(url);
emit setWindowCaption(url.toDisplayString(QUrl::PreferLocalFile));
Q_EMIT setWindowCaption(url.toDisplayString(QUrl::PreferLocalFile));
////qDebug() << "Set Window Caption to " << url.pathOrUrl();
emit started(nullptr);
Q_EMIT started(nullptr);
if (url.isLocalFile()) {
showShellInDir(url.path());
......@@ -363,7 +363,7 @@ bool Part::openUrl(const QUrl &url)
showShellInDir(QDir::homePath());
}
emit completed();
Q_EMIT completed();
return true;
}
......@@ -412,9 +412,9 @@ bool Part::isBlurEnabled()
void Part::notificationChanged(Session::Notification notification, bool enabled)
{
if (notification == Session::Notification::Silence && enabled) {
emit silenceDetected();
Q_EMIT silenceDetected();
} else if (notification == Session::Notification::Activity && enabled) {
emit activityDetected();
Q_EMIT activityDetected();
}
}
......
......@@ -75,7 +75,7 @@ void Pty::dataReceived()
return;
}
emit receivedData(data.constData(), data.count());
Q_EMIT receivedData(data.constData(), data.count());
}
void Pty::setWindowSize(int columns, int lines)
......
......@@ -172,7 +172,7 @@ void SaveHistoryTask::jobResult(KJob* job)
delete decoder;
// notify the world that the task is done
emit completed(true);
Q_EMIT completed(true);
if (autoDelete()) {
deleteLater();
......
......@@ -39,7 +39,7 @@ void ScreenWindow::setScreen(Screen *screen)
return;
}
emit screenAboutToChange();
Q_EMIT screenAboutToChange();
_screen = screen;
}
......@@ -139,7 +139,7 @@ void ScreenWindow::setSelectionStart(int column, int line, bool columnMode)
_screen->setSelectionStart(column, line + currentLine(), columnMode);
_bufferNeedsUpdate = true;
emit selectionChanged();
Q_EMIT selectionChanged();
}
void ScreenWindow::setSelectionEnd(int column, int line)
......@@ -147,7 +147,7 @@ void ScreenWindow::setSelectionEnd(int column, int line)
_screen->setSelectionEnd(column, line + currentLine());
_bufferNeedsUpdate = true;
emit selectionChanged();
Q_EMIT selectionChanged();
}
void ScreenWindow::setSelectionByLineRange(int start, int end)
......@@ -158,7 +158,7 @@ void ScreenWindow::setSelectionByLineRange(int start, int end)
_screen->setSelectionEnd(windowColumns(), end);
_bufferNeedsUpdate = true;
emit selectionChanged();
Q_EMIT selectionChanged();
}
bool ScreenWindow::isSelected(int column, int line)
......@@ -170,7 +170,7 @@ void ScreenWindow::clearSelection()
{
_screen->clearSelection();
emit selectionChanged();
Q_EMIT selectionChanged();
}
void ScreenWindow::setWindowLines(int lines)
......@@ -226,7 +226,7 @@ void ScreenWindow::setCurrentResultLine(int line)
}
_currentResultLine = line;
emit currentResultLineChanged();
Q_EMIT currentResultLineChanged();
}
void ScreenWindow::scrollBy(RelativeScrollMode mode, int amount, bool fullPage)
......@@ -261,7 +261,7 @@ void ScreenWindow::scrollTo(int line)
_bufferNeedsUpdate = true;
emit scrolled(_currentLine);
Q_EMIT scrolled(_currentLine);
}
void ScreenWindow::setTrackOutput(bool trackOutput)
......@@ -328,5 +328,5 @@ void ScreenWindow::notifyOutputChanged()
_bufferNeedsUpdate = true;
emit outputChanged();
Q_EMIT outputChanged();
}
......@@ -139,7 +139,7 @@ void SearchHistoryTask::executeOnScreenWindow(const QPointer<Session> &session ,
highlightResult(window, findPos);
emit completed(true);
Q_EMIT completed(true);
return;
}
......@@ -154,7 +154,7 @@ void SearchHistoryTask::executeOnScreenWindow(const QPointer<Session> &session ,
window->notifyOutputChanged();
}
emit completed(false);
Q_EMIT completed(false);
}
void SearchHistoryTask::highlightResult(const ScreenWindowPtr& window , int findPos)
{
......
......@@ -398,7 +398,7 @@ void ViewManager::detachActiveView()
auto newSplitter = new ViewSplitter();
newSplitter->addTerminalDisplay(terminal, Qt::Horizontal);
QHash<TerminalDisplay*, Session*> detachedSessions = forgetAll(newSplitter);
emit terminalsDetached(newSplitter, detachedSessions);
Q_EMIT terminalsDetached(newSplitter, detachedSessions);
focusAnotherTerminal(activeSplitter->getToplevelSplitter());
toggleActionsBasedOnState();
}
......@@ -414,7 +414,7 @@ void ViewManager::detachTab(int tabIdx)
{
ViewSplitter* splitter = _viewContainer->viewSplitterAt(tabIdx);
QHash<TerminalDisplay*, Session*> detachedSessions = forgetAll(_viewContainer->viewSplitterAt(tabIdx));
emit terminalsDetached(splitter, detachedSessions);
Q_EMIT terminalsDetached(splitter, detachedSessions);
}
QHash<TerminalDisplay*, Session*> ViewManager::forgetAll(ViewSplitter* splitter) {
......@@ -489,7 +489,7 @@ void ViewManager::sessionFinished()
if ((!_pluggedController.isNull()) && (_pluggedController->session() == session)) {
// This is needed to remove this controller from factory() in
// order to prevent BUG: 185466 - disappearing menu popup
emit unplugController(_pluggedController);
Q_EMIT unplugController(_pluggedController);
}
if (!_sessionMap.empty()) {
......@@ -621,7 +621,7 @@ void ViewManager::controllerChanged(SessionController *controller)
updateTerminalDisplayHistory(controller->view());
_pluggedController = controller;
emit activeViewChanged(controller);
Q_EMIT activeViewChanged(controller);
}
SessionController *ViewManager::activeViewController() const
......@@ -748,7 +748,7 @@ void ViewManager::containerViewsChanged(TabbedViewContainer *container)
{
Q_UNUSED(container)
// TODO: Verify that this is right.
emit viewPropertiesChanged(viewProperties());
Q_EMIT viewPropertiesChanged(viewProperties());
}
void ViewManager::viewDestroyed(QWidget *view)
......@@ -774,7 +774,7 @@ void ViewManager::viewDestroyed(QWidget *view)
// The below causes the menus to be messed up
// Only happens when using the tab bar close button
// if (_pluggedController)
// emit unplugController(_pluggedController);
// Q_EMIT unplugController(_pluggedController);
}
TerminalDisplay *ViewManager::createTerminalDisplay(Session *session)
......@@ -807,8 +807,8 @@ void ViewManager::applyProfileToView(TerminalDisplay *view, const Profile::Ptr &
{
Q_ASSERT(profile);
view->applyProfile(profile);
emit updateWindowIcon();
emit blurSettingChanged(view->colorScheme()->blur());
Q_EMIT updateWindowIcon();
Q_EMIT blurSettingChanged(view->colorScheme()->blur());
}
void ViewManager::updateViewsForSession(Session *session)
......
......@@ -41,7 +41,7 @@ QString ViewProperties::currentDir() const
void ViewProperties::fireActivity()
{
emit activity(this);
Q_EMIT activity(this);
}
void ViewProperties::rename()
......@@ -52,7 +52,7 @@ void ViewProperties::setTitle(const QString &title)
{
if (title != _title) {
_title = title;
emit titleChanged(this);
Q_EMIT titleChanged(this);
}
}
......@@ -63,7 +63,7 @@ void ViewProperties::setIcon(const QIcon &icon)
if (icon.cacheKey() != _icon.cacheKey()) {
_icon = icon;
emit iconChanged(this);
Q_EMIT iconChanged(this);
}
}
......@@ -71,7 +71,7 @@ void ViewProperties::setColor(const QColor &color)
{
if (color != _color) {
_color = color;
emit colorChanged(this);
Q_EMIT colorChanged(this);
}
}
......
......@@ -96,7 +96,7 @@ void Vt102Emulation::reset()
setCodec(LocaleCodec);
}
emit resetCursorStyleRequest();
Q_EMIT resetCursorStyleRequest();
bufferedUpdate();
}
......@@ -517,7 +517,7 @@ void Vt102Emulation::processSessionAttributeRequest(int tokenSize)
if (value == QLatin1String("?")) {
// pass terminator type indication here, because OSC response terminator
// should match the terminator of OSC request.
emit sessionAttributeRequest(attribute, tokenBuffer[tokenSize]);
Q_EMIT sessionAttributeRequest(attribute, tokenBuffer[tokenSize]);
return;
}
......@@ -530,7 +530,7 @@ void Vt102Emulation::updateSessionAttributes()
QListIterator<int> iter(_pendingSessionAttributesUpdates.keys());
while (iter.hasNext()) {
int arg = iter.next();
emit sessionAttributeChanged(arg , _pendingSessionAttributesUpdates[arg]);
Q_EMIT sessionAttributeChanged(arg , _pendingSessionAttributesUpdates[arg]);
}
_pendingSessionAttributesUpdates.clear();
}
......@@ -653,7 +653,7 @@ void Vt102Emulation::processToken(int token, int p, int q)
// resize = \e[8;<row>;<col>t
case token_csi_ps('t', 8) : setImageSize( p /*lines */, q /* columns */ );
emit imageResizeRequest(QSize(q, p));
Q_EMIT imageResizeRequest(QSize(q, p));
break;
// change tab text color : \e[28;<color>t color: 0-16,777,215
......@@ -974,7 +974,7 @@ void Vt102Emulation::clearScreenAndSetColumns(int columnCount)
void Vt102Emulation::sendString(const QByteArray& s)
{
emit sendData(s);
Q_EMIT sendData(s);
}
void Vt102Emulation::reportCursorPosition()
......@@ -1160,11 +1160,11 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event)
if ((modifiers &Qt::ControlModifier) != 0U) {
switch (event->key()) {
case Qt::Key_S:
emit flowControlKeyPressed(true);
Q_EMIT flowControlKeyPressed(true);
break;
case Qt::Key_Q:
case Qt::Key_C: // cancel flow control
emit flowControlKeyPressed(false);
Q_EMIT flowControlKeyPressed(false);
break;
}
}
......@@ -1228,7 +1228,7 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent *event)
}
if (!isReadOnly) {
emit sendData(textToSend);
Q_EMIT sendData(textToSend);
}
} else {
if (!isReadOnly) {
......@@ -1412,14 +1412,14 @@ void Vt102Emulation::setMode(int m)
case MODE_Mouse1001:
case MODE_Mouse1002:
case MODE_Mouse1003:
emit programRequestsMouseTracking(true);
Q_EMIT programRequestsMouseTracking(true);
break;
case MODE_Mouse1007:
emit enableAlternateScrolling(true);
Q_EMIT enableAlternateScrolling(true);
break;
case MODE_BracketedPaste:
emit programBracketedPasteModeChanged(true);
Q_EMIT programBracketedPasteModeChanged(true);
break;
case MODE_AppScreen:
......@@ -1449,14 +1449,14 @@ void Vt102Emulation::resetMode(int m)
case MODE_Mouse1001:
case MODE_Mouse1002:
case MODE_Mouse1003:
emit programRequestsMouseTracking(false);
Q_EMIT programRequestsMouseTracking(false);
break;
case MODE_Mouse1007:
emit enableAlternateScrolling(false);
Q_EMIT enableAlternateScrolling(false);
break;
case MODE_BracketedPaste:
emit programBracketedPasteModeChanged(false);
Q_EMIT programBracketedPasteModeChanged(false);
break;
case MODE_AppScreen:
......
......@@ -176,7 +176,7 @@ void ColorSchemeEditor::editColorItem(QTableWidgetItem *item)
_colors->setColorTableEntry(colorSchemeRow, color);
emit colorsChanged(_colors);
Q_EMIT colorsChanged(_colors);
}
}
......@@ -326,5 +326,5 @@ bool ColorSchemeEditor::isNewScheme() const
void ColorSchemeEditor::saveColorScheme()
{
emit colorSchemeSaveRequested(colorScheme(), _isNewScheme);
Q_EMIT colorSchemeSaveRequested(colorScheme(), _isNewScheme);
}
......@@ -24,8 +24,8 @@ void ShortcutItemDelegate::editorModified()
auto *editor = qobject_cast<FilteredKeySequenceEdit*>(sender());
Q_ASSERT(editor);
_modifiedEditors.insert(editor);
emit commitData(editor);
emit closeEditor(editor);
Q_EMIT commitData(editor);
Q_EMIT closeEditor(editor);
}
void ShortcutItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
......@@ -92,12 +92,12 @@ void FilteredKeySequenceEdit::keyPressEvent(QKeyEvent *event)
switch(event->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
emit editingFinished();
Q_EMIT editingFinished();
return;
case Qt::Key_Backspace:
case Qt::Key_Delete:
clear();
emit editingFinished();
Q_EMIT editingFinished();
event->accept();
return;
default:
......
......@@ -133,7 +133,7 @@ void ProfileList::addShortcutAction(const Profile::Ptr &profile)
for (QWidget *widget : qAsConst(_registeredWidgets)) {
widget->addAction(action);
}
emit actionsChanged(_group->actions());
Q_EMIT actionsChanged(_group->actions());
updateEmptyAction();
}
......@@ -147,14 +147,14 @@ void ProfileList::removeShortcutAction(const Profile::Ptr &profile)
for (QWidget *widget : qAsConst(_registeredWidgets)) {
widget->removeAction(action);
}
emit actionsChanged(_group->actions());
Q_EMIT actionsChanged(_group->actions());
}
updateEmptyAction();
}
void ProfileList::triggered(QAction* action)
{
emit profileSelected(action->data().value<Profile::Ptr>());
Q_EMIT profileSelected(action->data().value<Profile::Ptr>());
}
QList<QAction*> ProfileList::actions()
......
......@@ -450,7 +450,7 @@ void ProfileManager::changeProfile(Profile::Ptr profile,
initFallbackProfile();
} else {
// notify the world about the change
emit profileChanged(profile);
Q_EMIT profileChanged(profile);
}
}
......@@ -462,7 +462,7 @@ void ProfileManager::addProfile(const Profile::Ptr &profile)
_profiles.insert(profile);
emit profileAdded(profile);
Q_EMIT profileAdded(profile);
}
bool ProfileManager::deleteProfile(Profile::Ptr profile)
......@@ -495,7 +495,7 @@ bool ProfileManager::deleteProfile(Profile::Ptr profile)
setDefaultProfile(existingProfiles.at(0));
}
emit profileRemoved(profile);
Q_EMIT profileRemoved(profile);
return true;
}
......@@ -589,7 +589,7 @@ void ProfileManager::setShortcut(Profile::Ptr profile ,
// have a path yet
_shortcuts.insert(keySequence, data);
emit shortcutChanged(profile, keySequence);
Q_EMIT shortcutChanged(profile, keySequence);
}
QKeySequence ProfileManager::shortcut(Profile::Ptr profile) const
......
......@@ -142,7 +142,7 @@ bool ProfileModel::setData(const QModelIndex &idx, const QVariant &value, int ro
if (idx.column() == SHORTCUT) {
auto sequence = QKeySequence::fromString(value.toString());
ProfileManager::instance()->setShortcut(profile, sequence);
emit dataChanged(idx, idx, {Qt::DisplayRole});
Q_EMIT dataChanged(idx, idx, {Qt::DisplayRole});
return true;
}
......@@ -174,7 +174,7 @@ void ProfileModel::remove(QExplicitlySharedDataPointer<Profile> profile)
void ProfileModel::setDefault(QExplicitlySharedDataPointer<Profile> profile)
{
Q_UNUSED(profile)
emit dataChanged(index(0, 0), index(0, COLUMNS-1), {Qt::DisplayRole});
Q_EMIT dataChanged(index(0, 0), index(0, COLUMNS-1), {Qt::DisplayRole});
}