# HG changeset patch # User Jacob Dawid # Date 1327325642 -3600 # Node ID 3524352c7382ca0c7b8a292834ce1da322e70db5 # Parent 36110925f67b75e4359ce58e4ae1e232a39b745f Changed color scheme. diff --git a/libqterminal/CharacterColor.h b/libqterminal/CharacterColor.h --- a/libqterminal/CharacterColor.h +++ b/libqterminal/CharacterColor.h @@ -103,23 +103,19 @@ //defined in TerminalDisplay.cpp static const ColorEntry base_color_table[TABLE_COLORS] = -// The following are almost IBM standard color codes, with some slight -// gamma correction for the dim colors to compensate for bright X screens. -// It contains the 8 ansiterm/xterm colors in 2 intensities. { - // Fixme: could add faint colors here, also. - // normal - ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback - ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red - ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow - ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta - ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White - // intensiv - ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), - ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), - ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), - ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0xFF), 0, 0 ), - ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) + // normal + ColorEntry(QColor(0xFF,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0x00,0x00,0x00), 1, 0 ), // Dfore, Dback + ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red + ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow + ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta + ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White + // intensiv + ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), + ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), + ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), + ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0xFF), 0, 0 ), + ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) }; /* CharacterColor is a union of the various color spaces. diff --git a/libqterminal/DefaultTranslatorText.h b/libqterminal/DefaultTranslatorText.h deleted file mode 100644 --- a/libqterminal/DefaultTranslatorText.h +++ /dev/null @@ -1,2 +0,0 @@ -"keyboard \"Fallback Key Translator\"\n" -"key Tab : \"\\t\" \0" diff --git a/libqterminal/KeyboardTranslator.cpp b/libqterminal/KeyboardTranslator.cpp --- a/libqterminal/KeyboardTranslator.cpp +++ b/libqterminal/KeyboardTranslator.cpp @@ -30,25 +30,14 @@ // Qt #include -//#include #include #include #include #include -// KDE -//#include -//#include -//#include using namespace Konsole; -//this is for default REALLY fallback translator. - -//const char* KeyboardTranslatorManager::defaultTranslatorText = -//#include "DefaultTranslatorText.h" -//; - //and this is default now translator - default.keytab from original Konsole const char* KeyboardTranslatorManager::defaultTranslatorText = #include "ExtendedDefaultTranslator.h" @@ -73,8 +62,8 @@ filters << "*.keytab"; dir.setNameFilters(filters); QStringList list = dir.entryList(filters); //(".keytab"); // = KGlobal::dirs()->findAllResources("data", - // "konsole/*.keytab", - // KStandardDirs::NoDuplicates); + // "konsole/*.keytab", + // KStandardDirs::NoDuplicates); list = dir.entryList(filters); // add the name of each translator to the list and associated // the name with a null pointer to indicate that the translator @@ -85,7 +74,7 @@ QString translatorPath = listIter.next(); QString name = QFileInfo(translatorPath).baseName(); - + if ( !_translators.contains(name) ) { _translators.insert(name,0); } @@ -98,7 +87,7 @@ if ( name.isEmpty() ) return defaultTranslator(); -//here was smth wrong in original Konsole source + //here was smth wrong in original Konsole source findTranslators(); if ( _translators.contains(name) && _translators[name] != 0 ) { @@ -118,7 +107,7 @@ bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* translator) { const QString path = ".keytab";// = KGlobal::dirs()->saveLocation("data","konsole/")+translator->name() -// +".keytab"; + // +".keytab"; qDebug() << "Saving translator to" << path; @@ -135,7 +124,7 @@ { KeyboardTranslatorWriter writer(&destination); writer.writeHeader(translator->description()); - + QListIterator iter(translator->entries()); while ( iter.hasNext() ) writer.writeEntry(iter.next()); @@ -194,7 +183,7 @@ } KeyboardTranslatorWriter::KeyboardTranslatorWriter(QIODevice* destination) -: _destination(destination) + : _destination(destination) { Q_ASSERT( destination && destination->isWritable() ); @@ -244,18 +233,18 @@ : _source(source) , _hasNext(false) { - // read input until we find the description - while ( _description.isEmpty() && !source->atEnd() ) - { + // read input until we find the description + while ( _description.isEmpty() && !source->atEnd() ) + { const QList& tokens = tokenize( QString(source->readLine()) ); - + if ( !tokens.isEmpty() && tokens.first().type == Token::TitleKeyword ) { _description = (tokens[1].text.toUtf8()); } - } + } - readNext(); + readNext(); } void KeyboardTranslatorReader::readNext() { @@ -290,8 +279,8 @@ else if ( tokens[2].type == Token::Command ) { // identify command - if (!parseAsCommand(tokens[2].text,command)) - qWarning() << "Command" << tokens[2].text << "not understood."; + if (!parseAsCommand(tokens[2].text,command)) + qWarning() << "Command" << tokens[2].text << "not understood."; } KeyboardTranslator::Entry newEntry; @@ -316,8 +305,8 @@ bool KeyboardTranslatorReader::parseAsCommand(const QString& text,KeyboardTranslator::Command& command) { - if ( text.compare("erase",Qt::CaseInsensitive) == 0 ) - command = KeyboardTranslator::EraseCommand; + if ( text.compare("erase",Qt::CaseInsensitive) == 0 ) + command = KeyboardTranslator::EraseCommand; else if ( text.compare("scrollpageup",Qt::CaseInsensitive) == 0 ) command = KeyboardTranslator::ScrollPageUpCommand; else if ( text.compare("scrollpagedown",Qt::CaseInsensitive) == 0 ) @@ -331,7 +320,7 @@ else return false; - return true; + return true; } bool KeyboardTranslatorReader::decodeSequence(const QString& text, @@ -393,9 +382,9 @@ // check if this is a wanted / not-wanted flag and update the // state ready for the next item if ( ch == '+' ) - isWanted = true; + isWanted = true; else if ( ch == '-' ) - isWanted = false; + isWanted = false; } modifiers = tempModifiers; @@ -416,8 +405,8 @@ modifier = Qt::AltModifier; else if ( item == "meta" ) modifier = Qt::MetaModifier; - else if ( item == "keypad" ) - modifier = Qt::KeypadModifier; + else if ( item == "keypad" ) + modifier = Qt::KeypadModifier; else return false; @@ -478,14 +467,14 @@ entryString.append(condition); entryString.append(" : "); - // if 'result' is the name of a command then the entry result will be that command, - // otherwise the result will be treated as a string to echo when the key sequence - // specified by 'condition' is pressed - KeyboardTranslator::Command command; - if (parseAsCommand(result,command)) + // if 'result' is the name of a command then the entry result will be that command, + // otherwise the result will be treated as a string to echo when the key sequence + // specified by 'condition' is pressed + KeyboardTranslator::Command command; + if (parseAsCommand(result,command)) entryString.append(result); - else - entryString.append('\"' + result + '\"'); + else + entryString.append('\"' + result + '\"'); QByteArray array = entryString.toUtf8(); @@ -539,7 +528,7 @@ { Token titleToken = { Token::TitleKeyword , QString() }; Token textToken = { Token::TitleText , title.capturedTexts()[1] }; - + list << titleToken << textToken; } else if ( key.exactMatch(text) ) @@ -558,8 +547,8 @@ else { // capturedTexts()[3] is the output string - Token outputToken = { Token::OutputText , key.capturedTexts()[3] }; - list << outputToken; + Token outputToken = { Token::OutputText , key.capturedTexts()[3] }; + list << outputToken; } } else @@ -581,24 +570,24 @@ } KeyboardTranslator::Entry::Entry() -: _keyCode(0) -, _modifiers(Qt::NoModifier) -, _modifierMask(Qt::NoModifier) -, _state(NoState) -, _stateMask(NoState) -, _command(NoCommand) + : _keyCode(0) + , _modifiers(Qt::NoModifier) + , _modifierMask(Qt::NoModifier) + , _state(NoState) + , _stateMask(NoState) + , _command(NoCommand) { } bool KeyboardTranslator::Entry::operator==(const Entry& rhs) const { return _keyCode == rhs._keyCode && - _modifiers == rhs._modifiers && - _modifierMask == rhs._modifierMask && - _state == rhs._state && - _stateMask == rhs._stateMask && - _command == rhs._command && - _text == rhs._text; + _modifiers == rhs._modifiers && + _modifierMask == rhs._modifierMask && + _state == rhs._state && + _stateMask == rhs._stateMask && + _command == rhs._command && + _text == rhs._text; } bool KeyboardTranslator::Entry::matches(int keyCode , @@ -625,7 +614,7 @@ { // test fails if any modifier is required but none are set if ( (_state & KeyboardTranslator::AnyModifierState) && !anyModifiersSet ) - return false; + return false; // test fails if no modifier is allowed but one or more are set if ( !(_state & KeyboardTranslator::AnyModifierState) && anyModifiersSet ) @@ -645,17 +634,17 @@ switch ( ch ) { - case 27 : replacement = 'E'; break; - case 8 : replacement = 'b'; break; - case 12 : replacement = 'f'; break; - case 9 : replacement = 't'; break; - case 13 : replacement = 'r'; break; - case 10 : replacement = 'n'; break; - default: - // any character which is not printable is replaced by an equivalent - // \xhh escape sequence (where 'hh' are the corresponding hex digits) - if ( !QChar(ch).isPrint() ) - replacement = 'x'; + case 27 : replacement = 'E'; break; + case 8 : replacement = 'b'; break; + case 12 : replacement = 'f'; break; + case 9 : replacement = 't'; break; + case 13 : replacement = 'r'; break; + case 10 : replacement = 'n'; break; + default: + // any character which is not printable is replaced by an equivalent + // \xhh escape sequence (where 'hh' are the corresponding hex digits) + if ( !QChar(ch).isPrint() ) + replacement = 'x'; } if ( replacement == 'x' ) @@ -681,44 +670,44 @@ QByteRef ch = result[i]; if ( ch == '\\' ) { - char replacement[2] = {0,0}; - int charsToRemove = 2; - bool escapedChar = true; + char replacement[2] = {0,0}; + int charsToRemove = 2; + bool escapedChar = true; - switch ( result[i+1] ) - { - case 'E' : replacement[0] = 27; break; - case 'b' : replacement[0] = 8 ; break; - case 'f' : replacement[0] = 12; break; - case 't' : replacement[0] = 9 ; break; - case 'r' : replacement[0] = 13; break; - case 'n' : replacement[0] = 10; break; - case 'x' : - { - // format is \xh or \xhh where 'h' is a hexadecimal - // digit from 0-9 or A-F which should be replaced - // with the corresponding character value - char hexDigits[3] = {0}; + switch ( result[i+1] ) + { + case 'E' : replacement[0] = 27; break; + case 'b' : replacement[0] = 8 ; break; + case 'f' : replacement[0] = 12; break; + case 't' : replacement[0] = 9 ; break; + case 'r' : replacement[0] = 13; break; + case 'n' : replacement[0] = 10; break; + case 'x' : + { + // format is \xh or \xhh where 'h' is a hexadecimal + // digit from 0-9 or A-F which should be replaced + // with the corresponding character value + char hexDigits[3] = {0}; - if ( (i < result.count()-2) && isxdigit(result[i+2]) ) - hexDigits[0] = result[i+2]; - if ( (i < result.count()-3) && isxdigit(result[i+3]) ) - hexDigits[1] = result[i+3]; + if ( (i < result.count()-2) && isxdigit(result[i+2]) ) + hexDigits[0] = result[i+2]; + if ( (i < result.count()-3) && isxdigit(result[i+3]) ) + hexDigits[1] = result[i+3]; - int charValue = 0; - sscanf(hexDigits,"%x",&charValue); - - replacement[0] = (char)charValue; + int charValue = 0; + sscanf(hexDigits,"%x",&charValue); + + replacement[0] = (char)charValue; - charsToRemove = 2 + strlen(hexDigits); - } - break; - default: - escapedChar = false; - } + charsToRemove = 2 + strlen(hexDigits); + } + break; + default: + escapedChar = false; + } - if ( escapedChar ) - result.replace(i,charsToRemove,replacement); + if ( escapedChar ) + result.replace(i,charsToRemove,replacement); } } @@ -743,8 +732,8 @@ item += "Alt"; else if ( modifier == Qt::MetaModifier ) item += "Meta"; - else if ( modifier == Qt::KeypadModifier ) - item += "KeyPad"; + else if ( modifier == Qt::KeypadModifier ) + item += "KeyPad"; } void KeyboardTranslator::Entry::insertState( QString& item , int state ) const { @@ -771,8 +760,8 @@ { if ( !_text.isEmpty() ) return escapedText(expandWildCards,modifiers); - else if ( _command == EraseCommand ) - return "Erase"; + else if ( _command == EraseCommand ) + return "Erase"; else if ( _command == ScrollPageUpCommand ) return "ScrollPageUp"; else if ( _command == ScrollPageDownCommand ) @@ -807,7 +796,7 @@ } KeyboardTranslator::KeyboardTranslator(const QString& name) -: _name(name) + : _name(name) { } diff --git a/libqterminal/TerminalDisplay.cpp b/libqterminal/TerminalDisplay.cpp --- a/libqterminal/TerminalDisplay.cpp +++ b/libqterminal/TerminalDisplay.cpp @@ -300,7 +300,6 @@ setUsesMouse(true); setColorTable(base_color_table); -// setColorTable(blackonlightyellow_color_table); setMouseTracking(true); // Enable drag and drop diff --git a/libqterminal/libqterminal.pro b/libqterminal/libqterminal.pro --- a/libqterminal/libqterminal.pro +++ b/libqterminal/libqterminal.pro @@ -10,44 +10,44 @@ DEFINES += HAVE_POSIX_OPENPT #or DEFINES += HAVE_GETPT -HEADERS = TerminalCharacterDecoder.h \ - Character.h \ - CharacterColor.h \ - KeyboardTranslator.h \ - ExtendedDefaultTranslator.h \ - Screen.h \ - History.h \ - BlockArray.h \ - konsole_wcwidth.h \ - ScreenWindow.h \ - Emulation.h \ - Vt102Emulation.h \ - TerminalDisplay.h \ - Filter.h LineFont.h \ - Pty.h \ - kpty.h \ - kpty_p.h \ - k3process.h \ - k3processcontroller.h \ - Session.h \ - ShellCommand.h \ - QTerminal.h - -SOURCES = TerminalCharacterDecoder.cpp \ - KeyboardTranslator.cpp \ - Screen.cpp \ - History.cpp \ - BlockArray.cpp \ - konsole_wcwidth.cpp \ - ScreenWindow.cpp \ - Emulation.cpp \ - Vt102Emulation.cpp \ - TerminalDisplay.cpp \ - Filter.cpp \ - Pty.cpp \ - kpty.cpp \ - k3process.cpp \ - k3processcontroller.cpp \ - Session.cpp \ - ShellCommand.cpp \ - QTerminal.cpp +HEADERS = BlockArray.h \ + Character.h \ + CharacterColor.h \ + Emulation.h \ + ExtendedDefaultTranslator.h \ + Filter.h \ + History.h \ + k3process.h \ + k3processcontroller.h \ + KeyboardTranslator.h \ + konsole_wcwidth.h \ + kpty.h \ + kpty_p.h \ + LineFont.h \ + Pty.h \ + QTerminal.h \ + Screen.h \ + ScreenWindow.h \ + Session.h \ + ShellCommand.h \ + TerminalCharacterDecoder.h \ + TerminalDisplay.h \ + Vt102Emulation.h +SOURCES = BlockArray.cpp \ + Emulation.cpp \ + Filter.cpp \ + History.cpp \ + k3process.cpp \ + k3processcontroller.cpp \ + KeyboardTranslator.cpp \ + konsole_wcwidth.cpp \ + kpty.cpp \ + Pty.cpp \ + QTerminal.cpp \ + Screen.cpp \ + ScreenWindow.cpp \ + Session.cpp \ + ShellCommand.cpp \ + TerminalCharacterDecoder.cpp \ + TerminalDisplay.cpp \ + Vt102Emulation.cpp