diff --git a/src/Application.cpp b/src/Application.cpp index c14edb90c..0b382d46f 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -70,10 +70,10 @@ MainWindow* Application::newMainWindow() { MainWindow* window = new MainWindow(); - connect(window, SIGNAL(newWindowRequest(Profile::Ptr,QString)), - this, SLOT(createWindow(Profile::Ptr,QString))); - connect(window, SIGNAL(viewDetached(Session*)), - this, SLOT(detachView(Session*))); + connect(window, &Konsole::MainWindow::newWindowRequest, + this, &Konsole::Application::createWindow); + connect(window, &Konsole::MainWindow::viewDetached, + this, &Konsole::Application::detachView); return window; } diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp index 9f029ab63..e57c31013 100644 --- a/src/ColorSchemeEditor.cpp +++ b/src/ColorSchemeEditor.cpp @@ -57,8 +57,8 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent) { // Kdialog buttons setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply); - connect(this, SIGNAL(applyClicked()), this, SLOT(saveColorScheme())); - connect(this, SIGNAL(okClicked()), this, SLOT(saveColorScheme())); + connect(this, &Konsole::ColorSchemeEditor::applyClicked, this, &Konsole::ColorSchemeEditor::saveColorScheme); + connect(this, &Konsole::ColorSchemeEditor::okClicked, this, &Konsole::ColorSchemeEditor::saveColorScheme); // ui _ui = new Ui::ColorSchemeEditor(); @@ -66,18 +66,18 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent) // description edit _ui->descriptionEdit->setClearButtonEnabled(true); - connect(_ui->descriptionEdit , SIGNAL(textChanged(QString)) , this , - SLOT(setDescription(QString))); + connect(_ui->descriptionEdit , &QLineEdit::textChanged , this , + &Konsole::ColorSchemeEditor::setDescription); // transparency slider QFontMetrics metrics(font()); _ui->transparencyPercentLabel->setMinimumWidth(metrics.width("100%")); - connect(_ui->transparencySlider , SIGNAL(valueChanged(int)) , this , SLOT(setTransparencyPercentLabel(int))); + connect(_ui->transparencySlider , &QSlider::valueChanged , this , &Konsole::ColorSchemeEditor::setTransparencyPercentLabel); // randomized background - connect(_ui->randomizedBackgroundCheck , SIGNAL(toggled(bool)) , this , - SLOT(setRandomizedBackgroundColor(bool))); + connect(_ui->randomizedBackgroundCheck , &QCheckBox::toggled , this , + &Konsole::ColorSchemeEditor::setRandomizedBackgroundColor); // wallpaper stuff QFileSystemModel *dirModel = new QFileSystemModel(this); @@ -90,10 +90,10 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent) _ui->wallpaperPath->setClearButtonEnabled(true); _ui->wallpaperSelectButton->setIcon(KIcon("image-x-generic")); - connect(_ui->wallpaperSelectButton, SIGNAL(clicked()), - this, SLOT(selectWallpaper())); - connect(_ui->wallpaperPath, SIGNAL(textChanged(QString)), - this, SLOT(wallpaperPathChanged(QString))); + connect(_ui->wallpaperSelectButton, &QToolButton::clicked, + this, &Konsole::ColorSchemeEditor::selectWallpaper); + connect(_ui->wallpaperPath, &QLineEdit::textChanged, + this, &Konsole::ColorSchemeEditor::wallpaperPathChanged); // color table _ui->colorTable->setColumnCount(3); @@ -115,8 +115,8 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent) _ui->colorTable->verticalHeader()->hide(); - connect(_ui->colorTable , SIGNAL(itemClicked(QTableWidgetItem*)) , this , - SLOT(editColorItem(QTableWidgetItem*))); + connect(_ui->colorTable , &QTableWidget::itemClicked , this , + &Konsole::ColorSchemeEditor::editColorItem); // warning label when transparency is not available _ui->transparencyWarningWidget->setWordWrap(true); diff --git a/src/CopyInputDialog.cpp b/src/CopyInputDialog.cpp index 619307b98..04d619fb9 100644 --- a/src/CopyInputDialog.cpp +++ b/src/CopyInputDialog.cpp @@ -41,8 +41,8 @@ CopyInputDialog::CopyInputDialog(QWidget* parent) _ui = new Ui::CopyInputDialog(); _ui->setupUi(mainWidget()); - connect(_ui->selectAllButton, SIGNAL(clicked()), this, SLOT(selectAll())); - connect(_ui->deselectAllButton, SIGNAL(clicked()), this, SLOT(deselectAll())); + connect(_ui->selectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::selectAll); + connect(_ui->deselectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::deselectAll); _ui->filterEdit->setClearButtonEnabled(true); _ui->filterEdit->setFocus(); @@ -57,8 +57,8 @@ CopyInputDialog::CopyInputDialog(QWidget* parent) filterProxyModel->setSourceModel(_model); filterProxyModel->setFilterKeyColumn(-1); - connect(_ui->filterEdit, SIGNAL(textChanged(QString)), - filterProxyModel, SLOT(setFilterFixedString(QString))); + connect(_ui->filterEdit, &QLineEdit::textChanged, + filterProxyModel, &QSortFilterProxyModel::setFilterFixedString); _ui->sessionList->setModel(filterProxyModel); _ui->sessionList->setColumnHidden(0, true); // Hide number column diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index b04235578..3693eb16a 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -79,9 +79,9 @@ EditProfileDialog::EditProfileDialog(QWidget* aParent) // disable the apply button , since no modification has been made enableButtonApply(false); - connect(this, SIGNAL(applyClicked()), this, SLOT(save())); + connect(this, &Konsole::EditProfileDialog::applyClicked, this, &Konsole::EditProfileDialog::save); - connect(_delayedPreviewTimer, SIGNAL(timeout()), this, SLOT(delayedPreviewActivate())); + connect(_delayedPreviewTimer, &QTimer::timeout, this, &Konsole::EditProfileDialog::delayedPreviewActivate); _ui = new Ui::EditProfileDialog(); _ui->setupUi(mainWidget()); @@ -97,8 +97,8 @@ EditProfileDialog::EditProfileDialog(QWidget* aParent) // not been updated since the last profile change and will need // to be refreshed when the user switches to them _pageNeedsUpdate.resize(_ui->tabWidget->count()); - connect(_ui->tabWidget, SIGNAL(currentChanged(int)), this, - SLOT(preparePage(int))); + connect(_ui->tabWidget, &QTabWidget::currentChanged, this, + &Konsole::EditProfileDialog::preparePage); createTempProfile(); } @@ -305,26 +305,26 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile) _ui->showTerminalSizeHintButton->setChecked(profile->showTerminalSizeHint()); // signals and slots - connect(_ui->dirSelectButton, SIGNAL(clicked()), this, SLOT(selectInitialDir())); - connect(_ui->iconSelectButton, SIGNAL(clicked()), this, SLOT(selectIcon())); - connect(_ui->startInSameDirButton, SIGNAL(toggled(bool)), this , - SLOT(startInSameDir(bool))); - connect(_ui->profileNameEdit, SIGNAL(textChanged(QString)), this, - SLOT(profileNameChanged(QString))); - connect(_ui->initialDirEdit, SIGNAL(textChanged(QString)), this, - SLOT(initialDirChanged(QString))); - connect(_ui->commandEdit, SIGNAL(textChanged(QString)), this, - SLOT(commandChanged(QString))); - connect(_ui->environmentEditButton , SIGNAL(clicked()), this, - SLOT(showEnvironmentEditor())); + connect(_ui->dirSelectButton, &QToolButton::clicked, this, &Konsole::EditProfileDialog::selectInitialDir); + connect(_ui->iconSelectButton, &QPushButton::clicked, this, &Konsole::EditProfileDialog::selectIcon); + connect(_ui->startInSameDirButton, &QCheckBox::toggled, this , + &Konsole::EditProfileDialog::startInSameDir); + connect(_ui->profileNameEdit, &QLineEdit::textChanged, this, + &Konsole::EditProfileDialog::profileNameChanged); + connect(_ui->initialDirEdit, &QLineEdit::textChanged, this, + &Konsole::EditProfileDialog::initialDirChanged); + connect(_ui->commandEdit, &QLineEdit::textChanged, this, + &Konsole::EditProfileDialog::commandChanged); + connect(_ui->environmentEditButton , &QPushButton::clicked, this, + &Konsole::EditProfileDialog::showEnvironmentEditor); - connect(_ui->terminalColumnsEntry, SIGNAL(valueChanged(int)), - this, SLOT(terminalColumnsEntryChanged(int))); - connect(_ui->terminalRowsEntry, SIGNAL(valueChanged(int)), - this, SLOT(terminalRowsEntryChanged(int))); + connect(_ui->terminalColumnsEntry, static_cast(&KIntSpinBox::valueChanged), + this, &Konsole::EditProfileDialog::terminalColumnsEntryChanged); + connect(_ui->terminalRowsEntry, static_cast(&KIntSpinBox::valueChanged), + this, &Konsole::EditProfileDialog::terminalRowsEntryChanged); - connect(_ui->showTerminalSizeHintButton, SIGNAL(toggled(bool)), this, - SLOT(showTerminalSizeHint(bool))); + connect(_ui->showTerminalSizeHintButton, &QCheckBox::toggled, this, + &Konsole::EditProfileDialog::showTerminalSizeHint); } void EditProfileDialog::showEnvironmentEditor() { @@ -354,18 +354,18 @@ void EditProfileDialog::setupTabsPage(const Profile::Ptr profile) _ui->renameTabWidget->setTabTitleText(profile->localTabTitleFormat()); _ui->renameTabWidget->setRemoteTabTitleText(profile->remoteTabTitleFormat()); - connect(_ui->renameTabWidget, SIGNAL(tabTitleFormatChanged(QString)), this, - SLOT(tabTitleFormatChanged(QString))); - connect(_ui->renameTabWidget, SIGNAL(remoteTabTitleFormatChanged(QString)), this, - SLOT(remoteTabTitleFormatChanged(QString))); + connect(_ui->renameTabWidget, &Konsole::RenameTabWidget::tabTitleFormatChanged, this, + &Konsole::EditProfileDialog::tabTitleFormatChanged); + connect(_ui->renameTabWidget, &Konsole::RenameTabWidget::remoteTabTitleFormatChanged, this, + &Konsole::EditProfileDialog::remoteTabTitleFormatChanged); // tab monitoring const int silenceSeconds = profile->silenceSeconds(); _ui->silenceSecondsSpinner->setValue(silenceSeconds); _ui->silenceSecondsSpinner->setSuffix(ki18ncp("Unit of time", " second", " seconds")); - connect(_ui->silenceSecondsSpinner, SIGNAL(valueChanged(int)), - this, SLOT(silenceSecondsChanged(int))); + connect(_ui->silenceSecondsSpinner, static_cast(&KIntSpinBox::valueChanged), + this, &Konsole::EditProfileDialog::silenceSecondsChanged); } void EditProfileDialog::terminalColumnsEntryChanged(int value) @@ -456,19 +456,19 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile) _ui->colorSchemeList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); connect(_ui->colorSchemeList->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(colorSchemeSelected())); - connect(_ui->colorSchemeList, SIGNAL(entered(QModelIndex)), this, - SLOT(previewColorScheme(QModelIndex))); + &QItemSelectionModel::selectionChanged, + this, &Konsole::EditProfileDialog::colorSchemeSelected); + connect(_ui->colorSchemeList, &QListView::entered, this, + &Konsole::EditProfileDialog::previewColorScheme); updateColorSchemeButtons(); - connect(_ui->editColorSchemeButton, SIGNAL(clicked()), this, - SLOT(editColorScheme())); - connect(_ui->removeColorSchemeButton, SIGNAL(clicked()), this, - SLOT(removeColorScheme())); - connect(_ui->newColorSchemeButton, SIGNAL(clicked()), this, - SLOT(newColorScheme())); + connect(_ui->editColorSchemeButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::editColorScheme); + connect(_ui->removeColorSchemeButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::removeColorScheme); + connect(_ui->newColorSchemeButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::newColorScheme); // setup font preview const bool antialias = profile->antiAliasFonts(); @@ -480,22 +480,22 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile) _ui->fontPreviewLabel->setFont(profileFont); setFontInputValue(profileFont); - connect(_ui->fontSizeInput, SIGNAL(valueChanged(double)), this, - SLOT(setFontSize(double))); - connect(_ui->selectFontButton, SIGNAL(clicked()), this, - SLOT(showFontDialog())); + connect(_ui->fontSizeInput, &KDoubleNumInput::valueChanged, this, + &Konsole::EditProfileDialog::setFontSize); + connect(_ui->selectFontButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::showFontDialog); // setup font smoothing _ui->antialiasTextButton->setChecked(antialias); - connect(_ui->antialiasTextButton, SIGNAL(toggled(bool)), this, - SLOT(setAntialiasText(bool))); + connect(_ui->antialiasTextButton, &QCheckBox::toggled, this, + &Konsole::EditProfileDialog::setAntialiasText); _ui->boldIntenseButton->setChecked(profile->boldIntense()); - connect(_ui->boldIntenseButton, SIGNAL(toggled(bool)), this, - SLOT(setBoldIntense(bool))); + connect(_ui->boldIntenseButton, &QCheckBox::toggled, this, + &Konsole::EditProfileDialog::setBoldIntense); _ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled()); - connect(_ui->enableMouseWheelZoomButton, SIGNAL(toggled(bool)), this, - SLOT(toggleMouseWheelZoom(bool))); + connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, + &Konsole::EditProfileDialog::toggleMouseWheelZoom); } void EditProfileDialog::setAntialiasText(bool enable) { @@ -718,8 +718,8 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme) } _colorDialog = new ColorSchemeEditor(this); - connect(_colorDialog, SIGNAL(colorSchemeSaveRequested(ColorScheme,bool)), - this, SLOT(saveColorScheme(ColorScheme,bool))); + connect(_colorDialog, &Konsole::ColorSchemeEditor::colorSchemeSaveRequested, + this, &Konsole::EditProfileDialog::saveColorScheme); _colorDialog->setup(colors, isNewScheme); _colorDialog->show(); @@ -851,17 +851,17 @@ void EditProfileDialog::setupKeyboardPage(const Profile::Ptr /* profile */) updateKeyBindingsList(true); connect(_ui->keyBindingList->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - SLOT(keyBindingSelected())); - connect(_ui->newKeyBindingsButton, SIGNAL(clicked()), this, - SLOT(newKeyBinding())); + &QItemSelectionModel::selectionChanged, + this, &Konsole::EditProfileDialog::keyBindingSelected); + connect(_ui->newKeyBindingsButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::newKeyBinding); updateKeyBindingsButtons(); - connect(_ui->editKeyBindingsButton, SIGNAL(clicked()), this, - SLOT(editKeyBinding())); - connect(_ui->removeKeyBindingsButton, SIGNAL(clicked()), this, - SLOT(removeKeyBinding())); + connect(_ui->editKeyBindingsButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::editKeyBinding); + connect(_ui->removeKeyBindingsButton, &QPushButton::clicked, this, + &Konsole::EditProfileDialog::removeKeyBinding); } void EditProfileDialog::keyBindingSelected() { @@ -983,8 +983,8 @@ void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile) // setup scrollback type radio int scrollBackType = profile->property(Profile::HistoryMode); _ui->historySizeWidget->setMode(Enum::HistoryModeEnum(scrollBackType)); - connect(_ui->historySizeWidget, SIGNAL(historyModeChanged(Enum::HistoryModeEnum)), - this, SLOT(historyModeChanged(Enum::HistoryModeEnum))); + connect(_ui->historySizeWidget, &Konsole::HistorySizeWidget::historyModeChanged, + this, &Konsole::EditProfileDialog::historyModeChanged); // setup scrollback line count spinner const int historySize = profile->historySize(); @@ -1002,8 +1002,8 @@ void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile) setupRadio(pageamounts, scrollFullPage); // signals and slots - connect(_ui->historySizeWidget, SIGNAL(historySizeChanged(int)), - this, SLOT(historySizeChanged(int))); + connect(_ui->historySizeWidget, &Konsole::HistorySizeWidget::historySizeChanged, + this, &Konsole::EditProfileDialog::historySizeChanged); } void EditProfileDialog::historySizeChanged(int lineCount) @@ -1072,20 +1072,20 @@ void EditProfileDialog::setupMousePage(const Profile::Ptr profile) // interaction options _ui->wordCharacterEdit->setText(profile->wordCharacters()); - connect(_ui->wordCharacterEdit, SIGNAL(textChanged(QString)), this, - SLOT(wordCharactersChanged(QString))); + connect(_ui->wordCharacterEdit, &QLineEdit::textChanged, this, + &Konsole::EditProfileDialog::wordCharactersChanged); int tripleClickMode = profile->property(Profile::TripleClickMode); _ui->tripleClickModeCombo->setCurrentIndex(tripleClickMode); - connect(_ui->tripleClickModeCombo, SIGNAL(activated(int)), this, - SLOT(TripleClickModeChanged(int))); + connect(_ui->tripleClickModeCombo, static_cast(&KComboBox::activated), this, + &Konsole::EditProfileDialog::TripleClickModeChanged); _ui->openLinksByDirectClickButton->setEnabled(_ui->underlineLinksButton->isChecked()); _ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled()); - connect(_ui->enableMouseWheelZoomButton, SIGNAL(toggled(bool)), this, - SLOT(toggleMouseWheelZoom(bool))); + connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, + &Konsole::EditProfileDialog::toggleMouseWheelZoom); } void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile) { @@ -1112,8 +1112,8 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile) const int lineSpacing = profile->lineSpacing(); _ui->lineSpacingSpinner->setValue(lineSpacing); - connect(_ui->lineSpacingSpinner, SIGNAL(valueChanged(int)), - this, SLOT(lineSpacingChanged(int))); + connect(_ui->lineSpacingSpinner, static_cast(&KIntSpinBox::valueChanged), + this, &Konsole::EditProfileDialog::lineSpacingChanged); // cursor options if (profile->useCustomCursorColor()) @@ -1123,20 +1123,20 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile) _ui->customColorSelectButton->setColor(profile->customCursorColor()); - connect(_ui->customCursorColorButton, SIGNAL(clicked()), this, SLOT(customCursorColor())); - connect(_ui->autoCursorColorButton, SIGNAL(clicked()), this, SLOT(autoCursorColor())); - connect(_ui->customColorSelectButton, SIGNAL(changed(QColor)), - SLOT(customCursorColorChanged(QColor))); + connect(_ui->customCursorColorButton, &QRadioButton::clicked, this, &Konsole::EditProfileDialog::customCursorColor); + connect(_ui->autoCursorColorButton, &QRadioButton::clicked, this, &Konsole::EditProfileDialog::autoCursorColor); + connect(_ui->customColorSelectButton, &KColorButton::changed, + this, &Konsole::EditProfileDialog::customCursorColorChanged); int shape = profile->property(Profile::CursorShape); _ui->cursorShapeCombo->setCurrentIndex(shape); - connect(_ui->cursorShapeCombo, SIGNAL(activated(int)), this, SLOT(setCursorShape(int))); + connect(_ui->cursorShapeCombo, static_cast(&KComboBox::activated), this, &Konsole::EditProfileDialog::setCursorShape); // encoding options - QAction* codecAction = new KCodecAction(this); + KCodecAction* codecAction = new KCodecAction(this); _ui->selectEncodingButton->setMenu(codecAction->menu()); - connect(codecAction, SIGNAL(triggered(QTextCodec*)), this, SLOT(setDefaultCodec(QTextCodec*))); + connect(codecAction, static_cast(&KCodecAction::triggered), this, &Konsole::EditProfileDialog::setDefaultCodec); _ui->characterEncodingLabel->setText(profile->defaultEncoding()); } @@ -1255,7 +1255,7 @@ void EditProfileDialog::showFontDialog() if (!chooserList.isEmpty()) chooserList.at(0)->setSampleText(sampleText); - connect(dialog.data(), SIGNAL(fontSelected(QFont)), this, SLOT(fontSelected(QFont))); + connect(dialog.data(), &KFontDialog::fontSelected, this, &Konsole::EditProfileDialog::fontSelected); if (dialog.data()->exec() == QDialog::Rejected) fontSelected(currentFont); diff --git a/src/Emulation.cpp b/src/Emulation.cpp index a02dd2a52..0058e0f33 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -47,14 +47,14 @@ Emulation::Emulation() : _screen[1] = new Screen(40, 80); _currentScreen = _screen[0]; - QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk())); - QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk())); + QObject::connect(&_bulkTimer1, &QTimer::timeout, this, &Konsole::Emulation::showBulk); + QObject::connect(&_bulkTimer2, &QTimer::timeout, this, &Konsole::Emulation::showBulk); // listen for mouse status changes - connect(this , SIGNAL(programUsesMouseChanged(bool)) , - SLOT(usesMouseChanged(bool))); - connect(this , SIGNAL(programBracketedPasteModeChanged(bool)) , - SLOT(bracketedPasteModeChanged(bool))); + connect(this , &Konsole::Emulation::programUsesMouseChanged , + this, &Konsole::Emulation::usesMouseChanged); + connect(this , &Konsole::Emulation::programBracketedPasteModeChanged , + this, &Konsole::Emulation::bracketedPasteModeChanged); } bool Emulation::programUsesMouse() const @@ -82,13 +82,13 @@ ScreenWindow* Emulation::createWindow() ScreenWindow* window = new ScreenWindow(_currentScreen); _windows << window; - connect(window , SIGNAL(selectionChanged()), - this , SLOT(bufferedUpdate())); - connect(window, SIGNAL(selectionChanged()), - this, SLOT(checkSelectedText())); + connect(window , &Konsole::ScreenWindow::selectionChanged, + this , &Konsole::Emulation::bufferedUpdate); + connect(window, &Konsole::ScreenWindow::selectionChanged, + this, &Konsole::Emulation::checkSelectedText); - connect(this , SIGNAL(outputChanged()), - window , SLOT(notifyOutputChanged())); + connect(this , &Konsole::Emulation::outputChanged, + window , &Konsole::ScreenWindow::notifyOutputChanged); return window; } @@ -204,15 +204,10 @@ 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().toUtf8().constData(), ev->text().length()); + emit sendData(ev->text().toLocal8Bit()); } } -void Emulation::sendString(const char*, int) -{ - // default implementation does nothing -} - void Emulation::sendMouseEvent(int /*buttons*/, int /*column*/, int /*row*/, int /*eventType*/) { // default implementation does nothing diff --git a/src/Emulation.h b/src/Emulation.h index 52a34b4ee..764e5dc4d 100644 --- a/src/Emulation.h +++ b/src/Emulation.h @@ -244,10 +244,8 @@ public slots: * Sends a string of characters to the foreground terminal process. * * @param string The characters to send. - * @param length Length of @p string or if set to a negative value, @p string will - * be treated as a null-terminated string and its length will be determined automatically. */ - virtual void sendString(const char* string, int length = -1) = 0; + virtual void sendString(const QByteArray &string) = 0; /** * Processes an incoming stream of characters. receiveData() decodes the incoming @@ -270,9 +268,8 @@ signals: * standard input of the terminal. * * @param data The buffer of data ready to be sent - * @param len The length of @p data in bytes */ - void sendData(const char* data, int len); + void sendData(const QByteArray& data); /** * Requests that the pty used by the terminal process diff --git a/src/Filter.cpp b/src/Filter.cpp index bb695fb3d..6e151b043 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -475,8 +475,8 @@ QList UrlFilter::HotSpot::actions() openAction->setObjectName(QLatin1String("open-action")); copyAction->setObjectName(QLatin1String("copy-action")); - QObject::connect(openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated())); - QObject::connect(copyAction , SIGNAL(triggered()) , _urlObject , SLOT(activated())); + QObject::connect(openAction , &QAction::triggered , _urlObject , &Konsole::FilterObject::activated); + QObject::connect(copyAction , &QAction::triggered , _urlObject , &Konsole::FilterObject::activated); QList actions; actions << openAction; diff --git a/src/Filter.h b/src/Filter.h index cbcc8e22d..8d125f29f 100644 --- a/src/Filter.h +++ b/src/Filter.h @@ -286,7 +286,7 @@ class FilterObject : public QObject Q_OBJECT public: explicit FilterObject(Filter::HotSpot* filter) : _filter(filter) {} -private slots: +public slots: void activated(); private: Filter::HotSpot* _filter; diff --git a/src/HistorySizeWidget.cpp b/src/HistorySizeWidget.cpp index f45608a32..f5614f685 100644 --- a/src/HistorySizeWidget.cpp +++ b/src/HistorySizeWidget.cpp @@ -49,21 +49,21 @@ HistorySizeWidget::HistorySizeWidget(QWidget* parent) // focus and select the spinner automatically when appropriate _ui->fixedSizeHistoryButton->setFocusProxy(_ui->historyLineSpinner); - connect(_ui->fixedSizeHistoryButton , SIGNAL(clicked()) , - _ui->historyLineSpinner , SLOT(selectAll())); + connect(_ui->fixedSizeHistoryButton , &QRadioButton::clicked , + _ui->historyLineSpinner , &KIntSpinBox::selectAll); QButtonGroup* modeGroup = new QButtonGroup(this); modeGroup->addButton(_ui->noHistoryButton); modeGroup->addButton(_ui->fixedSizeHistoryButton); modeGroup->addButton(_ui->unlimitedHistoryButton); - connect(modeGroup, SIGNAL(buttonClicked(QAbstractButton*)), - this, SLOT(buttonClicked(QAbstractButton*))); + connect(modeGroup, static_cast(&QButtonGroup::buttonClicked), + this, &Konsole::HistorySizeWidget::buttonClicked); _ui->historyLineSpinner->setSuffix(ki18ncp("Unit of scrollback", " line", " lines")); this->setLineCount(HistorySizeWidget::DefaultLineCount); - connect(_ui->historyLineSpinner, SIGNAL(valueChanged(int)), - this, SIGNAL(historySizeChanged(int))); + connect(_ui->historyLineSpinner, static_cast(&KIntSpinBox::valueChanged), + this, &Konsole::HistorySizeWidget::historySizeChanged); } HistorySizeWidget::~HistorySizeWidget() diff --git a/src/IncrementalSearchBar.cpp b/src/IncrementalSearchBar.cpp index 133c84438..965d4737f 100644 --- a/src/IncrementalSearchBar.cpp +++ b/src/IncrementalSearchBar.cpp @@ -54,7 +54,7 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent) closeButton->setToolTip(i18nc("@info:tooltip", "Close the search bar")); closeButton->setAutoRaise(true); closeButton->setIcon(KIcon("dialog-close")); - connect(closeButton , SIGNAL(clicked()) , this , SIGNAL(closeClicked())); + connect(closeButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::closeClicked); QLabel* findLabel = new QLabel(i18nc("@label:textbox", "Find:"), this); _searchEdit = new QLineEdit(this); @@ -74,27 +74,27 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent) _searchTimer = new QTimer(this); _searchTimer->setInterval(250); _searchTimer->setSingleShot(true); - connect(_searchTimer , SIGNAL(timeout()) , this , SLOT(notifySearchChanged())); - connect(_searchEdit , SIGNAL(textChanged(QString)) , _searchTimer , SLOT(start())); + connect(_searchTimer , &QTimer::timeout , this , &Konsole::IncrementalSearchBar::notifySearchChanged); + connect(_searchEdit , &QLineEdit::textChanged , _searchTimer , static_cast(&QTimer::start)); _findNextButton = new QToolButton(this); _findNextButton->setObjectName(QLatin1String("find-next-button")); _findNextButton->setText(i18nc("@action:button Go to the next phrase", "Next")); _findNextButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); _findNextButton->setToolTip(i18nc("@info:tooltip", "Find the next match for the current search phrase")); - connect(_findNextButton , SIGNAL(clicked()) , this , SIGNAL(findNextClicked())); + connect(_findNextButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::findNextClicked); _findPreviousButton = new QToolButton(this); _findPreviousButton->setObjectName(QLatin1String("find-previous-button")); _findPreviousButton->setText(i18nc("@action:button Go to the previous phrase", "Previous")); _findPreviousButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); _findPreviousButton->setToolTip(i18nc("@info:tooltip", "Find the previous match for the current search phrase")); - connect(_findPreviousButton , SIGNAL(clicked()) , this , SIGNAL(findPreviousClicked())); + connect(_findPreviousButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::findPreviousClicked); _searchFromButton = new QToolButton(this); _searchFromButton->setObjectName(QLatin1String("search-from-button")); - connect(_searchFromButton , SIGNAL(clicked()) , this , SIGNAL(searchFromClicked())); + connect(_searchFromButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::searchFromClicked); QToolButton* optionsButton = new QToolButton(this); optionsButton->setObjectName(QLatin1String("find-options-button")); @@ -120,27 +120,27 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent) _caseSensitive = optionsMenu->addAction(i18nc("@item:inmenu", "Case sensitive")); _caseSensitive->setCheckable(true); _caseSensitive->setToolTip(i18nc("@info:tooltip", "Sets whether the search is case sensitive")); - connect(_caseSensitive, SIGNAL(toggled(bool)), - this, SIGNAL(matchCaseToggled(bool))); + connect(_caseSensitive, &QAction::toggled, + this, &Konsole::IncrementalSearchBar::matchCaseToggled); _regExpression = optionsMenu->addAction(i18nc("@item:inmenu", "Match regular expression")); _regExpression->setCheckable(true); - connect(_regExpression, SIGNAL(toggled(bool)), - this, SIGNAL(matchRegExpToggled(bool))); + connect(_regExpression, &QAction::toggled, + this, &Konsole::IncrementalSearchBar::matchRegExpToggled); _highlightMatches = optionsMenu->addAction(i18nc("@item:inmenu", "Highlight all matches")); _highlightMatches->setCheckable(true); _highlightMatches->setToolTip(i18nc("@info:tooltip", "Sets whether matching text should be highlighted")); _highlightMatches->setChecked(true); - connect(_highlightMatches, SIGNAL(toggled(bool)), - this, SIGNAL(highlightMatchesToggled(bool))); + connect(_highlightMatches, &QAction::toggled, + this, &Konsole::IncrementalSearchBar::highlightMatchesToggled); _reverseSearch = optionsMenu->addAction(i18n("Search backwards")); _reverseSearch->setCheckable(true); _reverseSearch->setToolTip(i18n("Sets whether search should start from the bottom")); _reverseSearch->setChecked(true); - connect(_reverseSearch, SIGNAL(toggled(bool)), - this, SLOT(updateButtonsAccordingToReverseSearchSetting())); + connect(_reverseSearch, &QAction::toggled, + this, &Konsole::IncrementalSearchBar::updateButtonsAccordingToReverseSearchSetting); updateButtonsAccordingToReverseSearchSetting(); barLayout->addStretch(); diff --git a/src/KeyBindingEditor.cpp b/src/KeyBindingEditor.cpp index c22bb4fc6..9f2bc7a66 100644 --- a/src/KeyBindingEditor.cpp +++ b/src/KeyBindingEditor.cpp @@ -40,8 +40,8 @@ KeyBindingEditor::KeyBindingEditor(QWidget* parent) _ui->setupUi(this); // description edit - connect(_ui->descriptionEdit , SIGNAL(textChanged(QString)) , - this , SLOT(setTranslatorDescription(QString))); + connect(_ui->descriptionEdit , &QLineEdit::textChanged , + this , &Konsole::KeyBindingEditor::setTranslatorDescription); // key bindings table _ui->keyBindingTable->setColumnCount(2); @@ -58,8 +58,8 @@ KeyBindingEditor::KeyBindingEditor(QWidget* parent) _ui->addEntryButton->setIcon(KIcon("list-add")); _ui->removeEntryButton->setIcon(KIcon("list-remove")); - connect(_ui->removeEntryButton , SIGNAL(clicked()) , this , SLOT(removeSelectedEntry())); - connect(_ui->addEntryButton , SIGNAL(clicked()) , this , SLOT(addNewEntry())); + connect(_ui->removeEntryButton , &QPushButton::clicked , this , &Konsole::KeyBindingEditor::removeSelectedEntry); + connect(_ui->addEntryButton , &QPushButton::clicked , this , &Konsole::KeyBindingEditor::addNewEntry); // test area _ui->testAreaInputEdit->installEventFilter(this); @@ -207,8 +207,8 @@ void KeyBindingEditor::bindingTableItemChanged(QTableWidgetItem* item) void KeyBindingEditor::setupKeyBindingTable(const KeyboardTranslator* translator) { - disconnect(_ui->keyBindingTable , SIGNAL(itemChanged(QTableWidgetItem*)) , this , - SLOT(bindingTableItemChanged(QTableWidgetItem*))); + disconnect(_ui->keyBindingTable , &QTableWidget::itemChanged , this , + &Konsole::KeyBindingEditor::bindingTableItemChanged); QList entries = translator->entries(); _ui->keyBindingTable->setRowCount(entries.count()); @@ -226,7 +226,7 @@ void KeyBindingEditor::setupKeyBindingTable(const KeyboardTranslator* translator } _ui->keyBindingTable->sortItems(0); - connect(_ui->keyBindingTable , SIGNAL(itemChanged(QTableWidgetItem*)) , this , - SLOT(bindingTableItemChanged(QTableWidgetItem*))); + connect(_ui->keyBindingTable , &QTableWidget::itemChanged , this , + &Konsole::KeyBindingEditor::bindingTableItemChanged); } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ea0b9796b..f0e31b77a 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -109,22 +109,22 @@ MainWindow::MainWindow() // create view manager _viewManager = new ViewManager(this, actionCollection()); - connect(_viewManager, SIGNAL(empty()), this, SLOT(close())); - connect(_viewManager, SIGNAL(activeViewChanged(SessionController*)), this, - SLOT(activeViewChanged(SessionController*))); - connect(_viewManager, SIGNAL(unplugController(SessionController*)), this, - SLOT(disconnectController(SessionController*))); - connect(_viewManager, SIGNAL(viewPropertiesChanged(QList)), - bookmarkHandler(), SLOT(setViews(QList))); + connect(_viewManager, &Konsole::ViewManager::empty, this, &Konsole::MainWindow::close); + connect(_viewManager, &Konsole::ViewManager::activeViewChanged, this, + &Konsole::MainWindow::activeViewChanged); + connect(_viewManager, &Konsole::ViewManager::unplugController, this, + &Konsole::MainWindow::disconnectController); + connect(_viewManager, &Konsole::ViewManager::viewPropertiesChanged, + bookmarkHandler(), &Konsole::BookmarkHandler::setViews); - connect(_viewManager, SIGNAL(updateWindowIcon()), this, - SLOT(updateWindowIcon())); - connect(_viewManager, SIGNAL(newViewRequest(Profile::Ptr)), - this, SLOT(newFromProfile(Profile::Ptr))); - connect(_viewManager, SIGNAL(newViewRequest()), - this, SLOT(newTab())); - connect(_viewManager, SIGNAL(viewDetached(Session*)), - this, SIGNAL(viewDetached(Session*))); + connect(_viewManager, &Konsole::ViewManager::updateWindowIcon, this, + &Konsole::MainWindow::updateWindowIcon); + connect(_viewManager, static_cast(&Konsole::ViewManager::newViewRequest), + this, &Konsole::MainWindow::newFromProfile); + connect(_viewManager, static_cast(&Konsole::ViewManager::newViewRequest), + this, &Konsole::MainWindow::newTab); + connect(_viewManager, &Konsole::ViewManager::viewDetached, + this, &Konsole::MainWindow::viewDetached); // create the main widget setupMainWidget(); @@ -148,7 +148,7 @@ MainWindow::MainWindow() // this must come at the end applyKonsoleSettings(); - connect(KonsoleSettings::self(), SIGNAL(configChanged()), this, SLOT(applyKonsoleSettings())); + connect(KonsoleSettings::self(), &Konsole::KonsoleSettings::configChanged, this, &Konsole::MainWindow::applyKonsoleSettings); } void MainWindow::rememberMenuAccelerators() @@ -211,10 +211,10 @@ ViewManager* MainWindow::viewManager() const void MainWindow::disconnectController(SessionController* controller) { - disconnect(controller, SIGNAL(titleChanged(ViewProperties*)), - this, SLOT(activeViewTitleChanged(ViewProperties*))); - disconnect(controller, SIGNAL(rawTitleChanged()), - this, SLOT(updateWindowCaption())); + disconnect(controller, &Konsole::SessionController::titleChanged, + this, &Konsole::MainWindow::activeViewTitleChanged); + disconnect(controller, &Konsole::SessionController::rawTitleChanged, + this, &Konsole::MainWindow::updateWindowCaption); // KXmlGuiFactory::removeClient() will try to access actions associated // with the controller internally, which may not be valid after the controller @@ -230,9 +230,9 @@ void MainWindow::activeViewChanged(SessionController* controller) { // associate bookmark menu with current session bookmarkHandler()->setActiveView(controller); - disconnect(bookmarkHandler(), SIGNAL(openUrl(KUrl)), 0, 0); - connect(bookmarkHandler(), SIGNAL(openUrl(KUrl)), controller, - SLOT(openUrl(KUrl))); + disconnect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, 0, 0); + connect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, controller, + &Konsole::SessionController::openUrl); if (_pluggedController) disconnectController(_pluggedController); @@ -241,10 +241,10 @@ void MainWindow::activeViewChanged(SessionController* controller) _pluggedController = controller; // listen for title changes from the current session - connect(controller, SIGNAL(titleChanged(ViewProperties*)), - this, SLOT(activeViewTitleChanged(ViewProperties*))); - connect(controller, SIGNAL(rawTitleChanged()), - this, SLOT(updateWindowCaption())); + connect(controller, &Konsole::SessionController::titleChanged, + this, &Konsole::MainWindow::activeViewTitleChanged); + connect(controller, &Konsole::SessionController::rawTitleChanged, + this, &Konsole::MainWindow::updateWindowCaption); controller->setShowMenuAction(_toggleMenuBarAction); guiFactory()->addClient(controller); @@ -313,7 +313,7 @@ void MainWindow::setupActions() _newTabMenuAction->setShortcutConfigurable(true); #endif _newTabMenuAction->setAutoRepeat(false); - connect(_newTabMenuAction, SIGNAL(triggered()), this, SLOT(newTab())); + connect(_newTabMenuAction, &KActionMenu::triggered, this, &Konsole::MainWindow::newTab); collection->addAction("new-tab", _newTabMenuAction); menuAction = collection->addAction("clone-tab"); @@ -321,26 +321,26 @@ void MainWindow::setupActions() menuAction->setText(i18nc("@action:inmenu", "&Clone Tab")); menuAction->setShortcut(QKeySequence()); menuAction->setAutoRepeat(false); - connect(menuAction, SIGNAL(triggered()), this, SLOT(cloneTab())); + connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::cloneTab); menuAction = collection->addAction("new-window"); menuAction->setIcon(KIcon("window-new")); menuAction->setText(i18nc("@action:inmenu", "New &Window")); menuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N)); menuAction->setAutoRepeat(false); - connect(menuAction, SIGNAL(triggered()), this, SLOT(newWindow())); + connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::newWindow); menuAction = collection->addAction("close-window"); menuAction->setIcon(KIcon("window-close")); menuAction->setText(i18nc("@action:inmenu", "Close Window")); menuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Q)); - connect(menuAction, SIGNAL(triggered()), this, SLOT(close())); + connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::close); // Bookmark Menu KActionMenu* bookmarkMenu = new KActionMenu(i18nc("@title:menu", "&Bookmarks"), collection); _bookmarkHandler = new BookmarkHandler(collection, bookmarkMenu->menu(), true, this); collection->addAction("bookmark", bookmarkMenu); - connect(_bookmarkHandler, SIGNAL(openUrls(QList)), this, SLOT(openUrls(QList))); + connect(_bookmarkHandler, &Konsole::BookmarkHandler::openUrls, this, &Konsole::MainWindow::openUrls); // Settings Menu _toggleMenuBarAction = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), collection); @@ -357,13 +357,13 @@ void MainWindow::setupActions() menuAction = collection->addAction("manage-profiles"); menuAction->setText(i18nc("@action:inmenu", "Manage Profiles...")); menuAction->setIcon(KIcon("configure")); - connect(menuAction, SIGNAL(triggered()), this, SLOT(showManageProfilesDialog())); + connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::showManageProfilesDialog); // Set up an shortcut-only action for activating menu bar. menuAction = collection->addAction("activate-menu"); menuAction->setText(i18nc("@item", "Activate Menu")); menuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F10)); - connect(menuAction, SIGNAL(triggered()), this, SLOT(activateMenuBar())); + connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::activateMenuBar); } void MainWindow::viewFullScreen(bool fullScreen) @@ -383,11 +383,11 @@ void MainWindow::setProfileList(ProfileList* list) { profileListChanged(list->actions()); - connect(list, SIGNAL(profileSelected(Profile::Ptr)), this, - SLOT(newFromProfile(Profile::Ptr))); + connect(list, &Konsole::ProfileList::profileSelected, this, + &Konsole::MainWindow::newFromProfile); - connect(list, SIGNAL(actionsChanged(QList)), this, - SLOT(profileListChanged(QList))); + connect(list, &Konsole::ProfileList::actionsChanged, this, + &Konsole::MainWindow::profileListChanged); } void MainWindow::profileListChanged(const QList& sessionActions) diff --git a/src/ManageProfilesDialog.cpp b/src/ManageProfilesDialog.cpp index a2887b611..29d25a62d 100644 --- a/src/ManageProfilesDialog.cpp +++ b/src/ManageProfilesDialog.cpp @@ -48,8 +48,8 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* aParent) setCaption(i18nc("@title:window", "Manage Profiles")); setButtons(KDialog::Close); - connect(this, SIGNAL(finished()), - ProfileManager::instance(), SLOT(saveSettings())); + connect(this, static_cast(&Konsole::ManageProfilesDialog::finished), + ProfileManager::instance(), &Konsole::ProfileManager::saveSettings); _ui = new Ui::ManageProfilesDialog(); _ui->setupUi(mainWidget()); @@ -66,15 +66,15 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* aParent) populateTable(); // listen for changes to profiles - connect(ProfileManager::instance(), SIGNAL(profileAdded(Profile::Ptr)), this, - SLOT(addItems(Profile::Ptr))); - connect(ProfileManager::instance(), SIGNAL(profileRemoved(Profile::Ptr)), this, - SLOT(removeItems(Profile::Ptr))); - connect(ProfileManager::instance(), SIGNAL(profileChanged(Profile::Ptr)), this, - SLOT(updateItems(Profile::Ptr))); + connect(ProfileManager::instance(), &Konsole::ProfileManager::profileAdded, this, + &Konsole::ManageProfilesDialog::addItems); + connect(ProfileManager::instance(), &Konsole::ProfileManager::profileRemoved, this, + &Konsole::ManageProfilesDialog::removeItems); + connect(ProfileManager::instance(), &Konsole::ProfileManager::profileChanged, this, + &Konsole::ManageProfilesDialog::updateItems); connect(ProfileManager::instance() , - SIGNAL(favoriteStatusChanged(Profile::Ptr,bool)), this, - SLOT(updateFavoriteStatus(Profile::Ptr,bool))); + &Konsole::ProfileManager::favoriteStatusChanged, this, + &Konsole::ManageProfilesDialog::updateFavoriteStatus); // resize the session table to the full width of the table _ui->sessionTable->horizontalHeader()->setHighlightSections(false); @@ -87,10 +87,10 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* aParent) _ui->sessionTable->columnWidth(ShortcutColumn) + 100); // setup buttons - connect(_ui->newProfileButton, SIGNAL(clicked()), this, SLOT(createProfile())); - connect(_ui->editProfileButton, SIGNAL(clicked()), this, SLOT(editSelected())); - connect(_ui->deleteProfileButton, SIGNAL(clicked()), this, SLOT(deleteSelected())); - connect(_ui->setAsDefaultButton, SIGNAL(clicked()), this, SLOT(setSelectedAsDefault())); + connect(_ui->newProfileButton, &QPushButton::clicked, this, &Konsole::ManageProfilesDialog::createProfile); + connect(_ui->editProfileButton, &QPushButton::clicked, this, &Konsole::ManageProfilesDialog::editSelected); + connect(_ui->deleteProfileButton, &QPushButton::clicked, this, &Konsole::ManageProfilesDialog::deleteSelected); + connect(_ui->setAsDefaultButton, &QPushButton::clicked, this, &Konsole::ManageProfilesDialog::setSelectedAsDefault); } void ManageProfilesDialog::showEvent(QShowEvent*) @@ -228,8 +228,8 @@ void ManageProfilesDialog::populateTable() } updateDefaultItem(); - connect(_sessionModel, SIGNAL(itemChanged(QStandardItem*)), this, - SLOT(itemDataChanged(QStandardItem*))); + connect(_sessionModel, &QStandardItemModel::itemChanged, this, + &Konsole::ManageProfilesDialog::itemDataChanged); // listen for changes in the table selection and update the state of the form's buttons // accordingly. @@ -237,8 +237,8 @@ void ManageProfilesDialog::populateTable() // it appears that the selection model is changed when the model itself is replaced, // so the signals need to be reconnected each time the model is updated. connect(_ui->sessionTable->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, - SLOT(tableSelectionChanged(QItemSelection))); + &QItemSelectionModel::selectionChanged, this, + &Konsole::ManageProfilesDialog::tableSelectionChanged); _ui->sessionTable->selectRow(0); } @@ -528,7 +528,7 @@ QWidget* ShortcutItemDelegate::createEditor(QWidget* aParent, const QStyleOption editor->setModifierlessAllowed(false); QString shortcutString = index.data(Qt::DisplayRole).toString(); editor->setKeySequence(QKeySequence::fromString(shortcutString)); - connect(editor, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(editorModified(QKeySequence))); + connect(editor, &KKeySequenceWidget::keySequenceChanged, this, &Konsole::ShortcutItemDelegate::editorModified); editor->captureKeySequence(); return editor; } diff --git a/src/Part.cpp b/src/Part.cpp index 62bc0f3b8..fb37380c0 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -72,10 +72,10 @@ Part::Part(QWidget* parentWidget , QObject* parent, const QVariantList&) _viewManager = new ViewManager(this, actionCollection()); _viewManager->setNavigationMethod(ViewManager::NoNavigation); - connect(_viewManager, SIGNAL(activeViewChanged(SessionController*)), this , - SLOT(activeViewChanged(SessionController*))); - connect(_viewManager, SIGNAL(empty()), this, SLOT(terminalExited())); - connect(_viewManager, SIGNAL(newViewRequest()), this, SLOT(newTab())); + connect(_viewManager, &Konsole::ViewManager::activeViewChanged, this , + &Konsole::Part::activeViewChanged); + connect(_viewManager, &Konsole::ViewManager::empty, this, &Konsole::Part::terminalExited); + connect(_viewManager, static_cast(&Konsole::ViewManager::newViewRequest), this, &Konsole::Part::newTab); _viewManager->widget()->setParent(parentWidget); @@ -100,7 +100,7 @@ Part::~Part() void Part::createGlobalActions() { _manageProfilesAction = new KAction(i18n("Manage Profiles..."), this); - connect(_manageProfilesAction, SIGNAL(triggered()), this, SLOT(showManageProfilesDialog())); + connect(_manageProfilesAction, &QAction::triggered, this, static_cast(&Konsole::Part::showManageProfilesDialog)); } void Part::setupActionsForSession(SessionController* controller) @@ -244,21 +244,21 @@ void Part::activeViewChanged(SessionController* controller) // remove existing controller if (_pluggedController) { removeChildClient(_pluggedController); - disconnect(_pluggedController, SIGNAL(titleChanged(ViewProperties*)), this, - SLOT(activeViewTitleChanged(ViewProperties*))); - disconnect(_pluggedController, SIGNAL(currentDirectoryChanged(QString)), this, - SIGNAL(currentDirectoryChanged(QString))); + disconnect(_pluggedController, &Konsole::SessionController::titleChanged, this, + &Konsole::Part::activeViewTitleChanged); + disconnect(_pluggedController, &Konsole::SessionController::currentDirectoryChanged, this, + &Konsole::Part::currentDirectoryChanged); } // insert new controller insertChildClient(controller); setupActionsForSession(controller); - connect(controller, SIGNAL(titleChanged(ViewProperties*)), this, - SLOT(activeViewTitleChanged(ViewProperties*))); + connect(controller, &Konsole::SessionController::titleChanged, this, + &Konsole::Part::activeViewTitleChanged); activeViewTitleChanged(controller); - connect(controller, SIGNAL(currentDirectoryChanged(QString)), this, - SIGNAL(currentDirectoryChanged(QString))); + connect(controller, &Konsole::SessionController::currentDirectoryChanged, this, + &Konsole::Part::currentDirectoryChanged); const char* displaySignal = SIGNAL(overrideShortcutCheck(QKeyEvent*,bool&)); const char* partSlot = SLOT(overrideTerminalShortcut(QKeyEvent*,bool&)); @@ -364,10 +364,10 @@ void Part::setMonitorSilenceEnabled(bool enabled) if (enabled) { activeSession()->setMonitorSilence(true); - connect(activeSession(), SIGNAL(stateChanged(int)), this, SLOT(sessionStateChanged(int)), Qt::UniqueConnection); + connect(activeSession(), &Konsole::Session::stateChanged, this, &Konsole::Part::sessionStateChanged, Qt::UniqueConnection); } else { activeSession()->setMonitorSilence(false); - disconnect(activeSession(), SIGNAL(stateChanged(int)), this, SLOT(sessionStateChanged(int))); + disconnect(activeSession(), &Konsole::Session::stateChanged, this, &Konsole::Part::sessionStateChanged); } } @@ -377,10 +377,10 @@ void Part::setMonitorActivityEnabled(bool enabled) if (enabled) { activeSession()->setMonitorActivity(true); - connect(activeSession(), SIGNAL(stateChanged(int)), this, SLOT(sessionStateChanged(int)), Qt::UniqueConnection); + connect(activeSession(), &Konsole::Session::stateChanged, this, &Konsole::Part::sessionStateChanged, Qt::UniqueConnection); } else { activeSession()->setMonitorActivity(false); - disconnect(activeSession(), SIGNAL(stateChanged(int)), this, SLOT(sessionStateChanged(int))); + disconnect(activeSession(), &Konsole::Session::stateChanged, this, &Konsole::Part::sessionStateChanged); } } diff --git a/src/ProfileList.cpp b/src/ProfileList.cpp index a393371c9..7d19a7a57 100644 --- a/src/ProfileList.cpp +++ b/src/ProfileList.cpp @@ -54,15 +54,15 @@ ProfileList::ProfileList(bool addShortcuts , QObject* parent) favoriteChanged(profile, true); } - connect(_group, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*))); + connect(_group, &QActionGroup::triggered, this, &Konsole::ProfileList::triggered); // listen for future changes to the profiles - connect(manager, SIGNAL(favoriteStatusChanged(Profile::Ptr,bool)), this, - SLOT(favoriteChanged(Profile::Ptr,bool))); - connect(manager, SIGNAL(shortcutChanged(Profile::Ptr,QKeySequence)), this, - SLOT(shortcutChanged(Profile::Ptr,QKeySequence))); - connect(manager, SIGNAL(profileChanged(Profile::Ptr)), this, - SLOT(profileChanged(Profile::Ptr))); + connect(manager, &Konsole::ProfileManager::favoriteStatusChanged, this, + &Konsole::ProfileList::favoriteChanged); + connect(manager, &Konsole::ProfileManager::shortcutChanged, this, + &Konsole::ProfileList::shortcutChanged); + connect(manager, &Konsole::ProfileManager::profileChanged, this, + &Konsole::ProfileList::profileChanged); } void ProfileList::updateEmptyAction() { diff --git a/src/Pty.cpp b/src/Pty.cpp index ea4c52919..c61d8830a 100644 --- a/src/Pty.cpp +++ b/src/Pty.cpp @@ -64,19 +64,19 @@ void Pty::init() setUseUtmp(true); setPtyChannels(KPtyProcess::AllChannels); - connect(pty(), SIGNAL(readyRead()) , this , SLOT(dataReceived())); + connect(pty(), &KPtyDevice::readyRead , this , &Konsole::Pty::dataReceived); } Pty::~Pty() { } -void Pty::sendData(const char* data, int length) +void Pty::sendData(const QByteArray& data) { - if (length == 0) + if (data.isEmpty()) return; - if (!pty()->write(data, length)) { + if (!pty()->write(data.constData(), data.length())) { kWarning() << "Could not send input data to terminal process."; return; } diff --git a/src/Pty.h b/src/Pty.h index 73b453610..b75e3efd8 100644 --- a/src/Pty.h +++ b/src/Pty.h @@ -151,10 +151,9 @@ public slots: * Sends data to the process currently controlling the * teletype ( whose id is returned by foregroundProcessGroup() ) * - * @param buffer Pointer to the data to send. - * @param length Length of @p buffer. + * @param buffer the data to send. */ - void sendData(const char* buffer, int length); + void sendData(const QByteArray& data); signals: /** diff --git a/src/RenameTabWidget.cpp b/src/RenameTabWidget.cpp index 873ebcf8b..b43c73f64 100644 --- a/src/RenameTabWidget.cpp +++ b/src/RenameTabWidget.cpp @@ -34,18 +34,18 @@ RenameTabWidget::RenameTabWidget(QWidget* parent) _ui->tabTitleEdit->setClearButtonEnabled(true); _ui->remoteTabTitleEdit->setClearButtonEnabled(true); - connect(_ui->tabTitleEdit, SIGNAL(textChanged(QString)), this, - SIGNAL(tabTitleFormatChanged(QString))); - connect(_ui->remoteTabTitleEdit, SIGNAL(textChanged(QString)), this, - SIGNAL(remoteTabTitleFormatChanged(QString))); + connect(_ui->tabTitleEdit, &QLineEdit::textChanged, this, + &Konsole::RenameTabWidget::tabTitleFormatChanged); + connect(_ui->remoteTabTitleEdit, &QLineEdit::textChanged, this, + &Konsole::RenameTabWidget::remoteTabTitleFormatChanged); _ui->tabTitleFormatButton->setContext(Session::LocalTabTitle); - connect(_ui->tabTitleFormatButton, SIGNAL(dynamicElementSelected(QString)), - this, SLOT(insertTabTitleText(QString))); + connect(_ui->tabTitleFormatButton, &Konsole::TabTitleFormatButton::dynamicElementSelected, + this, &Konsole::RenameTabWidget::insertTabTitleText); _ui->remoteTabTitleFormatButton->setContext(Session::RemoteTabTitle); - connect(_ui->remoteTabTitleFormatButton, SIGNAL(dynamicElementSelected(QString)), - this, SLOT(insertRemoteTabTitleText(QString))); + connect(_ui->remoteTabTitleFormatButton, &Konsole::TabTitleFormatButton::dynamicElementSelected, + this, &Konsole::RenameTabWidget::insertRemoteTabTitleText); } RenameTabWidget::~RenameTabWidget() diff --git a/src/Session.cpp b/src/Session.cpp index cf0fc4d8e..504b752c1 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // KDE #include @@ -126,24 +127,24 @@ Session::Session(QObject* parent) : //create emulation backend _emulation = new Vt102Emulation(); - connect(_emulation, SIGNAL(titleChanged(int,QString)), - this, SLOT(setUserTitle(int,QString))); - connect(_emulation, SIGNAL(stateSet(int)), - this, SLOT(activityStateSet(int))); - connect(_emulation, SIGNAL(zmodemDetected()), - this, SLOT(fireZModemDetected())); - connect(_emulation, SIGNAL(changeTabTextColorRequest(int)), - this, SIGNAL(changeTabTextColorRequest(int))); - connect(_emulation, SIGNAL(profileChangeCommandReceived(QString)), - this, SIGNAL(profileChangeCommandReceived(QString))); - connect(_emulation, SIGNAL(flowControlKeyPressed(bool)), - this, SLOT(updateFlowControlState(bool))); - connect(_emulation, SIGNAL(primaryScreenInUse(bool)), - this, SLOT(onPrimaryScreenInUse(bool))); - connect(_emulation, SIGNAL(selectionChanged(QString)), - this, SIGNAL(selectionChanged(QString))); - connect(_emulation, SIGNAL(imageResizeRequest(QSize)), - this, SIGNAL(resizeRequest(QSize))); + connect(_emulation, &Konsole::Emulation::titleChanged, + this, &Konsole::Session::setUserTitle); + connect(_emulation, &Konsole::Emulation::stateSet, + this, &Konsole::Session::activityStateSet); + connect(_emulation, &Konsole::Emulation::zmodemDetected, + this, &Konsole::Session::fireZModemDetected); + connect(_emulation, &Konsole::Emulation::changeTabTextColorRequest, + this, &Konsole::Session::changeTabTextColorRequest); + connect(_emulation, &Konsole::Emulation::profileChangeCommandReceived, + this, &Konsole::Session::profileChangeCommandReceived); + connect(_emulation, &Konsole::Emulation::flowControlKeyPressed, + this, &Konsole::Session::updateFlowControlState); + connect(_emulation, &Konsole::Emulation::primaryScreenInUse, + this, &Konsole::Session::onPrimaryScreenInUse); + connect(_emulation, &Konsole::Emulation::selectionChanged, + this, &Konsole::Session::selectionChanged); + connect(_emulation, &Konsole::Emulation::imageResizeRequest, + this, &Konsole::Session::resizeRequest); //create new teletype for I/O with shell process openTeletype(-1); @@ -151,11 +152,11 @@ Session::Session(QObject* parent) : //setup timer for monitoring session activity & silence _silenceTimer = new QTimer(this); _silenceTimer->setSingleShot(true); - connect(_silenceTimer, SIGNAL(timeout()), this, SLOT(silenceTimerDone())); + connect(_silenceTimer, &QTimer::timeout, this, &Konsole::Session::silenceTimerDone); _activityTimer = new QTimer(this); _activityTimer->setSingleShot(true); - connect(_activityTimer, SIGNAL(timeout()), this, SLOT(activityTimerDone())); + connect(_activityTimer, &QTimer::timeout, this, &Konsole::Session::activityTimerDone); } Session::~Session() @@ -184,24 +185,24 @@ void Session::openTeletype(int fd) _shellProcess->setUtf8Mode(_emulation->utf8()); // connect the I/O between emulator and pty process - connect(_shellProcess, SIGNAL(receivedData(const char*,int)), - this, SLOT(onReceiveBlock(const char*,int))); - connect(_emulation, SIGNAL(sendData(const char*,int)), - _shellProcess, SLOT(sendData(const char*,int))); + connect(_shellProcess, &Konsole::Pty::receivedData, + this, &Konsole::Session::onReceiveBlock); + connect(_emulation, &Konsole::Emulation::sendData, + _shellProcess, &Konsole::Pty::sendData); // UTF8 mode - connect(_emulation, SIGNAL(useUtf8Request(bool)), - _shellProcess, SLOT(setUtf8Mode(bool))); + connect(_emulation, &Konsole::Emulation::useUtf8Request, + _shellProcess, &Konsole::Pty::setUtf8Mode); // get notified when the pty process is finished - connect(_shellProcess, SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(done(int,QProcess::ExitStatus))); + connect(_shellProcess, static_cast(&Konsole::Pty::finished), + this, &Konsole::Session::done); // emulator size - connect(_emulation, SIGNAL(imageSizeChanged(int,int)), - this, SLOT(updateWindowSize(int,int))); - connect(_emulation, SIGNAL(imageSizeInitialized()), - this, SLOT(run())); + connect(_emulation, &Konsole::Emulation::imageSizeChanged, + this, &Konsole::Session::updateWindowSize); + connect(_emulation, &Konsole::Emulation::imageSizeInitialized, + this, &Konsole::Session::run); } WId Session::windowId() const @@ -312,33 +313,33 @@ void Session::addView(TerminalDisplay* widget) _views.append(widget); // connect emulation - view signals and slots - connect(widget, SIGNAL(keyPressedSignal(QKeyEvent*)), - _emulation, SLOT(sendKeyEvent(QKeyEvent*))); - connect(widget, SIGNAL(mouseSignal(int,int,int,int)), - _emulation, SLOT(sendMouseEvent(int,int,int,int))); - connect(widget, SIGNAL(sendStringToEmu(const char*)), - _emulation, SLOT(sendString(const char*))); + connect(widget, &Konsole::TerminalDisplay::keyPressedSignal, + _emulation, &Konsole::Emulation::sendKeyEvent); + connect(widget, &Konsole::TerminalDisplay::mouseSignal, + _emulation, &Konsole::Emulation::sendMouseEvent); + connect(widget, &Konsole::TerminalDisplay::sendStringToEmu, + _emulation, &Konsole::Emulation::sendString); // allow emulation to notify view when the foreground process // indicates whether or not it is interested in mouse signals - connect(_emulation, SIGNAL(programUsesMouseChanged(bool)), - widget, SLOT(setUsesMouse(bool))); + connect(_emulation, &Konsole::Emulation::programUsesMouseChanged, + widget, &Konsole::TerminalDisplay::setUsesMouse); widget->setUsesMouse(_emulation->programUsesMouse()); - connect(_emulation, SIGNAL(programBracketedPasteModeChanged(bool)), - widget, SLOT(setBracketedPasteMode(bool))); + connect(_emulation, &Konsole::Emulation::programBracketedPasteModeChanged, + widget, &Konsole::TerminalDisplay::setBracketedPasteMode); widget->setBracketedPasteMode(_emulation->programBracketedPasteMode()); widget->setScreenWindow(_emulation->createWindow()); //connect view signals and slots - connect(widget, SIGNAL(changedContentSizeSignal(int,int)), - this, SLOT(onViewSizeChange(int,int))); + connect(widget, &Konsole::TerminalDisplay::changedContentSizeSignal, + this, &Konsole::Session::onViewSizeChange); - connect(widget, SIGNAL(destroyed(QObject*)), - this, SLOT(viewDestroyed(QObject*))); + connect(widget, &Konsole::TerminalDisplay::destroyed, + this, &Konsole::Session::viewDestroyed); } void Session::viewDestroyed(QObject* view) @@ -829,8 +830,8 @@ void Session::sendMouseEvent(int buttons, int column, int line, int eventType) void Session::done(int exitCode, QProcess::ExitStatus exitStatus) { // This slot should be triggered only one time - disconnect(_shellProcess, SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(done(int,QProcess::ExitStatus))); + disconnect(_shellProcess, static_cast(&Konsole::Pty::finished), + this, &Konsole::Session::done); if (!_autoClose) { _userTitle = i18nc("@info:shell This session is done", "Finished"); @@ -1170,7 +1171,7 @@ void Session::fireZModemDetected() void Session::cancelZModem() { - _shellProcess->sendData("\030\030\030\030", 4); // Abort + _shellProcess->sendData(QByteArrayLiteral("\030\030\030\030")); // Abort _zmodemBusy = false; } @@ -1185,25 +1186,25 @@ void Session::startZModem(const QString& zmodem, const QString& dir, const QStri if (!dir.isEmpty()) _zmodemProc->setWorkingDirectory(dir); - connect(_zmodemProc, SIGNAL(readyReadStandardOutput()), - this, SLOT(zmodemReadAndSendBlock())); - connect(_zmodemProc, SIGNAL(readyReadStandardError()), - this, SLOT(zmodemReadStatus())); - connect(_zmodemProc, SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(zmodemFinished())); + connect(_zmodemProc, &KProcess::readyReadStandardOutput, + this, &Konsole::Session::zmodemReadAndSendBlock); + connect(_zmodemProc, &KProcess::readyReadStandardError, + this, &Konsole::Session::zmodemReadStatus); + connect(_zmodemProc, static_cast(&KProcess::finished), + this, &Konsole::Session::zmodemFinished); _zmodemProc->start(); - disconnect(_shellProcess, SIGNAL(receivedData(const char*,int)), - this, SLOT(onReceiveBlock(const char*,int))); - connect(_shellProcess, SIGNAL(receivedData(const char*,int)), - this, SLOT(zmodemReceiveBlock(const char*,int))); + disconnect(_shellProcess, &Konsole::Pty::receivedData, + this, &Konsole::Session::onReceiveBlock); + connect(_shellProcess, &Konsole::Pty::receivedData, + this, &Konsole::Session::zmodemReceiveBlock); _zmodemProgress = new ZModemDialog(QApplication::activeWindow(), false, i18n("ZModem Progress")); - connect(_zmodemProgress, SIGNAL(user1Clicked()), - this, SLOT(zmodemFinished())); + connect(_zmodemProgress, &Konsole::ZModemDialog::user1Clicked, + this, &Konsole::Session::zmodemFinished); _zmodemProgress->show(); } @@ -1216,7 +1217,7 @@ void Session::zmodemReadAndSendBlock() if (data.count() == 0) return; - _shellProcess->sendData(data.constData(), data.count()); + _shellProcess->sendData(data); } void Session::zmodemReadStatus() @@ -1260,13 +1261,13 @@ void Session::zmodemFinished() _zmodemBusy = false; delete process; // Now, the KProcess may be disposed safely. - disconnect(_shellProcess, SIGNAL(receivedData(const char*,int)), - this , SLOT(zmodemReceiveBlock(const char*,int))); - connect(_shellProcess, SIGNAL(receivedData(const char*,int)), - this, SLOT(onReceiveBlock(const char*,int))); + disconnect(_shellProcess, &Konsole::Pty::receivedData, + this , &Konsole::Session::zmodemReceiveBlock); + connect(_shellProcess, &Konsole::Pty::receivedData, + this, &Konsole::Session::onReceiveBlock); - _shellProcess->sendData("\030\030\030\030", 4); // Abort - _shellProcess->sendData("\001\013\n", 3); // Try to get prompt back + _shellProcess->sendData(QByteArrayLiteral("\030\030\030\030")); // Abort + _shellProcess->sendData(QByteArrayLiteral("\001\013\n")); // Try to get prompt back _zmodemProgress->transferDone(); } } @@ -1463,12 +1464,12 @@ bool SessionGroup::masterStatus(Session* session) const void SessionGroup::addSession(Session* session) { - connect(session, SIGNAL(finished()), this, SLOT(sessionFinished())); + connect(session, &Konsole::Session::finished, this, &Konsole::SessionGroup::sessionFinished); _sessions.insert(session, false); } void SessionGroup::removeSession(Session* session) { - disconnect(session, SIGNAL(finished()), this, SLOT(sessionFinished())); + disconnect(session, &Konsole::Session::finished, this, &Konsole::SessionGroup::sessionFinished); setMasterStatus(session, false); _sessions.remove(session); } @@ -1497,14 +1498,14 @@ void SessionGroup::setMasterStatus(Session* session , bool master) _sessions[session] = master; if (master) { - connect(session->emulation(), SIGNAL(sendData(const char*,int)), - this, SLOT(forwardData(const char*,int))); + connect(session->emulation(), &Konsole::Emulation::sendData, + this, &Konsole::SessionGroup::forwardData); } else { - disconnect(session->emulation(), SIGNAL(sendData(const char*,int)), - this, SLOT(forwardData(const char*,int))); + disconnect(session->emulation(), &Konsole::Emulation::sendData, + this, &Konsole::SessionGroup::forwardData); } } -void SessionGroup::forwardData(const char* data, int size) +void SessionGroup::forwardData(const QByteArray& data) { static bool _inForwardData = false; if (_inForwardData) { // Avoid recursive calls among session groups! @@ -1518,7 +1519,7 @@ void SessionGroup::forwardData(const char* data, int size) _inForwardData = true; foreach(Session* other, _sessions.keys()) { if (!_sessions[other]) { - other->emulation()->sendString(data, size); + other->emulation()->sendString(data); } } _inForwardData = false; diff --git a/src/Session.h b/src/Session.h index 9e982df6d..de3638903 100644 --- a/src/Session.h +++ b/src/Session.h @@ -813,7 +813,7 @@ public: private slots: void sessionFinished(); - void forwardData(const char* data, int size); + void forwardData(const QByteArray& data); private: QList masters() const; diff --git a/src/SessionController.cpp b/src/SessionController.cpp index 5cd69ec36..e639936cf 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -153,43 +153,43 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q view->setSessionController(this); // listen for session resize requests - connect(_session, SIGNAL(resizeRequest(QSize)), this, - SLOT(sessionResizeRequest(QSize))); + connect(_session.data(), &Konsole::Session::resizeRequest, this, + &Konsole::SessionController::sessionResizeRequest); // listen for popup menu requests - connect(_view, SIGNAL(configureRequest(QPoint)), this, - SLOT(showDisplayContextMenu(QPoint))); + connect(_view.data(), &Konsole::TerminalDisplay::configureRequest, this, + &Konsole::SessionController::showDisplayContextMenu); // move view to newest output when keystrokes occur - connect(_view, SIGNAL(keyPressedSignal(QKeyEvent*)), this, - SLOT(trackOutput(QKeyEvent*))); + connect(_view.data(), &Konsole::TerminalDisplay::keyPressedSignal, this, + &Konsole::SessionController::trackOutput); // listen to activity / silence notifications from session - connect(_session, SIGNAL(stateChanged(int)), this, - SLOT(sessionStateChanged(int))); + connect(_session.data(), &Konsole::Session::stateChanged, this, + &Konsole::SessionController::sessionStateChanged); // listen to title and icon changes - connect(_session, SIGNAL(titleChanged()), this, SLOT(sessionTitleChanged())); + connect(_session.data(), &Konsole::Session::titleChanged, this, &Konsole::SessionController::sessionTitleChanged); - connect(_session , SIGNAL(currentDirectoryChanged(QString)) , - this , SIGNAL(currentDirectoryChanged(QString))); + connect(_session.data() , &Konsole::Session::currentDirectoryChanged , + this , &Konsole::SessionController::currentDirectoryChanged); // listen for color changes - connect(_session, SIGNAL(changeBackgroundColorRequest(QColor)), _view, SLOT(setBackgroundColor(QColor))); - connect(_session, SIGNAL(changeForegroundColorRequest(QColor)), _view, SLOT(setForegroundColor(QColor))); + connect(_session.data(), &Konsole::Session::changeBackgroundColorRequest, _view.data(), &Konsole::TerminalDisplay::setBackgroundColor); + connect(_session.data(), &Konsole::Session::changeForegroundColorRequest, _view.data(), &Konsole::TerminalDisplay::setForegroundColor); // update the title when the session starts - connect(_session, SIGNAL(started()), this, SLOT(snapshot())); + connect(_session.data(), &Konsole::Session::started, this, &Konsole::SessionController::snapshot); // listen for output changes to set activity flag - connect(_session->emulation(), SIGNAL(outputChanged()), this, - SLOT(fireActivity())); + connect(_session->emulation(), &Konsole::Emulation::outputChanged, this, + &Konsole::SessionController::fireActivity); // listen for detection of ZModem transfer - connect(_session, SIGNAL(zmodemDetected()), this, SLOT(zmodemDownload())); + connect(_session.data(), &Konsole::Session::zmodemDetected, this, &Konsole::SessionController::zmodemDownload); // listen for flow control status changes - connect(_session, SIGNAL(flowControlEnabledChanged(bool)), _view, - SLOT(setFlowControlWarningEnabled(bool))); + connect(_session.data(), &Konsole::Session::flowControlEnabledChanged, _view.data(), + &Konsole::TerminalDisplay::setFlowControlWarningEnabled); _view->setFlowControlWarningEnabled(_session->flowControlEnabled()); // take a snapshot of the session state every so often when @@ -200,14 +200,14 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q _interactionTimer = new QTimer(_session); _interactionTimer->setSingleShot(true); _interactionTimer->setInterval(500); - connect(_interactionTimer, SIGNAL(timeout()), this, SLOT(snapshot())); - connect(_view, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(interactionHandler())); + connect(_interactionTimer, &QTimer::timeout, this, &Konsole::SessionController::snapshot); + connect(_view.data(), &Konsole::TerminalDisplay::keyPressedSignal, this, &Konsole::SessionController::interactionHandler); // take a snapshot of the session state periodically in the background QTimer* backgroundTimer = new QTimer(_session); backgroundTimer->setSingleShot(false); backgroundTimer->setInterval(2000); - connect(backgroundTimer, SIGNAL(timeout()), this, SLOT(snapshot())); + connect(backgroundTimer, &QTimer::timeout, this, &Konsole::SessionController::snapshot); backgroundTimer->start(); _allControllers.insert(this); @@ -414,21 +414,21 @@ void SessionController::updateWebSearchMenu() if (!searchProviders.isEmpty()) { _webSearchMenu->setText(i18n("Search for '%1' with", KStringHandler::rsqueeze(searchText, 16))); - KAction* action = 0; + QAction* action = 0; foreach(const QString& searchProvider, searchProviders) { - action = new KAction(searchProvider, _webSearchMenu); + action = new QAction(searchProvider, _webSearchMenu); action->setIcon(KIcon(filterData.iconNameForPreferredSearchProvider(searchProvider))); action->setData(filterData.queryForPreferredSearchProvider(searchProvider)); - connect(action, SIGNAL(triggered()), this, SLOT(handleWebShortcutAction())); + connect(action, &QAction::triggered, this, &Konsole::SessionController::handleWebShortcutAction); _webSearchMenu->addAction(action); } _webSearchMenu->addSeparator(); - action = new KAction(i18n("Configure Web Shortcuts..."), _webSearchMenu); + action = new QAction(i18n("Configure Web Shortcuts..."), _webSearchMenu); action->setIcon(KIcon("configure")); - connect(action, SIGNAL(triggered()), this, SLOT(configureWebShortcuts())); + connect(action, &QAction::triggered, this, &Konsole::SessionController::configureWebShortcuts); _webSearchMenu->addAction(action); _webSearchMenu->setVisible(true); @@ -473,10 +473,10 @@ bool SessionController::eventFilter(QObject* watched , QEvent* event) // by the focused view // first, disconnect any other views which are listening for bell signals from the session - disconnect(_session, SIGNAL(bellRequest(QString)), 0, 0); + disconnect(_session.data(), &Konsole::Session::bellRequest, 0, 0); // second, connect the newly focused view to listen for the session's bell signal - connect(_session, SIGNAL(bellRequest(QString)), - _view, SLOT(bell(QString))); + connect(_session.data(), &Konsole::Session::bellRequest, + _view.data(), &Konsole::TerminalDisplay::bell); if (_copyInputToAllTabsAction && _copyInputToAllTabsAction->isChecked()) { // A session with "Copy To All Tabs" has come into focus: @@ -494,10 +494,10 @@ bool SessionController::eventFilter(QObject* watched , QEvent* event) (!_viewUrlFilter || _urlFilterUpdateRequired) && ((QMouseEvent*)event)->buttons() == Qt::NoButton) { if (_view->screenWindow() && !_viewUrlFilter) { - connect(_view->screenWindow(), SIGNAL(scrolled(int)), this, - SLOT(requireUrlFilterUpdate())); - connect(_view->screenWindow(), SIGNAL(outputChanged()), this, - SLOT(requireUrlFilterUpdate())); + connect(_view->screenWindow(), &Konsole::ScreenWindow::scrolled, this, + &Konsole::SessionController::requireUrlFilterUpdate); + connect(_view->screenWindow(), &Konsole::ScreenWindow::outputChanged, this, + &Konsole::SessionController::requireUrlFilterUpdate); // install filter on the view to highlight URLs _viewUrlFilter = new UrlFilter(); @@ -533,13 +533,13 @@ void SessionController::setSearchBar(IncrementalSearchBar* searchBar) // connect new search bar _searchBar = searchBar; if (_searchBar) { - connect(_searchBar, SIGNAL(unhandledMovementKeyPressed(QKeyEvent*)), this, SLOT(movementKeyFromSearchBarReceived(QKeyEvent*))); - connect(_searchBar, SIGNAL(closeClicked()), this, SLOT(searchClosed())); - connect(_searchBar, SIGNAL(searchFromClicked()), this, SLOT(searchFrom())); - connect(_searchBar, SIGNAL(findNextClicked()), this, SLOT(findNextInHistory())); - connect(_searchBar, SIGNAL(findPreviousClicked()), this, SLOT(findPreviousInHistory())); - connect(_searchBar, SIGNAL(highlightMatchesToggled(bool)) , this , SLOT(highlightMatches(bool))); - connect(_searchBar, SIGNAL(matchCaseToggled(bool)), this, SLOT(changeSearchMatch())); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::unhandledMovementKeyPressed, this, &Konsole::SessionController::movementKeyFromSearchBarReceived); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::closeClicked, this, &Konsole::SessionController::searchClosed); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchFromClicked, this, &Konsole::SessionController::searchFrom); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::findNextClicked, this, &Konsole::SessionController::findNextInHistory); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::findPreviousClicked, this, &Konsole::SessionController::findPreviousInHistory); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::highlightMatchesToggled , this , &Konsole::SessionController::highlightMatches); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::matchCaseToggled, this, &Konsole::SessionController::changeSearchMatch); // if the search bar was previously active // then re-enter search mode @@ -633,7 +633,7 @@ void SessionController::setupCommonActions() _switchProfileMenu = new KActionMenu(i18n("Switch Profile"), this); collection->addAction("switch-profile", _switchProfileMenu); - connect(_switchProfileMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(prepareSwitchProfileMenu())); + connect(_switchProfileMenu->menu(), &QMenu::aboutToShow, this, &Konsole::SessionController::prepareSwitchProfileMenu); // History _findAction = KStandardAction::find(this, SLOT(searchBarEvent()), collection); @@ -651,8 +651,8 @@ void SessionController::setupCommonActions() _codecAction = new KCodecAction(i18n("Set &Encoding"), this); _codecAction->setIcon(KIcon("character-set")); collection->addAction("set-encoding", _codecAction); - connect(_codecAction->menu(), SIGNAL(aboutToShow()), this, SLOT(updateCodecAction())); - connect(_codecAction, SIGNAL(triggered(QTextCodec*)), this, SLOT(changeCodec(QTextCodec*))); + connect(_codecAction->menu(), &QMenu::aboutToShow, this, &Konsole::SessionController::updateCodecAction); + connect(_codecAction, static_cast(&KCodecAction::triggered), this, &Konsole::SessionController::changeCodec); } void SessionController::setupExtraActions() @@ -694,7 +694,7 @@ void SessionController::setupExtraActions() copyInputActions->addAction(copyInputToAllTabsAction); copyInputActions->addAction(copyInputToSelectedTabsAction); copyInputActions->addAction(copyInputToNoneAction); - connect(copyInputActions, SIGNAL(triggered(QAction*)), this, SLOT(copyInputActionsTriggered(QAction*))); + connect(copyInputActions, static_cast(&KSelectAction::triggered), this, &Konsole::SessionController::copyInputActionsTriggered); action = collection->addAction("zmodem-upload", this, SLOT(zmodemUpload())); action->setText(i18n("&ZModem Upload...")); @@ -705,12 +705,12 @@ void SessionController::setupExtraActions() toggleAction = new KToggleAction(i18n("Monitor for &Activity"), this); toggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A)); action = collection->addAction("monitor-activity", toggleAction); - connect(action, SIGNAL(toggled(bool)), this, SLOT(monitorActivity(bool))); + connect(action, &QAction::toggled, this, &Konsole::SessionController::monitorActivity); toggleAction = new KToggleAction(i18n("Monitor for &Silence"), this); toggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); action = collection->addAction("monitor-silence", toggleAction); - connect(action, SIGNAL(toggled(bool)), this, SLOT(monitorSilence(bool))); + connect(action, &QAction::toggled, this, &Konsole::SessionController::monitorSilence); // Text Size action = collection->addAction("enlarge-font", this, SLOT(increaseFontSize())); @@ -730,7 +730,7 @@ void SessionController::setupExtraActions() // Send signal KSelectAction* sendSignalActions = collection->add("send-signal"); sendSignalActions->setText(i18n("Send Signal")); - connect(sendSignalActions, SIGNAL(triggered(QAction*)), this, SLOT(sendSignal(QAction*))); + connect(sendSignalActions, static_cast(&KSelectAction::triggered), this, &Konsole::SessionController::sendSignal); action = collection->addAction("sigstop-signal"); action->setText(i18n("&Suspend Task") + " (STOP)"); @@ -786,7 +786,7 @@ void SessionController::prepareSwitchProfileMenu() { if (_switchProfileMenu->menu()->isEmpty()) { _profileList = new ProfileList(false, this); - connect(_profileList, SIGNAL(profileSelected(Profile::Ptr)), this, SLOT(switchProfile(Profile::Ptr))); + connect(_profileList, &Konsole::ProfileList::profileSelected, this, &Konsole::SessionController::switchProfile); } _switchProfileMenu->menu()->clear(); @@ -1120,12 +1120,12 @@ void SessionController::listenForScreenWindowUpdates() if (_listenForScreenWindowUpdates) return; - connect(_view->screenWindow(), SIGNAL(outputChanged()), this, - SLOT(updateSearchFilter())); - connect(_view->screenWindow(), SIGNAL(scrolled(int)), this, - SLOT(updateSearchFilter())); - connect(_view->screenWindow(), SIGNAL(currentResultLineChanged()), _view, - SLOT(update())); + connect(_view->screenWindow(), &Konsole::ScreenWindow::outputChanged, this, + &Konsole::SessionController::updateSearchFilter); + connect(_view->screenWindow(), &Konsole::ScreenWindow::scrolled, this, + &Konsole::SessionController::updateSearchFilter); + connect(_view->screenWindow(), &Konsole::ScreenWindow::currentResultLineChanged, _view.data(), + static_cast(&Konsole::TerminalDisplay::update)); _listenForScreenWindowUpdates = true; } @@ -1162,19 +1162,19 @@ void SessionController::enableSearchBar(bool showSearchBar) _searchBar->setVisible(showSearchBar); if (showSearchBar) { - connect(_searchBar, SIGNAL(searchChanged(QString)), this, - SLOT(searchTextChanged(QString))); - connect(_searchBar, SIGNAL(searchReturnPressed(QString)), this, - SLOT(findPreviousInHistory())); - connect(_searchBar, SIGNAL(searchShiftPlusReturnPressed()), this, - SLOT(findNextInHistory())); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchChanged, this, + &Konsole::SessionController::searchTextChanged); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchReturnPressed, this, + &Konsole::SessionController::findPreviousInHistory); + connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchShiftPlusReturnPressed, this, + &Konsole::SessionController::findNextInHistory); } else { - disconnect(_searchBar, SIGNAL(searchChanged(QString)), this, - SLOT(searchTextChanged(QString))); - disconnect(_searchBar, SIGNAL(searchReturnPressed(QString)), this, - SLOT(findPreviousInHistory())); - disconnect(_searchBar, SIGNAL(searchShiftPlusReturnPressed()), this, - SLOT(findNextInHistory())); + disconnect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchChanged, this, + &Konsole::SessionController::searchTextChanged); + disconnect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchReturnPressed, this, + &Konsole::SessionController::findPreviousInHistory); + disconnect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchShiftPlusReturnPressed, this, + &Konsole::SessionController::findNextInHistory); if (_view && _view->screenWindow()) { _view->screenWindow()->setCurrentResultLine(-1); } @@ -1280,7 +1280,7 @@ void SessionController::beginSearch(const QString& text , int direction) _view->screenWindow()->setCurrentResultLine(-1); SearchHistoryTask* task = new SearchHistoryTask(this); - connect(task, SIGNAL(completed(bool)), this, SLOT(searchCompleted(bool))); + connect(task, &Konsole::SearchHistoryTask::completed, this, &Konsole::SessionController::searchCompleted); task->setRegExp(regExp); task->setSearchDirection((SearchHistoryTask::SearchDirection)direction); @@ -1401,7 +1401,7 @@ void SessionController::print_screen() dialog->setOptionTabs(QList() << options); dialog->setWindowTitle(i18n("Print Shell")); - connect(dialog, SIGNAL(accepted()), options, SLOT(saveSettings())); + connect(dialog.data(), static_cast(&QPrintDialog::accepted), options, &Konsole::PrintOptions::saveSettings); if (dialog->exec() != QDialog::Accepted) return; @@ -1749,10 +1749,10 @@ void SaveHistoryTask::execute() _jobSession.insert(job, jobInfo); - connect(job, SIGNAL(dataReq(KIO::Job*,QByteArray&)), - this, SLOT(jobDataRequested(KIO::Job*,QByteArray&))); - connect(job, SIGNAL(result(KJob*)), - this, SLOT(jobResult(KJob*))); + connect(job, &KIO::TransferJob::dataReq, + this, &Konsole::SaveHistoryTask::jobDataRequested); + connect(job, &KIO::TransferJob::result, + this, &Konsole::SaveHistoryTask::jobResult); } dialog->deleteLater(); diff --git a/src/SessionListModel.cpp b/src/SessionListModel.cpp index 33af851f9..58854aa07 100644 --- a/src/SessionListModel.cpp +++ b/src/SessionListModel.cpp @@ -42,7 +42,7 @@ void SessionListModel::setSessions(const QList& sessions) _sessions = sessions; foreach(Session * session, sessions) { - connect(session, SIGNAL(finished()), this, SLOT(sessionFinished())); + connect(session, &Konsole::Session::finished, this, &Konsole::SessionListModel::sessionFinished); } reset(); diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 1b80b7500..12c5d196e 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -45,12 +45,12 @@ SessionManager::SessionManager() { //map finished() signals from sessions _sessionMapper = new QSignalMapper(this); - connect(_sessionMapper , SIGNAL(mapped(QObject*)) , this , - SLOT(sessionTerminated(QObject*))); + connect(_sessionMapper , static_cast(&QSignalMapper::mapped) , this , + &Konsole::SessionManager::sessionTerminated); ProfileManager* profileMananger = ProfileManager::instance(); - connect(profileMananger , SIGNAL(profileChanged(Profile::Ptr)) , - this , SLOT(profileChanged(Profile::Ptr))); + connect(profileMananger , &Konsole::ProfileManager::profileChanged , + this , &Konsole::SessionManager::profileChanged); } SessionManager::~SessionManager() @@ -99,13 +99,13 @@ Session* SessionManager::createSession(Profile::Ptr profile) Q_ASSERT(session); applyProfile(session, profile, false); - connect(session , SIGNAL(profileChangeCommandReceived(QString)) , this , - SLOT(sessionProfileCommandReceived(QString))); + connect(session , &Konsole::Session::profileChangeCommandReceived , this , + &Konsole::SessionManager::sessionProfileCommandReceived); //ask for notification when session dies _sessionMapper->setMapping(session, session); - connect(session , SIGNAL(finished()) , _sessionMapper , - SLOT(map())); + connect(session , &Konsole::Session::finished , _sessionMapper , + static_cast(&QSignalMapper::map)); //add session to active list _sessions << session; diff --git a/src/TabTitleFormatButton.cpp b/src/TabTitleFormatButton.cpp index 7b85ffee0..6147e7630 100644 --- a/src/TabTitleFormatButton.cpp +++ b/src/TabTitleFormatButton.cpp @@ -57,7 +57,7 @@ TabTitleFormatButton::TabTitleFormatButton(QWidget* aParent) { setText(i18n("Insert")); setMenu(new QMenu()); - connect(menu() , SIGNAL(triggered(QAction*)) , this , SLOT(fireElementSelected(QAction*))); + connect(menu() , &QMenu::triggered , this , &Konsole::TabTitleFormatButton::fireElementSelected); } TabTitleFormatButton::~TabTitleFormatButton() diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index e67b449a1..f5e84ebd9 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -115,9 +115,9 @@ void TerminalDisplay::setScreenWindow(ScreenWindow* window) _screenWindow = window; if (_screenWindow) { - connect(_screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateLineProperties())); - connect(_screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateImage())); - connect(_screenWindow , SIGNAL(currentResultLineChanged()) , this , SLOT(updateImage())); + connect(_screenWindow.data() , &Konsole::ScreenWindow::outputChanged , this , &Konsole::TerminalDisplay::updateLineProperties); + connect(_screenWindow.data() , &Konsole::ScreenWindow::outputChanged , this , &Konsole::TerminalDisplay::updateImage); + connect(_screenWindow.data() , &Konsole::ScreenWindow::currentResultLineChanged , this , &Konsole::TerminalDisplay::updateImage); _screenWindow->setWindowLines(_lines); } } @@ -363,20 +363,20 @@ TerminalDisplay::TerminalDisplay(QWidget* parent) // set the scroll bar's slider to occupy the whole area of the scroll bar initially setScroll(0, 0); _scrollBar->setCursor(Qt::ArrowCursor); - connect(_scrollBar, SIGNAL(valueChanged(int)), - this, SLOT(scrollBarPositionChanged(int))); - connect(_scrollBar, SIGNAL(sliderMoved(int)), - this, SLOT(viewScrolledByUser())); + connect(_scrollBar, &QScrollBar::valueChanged, + this, &Konsole::TerminalDisplay::scrollBarPositionChanged); + connect(_scrollBar, &QScrollBar::sliderMoved, + this, &Konsole::TerminalDisplay::viewScrolledByUser); // setup timers for blinking text _blinkTextTimer = new QTimer(this); _blinkTextTimer->setInterval(TEXT_BLINK_DELAY); - connect(_blinkTextTimer, SIGNAL(timeout()), this, SLOT(blinkTextEvent())); + connect(_blinkTextTimer, &QTimer::timeout, this, &Konsole::TerminalDisplay::blinkTextEvent); // setup timers for blinking cursor _blinkCursorTimer = new QTimer(this); _blinkCursorTimer->setInterval(QApplication::cursorFlashTime() / 2); - connect(_blinkCursorTimer, SIGNAL(timeout()), this, SLOT(blinkCursorEvent())); + connect(_blinkCursorTimer, &QTimer::timeout, this, &Konsole::TerminalDisplay::blinkCursorEvent); // hide mouse cursor on keystroke or idle KCursor::setAutoHideCursor(this, true); @@ -1157,7 +1157,7 @@ void TerminalDisplay::showResizeNotification() _resizeTimer = new QTimer(this); _resizeTimer->setInterval(SIZE_HINT_DURATION); _resizeTimer->setSingleShot(true); - connect(_resizeTimer, SIGNAL(timeout()), _resizeWidget, SLOT(hide())); + connect(_resizeTimer, &QTimer::timeout, _resizeWidget, &QLabel::hide); } QString sizeStr = i18n("Size: %1 x %2", _columns, _lines); _resizeWidget->setText(sizeStr); @@ -1808,12 +1808,12 @@ void TerminalDisplay::setScroll(int cursor, int slines) return; } - disconnect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int))); + disconnect(_scrollBar, &QScrollBar::valueChanged, this, &Konsole::TerminalDisplay::scrollBarPositionChanged); _scrollBar->setRange(0, slines - _lines); _scrollBar->setSingleStep(1); _scrollBar->setPageStep(_lines); _scrollBar->setValue(cursor); - connect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int))); + connect(_scrollBar, &QScrollBar::valueChanged, this, &Konsole::TerminalDisplay::scrollBarPositionChanged); } void TerminalDisplay::setScrollFullPage(bool fullPage) @@ -3188,7 +3188,7 @@ void TerminalDisplay::dropEvent(QDropEvent* event) if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list")) { - emit sendStringToEmu(dropText.toLocal8Bit().constData()); + emit sendStringToEmu(dropText.toLocal8Bit()); } } @@ -3197,7 +3197,7 @@ void TerminalDisplay::dropMenuPasteActionTriggered() if (sender()) { const QAction* action = qobject_cast(sender()); if (action) { - emit sendStringToEmu(action->data().toString().toLocal8Bit().constData()); + emit sendStringToEmu(action->data().toString().toLocal8Bit()); } } } @@ -3207,7 +3207,7 @@ void TerminalDisplay::dropMenuCdActionTriggered() if (sender()) { const QAction* action = qobject_cast(sender()); if (action) { - emit sendStringToEmu(action->data().toString().toLocal8Bit().constData()); + emit sendStringToEmu(action->data().toString().toLocal8Bit()); } } } diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h index f0699e92b..68462bbb0 100644 --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -610,7 +610,7 @@ signals: */ void overrideShortcutCheck(QKeyEvent* keyEvent, bool& override); - void sendStringToEmu(const char*); + void sendStringToEmu(const QByteArray& local8BitString); protected: virtual bool event(QEvent* event); diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index 4acc0e300..79c24d5c9 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -62,7 +62,7 @@ ViewContainer::ViewContainer(NavigationPosition position , QObject* parent) ViewContainer::~ViewContainer() { foreach(QWidget * view , _views) { - disconnect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*))); + disconnect(view, &QWidget::destroyed, this, &Konsole::ViewContainer::viewDestroyed); } if (_searchBar) { @@ -144,7 +144,7 @@ void ViewContainer::addView(QWidget* view , ViewProperties* item, int index) _navigation[view] = item; - connect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*))); + connect(view, &QWidget::destroyed, this, &Konsole::ViewContainer::viewDestroyed); addViewWidget(view, index); @@ -176,7 +176,7 @@ void ViewContainer::removeView(QWidget* view) _views.removeAll(view); _navigation.remove(view); - disconnect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*))); + disconnect(view, &QWidget::destroyed, this, &Konsole::ViewContainer::viewDestroyed); removeViewWidget(view); @@ -196,7 +196,7 @@ IncrementalSearchBar* ViewContainer::searchBar() if (!_searchBar) { _searchBar = new IncrementalSearchBar(0); _searchBar->setVisible(false); - connect(_searchBar, SIGNAL(destroyed(QObject*)), this, SLOT(searchBarDestroyed())); + connect(_searchBar, &Konsole::IncrementalSearchBar::destroyed, this, &Konsole::ViewContainer::searchBarDestroyed); } return _searchBar; } @@ -269,17 +269,17 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position, ViewManage _tabBar = new ViewContainerTabBar(_containerWidget, this); _tabBar->setSupportedMimeType(ViewProperties::mimeType()); - connect(_tabBar, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); - connect(_tabBar, SIGNAL(tabDoubleClicked(int)), this, SLOT(tabDoubleClicked(int))); - connect(_tabBar, SIGNAL(newTabRequest()), this, SIGNAL(newViewRequest())); - connect(_tabBar, SIGNAL(wheelDelta(int)), this, SLOT(wheelScrolled(int))); - connect(_tabBar, SIGNAL(initiateDrag(int)), this, SLOT(startTabDrag(int))); - connect(_tabBar, SIGNAL(querySourceIndex(const QDropEvent*,int&)), - this, SLOT(querySourceIndex(const QDropEvent*,int&))); - connect(_tabBar, SIGNAL(moveViewRequest(int,const QDropEvent*,bool&,TabbedViewContainer*)), - this, SLOT(onMoveViewRequest(int,const QDropEvent*,bool&,TabbedViewContainer*))); - connect(_tabBar, SIGNAL(contextMenu(int,QPoint)), this, - SLOT(openTabContextMenu(int,QPoint))); + connect(_tabBar, &Konsole::ViewContainerTabBar::currentChanged, this, &Konsole::TabbedViewContainer::currentTabChanged); + connect(_tabBar, &Konsole::ViewContainerTabBar::tabDoubleClicked, this, &Konsole::TabbedViewContainer::tabDoubleClicked); + connect(_tabBar, &Konsole::ViewContainerTabBar::newTabRequest, this, static_cast(&Konsole::TabbedViewContainer::newViewRequest)); + connect(_tabBar, &Konsole::ViewContainerTabBar::wheelDelta, this, &Konsole::TabbedViewContainer::wheelScrolled); + connect(_tabBar, &Konsole::ViewContainerTabBar::initiateDrag, this, &Konsole::TabbedViewContainer::startTabDrag); + connect(_tabBar, &Konsole::ViewContainerTabBar::querySourceIndex, + this, &Konsole::TabbedViewContainer::querySourceIndex); + connect(_tabBar, &Konsole::ViewContainerTabBar::moveViewRequest, + this, &Konsole::TabbedViewContainer::onMoveViewRequest); + connect(_tabBar, &Konsole::ViewContainerTabBar::contextMenu, this, + &Konsole::TabbedViewContainer::openTabContextMenu); // The context menu of tab bar _contextPopupMenu = new KMenu(_tabBar); @@ -311,8 +311,8 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position, ViewManage QMenu* profileMenu = new QMenu(_newTabButton); ProfileList* profileList = new ProfileList(false, profileMenu); profileList->syncWidgetActions(profileMenu, true); - connect(profileList, SIGNAL(profileSelected(Profile::Ptr)), - this, SIGNAL(newViewRequest(Profile::Ptr))); + connect(profileList, &Konsole::ProfileList::profileSelected, + this, static_cast(&Konsole::TabbedViewContainer::newViewRequest)); setNewViewMenu(profileMenu); _closeTabButton = new QToolButton(_containerWidget); @@ -327,8 +327,8 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position, ViewManage _newTabButton->setHidden(true); _closeTabButton->setHidden(true); - connect(_newTabButton, SIGNAL(clicked()), this, SIGNAL(newViewRequest())); - connect(_closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentTab())); + connect(_newTabButton, &QToolButton::clicked, this, static_cast(&Konsole::TabbedViewContainer::newViewRequest)); + connect(_closeTabButton, &QToolButton::clicked, this, &Konsole::TabbedViewContainer::closeCurrentTab); // Combine tab bar and 'new/close tab' buttons _tabBarLayout = new QHBoxLayout; @@ -637,12 +637,12 @@ void TabbedViewContainer::addViewWidget(QWidget* view , int index) _stackWidget->updateGeometry(); ViewProperties* item = viewProperties(view); - connect(item, SIGNAL(titleChanged(ViewProperties*)), this , - SLOT(updateTitle(ViewProperties*))); - connect(item, SIGNAL(iconChanged(ViewProperties*)), this , - SLOT(updateIcon(ViewProperties*))); - connect(item, SIGNAL(activity(ViewProperties*)), this , - SLOT(updateActivity(ViewProperties*))); + connect(item, &Konsole::ViewProperties::titleChanged, this , + &Konsole::TabbedViewContainer::updateTitle); + connect(item, &Konsole::ViewProperties::iconChanged, this , + &Konsole::TabbedViewContainer::updateIcon); + connect(item, &Konsole::ViewProperties::activity, this , + &Konsole::TabbedViewContainer::updateActivity); _tabBar->insertTab(index , item->icon() , item->title()); diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 6485586bc..75473e9c2 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -26,12 +26,12 @@ #include #include #include +#include #include // KDE #include #include -#include #include #include @@ -84,18 +84,18 @@ ViewManager::ViewManager(QObject* parent , KActionCollection* collection) setupActions(); // emit a signal when all of the views held by this view manager are destroyed - connect(_viewSplitter , SIGNAL(allContainersEmpty()) , this , SIGNAL(empty())); - connect(_viewSplitter , SIGNAL(empty(ViewSplitter*)) , this , SIGNAL(empty())); + connect(_viewSplitter.data() , &Konsole::ViewSplitter::allContainersEmpty , this , &Konsole::ViewManager::empty); + connect(_viewSplitter.data() , &Konsole::ViewSplitter::empty , this , &Konsole::ViewManager::empty); // listen for addition or removal of views from associated containers - connect(_containerSignalMapper , SIGNAL(mapped(QObject*)) , this , - SLOT(containerViewsChanged(QObject*))); + connect(_containerSignalMapper , static_cast(&QSignalMapper::mapped) , this , + &Konsole::ViewManager::containerViewsChanged); // listen for profile changes - connect(ProfileManager::instance() , SIGNAL(profileChanged(Profile::Ptr)) , this, - SLOT(profileChanged(Profile::Ptr))); - connect(SessionManager::instance() , SIGNAL(sessionUpdated(Session*)) , this, - SLOT(updateViewsForSession(Session*))); + connect(ProfileManager::instance() , &Konsole::ProfileManager::profileChanged , this, + &Konsole::ViewManager::profileChanged); + connect(SessionManager::instance() , &Konsole::SessionManager::sessionUpdated , this, + &Konsole::ViewManager::updateViewsForSession); //prepare DBus communication new WindowAdaptor(this); @@ -134,13 +134,13 @@ void ViewManager::setupActions() { KActionCollection* collection = _actionCollection; - KAction* nextViewAction = new KAction(i18nc("@action Shortcut entry", "Next Tab") , this); - KAction* previousViewAction = new KAction(i18nc("@action Shortcut entry", "Previous Tab") , this); - KAction* lastViewAction = new KAction(i18nc("@action Shortcut entry", "Switch to Last Tab") , this); - KAction* nextContainerAction = new KAction(i18nc("@action Shortcut entry", "Next View Container") , this); + QAction* nextViewAction = new QAction(i18nc("@action Shortcut entry", "Next Tab") , this); + QAction* previousViewAction = new QAction(i18nc("@action Shortcut entry", "Previous Tab") , this); + QAction* lastViewAction = new QAction(i18nc("@action Shortcut entry", "Switch to Last Tab") , this); + QAction* nextContainerAction = new QAction(i18nc("@action Shortcut entry", "Next View Container") , this); - KAction* moveViewLeftAction = new KAction(i18nc("@action Shortcut entry", "Move Tab Left") , this); - KAction* moveViewRightAction = new KAction(i18nc("@action Shortcut entry", "Move Tab Right") , this); + QAction* moveViewLeftAction = new QAction(i18nc("@action Shortcut entry", "Move Tab Left") , this); + QAction* moveViewRightAction = new QAction(i18nc("@action Shortcut entry", "Move Tab Right") , this); // list of actions that should only be enabled when there are multiple view // containers open @@ -148,50 +148,50 @@ void ViewManager::setupActions() multiViewOnlyActions << nextContainerAction; if (collection) { - KAction* splitLeftRightAction = new KAction(KIcon("view-split-left-right"), + QAction* splitLeftRightAction = new QAction(KIcon("view-split-left-right"), i18nc("@action:inmenu", "Split View Left/Right"), this); splitLeftRightAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_ParenLeft)); collection->addAction("split-view-left-right", splitLeftRightAction); - connect(splitLeftRightAction , SIGNAL(triggered()) , this , SLOT(splitLeftRight())); + connect(splitLeftRightAction , &QAction::triggered , this , &Konsole::ViewManager::splitLeftRight); - KAction* splitTopBottomAction = new KAction(KIcon("view-split-top-bottom") , + QAction* splitTopBottomAction = new QAction(KIcon("view-split-top-bottom") , i18nc("@action:inmenu", "Split View Top/Bottom"), this); splitTopBottomAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_ParenRight)); collection->addAction("split-view-top-bottom", splitTopBottomAction); - connect(splitTopBottomAction , SIGNAL(triggered()) , this , SLOT(splitTopBottom())); + connect(splitTopBottomAction , &QAction::triggered , this , &Konsole::ViewManager::splitTopBottom); - KAction* closeActiveAction = new KAction(i18nc("@action:inmenu Close Active View", "Close Active") , this); + QAction* closeActiveAction = new QAction(i18nc("@action:inmenu Close Active View", "Close Active") , this); closeActiveAction->setIcon(KIcon("view-close")); closeActiveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S)); closeActiveAction->setEnabled(false); collection->addAction("close-active-view", closeActiveAction); - connect(closeActiveAction , SIGNAL(triggered()) , this , SLOT(closeActiveContainer())); + connect(closeActiveAction , &QAction::triggered , this , &Konsole::ViewManager::closeActiveContainer); multiViewOnlyActions << closeActiveAction; - KAction* closeOtherAction = new KAction(i18nc("@action:inmenu Close Other Views", "Close Others") , this); + QAction* closeOtherAction = new QAction(i18nc("@action:inmenu Close Other Views", "Close Others") , this); closeOtherAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O)); closeOtherAction->setEnabled(false); collection->addAction("close-other-views", closeOtherAction); - connect(closeOtherAction , SIGNAL(triggered()) , this , SLOT(closeOtherContainers())); + connect(closeOtherAction , &QAction::triggered , this , &Konsole::ViewManager::closeOtherContainers); multiViewOnlyActions << closeOtherAction; // Expand & Shrink Active View - KAction* expandActiveAction = new KAction(i18nc("@action:inmenu", "Expand View") , this); + QAction* expandActiveAction = new QAction(i18nc("@action:inmenu", "Expand View") , this); expandActiveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_BracketRight)); expandActiveAction->setEnabled(false); collection->addAction("expand-active-view", expandActiveAction); - connect(expandActiveAction , SIGNAL(triggered()) , this , SLOT(expandActiveContainer())); + connect(expandActiveAction , &QAction::triggered , this , &Konsole::ViewManager::expandActiveContainer); multiViewOnlyActions << expandActiveAction; - KAction* shrinkActiveAction = new KAction(i18nc("@action:inmenu", "Shrink View") , this); + QAction* shrinkActiveAction = new QAction(i18nc("@action:inmenu", "Shrink View") , this); shrinkActiveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_BracketLeft)); shrinkActiveAction->setEnabled(false); collection->addAction("shrink-active-view", shrinkActiveAction); - connect(shrinkActiveAction , SIGNAL(triggered()) , this , SLOT(shrinkActiveContainer())); + connect(shrinkActiveAction , &QAction::triggered , this , &Konsole::ViewManager::shrinkActiveContainer); multiViewOnlyActions << shrinkActiveAction; @@ -203,8 +203,8 @@ void ViewManager::setupActions() // to Ctrl+D - which will terminate the session in many cases detachViewAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H)); - connect(this , SIGNAL(splitViewToggle(bool)) , this , SLOT(updateDetachViewState())); - connect(detachViewAction , SIGNAL(triggered()) , this , SLOT(detachActiveView())); + connect(this , &Konsole::ViewManager::splitViewToggle , this , &Konsole::ViewManager::updateDetachViewState); + connect(detachViewAction , &QAction::triggered , this , &Konsole::ViewManager::detachActiveView); #endif // Next / Previous View , Next Container @@ -218,42 +218,42 @@ void ViewManager::setupActions() // Switch to tab N shortcuts const int SWITCH_TO_TAB_COUNT = 19; QSignalMapper* switchToTabMapper = new QSignalMapper(this); - connect(switchToTabMapper, SIGNAL(mapped(int)), this, SLOT(switchToView(int))); + connect(switchToTabMapper, static_cast(&QSignalMapper::mapped), this, &Konsole::ViewManager::switchToView); for (int i = 0; i < SWITCH_TO_TAB_COUNT; i++) { - KAction* switchToTabAction = new KAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); + QAction* switchToTabAction = new QAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); switchToTabMapper->setMapping(switchToTabAction, i); - connect(switchToTabAction, SIGNAL(triggered()), switchToTabMapper, - SLOT(map())); + connect(switchToTabAction, &QAction::triggered, switchToTabMapper, + static_cast(&QSignalMapper::map)); collection->addAction(QString("switch-to-tab-%1").arg(i), switchToTabAction); } } foreach(QAction* action, multiViewOnlyActions) { - connect(this , SIGNAL(splitViewToggle(bool)) , action , SLOT(setEnabled(bool))); + connect(this , &Konsole::ViewManager::splitViewToggle , action , &QAction::setEnabled); } // keyboard shortcut only actions nextViewAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Right)); - connect(nextViewAction, SIGNAL(triggered()) , this , SLOT(nextView())); + connect(nextViewAction, &QAction::triggered , this , &Konsole::ViewManager::nextView); _viewSplitter->addAction(nextViewAction); previousViewAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left)); - connect(previousViewAction, SIGNAL(triggered()) , this , SLOT(previousView())); + connect(previousViewAction, &QAction::triggered , this , &Konsole::ViewManager::previousView); _viewSplitter->addAction(previousViewAction); nextContainerAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Tab)); - connect(nextContainerAction , SIGNAL(triggered()) , this , SLOT(nextContainer())); + connect(nextContainerAction , &QAction::triggered , this , &Konsole::ViewManager::nextContainer); _viewSplitter->addAction(nextContainerAction); moveViewLeftAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Left)); - connect(moveViewLeftAction , SIGNAL(triggered()) , this , SLOT(moveActiveViewLeft())); + connect(moveViewLeftAction , &QAction::triggered , this , &Konsole::ViewManager::moveActiveViewLeft); _viewSplitter->addAction(moveViewLeftAction); moveViewRightAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Right)); - connect(moveViewRightAction , SIGNAL(triggered()) , this , SLOT(moveActiveViewRight())); + connect(moveViewRightAction , &QAction::triggered , this , &Konsole::ViewManager::moveActiveViewRight); _viewSplitter->addAction(moveViewRightAction); - connect(lastViewAction, SIGNAL(triggered()) , this , SLOT(lastView())); + connect(lastViewAction, &QAction::triggered , this , &Konsole::ViewManager::lastView); _viewSplitter->addAction(lastViewAction); } void ViewManager::switchToView(int index) @@ -504,13 +504,13 @@ SessionController* ViewManager::createController(Session* session , TerminalDisp // create a new controller for the session, and ensure that this view manager // is notified when the view gains the focus SessionController* controller = new SessionController(session, view, this); - connect(controller , SIGNAL(focused(SessionController*)) , this , SLOT(controllerChanged(SessionController*))); - connect(session , SIGNAL(destroyed()) , controller , SLOT(deleteLater())); - connect(session , SIGNAL(primaryScreenInUse(bool)) , - controller , SLOT(setupPrimaryScreenSpecificActions(bool))); - connect(session , SIGNAL(selectionChanged(QString)) , - controller , SLOT(selectionChanged(QString))); - connect(view , SIGNAL(destroyed()) , controller , SLOT(deleteLater())); + connect(controller , &Konsole::SessionController::focused , this , &Konsole::ViewManager::controllerChanged); + connect(session , &Konsole::Session::destroyed , controller , &Konsole::SessionController::deleteLater); + connect(session , &Konsole::Session::primaryScreenInUse , + controller , &Konsole::SessionController::setupPrimaryScreenSpecificActions); + connect(session , &Konsole::Session::selectionChanged , + controller , &Konsole::SessionController::selectionChanged); + connect(view , &Konsole::TerminalDisplay::destroyed , controller , &Konsole::SessionController::deleteLater); // if this is the first controller created then set it as the active controller if (!_pluggedController) @@ -546,7 +546,7 @@ void ViewManager::createView(Session* session, ViewContainer* container, int ind // can be deleted // // Use Qt::UniqueConnection to avoid duplicate connection - connect(session, SIGNAL(finished()), this, SLOT(sessionFinished()), Qt::UniqueConnection); + connect(session, &Konsole::Session::finished, this, &Konsole::ViewManager::sessionFinished, Qt::UniqueConnection); TerminalDisplay* display = createTerminalDisplay(session); const Profile::Ptr profile = SessionManager::instance()->sessionProfile(session); @@ -618,13 +618,13 @@ ViewContainer* ViewManager::createContainer() switch (_navigationMethod) { case TabbedNavigation: { - container = new TabbedViewContainer(_navigationPosition, this, _viewSplitter); + TabbedViewContainer* tabbedContainer = new TabbedViewContainer(_navigationPosition, this, _viewSplitter); + container = tabbedContainer; - connect(container, SIGNAL(detachTab(ViewContainer*,QWidget*)), - this, SLOT(detachView(ViewContainer*,QWidget*)) - ); - connect(container, SIGNAL(closeTab(ViewContainer*,QWidget*)), - this, SLOT(closeTabFromContainer(ViewContainer*,QWidget*))); + connect(tabbedContainer, &TabbedViewContainer::detachTab, + this, &ViewManager::detachView); + connect(tabbedContainer, &TabbedViewContainer::closeTab, + this, &ViewManager::closeTabFromContainer); } break; case NoNavigation: @@ -647,18 +647,18 @@ ViewContainer* ViewManager::createContainer() } // connect signals and slots - connect(container , SIGNAL(viewAdded(QWidget*,ViewProperties*)) , _containerSignalMapper , - SLOT(map())); - connect(container , SIGNAL(viewRemoved(QWidget*)) , _containerSignalMapper , - SLOT(map())); + connect(container , &Konsole::ViewContainer::viewAdded , _containerSignalMapper , + static_cast(&QSignalMapper::map)); + connect(container , &Konsole::ViewContainer::viewRemoved , _containerSignalMapper , + static_cast(&QSignalMapper::map)); _containerSignalMapper->setMapping(container, container); - connect(container, SIGNAL(newViewRequest()), this, SIGNAL(newViewRequest())); - connect(container, SIGNAL(newViewRequest(Profile::Ptr)), this, SIGNAL(newViewRequest(Profile::Ptr))); - connect(container, SIGNAL(moveViewRequest(int,int,bool&,TabbedViewContainer*)), - this , SLOT(containerMoveViewRequest(int,int,bool&,TabbedViewContainer*))); - connect(container , SIGNAL(viewRemoved(QWidget*)) , this , SLOT(viewDestroyed(QWidget*))); - connect(container , SIGNAL(activeViewChanged(QWidget*)) , this , SLOT(viewActivated(QWidget*))); + connect(container, static_cast(&Konsole::ViewContainer::newViewRequest), this, static_cast(&Konsole::ViewManager::newViewRequest)); + connect(container, static_cast(&Konsole::ViewContainer::newViewRequest), this, static_cast(&Konsole::ViewManager::newViewRequest)); + connect(container, &Konsole::ViewContainer::moveViewRequest, + this , &Konsole::ViewManager::containerMoveViewRequest); + connect(container , &Konsole::ViewContainer::viewRemoved , this , &Konsole::ViewManager::viewDestroyed); + connect(container , &Konsole::ViewContainer::activeViewChanged , this , &Konsole::ViewManager::viewActivated); return container; } diff --git a/src/ViewSplitter.cpp b/src/ViewSplitter.cpp index ea043738d..bfc727e5f 100644 --- a/src/ViewSplitter.cpp +++ b/src/ViewSplitter.cpp @@ -85,8 +85,8 @@ ViewSplitter* ViewSplitter::activeSplitter() void ViewSplitter::registerContainer(ViewContainer* container) { _containers << container; - connect(container , SIGNAL(destroyed(ViewContainer*)) , this , SLOT(containerDestroyed(ViewContainer*))); - connect(container , SIGNAL(empty(ViewContainer*)) , this , SLOT(containerEmpty(ViewContainer*))); + connect(container , static_cast(&Konsole::ViewContainer::destroyed) , this , &Konsole::ViewSplitter::containerDestroyed); + connect(container , &Konsole::ViewContainer::empty , this , &Konsole::ViewSplitter::containerEmpty); } void ViewSplitter::unregisterContainer(ViewContainer* container) @@ -145,7 +145,7 @@ void ViewSplitter::addContainer(ViewContainer* container , splitter->updateSizes(); } else { ViewSplitter* newSplitter = new ViewSplitter(this); - connect(newSplitter , SIGNAL(empty(ViewSplitter*)) , splitter , SLOT(childEmpty(ViewSplitter*))); + connect(newSplitter , &Konsole::ViewSplitter::empty , splitter , &Konsole::ViewSplitter::childEmpty); ViewContainer* oldContainer = splitter->activeContainer(); const int oldContainerIndex = splitter->indexOf(oldContainer->containerWidget()); diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index 33df23bbf..f5aa85e26 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -70,7 +70,7 @@ Vt102Emulation::Vt102Emulation() _titleUpdateTimer(new QTimer(this)) { _titleUpdateTimer->setSingleShot(true); - QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle())); + QObject::connect(_titleUpdateTimer , &QTimer::timeout , this , &Konsole::Vt102Emulation::updateTitle); initTokenizer(); reset(); @@ -834,12 +834,9 @@ void Vt102Emulation::clearScreenAndSetColumns(int columnCount) _currentScreen->setCursorYX(0,0); } -void Vt102Emulation::sendString(const char* s , int length) +void Vt102Emulation::sendString(const QByteArray& s) { - if ( length >= 0 ) - emit sendData(s,length); - else - emit sendData(s,qstrlen(s)); + emit sendData(s); } void Vt102Emulation::reportCursorPosition() @@ -1054,7 +1051,7 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event) else textToSend += _codec->fromUnicode(event->text()); - sendData(textToSend.constData(), textToSend.length()); + sendData(textToSend); } else { diff --git a/src/Vt102Emulation.h b/src/Vt102Emulation.h index 8d678e00b..a1adb8619 100644 --- a/src/Vt102Emulation.h +++ b/src/Vt102Emulation.h @@ -83,22 +83,22 @@ public: ~Vt102Emulation(); // reimplemented from Emulation - virtual void clearEntireScreen(); - virtual void reset(); - virtual char eraseChar() const; + virtual void clearEntireScreen() Q_DECL_OVERRIDE; + virtual void reset() Q_DECL_OVERRIDE; + virtual char eraseChar() const Q_DECL_OVERRIDE; public slots: // reimplemented from Emulation - virtual void sendString(const char*, int length = -1); - virtual void sendText(const QString& text); - virtual void sendKeyEvent(QKeyEvent*); - virtual void sendMouseEvent(int buttons, int column, int line, int eventType); + virtual void sendString(const QByteArray& string) Q_DECL_OVERRIDE; + virtual void sendText(const QString& text) Q_DECL_OVERRIDE; + virtual void sendKeyEvent(QKeyEvent*) Q_DECL_OVERRIDE; + virtual void sendMouseEvent(int buttons, int column, int line, int eventType) Q_DECL_OVERRIDE; protected: // reimplemented from Emulation - virtual void setMode(int mode); - virtual void resetMode(int mode); - virtual void receiveChar(int cc); + virtual void setMode(int mode) Q_DECL_OVERRIDE; + virtual void resetMode(int mode) Q_DECL_OVERRIDE; + virtual void receiveChar(int cc) Q_DECL_OVERRIDE; private slots: //causes changeTitle() to be emitted for each (int,QString) pair in pendingTitleUpdates diff --git a/src/ZModemDialog.cpp b/src/ZModemDialog.cpp index e5e7ce933..4488cc0b0 100644 --- a/src/ZModemDialog.cpp +++ b/src/ZModemDialog.cpp @@ -43,8 +43,8 @@ ZModemDialog::ZModemDialog(QWidget* aParent, bool modal, const QString& caption) _textEdit->setReadOnly(true); setMainWidget(_textEdit); - connect(this, SIGNAL(user1Clicked()), this, SLOT(slotClose())); - connect(this, SIGNAL(closeClicked()), this, SLOT(slotClose())); + connect(this, &Konsole::ZModemDialog::user1Clicked, this, &Konsole::ZModemDialog::slotClose); + connect(this, &Konsole::ZModemDialog::closeClicked, this, &Konsole::ZModemDialog::slotClose); } void ZModemDialog::addProgressText(const QString& text) diff --git a/src/settings/GeneralSettings.cpp b/src/settings/GeneralSettings.cpp index 160a87a91..3e42ae148 100644 --- a/src/settings/GeneralSettings.cpp +++ b/src/settings/GeneralSettings.cpp @@ -29,7 +29,7 @@ GeneralSettings::GeneralSettings(QWidget* aParent) : QWidget(aParent) { setupUi(this); - connect(enableAllMessagesButton, SIGNAL(clicked()), this, SLOT(slotEnableAllMessages())); + connect(enableAllMessagesButton, &QPushButton::clicked, this, &Konsole::GeneralSettings::slotEnableAllMessages); this->kcfg_ShowTerminalSizeHint->setVisible(false); } diff --git a/src/tests/PartManualTest.cpp b/src/tests/PartManualTest.cpp index 957877b85..2066a62f9 100644 --- a/src/tests/PartManualTest.cpp +++ b/src/tests/PartManualTest.cpp @@ -69,7 +69,7 @@ void PartManualTest::testShortcutOverride() QMenu* fileMenu = mainWindow->menuBar()->addMenu("File"); QAction* testAction = fileMenu->addAction("Test"); testAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); - connect(testAction, SIGNAL(triggered()), this, SLOT(shortcutTriggered())); + connect(testAction, &QAction::triggered, this, &Konsole::PartManualTest::shortcutTriggered); // Create terminal part and embed in into the main window KParts::Part* terminalPart = createPart();