Commit 87e27eb8 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

automatic clang-format run (clang 14)

parent f4b83696
......@@ -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) {
......
......@@ -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
{
......
......@@ -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>
......
......@@ -825,7 +825,6 @@ void Screen::reset(bool softReset, bool preservePrompt)
resetMode(MODE_NewLine);
initTabStops();
}
_currentModes[MODE_Origin] = 0;
......
......@@ -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);
......
......@@ -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"
......
......@@ -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)
......@@ -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
......
......@@ -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);
}
......
......@@ -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());
}
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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
......
......@@ -58,7 +58,6 @@ void CompactHistoryScroll::addCellsMove(Character characters[], const int count)
}
}
void CompactHistoryScroll::addLine(const LineProperty lineProperty)
{
auto &flag = _lineDatas.back().flag;
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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.
......
......@@ -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);
}
}
}
......
......@@ -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;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment