diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-01-13 22:57:50 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-01-13 23:27:11 (GMT) |
commit | 2957eaa033fc57414080a0c9bdebd51b67c3b047 (patch) | |
tree | 534ea3a9d5fb0ea007d8f509dbb312c69cd0048d | |
parent | 4feb5e9e8844bc68e13d5119f4749e39fdec0ccc (diff) | |
download | swift-contrib-2957eaa033fc57414080a0c9bdebd51b67c3b047.zip swift-contrib-2957eaa033fc57414080a0c9bdebd51b67c3b047.tar.bz2 |
Cleanup after previous patches.
-rw-r--r-- | COPYING | 16 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 30 |
2 files changed, 32 insertions, 14 deletions
@@ -818,4 +818,18 @@ under the terms of the OpenSSL license below. copied and put under another distribution licence [including the GNU Public Licence.] ---- END OF OpenSSL LICENSE ---
\ No newline at end of file +--- END OF OpenSSL LICENSE --- + +Swift contains some code contributed under the BSD License, under the following terms: + +--- START OF BSD LICENSE +Copyright (c) 2011, Arnt Gulbrandsen +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the their orginizations nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- END OF BSD LICENSE diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 3493ba7..b894e9e 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -173,7 +173,7 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) { // look for spectrum-generated and other long JID localparts, and // try to abbreviate the resulting long tab texts - QRegExp hasTrailingGarbage( "^(.[-\\w\\s&]+)([^\\s\\w].*)$" ); + QRegExp hasTrailingGarbage("^(.[-\\w\\s&]+)([^\\s\\w].*)$"); if (hasTrailingGarbage.exactMatch(tabText) && hasTrailingGarbage.cap(1).simplified().length() >= 2 && hasTrailingGarbage.cap(2).length() >= 7) { @@ -184,38 +184,42 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) { } // QTabBar interprets &, so escape that - tabText.replace( "&", "&&" ); + tabText.replace("&", "&&"); // see which alt[a-z] keys other tabs use bool accelsTaken[26]; int i = 0; - while (i < 26) + while (i < 26) { accelsTaken[i++] = false; + } int other = tabs_->tabBar()->count(); while (other >= 0) { other--; - if ( other != index ) { + if (other != index) { QString t = tabs_->tabBar()->tabText(other).toLower(); - int r = t.indexOf( '&' ); - if ( r >= 0 && t[r+1] >= 'a' && t[r+1] <= 'z' ) + int r = t.indexOf('&'); + if (r >= 0 && t[r+1] >= 'a' && t[r+1] <= 'z') { accelsTaken[t[r+1].unicode()-'a'] = true; + } } } // then look to see which letters in tabText may be used i = 0; int accelPos = -1; while (i < tabText.length() && accelPos < 0) { - if ( tabText[i] >= 'A' && tabText[i] <= 'Z' && - !accelsTaken[tabText[i].unicode()-'A'] ) + if (tabText[i] >= 'A' && tabText[i] <= 'Z' && + !accelsTaken[tabText[i].unicode()-'A']) { accelPos = i; - if ( tabText[i] >= 'a' && tabText[i] <= 'z' && - !accelsTaken[tabText[i].unicode()-'a'] ) + } + if (tabText[i] >= 'a' && tabText[i] <= 'z' && + !accelsTaken[tabText[i].unicode()-'a']) { accelPos = i; + } ++i; } - if (accelPos >= 0) - tabText = tabText.mid(0, accelPos) + "&" + - tabText.mid(accelPos); + if (accelPos >= 0) { + tabText = tabText.mid(0, accelPos) + "&" + tabText.mid(accelPos); + } // this could be improved on some european keyboards, such as // the German one (where alt-ß is available) and basically // doesn't work on Arabic/Indic keyboards (where Latin letters |