diff --git a/src/Application.cpp b/src/Application.cpp index 49fd44561866814023a766b9de101c4ebfd1b3f3..2cdbaba63d44828e2556764b2286018633bf47a0 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -141,7 +141,7 @@ MainWindow* Application::newMainWindow() { WindowSystemInfo::HAVE_TRANSPARENCY = !m_parser->isSet(QStringLiteral("notransparency")); - MainWindow* window = new MainWindow(); + auto window = new MainWindow(); connect(window, &Konsole::MainWindow::newWindowRequest, this, &Konsole::Application::createWindow); connect(window, &Konsole::MainWindow::viewDetached, this, &Konsole::Application::detachView); @@ -565,7 +565,7 @@ void Application::slotActivateRequested (QStringList args, const QString & /*wor m_customCommand = getCustomCommand(args); // We can't re-use QCommandLineParser instances, it preserves earlier parsed values - QCommandLineParser *parser = new QCommandLineParser; + auto parser = new QCommandLineParser; populateCommandLineParser(parser); parser->parse(args); m_parser.reset(parser); diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp index 297eecc485b3b124ce151877e9ef6303e7088d58..81576afc03585d28627b7e6e220350b4ccc1211f 100644 --- a/src/ColorSchemeEditor.cpp +++ b/src/ColorSchemeEditor.cpp @@ -60,9 +60,9 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent) , _isNewScheme(false) , _colors(0) { - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); + auto mainWidget = new QWidget(this); + auto mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); @@ -92,10 +92,10 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent) connect(_ui->randomizedBackgroundCheck , &QCheckBox::toggled , this , &Konsole::ColorSchemeEditor::setRandomizedBackgroundColor); // wallpaper stuff - QFileSystemModel *dirModel = new QFileSystemModel(this); + auto dirModel = new QFileSystemModel(this); dirModel->setFilter(QDir::AllEntries); dirModel->setRootPath(QString('/')); - QCompleter *completer = new QCompleter(this); + auto completer = new QCompleter(this); completer->setModel(dirModel); _ui->wallpaperPath->setCompleter(completer); @@ -267,17 +267,17 @@ void ColorSchemeEditor::setupColorTable(const ColorScheme* colors) QTableWidgetItem* nameItem = new QTableWidgetItem(ColorScheme::translatedColorNameForIndex(row)); nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable); - QTableWidgetItem* colorItem = new QTableWidgetItem(); + auto colorItem = new QTableWidgetItem(); colorItem->setBackground(table[row].color); colorItem->setFlags(colorItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable); colorItem->setToolTip(i18nc("@info:tooltip", "Click to choose color")); - QTableWidgetItem* colorItemIntense = new QTableWidgetItem(); + auto colorItemIntense = new QTableWidgetItem(); colorItemIntense->setBackground(table[COLOR_TABLE_ROW_LENGTH + row].color); colorItemIntense->setFlags(colorItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable); colorItemIntense->setToolTip(i18nc("@info:tooltip", "Click to choose intense color")); - QTableWidgetItem* colorItemFaint = new QTableWidgetItem(); + auto colorItemFaint = new QTableWidgetItem(); colorItemFaint->setBackground(table[2*COLOR_TABLE_ROW_LENGTH + row].color); colorItemFaint->setFlags(colorItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable); colorItemFaint->setToolTip(i18nc("@info:tooltip", "Click to choose Faint color")); diff --git a/src/ColorSchemeManager.cpp b/src/ColorSchemeManager.cpp index d81c269f31fb5c36d0a3ba6d6ab4f4f083b212da..53e15c7290f5259bdaeebaedc77dbc4196a36a2f 100644 --- a/src/ColorSchemeManager.cpp +++ b/src/ColorSchemeManager.cpp @@ -87,7 +87,7 @@ bool ColorSchemeManager::loadColorScheme(const QString& filePath) QFileInfo info(filePath); KConfig config(filePath , KConfig::NoGlobals); - ColorScheme* scheme = new ColorScheme(); + auto scheme = new ColorScheme(); scheme->setName(info.baseName()); scheme->read(config); diff --git a/src/CopyInputDialog.cpp b/src/CopyInputDialog.cpp index be19c8f06ec5dab30df38ba969865c9e573b24e9..8e2d6b4c2571019e8be006b041f0a4f62611fcda 100644 --- a/src/CopyInputDialog.cpp +++ b/src/CopyInputDialog.cpp @@ -37,9 +37,9 @@ CopyInputDialog::CopyInputDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(i18n("Copy Input")); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + auto mainWidget = new QWidget(this); + auto mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); @@ -64,7 +64,7 @@ CopyInputDialog::CopyInputDialog(QWidget* parent) _model->setCheckColumn(1); _model->setSessions(SessionManager::instance()->sessions()); - QSortFilterProxyModel* filterProxyModel = new QSortFilterProxyModel(this); + auto filterProxyModel = new QSortFilterProxyModel(this); filterProxyModel->setDynamicSortFilter(true); filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); filterProxyModel->setSourceModel(_model); diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index f149b6488252d401c50a4fe9e6200c8da4637c90..4ab314d539ad5b3f2b47d298d812a9c3e868eb11 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -68,8 +68,8 @@ EditProfileDialog::EditProfileDialog(QWidget* aParent) { setWindowTitle(i18n("Edit Profile")); mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto mainWidget = new QWidget(this); + auto mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok); @@ -398,7 +398,7 @@ void EditProfileDialog::selectInitialDir() } void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile) { - ColorSchemeViewDelegate* delegate = new ColorSchemeViewDelegate(this); + auto delegate = new ColorSchemeViewDelegate(this); _ui->colorSchemeList->setItemDelegate(delegate); _ui->transparencyWarningWidget->setVisible(false); @@ -716,7 +716,7 @@ void EditProfileDialog::editColorScheme() } void EditProfileDialog::saveColorScheme(const ColorScheme& scheme, bool isNewScheme) { - ColorScheme* newScheme = new ColorScheme(scheme); + auto newScheme = new ColorScheme(scheme); // if this is a new color scheme, pick a name based on the description if (isNewScheme) { @@ -873,7 +873,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator) Q_ASSERT(translator); QPointer dialog = new QDialog(this); - QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); + auto buttonBox = new QDialogButtonBox(dialog); buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, dialog.data(), &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, dialog.data(), &QDialog::reject); @@ -883,7 +883,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator) else dialog->setWindowTitle(i18n("Edit Key Binding List")); - KeyBindingEditor* editor = new KeyBindingEditor; + auto editor = new KeyBindingEditor; if (translator) editor->setup(translator); @@ -891,13 +891,13 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator) if (isNewTranslator) editor->setDescription(i18n("New Key Binding List")); - QVBoxLayout *layout = new QVBoxLayout; + auto layout = new QVBoxLayout; layout->addWidget(editor); layout->addWidget(buttonBox); dialog->setLayout(layout); if (dialog->exec() == QDialog::Accepted) { - KeyboardTranslator* newTranslator = new KeyboardTranslator(*editor->translator()); + auto newTranslator = new KeyboardTranslator(*editor->translator()); if (isNewTranslator) newTranslator->setName(newTranslator->description()); @@ -1129,7 +1129,7 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile) connect(_ui->cursorShapeCombo, static_cast(&KComboBox::activated), this, &Konsole::EditProfileDialog::setCursorShape); // encoding options - KCodecAction* codecAction = new KCodecAction(this); + auto codecAction = new KCodecAction(this); _ui->selectEncodingButton->setMenu(codecAction->menu()); connect(codecAction, static_cast(&KCodecAction::triggered), this, &Konsole::EditProfileDialog::setDefaultCodec); diff --git a/src/Emulation.cpp b/src/Emulation.cpp index 43eb4d563502b7e32c0e97e1e40331daf95ccad8..e5abe79a619b6a419ede1ee0ea7061e95a804656 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -77,7 +77,7 @@ void Emulation::bracketedPasteModeChanged(bool bracketedPasteMode) ScreenWindow* Emulation::createWindow() { - ScreenWindow* window = new ScreenWindow(_currentScreen); + auto window = new ScreenWindow(_currentScreen); _windows << window; connect(window , &Konsole::ScreenWindow::selectionChanged, this , &Konsole::Emulation::bufferedUpdate); diff --git a/src/ExtendedCharTable.cpp b/src/ExtendedCharTable.cpp index 3c1ea76d48e310a659d3c1abdfd268c5ae7c56f4..7242c6f5d8ee50677c0ffd58edc7691445c590d3 100644 --- a/src/ExtendedCharTable.cpp +++ b/src/ExtendedCharTable.cpp @@ -100,7 +100,7 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor // add the new sequence to the table and // return that index - ushort* buffer = new ushort[length + 1]; + auto buffer = new ushort[length + 1]; buffer[0] = length; for (int i = 0 ; i < length ; i++) buffer[i + 1] = unicodePoints[i]; diff --git a/src/Filter.cpp b/src/Filter.cpp index 7c0ec3ad33e0eff581cd89fb5e5fd71317daedd1..d0304b7b36bddc568ad219a86f2157e12088aa74 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -133,8 +133,8 @@ void TerminalImageFilterChain::setImage(const Character* const image , int lines decoder.setTrailingWhitespace(false); // setup new shared buffers for the filters to process on - QString* newBuffer = new QString(); - QList* newLinePositions = new QList(); + auto newBuffer = new QString(); + auto newLinePositions = new QList(); setBuffer(newBuffer , newLinePositions); // free the old buffers @@ -458,8 +458,8 @@ void FilterObject::activated() } QList UrlFilter::HotSpot::actions() { - QAction* openAction = new QAction(_urlObject); - QAction* copyAction = new QAction(_urlObject); + auto openAction = new QAction(_urlObject); + auto copyAction = new QAction(_urlObject); const UrlType kind = urlType(); Q_ASSERT(kind == StandardUrl || kind == Email); @@ -553,7 +553,7 @@ FileFilter::HotSpot::~HotSpot() QList FileFilter::HotSpot::actions() { - QAction* openAction = new QAction(_fileObject); + auto openAction = new QAction(_fileObject); openAction->setText(i18n("Open File")); QObject::connect(openAction , SIGNAL(triggered()) , _fileObject , SLOT(activated())); QList actions; diff --git a/src/History.cpp b/src/History.cpp index cfb791840d8f0a729091ce19de0d8a38ada0d480..c1493b187a76b3fa11f1f584fb99d201e2f75416 100644 --- a/src/History.cpp +++ b/src/History.cpp @@ -626,7 +626,7 @@ HistoryScroll* HistoryTypeFile::scroll(HistoryScroll* old) const for (int i = 0; i < lines; i++) { int size = old->getLineLen(i); if (size > LINE_SIZE) { - Character* tmp_line = new Character[size]; + auto tmp_line = new Character[size]; old->getCells(i, 0, size, tmp_line); newScroll->addCells(tmp_line, size); newScroll->addLine(old->isWrappedLine(i)); diff --git a/src/HistorySizeDialog.cpp b/src/HistorySizeDialog.cpp index 6aeed7b3bd8adeaefdb88260416b8631e6484bfd..57cbb7d68dbfdbde50f7ab2553d4e0a99b74a8be 100644 --- a/src/HistorySizeDialog.cpp +++ b/src/HistorySizeDialog.cpp @@ -36,9 +36,9 @@ HistorySizeDialog::HistorySizeDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(i18nc("@title:window", "Adjust Scrollback")); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + auto mainWidget = new QWidget(this); + auto mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); diff --git a/src/HistorySizeWidget.cpp b/src/HistorySizeWidget.cpp index 29971d30a7d4c5994ed6206e34ba517d88da8cc9..700d76100d04a1de6df4462e9cea0869be9cc9db 100644 --- a/src/HistorySizeWidget.cpp +++ b/src/HistorySizeWidget.cpp @@ -62,7 +62,7 @@ HistorySizeWidget::HistorySizeWidget(QWidget* parent) _ui->fixedSizeHistoryButton->setFocusProxy(_ui->historyLineSpinner); connect(_ui->fixedSizeHistoryButton , &QRadioButton::clicked , _ui->historyLineSpinner , &KPluralHandlingSpinBox::selectAll); - QButtonGroup* modeGroup = new QButtonGroup(this); + auto modeGroup = new QButtonGroup(this); modeGroup->addButton(_ui->noHistoryButton); modeGroup->addButton(_ui->fixedSizeHistoryButton); modeGroup->addButton(_ui->unlimitedHistoryButton); diff --git a/src/IncrementalSearchBar.cpp b/src/IncrementalSearchBar.cpp index a3a9576e99f0a881983641cdac8baee2befedf6e..428f9876e9e11449dac87ec03b010f4f9044e87c 100644 --- a/src/IncrementalSearchBar.cpp +++ b/src/IncrementalSearchBar.cpp @@ -47,9 +47,9 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent) , _findPreviousButton(0) , _searchFromButton(0) { - QHBoxLayout* barLayout = new QHBoxLayout(this); + auto barLayout = new QHBoxLayout(this); - QToolButton* closeButton = new QToolButton(this); + auto closeButton = new QToolButton(this); closeButton->setObjectName(QStringLiteral("close-button")); closeButton->setToolTip(i18nc("@info:tooltip", "Close the search bar")); closeButton->setAutoRaise(true); @@ -96,7 +96,7 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent) _searchFromButton->setObjectName(QStringLiteral("search-from-button")); connect(_searchFromButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::searchFromClicked); - QToolButton* optionsButton = new QToolButton(this); + auto optionsButton = new QToolButton(this); optionsButton->setObjectName(QStringLiteral("find-options-button")); optionsButton->setText(i18nc("@action:button Display options menu", "Options")); optionsButton->setCheckable(false); @@ -114,7 +114,7 @@ IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent) barLayout->addWidget(optionsButton); // Fill the options menu - QMenu* optionsMenu = new QMenu(this); + auto optionsMenu = new QMenu(this); optionsButton->setMenu(optionsMenu); _caseSensitive = optionsMenu->addAction(i18nc("@item:inmenu", "Case sensitive")); diff --git a/src/KeyboardTranslatorManager.cpp b/src/KeyboardTranslatorManager.cpp index 79bc84cc239b73ee27c181f71a12d0303f057a46..5b8f0b50557b4adff036f9081cbffda7f417079a 100644 --- a/src/KeyboardTranslatorManager.cpp +++ b/src/KeyboardTranslatorManager.cpp @@ -168,7 +168,7 @@ KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(const QString& nam KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(QIODevice* source, const QString& name) { - KeyboardTranslator* translator = new KeyboardTranslator(name); + auto translator = new KeyboardTranslator(name); KeyboardTranslatorReader reader(source); translator->setDescription(reader.description()); while (reader.hasNextEntry()) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8e313610fbe2cefb7c733dac1ce71aa06dfd4e28..690b34dd45fae8f973ce9efe6da641e7c2bf5425 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -686,22 +686,22 @@ void MainWindow::showSettingsDialog(const bool showProfilePage) KConfigDialog* settingsDialog = new KConfigDialog(this, QStringLiteral("settings"), KonsoleSettings::self()); settingsDialog->setFaceType(KPageDialog::Tabbed); - GeneralSettings* generalSettings = new GeneralSettings(settingsDialog); + auto generalSettings = new GeneralSettings(settingsDialog); settingsDialog->addPage(generalSettings, i18nc("@title Preferences page name", "General"), QStringLiteral("utilities-terminal")); - ProfileSettings* profileSettings = new ProfileSettings(settingsDialog); + auto profileSettings = new ProfileSettings(settingsDialog); KPageWidgetItem* profilePage = settingsDialog->addPage(profileSettings, i18nc("@title Preferences page name", "Profiles"), QStringLiteral("configure")); - TabBarSettings* tabBarSettings = new TabBarSettings(settingsDialog); + auto tabBarSettings = new TabBarSettings(settingsDialog); settingsDialog->addPage(tabBarSettings, i18nc("@title Preferences page name", "TabBar"), QStringLiteral("system-run")); - FileLocationSettings* fileLocationSettings = new FileLocationSettings(settingsDialog); + auto fileLocationSettings = new FileLocationSettings(settingsDialog); settingsDialog->addPage(fileLocationSettings, i18nc("@title Preferences page name", "File Location"), QStringLiteral("configure")); @@ -808,8 +808,8 @@ void MainWindow::activateMenuBar() void MainWindow::setupMainWidget() { - QWidget* mainWindowWidget = new QWidget(this); - QVBoxLayout* mainWindowLayout = new QVBoxLayout(); + auto mainWindowWidget = new QWidget(this); + auto mainWindowLayout = new QVBoxLayout(); mainWindowLayout->addWidget(_viewManager->widget()); mainWindowLayout->setContentsMargins(0, 0, 0, 0); diff --git a/src/Part.cpp b/src/Part.cpp index 7968176f2b977f391b44dc36a9df9597b27aff2d..c772be69117789d907d1862819c3bfe876aa2a5f 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -268,7 +268,7 @@ void Part::showEditCurrentProfileDialog(QWidget* parent) { Q_ASSERT(activeSession()); - EditProfileDialog* dialog = new EditProfileDialog(parent); + auto dialog = new EditProfileDialog(parent); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setProfile(SessionManager::instance()->sessionProfile(activeSession())); dialog->show(); diff --git a/src/ProfileList.cpp b/src/ProfileList.cpp index 883f5d62fdf0f7f535c333f9b485c8f23861ab24..5aaafe1713f6adccbf5c2b840b99cfa91ffde580 100644 --- a/src/ProfileList.cpp +++ b/src/ProfileList.cpp @@ -127,7 +127,7 @@ void ProfileList::favoriteChanged(Profile::Ptr profile, bool isFavorite) ProfileManager* manager = ProfileManager::instance(); if (isFavorite) { - QAction* action = new QAction(_group); + auto action = new QAction(_group); action->setData(QVariant::fromValue(profile)); if (_addShortcuts) { diff --git a/src/RenameTabDialog.cpp b/src/RenameTabDialog.cpp index 6601662b606940fb6c881ebc07f2b324e5a15069..eb82cce2f0c51e78406cd0752117b75dd4219506 100644 --- a/src/RenameTabDialog.cpp +++ b/src/RenameTabDialog.cpp @@ -35,9 +35,9 @@ RenameTabDialog::RenameTabDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(i18n("Rename Tab")); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + auto mainWidget = new QWidget(this); + auto mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); diff --git a/src/Screen.cpp b/src/Screen.cpp index 1aa41dd2c8c809ea814a00ce8ab84a5d07e90693..4ea287cea466f5a29431b67bf296b079f7f73263 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -306,7 +306,7 @@ void Screen::resizeImage(int new_lines, int new_columns) // create new screen _lines and copy from old to new - ImageLine* newScreenLines = new ImageLine[new_lines + 1]; + auto newScreenLines = new ImageLine[new_lines + 1]; for (int i = 0; i < qMin(_lines, new_lines + 1) ; i++) newScreenLines[i] = _screenLines[i]; for (int i = _lines; (i > 0) && (i < new_lines + 1); i++) @@ -662,7 +662,7 @@ void Screen::displayCharacter(unsigned short c) if (oldChars && extendedCharLength < 3) { Q_ASSERT(extendedCharLength > 1); Q_ASSERT(extendedCharLength < 65535); - ushort* chars = new ushort[extendedCharLength + 1]; + auto chars = new ushort[extendedCharLength + 1]; memcpy(chars, oldChars, sizeof(ushort) * extendedCharLength); chars[extendedCharLength] = c; currentChar.character = ExtendedCharTable::instance.createExtendedChar(chars, extendedCharLength + 1); diff --git a/src/SessionController.cpp b/src/SessionController.cpp index 59b87310a667056cad7f70196ca7638906cc18e1..c1898b4cbf32b6a5b681267f744ef2ba0c18e6bc 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -194,7 +194,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q 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); + auto backgroundTimer = new QTimer(_session); backgroundTimer->setSingleShot(false); backgroundTimer->setInterval(2000); connect(backgroundTimer, &QTimer::timeout, this, &Konsole::SessionController::snapshot); @@ -1296,7 +1296,7 @@ void SessionController::beginSearch(const QString& text , int direction) if (!regExp.pattern().isEmpty()) { _view->screenWindow()->setCurrentResultLine(-1); - SearchHistoryTask* task = new SearchHistoryTask(this); + auto task = new SearchHistoryTask(this); connect(task, &Konsole::SearchHistoryTask::completed, this, &Konsole::SessionController::searchCompleted); @@ -1415,7 +1415,7 @@ void SessionController::print_screen() QPrinter printer; QPointer dialog = new QPrintDialog(&printer, _view); - PrintOptions* options = new PrintOptions(); + auto options = new PrintOptions(); dialog->setOptionTabs(QList() << options); dialog->setWindowTitle(i18n("Print Shell")); @@ -1527,7 +1527,7 @@ void SessionController::showDisplayContextMenu(const QPoint& position) setClientBuilder(new KXMLGUIBuilder(_view)); } - KXMLGUIFactory* factory = new KXMLGUIFactory(clientBuilder(), this); + auto factory = new KXMLGUIFactory(clientBuilder(), this); factory->addClient(this); ////qDebug() << "Created xmlgui factory" << factory; } @@ -1536,7 +1536,7 @@ void SessionController::showDisplayContextMenu(const QPoint& position) if (popup) { // prepend content-specific actions such as "Open Link", "Copy Email Address" etc. QList contentActions = _view->filterActions(position); - QAction* contentSeparator = new QAction(popup); + auto contentSeparator = new QAction(popup); contentSeparator->setSeparator(true); contentActions << contentSeparator; popup->insertActions(popup->actions().value(0, 0), contentActions); diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 5413a31d621871672ce2d7357fe838817615b359..4ae05ba6831f05c052518706933d21a0bc80fed2 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -92,7 +92,7 @@ Session* SessionManager::createSession(Profile::Ptr profile) ProfileManager::instance()->addProfile(profile); //configuration information found, create a new session based on this - Session* session = new Session(); + auto session = new Session(); Q_ASSERT(session); applyProfile(session, profile, false); diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 1ba569b313d81c36adf29f444a99d61cfb164c79..cda4aa057605dc27d2a86ac9971b6f9528053d44 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -1120,7 +1120,7 @@ void TerminalDisplay::updateImage() const int linesToUpdate = qMin(this->_lines, qMax(0, lines)); const int columnsToUpdate = qMin(this->_columns, qMax(0, columns)); - char* dirtyMask = new char[columnsToUpdate + 2]; + auto dirtyMask = new char[columnsToUpdate + 2]; QRegion dirtyRegion; // debugging variable, this records the number of lines that are found to @@ -2898,7 +2898,7 @@ void TerminalDisplay::copyToX11Selection() return; QString html = _screenWindow->selectedText(_preserveLineBreaks, _trimTrailingSpaces, true); - QMimeData *mimeData = new QMimeData; + auto mimeData = new QMimeData; mimeData->setText(text); mimeData->setHtml(html); @@ -2920,7 +2920,7 @@ void TerminalDisplay::copyToClipboard() return; QString html = _screenWindow->selectedText(_preserveLineBreaks, _trimTrailingSpaces, true); - QMimeData *mimeData = new QMimeData; + auto mimeData = new QMimeData; mimeData->setText(text); mimeData->setHtml(html); @@ -3415,7 +3415,7 @@ void TerminalDisplay::doDrag() { _dragInfo.state = diDragging; _dragInfo.dragObject = new QDrag(this); - QMimeData* mimeData = new QMimeData(); + auto mimeData = new QMimeData(); mimeData->setText(QApplication::clipboard()->mimeData(QClipboard::Selection)->text()); mimeData->setHtml(QApplication::clipboard()->mimeData(QClipboard::Selection)->html()); _dragInfo.dragObject->setMimeData(mimeData); diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index d4c3a916ebb656b70b45760f6c42b28fd23a4bc7..21c26dde46b6eab8971e95ce41d80da361ac99b0 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -293,8 +293,8 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position, ViewManage _newTabButton->setWhatsThis(i18nc("@info:whatsthis", "Create a new tab. Press and hold to select profile from menu")); _newTabButton->adjustSize(); - QMenu* profileMenu = new QMenu(_newTabButton); - ProfileList* profileList = new ProfileList(false, profileMenu); + auto profileMenu = new QMenu(_newTabButton); + auto profileList = new ProfileList(false, profileMenu); profileList->syncWidgetActions(profileMenu, true); connect(profileList, &Konsole::ProfileList::profileSelected, this, static_cast(&Konsole::TabbedViewContainer::newViewRequest)); setNewViewMenu(profileMenu); @@ -716,7 +716,7 @@ StackedViewContainer::StackedViewContainer(QObject* parent) : ViewContainer(NavigationPositionTop, parent) { _containerWidget = new QWidget; - QVBoxLayout* layout = new QVBoxLayout(_containerWidget); + auto layout = new QVBoxLayout(_containerWidget); _stackWidget = new QStackedWidget(_containerWidget); diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 68dc6ac638fcba31b5a1d10547b5f274fca2de9d..770ea9f91e77cab1d29ce85abea1e2c3343371dd 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -209,7 +209,7 @@ void ViewManager::setupActions() // Switch to tab N shortcuts const int SWITCH_TO_TAB_COUNT = 19; - QSignalMapper* switchToTabMapper = new QSignalMapper(this); + auto switchToTabMapper = new QSignalMapper(this); connect(switchToTabMapper, static_cast(&QSignalMapper::mapped), this, &Konsole::ViewManager::switchToView); for (int i = 0; i < SWITCH_TO_TAB_COUNT; i++) { QAction* switchToTabAction = new QAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); @@ -485,7 +485,7 @@ 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); + auto controller = new SessionController(session, view, this); 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); @@ -598,7 +598,7 @@ ViewContainer* ViewManager::createContainer() switch (_navigationMethod) { case TabbedNavigation: { - TabbedViewContainer* tabbedContainer = new TabbedViewContainer(_navigationPosition, this, _viewSplitter); + auto tabbedContainer = new TabbedViewContainer(_navigationPosition, this, _viewSplitter); container = tabbedContainer; connect(tabbedContainer, &TabbedViewContainer::detachTab, this, &ViewManager::detachView); @@ -751,7 +751,7 @@ void ViewManager::viewDestroyed(QWidget* view) TerminalDisplay* ViewManager::createTerminalDisplay(Session* session) { - TerminalDisplay* display = new TerminalDisplay(0); + auto display = new TerminalDisplay(0); display->setRandomSeed(session->sessionId() * 31); return display; diff --git a/src/ViewProperties.h b/src/ViewProperties.h index 1c57acf21550d9678c29a7d748c4906994271079..3ab4cd4c6f91fe616e0a470be98ce9eaf7137e71 100644 --- a/src/ViewProperties.h +++ b/src/ViewProperties.h @@ -93,7 +93,7 @@ public: * be deleted by the caller. */ static QMimeData* createMimeData(int id) { - QMimeData* mimeData = new QMimeData; + auto mimeData = new QMimeData; mimeData->setData(mimeType(), QByteArray::number(id)); return mimeData; } diff --git a/src/ViewSplitter.cpp b/src/ViewSplitter.cpp index d558ca3f0b97314bf587c838a015596810a9c0ab..e1d8c6d672eccecb1eb64abd2bb5b11f024607c0 100644 --- a/src/ViewSplitter.cpp +++ b/src/ViewSplitter.cpp @@ -149,7 +149,7 @@ void ViewSplitter::addContainer(ViewContainer* container , splitter->updateSizes(); } else { - ViewSplitter* newSplitter = new ViewSplitter(this); + auto newSplitter = new ViewSplitter(this); connect(newSplitter , &Konsole::ViewSplitter::empty , splitter , &Konsole::ViewSplitter::childEmpty); ViewContainer* oldContainer = splitter->activeContainer(); diff --git a/src/ZModemDialog.cpp b/src/ZModemDialog.cpp index 83fe1654b5e275083c3b6dfd234b5ac7ac9c01aa..8adf97efed4c66337dac5ae0c65b708912653875 100644 --- a/src/ZModemDialog.cpp +++ b/src/ZModemDialog.cpp @@ -37,8 +37,8 @@ ZModemDialog::ZModemDialog(QWidget* aParent, bool modal, const QString& caption) setWindowTitle(caption); mButtonBox = new QDialogButtonBox(QDialogButtonBox::Close); - QWidget *mainWidget = new QWidget(this); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto mainWidget = new QWidget(this); + auto mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); mUser1Button = new QPushButton; diff --git a/src/autotests/HistoryTest.cpp b/src/autotests/HistoryTest.cpp index 1ae0cea5d75f277c56234e9f2ff3c7a0da55c93e..dfe7500291be93bf69d6d87d8c857a73603eb8a3 100644 --- a/src/autotests/HistoryTest.cpp +++ b/src/autotests/HistoryTest.cpp @@ -64,7 +64,7 @@ void HistoryTest::testCompactHistory() void HistoryTest::testEmulationHistory() { - Session* session = new Session(); + auto session = new Session(); Emulation* emulation = session->emulation(); const HistoryType& historyTypeDefault = emulation->history(); diff --git a/src/autotests/PartTest.cpp b/src/autotests/PartTest.cpp index c5a4b4388bb058c0ad6d52b09fdae1c34e25b85f..75403d6e326b28b0c2575dfb2e5f7f6c5a1b6bf8 100644 --- a/src/autotests/PartTest.cpp +++ b/src/autotests/PartTest.cpp @@ -84,7 +84,7 @@ void PartTest::testFd() ptyProcess.pty()->setSuspended(true); QPointer dialog = new QDialog(); - QVBoxLayout* layout = new QVBoxLayout(dialog.data()); + auto layout = new QVBoxLayout(dialog.data()); layout->addWidget(new QLabel(QStringLiteral("Output of 'ping localhost' should appear in a terminal below for 5 seconds"))); layout->addWidget(terminalPart->widget()); QTimer::singleShot(5000, dialog.data(), SLOT(close())); diff --git a/src/autotests/SessionTest.cpp b/src/autotests/SessionTest.cpp index c0c631b46517a00308db9568c94f3f07a0ffccb1..d8ca74cedc6efef1700be062c62eeb93aa568386 100644 --- a/src/autotests/SessionTest.cpp +++ b/src/autotests/SessionTest.cpp @@ -31,7 +31,7 @@ using namespace Konsole; void SessionTest::testNoProfile() { - Session* session = new Session(); + auto session = new Session(); // No profile loaded, nothing to run QCOMPARE(session->isRunning(), false); @@ -47,7 +47,7 @@ void SessionTest::testNoProfile() void SessionTest::testEmulation() { - Session* session = new Session(); + auto session = new Session(); Emulation* emulation = session->emulation(); diff --git a/src/autotests/TerminalTest.cpp b/src/autotests/TerminalTest.cpp index cd728fbcbaaf6cc6538d7313166231debf8a7e7d..e47e27e3d7900e4537a49f6c8690c95c857bc028 100644 --- a/src/autotests/TerminalTest.cpp +++ b/src/autotests/TerminalTest.cpp @@ -32,7 +32,7 @@ using namespace Konsole; void TerminalTest::testScrollBarPositions() { - TerminalDisplay* display = new TerminalDisplay(0); + auto display = new TerminalDisplay(0); // ScrollBar Positions display->setScrollBarPosition(Enum::ScrollBarLeft); @@ -61,7 +61,7 @@ void TerminalTest::testColorTable() ColorEntry(QColor(0x54, 0xFF, 0xFF)), ColorEntry(QColor(0x00, 0xFF, 0xFF)) }; - TerminalDisplay* display = new TerminalDisplay(0); + auto display = new TerminalDisplay(0); display->setColorTable(defaultTable); @@ -78,7 +78,7 @@ void TerminalTest::testColorTable() void TerminalTest::testSize() { - TerminalDisplay* display = new TerminalDisplay(0); + auto display = new TerminalDisplay(0); QCOMPARE(display->columns(), 1); QCOMPARE(display->lines(), 1); diff --git a/src/main.cpp b/src/main.cpp index 7f8fa4671b6ad4ed3d5b97055da421c83d20c249..18717d7098523b4200fb3022fc361b0bcc977a1e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -75,7 +75,7 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* argv[]) needToDeleteQApplication = true; } - QApplication *app = new QApplication(argc, argv); + auto app = new QApplication(argc, argv); // enable high dpi support app->setAttribute(Qt::AA_UseHighDpiPixmaps, true); diff --git a/src/settings/ProfileSettings.cpp b/src/settings/ProfileSettings.cpp index 5ecc019b1b91ce399a6e2eddbc0887720e31d824..93144eaa196c899023d094405899562931ef7d6a 100644 --- a/src/settings/ProfileSettings.cpp +++ b/src/settings/ProfileSettings.cpp @@ -508,7 +508,7 @@ QWidget* ShortcutItemDelegate::createEditor(QWidget* aParent, const QStyleOption { _itemsBeingEdited.insert(index); - KKeySequenceWidget* editor = new KKeySequenceWidget(aParent); + auto editor = new KKeySequenceWidget(aParent); editor->setFocusPolicy(Qt::StrongFocus); editor->setModifierlessAllowed(false); QString shortcutString = index.data(Qt::DisplayRole).toString(); diff --git a/src/tests/PartManualTest.cpp b/src/tests/PartManualTest.cpp index 450a7a78a469c159fafb764ad1a821f2457d1420..cd0948ff036bd61a056e3f2867152ed4e6138c19 100644 --- a/src/tests/PartManualTest.cpp +++ b/src/tests/PartManualTest.cpp @@ -58,7 +58,7 @@ void PartManualTest::testShortcutOverride() // Create a main window with a menu and a test // action with a shortcut set to Ctrl+S, which is also used by the terminal - KMainWindow* mainWindow = new KMainWindow(); + auto mainWindow = new KMainWindow(); QMenu* fileMenu = mainWindow->menuBar()->addMenu("File"); QAction* testAction = fileMenu->addAction("Test"); testAction->setShortcut(QKeySequence(Konsole::ACCEL + Qt::Key_S));