summaryrefslogtreecommitdiffstatshomepage
path: root/ui-tag.h
blob: d295cdcdbd59d75d7b3ef6a7a25f8b61a5d9edd4 (plain)
1
2
3
4
5
6
#ifndef UI_TAG_H
#define UI_TAG_H

extern void cgit_print_tag(char *revname);

#endif /* UI_TAG_H */
d-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#include "list_item.h"

QIcon* choose_icon(StatusType status_type) {
    // via the use of `static' in the following switch block, the idea is to only initialize each QIcon type once in the program's lifetime.

    switch (status_type) {
        // TODO: only null icon for the moment
        default:
            static QIcon* icon = new QIcon();
            return icon;
    }
}

StatusListItem::StatusListItem(const QString &text, StatusType status_type, bool has_attachement, Archive* data_archive, QListWidget *parent, int index) :
    status_index(index), has_attachement(has_attachement), status_type(status_type), data_archive(data_archive)
{
    setText(text);
    setIcon(*choose_icon(status_type));
    parent->addItem(this);
#ifndef NDEBUG
    QString tool_tip;
    switch (status_type) {
        case PUBLIC: tool_tip = "Public"; break;
        case UNLISTED: tool_tip = "Unlisted"; break;
        case PRIVATE: tool_tip = "Private"; break;
        case DIRECT: tool_tip = "Direct"; break;
        case UNKNOWN: tool_tip = "Unknown"; break;
        case REBLOG: tool_tip = "Reblog"; break;
    }
    setToolTip(tool_tip);
#endif
}

int StatusListItem::get_status_index() {
    return status_index;
}

StatusType StatusListItem::get_status_type() {
    return status_type;
}

QString StatusListItem::get_info_html(int text_zone_width, QLocale* locale) {
    return data_archive->get_html_status_info(status_index, text_zone_width, status_type, locale);
}