summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2017-06-19 09:48:21 -0400
committerKurt Hindenburg <[email protected]>2017-06-19 09:48:21 -0400
commit78a81b8e5b76fed2b934fddf2a53f1b65494d5ec (patch)
tree4d3e939727745ec520e96c08ff5c8a064e9868ea
parent0ede8bde1f61501b495c88a5fee9f6884e92ad4a (diff)
uncrustify using kf5 config
-rw-r--r--src/Application.cpp24
-rw-r--r--src/Emulation.cpp92
-rw-r--r--src/ExtendedCharTable.cpp39
3 files changed, 91 insertions, 64 deletions
diff --git a/src/Application.cpp b/src/Application.cpp
index d991ceb..b47cb9e 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -45,10 +45,10 @@
using namespace Konsole;
Application::Application(QSharedPointer<QCommandLineParser> parser,
- const QStringList &customCommand)
- : _backgroundInstance(0)
- , m_parser(parser)
- , m_customCommand(customCommand)
+ const QStringList &customCommand) :
+ _backgroundInstance(0),
+ m_parser(parser),
+ m_customCommand(customCommand)
{
}
@@ -87,17 +87,21 @@ void Application::populateCommandLineParser(QCommandLineParser *parser)
// --nofork is a compatibility alias for separate
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("separate")
<< QStringLiteral("nofork"),
- i18nc("@info:shell", "Run in a separate process")));
+ i18nc("@info:shell", "Run in a separate process")));
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("show-menubar"),
- i18nc("@info:shell", "Show the menubar, overriding the default setting")));
+ i18nc("@info:shell",
+ "Show the menubar, overriding the default setting")));
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("hide-menubar"),
- i18nc("@info:shell", "Hide the menubar, overriding the default setting")));
+ i18nc("@info:shell",
+ "Hide the menubar, overriding the default setting")));
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("show-tabbar"),
- i18nc("@info:shell", "Show the tabbar, overriding the default setting")));
+ i18nc("@info:shell",
+ "Show the tabbar, overriding the default setting")));
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("hide-tabbar"),
- i18nc("@info:shell", "Hide the tabbar, overriding the default setting")));
+ i18nc("@info:shell",
+ "Hide the tabbar, overriding the default setting")));
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("fullscreen"),
- i18nc("@info:shell", "Start Konsole in fullscreen mode")));
+ i18nc("@info:shell", "Start Konsole in fullscreen mode")));
parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("notransparency"),
i18nc("@info:shell",
"Disable transparent backgrounds, even if the system"
diff --git a/src/Emulation.cpp b/src/Emulation.cpp
index 4c71a95..321cd7f 100644
--- a/src/Emulation.cpp
+++ b/src/Emulation.cpp
@@ -51,8 +51,10 @@ Emulation::Emulation() :
QObject::connect(&_bulkTimer2, &QTimer::timeout, this, &Konsole::Emulation::showBulk);
// listen for mouse status changes
- connect(this , &Konsole::Emulation::programUsesMouseChanged , this, &Konsole::Emulation::usesMouseChanged);
- connect(this , &Konsole::Emulation::programBracketedPasteModeChanged , this, &Konsole::Emulation::bracketedPasteModeChanged);
+ connect(this, &Konsole::Emulation::programUsesMouseChanged, this,
+ &Konsole::Emulation::usesMouseChanged);
+ connect(this, &Konsole::Emulation::programBracketedPasteModeChanged, this,
+ &Konsole::Emulation::bracketedPasteModeChanged);
}
bool Emulation::programUsesMouse() const
@@ -75,15 +77,18 @@ void Emulation::bracketedPasteModeChanged(bool bracketedPasteMode)
_bracketedPasteMode = bracketedPasteMode;
}
-ScreenWindow* Emulation::createWindow()
+ScreenWindow *Emulation::createWindow()
{
auto window = new ScreenWindow(_currentScreen);
_windows << window;
- connect(window , &Konsole::ScreenWindow::selectionChanged, this , &Konsole::Emulation::bufferedUpdate);
- connect(window, &Konsole::ScreenWindow::selectionChanged, this, &Konsole::Emulation::checkSelectedText);
+ connect(window, &Konsole::ScreenWindow::selectionChanged, this,
+ &Konsole::Emulation::bufferedUpdate);
+ connect(window, &Konsole::ScreenWindow::selectionChanged, this,
+ &Konsole::Emulation::checkSelectedText);
- connect(this , &Konsole::Emulation::outputChanged, window , &Konsole::ScreenWindow::notifyOutputChanged);
+ connect(this, &Konsole::Emulation::outputChanged, window,
+ &Konsole::ScreenWindow::notifyOutputChanged);
return window;
}
@@ -101,7 +106,7 @@ void Emulation::checkSelectedText()
Emulation::~Emulation()
{
- foreach(ScreenWindow* window, _windows) {
+ foreach (ScreenWindow *window, _windows) {
delete window;
}
@@ -112,11 +117,11 @@ Emulation::~Emulation()
void Emulation::setScreen(int index)
{
- Screen* oldScreen = _currentScreen;
+ Screen *oldScreen = _currentScreen;
_currentScreen = _screen[index & 1];
if (_currentScreen != oldScreen) {
// tell all windows onto this emulation to switch to the newly active screen
- foreach(ScreenWindow * window, _windows) {
+ foreach (ScreenWindow *window, _windows) {
window->setScreen(_currentScreen);
}
@@ -127,21 +132,22 @@ void Emulation::setScreen(int index)
void Emulation::clearHistory()
{
- _screen[0]->setScroll(_screen[0]->getScroll() , false);
+ _screen[0]->setScroll(_screen[0]->getScroll(), false);
}
-void Emulation::setHistory(const HistoryType& history)
+
+void Emulation::setHistory(const HistoryType &history)
{
_screen[0]->setScroll(history);
showBulk();
}
-const HistoryType& Emulation::history() const
+const HistoryType &Emulation::history() const
{
return _screen[0]->getScroll();
}
-void Emulation::setCodec(const QTextCodec * codec)
+void Emulation::setCodec(const QTextCodec *codec)
{
if (codec != nullptr) {
_codec = codec;
@@ -157,13 +163,14 @@ void Emulation::setCodec(const QTextCodec * codec)
void Emulation::setCodec(EmulationCodec codec)
{
- if (codec == Utf8Codec)
+ if (codec == Utf8Codec) {
setCodec(QTextCodec::codecForName("utf8"));
- else if (codec == LocaleCodec)
+ } else if (codec == LocaleCodec) {
setCodec(QTextCodec::codecForLocale());
+ }
}
-void Emulation::setKeyBindings(const QString& name)
+void Emulation::setKeyBindings(const QString &name)
{
_keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name);
if (_keyTranslator == nullptr) {
@@ -182,16 +189,28 @@ void Emulation::receiveChar(int c)
{
c &= 0xff;
switch (c) {
- case '\b' : _currentScreen->backspace(); break;
- case '\t' : _currentScreen->tab(); break;
- case '\n' : _currentScreen->newLine(); break;
- case '\r' : _currentScreen->toStartOfLine(); break;
- case 0x07 : emit stateSet(NOTIFYBELL); break;
- default : _currentScreen->displayCharacter(static_cast<unsigned short int>(c)); break;
+ case '\b':
+ _currentScreen->backspace();
+ break;
+ case '\t':
+ _currentScreen->tab();
+ break;
+ case '\n':
+ _currentScreen->newLine();
+ break;
+ case '\r':
+ _currentScreen->toStartOfLine();
+ break;
+ case 0x07:
+ emit stateSet(NOTIFYBELL);
+ break;
+ default:
+ _currentScreen->displayCharacter(static_cast<unsigned short int>(c));
+ break;
}
}
-void Emulation::sendKeyEvent(QKeyEvent* ev)
+void Emulation::sendKeyEvent(QKeyEvent *ev)
{
emit stateSet(NOTIFYNORMAL);
@@ -212,7 +231,7 @@ void Emulation::sendMouseEvent(int /*buttons*/, int /*column*/, int /*row*/, int
We are doing code conversion from locale to unicode first.
*/
-void Emulation::receiveData(const char* text, int length)
+void Emulation::receiveData(const char *text, int length)
{
emit stateSet(NOTIFYACTIVITY);
@@ -221,16 +240,18 @@ void Emulation::receiveData(const char* text, int length)
QString unicodeText = _decoder->toUnicode(text, length);
//send characters to terminal emulator
- for (auto && i : unicodeText)
+ for (auto &&i : unicodeText) {
receiveChar(i.unicode());
+ }
//look for z-modem indicator
//-- someone who understands more about z-modems that I do may be able to move
//this check into the above for loop?
for (int i = 0; i < length; i++) {
if (text[i] == '\030') {
- if ((length - i - 1 > 3) && (qstrncmp(text + i + 1, "B00", 3) == 0))
+ if ((length - i - 1 > 3) && (qstrncmp(text + i + 1, "B00", 3) == 0)) {
emit zmodemDetected();
+ }
}
}
}
@@ -283,9 +304,7 @@ void Emulation::receiveData(const char* text, int length)
}
}*/
-void Emulation::writeToStream(TerminalCharacterDecoder* decoder ,
- int startLine ,
- int endLine)
+void Emulation::writeToStream(TerminalCharacterDecoder *decoder, int startLine, int endLine)
{
_currentScreen->writeLinesToStream(decoder, startLine, endLine);
}
@@ -327,14 +346,16 @@ char Emulation::eraseChar() const
void Emulation::setImageSize(int lines, int columns)
{
- if ((lines < 1) || (columns < 1))
+ if ((lines < 1) || (columns < 1)) {
return;
+ }
- QSize screenSize[2] = { QSize(_screen[0]->getColumns(),
- _screen[0]->getLines()),
- QSize(_screen[1]->getColumns(),
- _screen[1]->getLines())
- };
+ QSize screenSize[2] = {
+ QSize(_screen[0]->getColumns(),
+ _screen[0]->getLines()),
+ QSize(_screen[1]->getColumns(),
+ _screen[1]->getLines())
+ };
QSize newSize(columns, lines);
if (newSize == screenSize[0] && newSize == screenSize[1]) {
@@ -364,4 +385,3 @@ QSize Emulation::imageSize() const
{
return QSize(_currentScreen->getColumns(), _currentScreen->getLines());
}
-
diff --git a/src/ExtendedCharTable.cpp b/src/ExtendedCharTable.cpp
index 44b037f..f099ed4 100644
--- a/src/ExtendedCharTable.cpp
+++ b/src/ExtendedCharTable.cpp
@@ -39,7 +39,7 @@ ExtendedCharTable::ExtendedCharTable()
ExtendedCharTable::~ExtendedCharTable()
{
// free all allocated character buffers
- QHashIterator<ushort, ushort*> iter(extendedCharTable);
+ QHashIterator<ushort, ushort *> iter(extendedCharTable);
while (iter.hasNext()) {
iter.next();
delete[] iter.value();
@@ -49,7 +49,7 @@ ExtendedCharTable::~ExtendedCharTable()
// global instance
ExtendedCharTable ExtendedCharTable::instance;
-ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushort length)
+ushort ExtendedCharTable::createExtendedChar(const ushort *unicodePoints, ushort length)
{
// look for this sequence of points in the table
ushort hash = extendedCharHash(unicodePoints, length);
@@ -73,15 +73,15 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor
// All the hashes are full, go to all Screens and try to free any
// This is slow but should happen very rarely
QSet<ushort> usedExtendedChars;
- const SessionManager* sm = SessionManager::instance();
- foreach(const Session * s, sm->sessions()) {
- foreach(const TerminalDisplay * td, s->views()) {
+ const SessionManager *sm = SessionManager::instance();
+ foreach (const Session *s, sm->sessions()) {
+ foreach (const TerminalDisplay *td, s->views()) {
usedExtendedChars += td->screenWindow()->screen()->usedExtendedChars();
}
}
- QHash<ushort, ushort*>::iterator it = extendedCharTable.begin();
- QHash<ushort, ushort*>::iterator itEnd = extendedCharTable.end();
+ QHash<ushort, ushort *>::iterator it = extendedCharTable.begin();
+ QHash<ushort, ushort *>::iterator itEnd = extendedCharTable.end();
while (it != itEnd) {
if (usedExtendedChars.contains(it.key())) {
++it;
@@ -101,20 +101,21 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor
// return that index
auto buffer = new ushort[length + 1];
buffer[0] = length;
- for (int i = 0 ; i < length ; i++)
+ for (int i = 0; i < length; i++) {
buffer[i + 1] = unicodePoints[i];
+ }
extendedCharTable.insert(hash, buffer);
return hash;
}
-ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) const
+ushort *ExtendedCharTable::lookupExtendedChar(ushort hash, ushort &length) const
{
// look up index in table and if found, set the length
// argument and return a pointer to the character sequence
- ushort* buffer = extendedCharTable[hash];
+ ushort *buffer = extendedCharTable[hash];
if (buffer != nullptr) {
length = buffer[0];
return buffer + 1;
@@ -124,29 +125,31 @@ ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) cons
}
}
-ushort ExtendedCharTable::extendedCharHash(const ushort* unicodePoints , ushort length) const
+ushort ExtendedCharTable::extendedCharHash(const ushort *unicodePoints, ushort length) const
{
ushort hash = 0;
- for (ushort i = 0 ; i < length ; i++) {
+ for (ushort i = 0; i < length; i++) {
hash = 31 * hash + unicodePoints[i];
}
return hash;
}
-bool ExtendedCharTable::extendedCharMatch(ushort hash , const ushort* unicodePoints , ushort length) const
+bool ExtendedCharTable::extendedCharMatch(ushort hash, const ushort *unicodePoints,
+ ushort length) const
{
- ushort* entry = extendedCharTable[hash];
+ ushort *entry = extendedCharTable[hash];
// compare given length with stored sequence length ( given as the first ushort in the
// stored buffer )
- if (entry == 0 || entry[0] != length)
+ if (entry == 0 || entry[0] != length) {
return false;
+ }
// if the lengths match, each character must be checked. the stored buffer starts at
// entry[1]
- for (int i = 0 ; i < length ; i++) {
- if (entry[i + 1] != unicodePoints[i])
+ for (int i = 0; i < length; i++) {
+ if (entry[i + 1] != unicodePoints[i]) {
return false;
+ }
}
return true;
}
-