projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Slightly improve behavior on resize
[quassel.git]
/
src
/
uisupport
/
uistyle.cpp
diff --git
a/src/uisupport/uistyle.cpp
b/src/uisupport/uistyle.cpp
index
18934d6
..
75524db
100644
(file)
--- a/
src/uisupport/uistyle.cpp
+++ b/
src/uisupport/uistyle.cpp
@@
-102,17
+102,14
@@
void UiStyle::loadStyleSheet() {
QssParser parser;
parser.processStyleSheet(styleSheet);
QApplication::setPalette(parser.palette());
QssParser parser;
parser.processStyleSheet(styleSheet);
QApplication::setPalette(parser.palette());
- _uiStylePalette = parser.uiStylePalette();
- QTextCharFormat baseFmt = parser.formats().value(Base);
- foreach(quint64 fmtType, parser.formats().keys()) {
- QTextCharFormat fmt = baseFmt;
- fmt.merge(parser.formats().value(fmtType));
- _formats[fmtType] = fmt;
- }
+ _uiStylePalette = parser.uiStylePalette();
+ _formats = parser.formats();
_listItemFormats = parser.listItemFormats();
_listItemFormats = parser.listItemFormats();
- qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
+ styleSheet = styleSheet.trimmed();
+ if(!styleSheet.isEmpty())
+ qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
}
emit changed();
}
emit changed();
@@
-352,7
+349,7
@@
void UiStyle::mergeFormat(QTextCharFormat &fmt, quint32 ftype, quint64 label) {
// URL
if(ftype & Url)
// URL
if(ftype & Url)
- mergeSubElementFormat(fmt, ftype &
Url
, label);
+ mergeSubElementFormat(fmt, ftype &
(Url | 0x000000ff)
, label);
}
// Merge a subelement format into an existing message format
}
// Merge a subelement format into an existing message format
@@
-455,10
+452,10
@@
UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat
color &= 0x0f;
if(s[pos+3] == 'f') {
curfmt &= 0xf0ffffff;
color &= 0x0f;
if(s[pos+3] == 'f') {
curfmt &= 0xf0ffffff;
- curfmt |= (color << 24) | 0x00400000;
+ curfmt |= (
quint32)(
color << 24) | 0x00400000;
} else {
curfmt &= 0x0fffffff;
} else {
curfmt &= 0x0fffffff;
- curfmt |= (color << 28) | 0x00800000;
+ curfmt |= (
quint32)(
color << 28) | 0x00800000;
}
length = 6;
}
}
length = 6;
}
@@
-692,9
+689,10
@@
quint8 UiStyle::StyledMessage::senderHash() const {
QString nick = nickFromMask(sender()).toLower();
if(!nick.isEmpty()) {
int chopCount = 0;
QString nick = nickFromMask(sender()).toLower();
if(!nick.isEmpty()) {
int chopCount = 0;
- while(nick.at(nick.count() - 1 - chopCount) == '_')
+ while(
chopCount < nick.size() &&
nick.at(nick.count() - 1 - chopCount) == '_')
chopCount++;
chopCount++;
- nick.chop(chopCount);
+ if(chopCount < nick.size())
+ nick.chop(chopCount);
}
quint16 hash = qChecksum(nick.toAscii().data(), nick.toAscii().size());
return (_senderHash = (hash & 0xf) + 1);
}
quint16 hash = qChecksum(nick.toAscii().data(), nick.toAscii().size());
return (_senderHash = (hash & 0xf) + 1);