Example #1
0
UiStyle::UiStyle(QObject *parent)
    : QObject(parent),
    _channelJoinedIcon(SmallIcon("irc-channel-active")),
    _channelPartedIcon(SmallIcon("irc-channel-inactive")),
    _userOfflineIcon(SmallIcon("im-user-offline")),
    _userOnlineIcon(SmallIcon("im-user")),
    _userAwayIcon(SmallIcon("im-user-away")),
    _categoryOpIcon(SmallIcon("irc-operator")),
    _categoryVoiceIcon(SmallIcon("irc-voice")),
    _opIconLimit(UserCategoryItem::categoryFromModes("o")),
    _voiceIconLimit(UserCategoryItem::categoryFromModes("v"))
{
    // register FormatList if that hasn't happened yet
    // FIXME I don't think this actually avoids double registration... then again... does it hurt?
    if (QVariant::nameToType("UiStyle::FormatList") == QVariant::Invalid) {
        qRegisterMetaType<FormatList>("UiStyle::FormatList");
        qRegisterMetaTypeStreamOperators<FormatList>("UiStyle::FormatList");
        Q_ASSERT(QVariant::nameToType("UiStyle::FormatList") != QVariant::Invalid);
    }

    _uiStylePalette = QVector<QBrush>(NumRoles, QBrush());

    // Now initialize the mapping between FormatCodes and FormatTypes...
    _formatCodes["%O"] = Base;
    _formatCodes["%B"] = Bold;
    _formatCodes["%S"] = Italic;
    _formatCodes["%U"] = Underline;
    _formatCodes["%R"] = Reverse;

    _formatCodes["%DN"] = Nick;
    _formatCodes["%DH"] = Hostmask;
    _formatCodes["%DC"] = ChannelName;
    _formatCodes["%DM"] = ModeFlags;
    _formatCodes["%DU"] = Url;

    setTimestampFormatString("[hh:mm:ss]");

    // BufferView / NickView settings
    UiStyleSettings s;
    _showBufferViewIcons = _showNickViewIcons = s.value("ShowItemViewIcons", true).toBool();
    s.notify("ShowItemViewIcons", this, SLOT(showItemViewIconsChanged(QVariant)));

    _allowMircColors = s.value("AllowMircColors", true).toBool();
    s.notify("AllowMircColors", this, SLOT(allowMircColorsChanged(QVariant)));

    loadStyleSheet();
}
Example #2
0
void QtUiStyle::updateTimestampFormatString() {
  ChatViewSettings s;
  setTimestampFormatString(s.timestampFormatString());
}