automatic clang-format run (clang 14)

This commit is contained in:
Harald Sitter
2022-07-11 11:43:02 +02:00
parent f4b8369637
commit 87e27eb811
25 changed files with 64 additions and 68 deletions

View File

@@ -55,7 +55,9 @@ void Application::populateCommandLineParser(QCommandLineParser *parser)
{{QStringLiteral("workdir")}, i18nc("@info:shell", "Set the initial working directory of the new tab or window to 'dir'"), QStringLiteral("dir")},
{{QStringLiteral("hold"), QStringLiteral("noclose")}, i18nc("@info:shell", "Do not close the initial session automatically when it ends.")},
// BR: 373440
{{QStringLiteral("new-tab")}, i18nc("@info:shell", "Create a new tab in an existing window rather than creating a new window ('Run all Konsole windows in a single process' must be enabled)")},
{{QStringLiteral("new-tab")},
i18nc("@info:shell",
"Create a new tab in an existing window rather than creating a new window ('Run all Konsole windows in a single process' must be enabled)")},
{{QStringLiteral("tabs-from-file")}, i18nc("@info:shell", "Create tabs as specified in given tabs configuration file"), QStringLiteral("file")},
{{QStringLiteral("background-mode")},
i18nc("@info:shell", "Start Konsole in the background and bring to the front when Ctrl+Shift+F12 (by default) is pressed")},
@@ -72,7 +74,8 @@ void Application::populateCommandLineParser(QCommandLineParser *parser)
{{QStringLiteral("e")},
i18nc("@info:shell", "Command to execute. This option will catch all following arguments, so use it as the last option."),
QStringLiteral("cmd")},
{{QStringLiteral("force-reuse")}, i18nc("@info:shell", "Force re-using the existing instance even if it breaks functionality, e. g. --new-tab. Mostly for debugging.")},
{{QStringLiteral("force-reuse")},
i18nc("@info:shell", "Force re-using the existing instance even if it breaks functionality, e. g. --new-tab. Mostly for debugging.")},
};
for (const auto &option : options) {

View File

@@ -11,11 +11,11 @@
#include <QCommandLineParser>
// Konsole
#include "widgets/ViewSplitter.h"
#include "terminalDisplay/TerminalDisplay.h"
#include "konsole_export.h"
#include "pluginsystem/PluginManager.h"
#include "profile/Profile.h"
#include "konsole_export.h"
#include "terminalDisplay/TerminalDisplay.h"
#include "widgets/ViewSplitter.h"
namespace Konsole
{

View File

@@ -10,8 +10,8 @@
// Own
#include "NullProcessInfo.h"
#include "ProcessInfo.h"
#include "UnixProcessInfo.h"
#include "SSHProcessInfo.h"
#include "UnixProcessInfo.h"
// Unix
#include <arpa/inet.h>

View File

@@ -825,7 +825,6 @@ void Screen::reset(bool softReset, bool preservePrompt)
resetMode(MODE_NewLine);
initTabStops();
}
_currentModes[MODE_Origin] = 0;

View File

@@ -1042,7 +1042,7 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u
// the <id-part>. Often it is empty, but GNU libtextstyle
// may output an id here, see e.g.
// https://www.gnu.org/software/gettext/libtextstyle/manual/libtextstyle.html#index-styled_005fostream_005fset_005fhyperlink
value.remove(0, value.indexOf(QLatin1Char(';'))+1);
value.remove(0, value.indexOf(QLatin1Char(';')) + 1);
_currentScreen->urlExtractor()->setUrl(value);
return;
}
@@ -1760,11 +1760,7 @@ void Vt102Emulation::processGraphicsToken(int tokenSize)
return;
}
QImage::Format format = keys['f'] == 24 ? QImage::Format_RGB888 : QImage::Format_RGBA8888;
pixmap = QPixmap::fromImage(QImage((const uchar*)out.constData(),
0 + keys['s'],
0 + keys['v'],
0 + keys['s'] * keys['f'] / 8,
format));
pixmap = QPixmap::fromImage(QImage((const uchar *)out.constData(), 0 + keys['s'], 0 + keys['v'], 0 + keys['s'] * keys['f'] / 8, format));
pixmap.detach();
} else {
pixmap.loadFromData(out);

View File

@@ -22,13 +22,13 @@ void HotSpotFilterTest::testUrlFilterRegex_data()
QTest::newRow("url_with_port") << "\nhttps://api.kde.org:2098"
<< "https://api.kde.org:2098" << true;
QTest::newRow("url_with_port_trailing_slash") << "\nhttps://api.kde.org:2098/"
<< "https://api.kde.org:2098/" << true;
<< "https://api.kde.org:2098/" << true;
QTest::newRow("url_with_numeric_host") << "\nhttp://127.0.0.1"
<< "http://127.0.0.1" << true;
<< "http://127.0.0.1" << true;
QTest::newRow("url_with_numeric_host_port") << "\nhttp://127.0.0.1:4000"
<< "http://127.0.0.1:4000" << true;
<< "http://127.0.0.1:4000" << true;
QTest::newRow("url_with_numeric_host_port_slash") << "\nhttp://127.0.0.1:4000/"
<< "http://127.0.0.1:4000/" << true;
<< "http://127.0.0.1:4000/" << true;
QTest::newRow("url_with_path") << "https://api.kde.org/path/to/somewhere"
<< "https://api.kde.org/path/to/somewhere" << true;
QTest::newRow("url_with_query") << "https://user:pass@api.kde.org?somequery=foo"

View File

@@ -111,7 +111,6 @@ void KeyboardTranslatorTest::testFallback()
QCOMPARE(QStringLiteral("\\t"), entry.resultToString());
QVERIFY(entry.matches(Qt::Key_Tab, Qt::NoModifier, KeyboardTranslator::NoState));
QVERIFY(entry == fallback->findEntry(Qt::Key_Tab, Qt::NoModifier));
}
void KeyboardTranslatorTest::testHexKeys()
@@ -181,7 +180,6 @@ void KeyboardTranslatorTest::testHexKeys()
QVERIFY(entry == translator->findEntry(Qt::Key_Space, Qt::NoModifier));
QVERIFY(!entry.matches(Qt::Key_Backspace, Qt::NoModifier, KeyboardTranslator::NoState));
QVERIFY(!(entry == translator->findEntry(Qt::Key_Backspace, Qt::NoModifier)));
}
QTEST_GUILESS_MAIN(KeyboardTranslatorTest)

View File

@@ -186,7 +186,7 @@ public:
*/
friend constexpr bool operator==(const CharacterColor a, const CharacterColor b)
{
return std::tie(a._colorSpace, a._u, a._v, a._w) == std::tie(b._colorSpace, b._u, b._v, b._w);
return std::tie(a._colorSpace, a._u, a._v, a._w) == std::tie(b._colorSpace, b._u, b._v, b._w);
}
/**
* Compares two colors and returns true if they represent different color values

View File

@@ -12,8 +12,8 @@
#include "hsluv.h"
// Qt
#include <QPainter>
#include <QMetaEnum>
#include <QPainter>
// KDE
#include <KConfig>
@@ -26,7 +26,7 @@
// Konsole
#include "colorschemedebug.h"
//define DEBUG_LOADING_TIME
// define DEBUG_LOADING_TIME
#ifdef DEBUG_LOADING_TIME
#include <QElapsedTimer>
#endif
@@ -455,7 +455,8 @@ bool ColorScheme::blur() const
void ColorScheme::read(const KConfig &config)
{
#ifdef DEBUG_LOADING_TIME
QElapsedTimer t; t.start();
QElapsedTimer t;
t.start();
#endif
KConfigGroup configGroup = config.group("General");
@@ -529,9 +530,7 @@ void ColorScheme::write(KConfig &config) const
configGroup.writeEntry("Opacity", _opacity);
configGroup.writeEntry("Blur", _blur);
configGroup.writeEntry("Wallpaper", _wallpaper->path());
configGroup.writeEntry("FillStyle",
QMetaEnum::fromType<ColorSchemeWallpaper::FillStyle>()
.valueToKey(_wallpaper->style()));
configGroup.writeEntry("FillStyle", QMetaEnum::fromType<ColorSchemeWallpaper::FillStyle>().valueToKey(_wallpaper->style()));
configGroup.writeEntry("Anchor", _wallpaper->anchor());
configGroup.writeEntry("WallpaperOpacity", _wallpaper->opacity());
configGroup.writeEntry(EnableColorRandomizationKey, _colorRandomization);
@@ -589,11 +588,9 @@ void ColorScheme::setWallpaper(const QString &path, const ColorSchemeWallpaper::
void ColorScheme::setWallpaper(const QString &path, const QString &style, const QPointF &anchor, const qreal &opacity)
{
ColorSchemeWallpaper::FillStyle fstyle;
fstyle = static_cast<ColorSchemeWallpaper::FillStyle>
(std::max( //keyToValue returns -1 if key was not found, but we should default to 0
QMetaEnum::fromType<ColorSchemeWallpaper::FillStyle>()
.keyToValue(style.toStdString().c_str())
, 0));
fstyle = static_cast<ColorSchemeWallpaper::FillStyle>(std::max( // keyToValue returns -1 if key was not found, but we should default to 0
QMetaEnum::fromType<ColorSchemeWallpaper::FillStyle>().keyToValue(style.toStdString().c_str()),
0));
setWallpaper(path, fstyle, anchor, opacity);
}

View File

@@ -95,7 +95,7 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget *parent)
connect(_ui->wallpaperSelectButton, &QToolButton::clicked, this, &Konsole::ColorSchemeEditor::selectWallpaper);
connect(_ui->wallpaperPath, &QLineEdit::textChanged, this, &Konsole::ColorSchemeEditor::wallpaperPathChanged);
connect(_ui->wallpaperScalingType, (void(QComboBox::*)(int))&QComboBox::currentIndexChanged, this, &Konsole::ColorSchemeEditor::scalingTypeChanged);
connect(_ui->wallpaperScalingType, (void(QComboBox::*)(int)) & QComboBox::currentIndexChanged, this, &Konsole::ColorSchemeEditor::scalingTypeChanged);
connect(_ui->wallpaperHorizontalAnchorSlider, &QSlider::valueChanged, this, &Konsole::ColorSchemeEditor::horizontalAnchorChanged);
connect(_ui->wallpaperVerticalAnchorSlider, &QSlider::valueChanged, this, &Konsole::ColorSchemeEditor::verticalAnchorChanged);
@@ -216,7 +216,7 @@ void ColorSchemeEditor::wallpaperPathChanged(const QString &path)
void ColorSchemeEditor::scalingTypeChanged(int styleIndex)
{
const char *style = QMetaEnum::fromType<ColorSchemeWallpaper::FillStyle>().valueToKey(styleIndex);
const char *style = QMetaEnum::fromType<ColorSchemeWallpaper::FillStyle>().valueToKey(styleIndex);
_colors->setWallpaper(_colors->wallpaper()->path(), QString::fromLatin1(style), _colors->wallpaper()->anchor(), _colors->wallpaper()->opacity());
}

View File

@@ -25,8 +25,8 @@ ColorSchemeWallpaper::ColorSchemeWallpaper(const QString &path, const ColorSchem
, _opacity(opacity)
{
float x = _anchor.x(), y = _anchor.y();
if(x < 0 || x > 1.0f || y < 0 || y > 1.0f)
if (x < 0 || x > 1.0f || y < 0 || y > 1.0f)
_anchor = QPointF(0.5, 0.5);
}

View File

@@ -13,8 +13,8 @@
// Qt
#include <QMetaType>
#include <QSharedData>
#include <QPointF>
#include <QSharedData>
// Konsole
#include "../characters/CharacterColor.h"
@@ -31,13 +31,12 @@ namespace Konsole
class ColorSchemeWallpaper : public QSharedData
{
public:
enum FillStyle
{
enum FillStyle {
Tile = 0,
Stretch,
Crop,
Adapt,
NoScaling
NoScaling,
};
Q_ENUM(FillStyle)

View File

@@ -33,7 +33,10 @@ public:
LineProperty getLineProperty(const int lineno) const override;
void addCells(const Character text[], const int count) override;
void addCellsMove(Character text[], const int count) override { addCells(text, count); } // TODO: optimize, if there's any point
void addCellsMove(Character text[], const int count) override
{
addCells(text, count);
} // TODO: optimize, if there's any point
void addLine(LineProperty lineProperty = 0) override;
// Modify history

View File

@@ -58,7 +58,6 @@ void CompactHistoryScroll::addCellsMove(Character characters[], const int count)
}
}
void CompactHistoryScroll::addLine(const LineProperty lineProperty)
{
auto &flag = _lineDatas.back().flag;

View File

@@ -49,7 +49,7 @@ SSHManagerModel::SSHManagerModel(QObject *parent)
if (invisibleRootItem()->rowCount() == 0) {
addTopLevelItem(i18n("Default"));
}
if (QFileInfo::exists(sshDir + QStringLiteral("config"))){
if (QFileInfo::exists(sshDir + QStringLiteral("config"))) {
m_sshConfigWatcher.addPath(sshDir + QStringLiteral("config"));
connect(&m_sshConfigWatcher, &QFileSystemWatcher::fileChanged, this, [this] {
startImportFromSshConfig();

View File

@@ -148,7 +148,7 @@ void SSHManagerTreeWidget::addSshInfo()
void SSHManagerTreeWidget::saveEdit()
{
// SSHConfigurationData data; (not used?)
// SSHConfigurationData data; (not used?)
auto [error, errorString] = checkFields();
if (error) {
ui->errorPanel->setText(errorString);
@@ -179,7 +179,7 @@ SSHConfigurationData SSHManagerTreeWidget::info() const
data.username = ui->username->text().trimmed();
data.useSshConfig = ui->useSshConfig->checkState() == Qt::Checked;
// if ui->username is enabled then we were not imported!
data.importedFromSshConfig=!ui->username->isEnabled();
data.importedFromSshConfig = !ui->username->isEnabled();
return data;
}
@@ -354,8 +354,8 @@ std::pair<bool, QString> SSHManagerTreeWidget::checkFields() const
}
if (ui->useSshConfig->checkState() == Qt::Checked) {
// If ui->username is not enabled then this was an autopopulated entry and we should not complain
if (ui->username->isEnabled() && (ui->sshkey->text().count() || ui->username->text().count())) {
// If ui->username is not enabled then this was an autopopulated entry and we should not complain
if (ui->username->isEnabled() && (ui->sshkey->text().count() || ui->username->text().count())) {
error = true;
errorString += li + i18n("If Use Ssh Config is set, do not specify sshkey or username.") + il;
}

View File

@@ -752,12 +752,10 @@ void Session::refresh()
const QSize existingSize = _shellProcess->windowSize();
const QSize existingPxSize = _shellProcess->pixelSize();
_shellProcess->setWindowSize(existingSize.width() + 1, existingSize.height(),
existingPxSize.width() + 1, existingPxSize.height());
_shellProcess->setWindowSize(existingSize.width() + 1, existingSize.height(), existingPxSize.width() + 1, existingPxSize.height());
// introduce small delay to avoid changing size too quickly
QThread::usleep(500);
_shellProcess->setWindowSize(existingSize.width(), existingSize.height(),
existingPxSize.width(), existingPxSize.height());
_shellProcess->setWindowSize(existingSize.width(), existingSize.height(), existingPxSize.width(), existingPxSize.height());
}
void Session::sendSignal(int signal)

View File

@@ -618,7 +618,10 @@ void SessionController::setupSearchBar()
connect(_searchBar, &Konsole::IncrementalSearchBar::searchFromClicked, this, &Konsole::SessionController::searchFrom);
connect(_searchBar, &Konsole::IncrementalSearchBar::findNextClicked, this, &Konsole::SessionController::findNextInHistory);
connect(_searchBar, &Konsole::IncrementalSearchBar::findPreviousClicked, this, &Konsole::SessionController::findPreviousInHistory);
connect(_searchBar, &Konsole::IncrementalSearchBar::reverseSearchToggled, this, &Konsole::SessionController::updateMenuIconsAccordingToReverseSearchSetting);
connect(_searchBar,
&Konsole::IncrementalSearchBar::reverseSearchToggled,
this,
&Konsole::SessionController::updateMenuIconsAccordingToReverseSearchSetting);
connect(_searchBar, &Konsole::IncrementalSearchBar::highlightMatchesToggled, this, &Konsole::SessionController::highlightMatches);
connect(_searchBar, &Konsole::IncrementalSearchBar::matchCaseToggled, this, &Konsole::SessionController::changeSearchMatch);
connect(_searchBar, &Konsole::IncrementalSearchBar::matchRegExpToggled, this, &Konsole::SessionController::changeSearchMatch);
@@ -1899,7 +1902,7 @@ void SessionController::showDisplayContextMenu(const QPoint &position)
#endif
auto newActions = popup->actions();
for (auto* elm : old) {
for (auto *elm : old) {
newActions.removeAll(elm);
}
// Finish Ading the "Open Folder With" action.

View File

@@ -281,7 +281,10 @@ void SessionManager::applyProfile(Session *session, const Profile::Ptr &profile,
view->screenWindow()->screen()->setEnableUrlExtractor(shouldEnableUrlExtractor);
if (shouldEnableUrlExtractor) {
view->screenWindow()->screen()->urlExtractor()->setAllowedLinkSchema(profile->escapedLinksSchema());
connect(session->emulation(), &Emulation::toggleUrlExtractionRequest, view->screenWindow()->screen()->urlExtractor(), &EscapeSequenceUrlExtractor::toggleUrlInput);
connect(session->emulation(),
&Emulation::toggleUrlExtractionRequest,
view->screenWindow()->screen()->urlExtractor(),
&EscapeSequenceUrlExtractor::toggleUrlInput);
}
}
}

View File

@@ -688,10 +688,9 @@ void TerminalDisplay::paintEvent(QPaintEvent *pe)
if (screenWindow()->currentResultLine() != -1) {
_searchResultRect.setRect(0,
contentRect().top() + (screenWindow()->currentResultLine() - screenWindow()->currentLine()) * _terminalFont->fontHeight(),
columns() * terminalFont()->fontWidth(),
_terminalFont->fontHeight()
);
contentRect().top() + (screenWindow()->currentResultLine() - screenWindow()->currentLine()) * _terminalFont->fontHeight(),
columns() * terminalFont()->fontWidth(),
_terminalFont->fontHeight());
_terminalPainter->drawCurrentResultRect(paint, _searchResultRect);
}
@@ -1812,7 +1811,7 @@ QPoint TerminalDisplay::findWordEnd(const QPoint &pnt)
col = maxX;
line--;
}
return { qBound(0, col, maxX), qBound(0, line, maxY) };
return {qBound(0, col, maxX), qBound(0, line, maxY)};
}
const int regSize = qMax(_screenWindow->windowLines(), 10);
@@ -2893,5 +2892,3 @@ int TerminalDisplay::selectionState() const
{
return _actSel;
}

View File

@@ -20,8 +20,8 @@
// KDE
#include <KMainWindow>
#include <KPluginFactory>
#include <qtest.h>
#include <kservice_version.h>
#include <qtest.h>
#if KSERVICE_VERSION < QT_VERSION_CHECK(5, 86, 0)
#include <KPluginLoader>

View File

@@ -15,8 +15,8 @@
#include <KWindowEffects>
#include <KWindowSystem>
#include <kwindowsystem_version.h>
#include <kservice_version.h>
#include <kwindowsystem_version.h>
#if KSERVICE_VERSION < QT_VERSION_CHECK(5, 86, 0)
#include <KPluginLoader>

View File

@@ -705,9 +705,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
connect(_appearanceUi->useFontLineCharactersButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::useFontLineCharacters);
_mouseUi->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled());
connect(_mouseUi->enableMouseWheelZoomButton, &QCheckBox::toggled, this,
&Konsole::EditProfileDialog::toggleMouseWheelZoom);
connect(_mouseUi->enableMouseWheelZoomButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::toggleMouseWheelZoom);
// cursor options
_appearanceUi->enableBlinkingCursorButton->setChecked(profile->property<bool>(Profile::BlinkingCursorEnabled));

View File

@@ -542,7 +542,7 @@ void Konsole::ViewSplitterHandle::mouseMoveEvent(QMouseEvent *ev)
void Konsole::ViewSplitterHandle::mouseDoubleClickEvent(QMouseEvent *ev)
{
auto parentSplitter = qobject_cast<ViewSplitter*>(parentWidget());
auto parentSplitter = qobject_cast<ViewSplitter *>(parentWidget());
if (parentSplitter->count() > 1) {
for (int i = 1; i < parentSplitter->count(); i++) {
@@ -550,9 +550,11 @@ void Konsole::ViewSplitterHandle::mouseDoubleClickEvent(QMouseEvent *ev)
continue;
}
if (orientation() == Qt::Horizontal) {
moveSplitter(parentSplitter->widget(i - 1)->pos().x() + ((parentSplitter->widget(i)->pos().x() + parentSplitter->widget(i)->width() - (parentSplitter->widget(i - 1)->pos().x())) / 2));
moveSplitter(parentSplitter->widget(i - 1)->pos().x()
+ ((parentSplitter->widget(i)->pos().x() + parentSplitter->widget(i)->width() - (parentSplitter->widget(i - 1)->pos().x())) / 2));
} else {
moveSplitter(parentSplitter->widget(i - 1)->pos().y() + ((parentSplitter->widget(i)->pos().y() + parentSplitter->widget(i)->height() - (parentSplitter->widget(i - 1)->pos().y())) / 2));
moveSplitter(parentSplitter->widget(i - 1)->pos().y()
+ ((parentSplitter->widget(i)->pos().y() + parentSplitter->widget(i)->height() - (parentSplitter->widget(i - 1)->pos().y())) / 2));
}
break;
}

View File

@@ -34,6 +34,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *ev) override;
void mouseMoveEvent(QMouseEvent *ev) override;
void mouseDoubleClickEvent(QMouseEvent *ev) override;
private:
/* For some reason, the first time we double-click on the splitter handle
* the second mouse press event is not fired, nor is the double click event.