aboutsummaryrefslogtreecommitdiffstats
path: root/src/list_item.cpp
blob: a7fde7e95fae0782f3729bda8525e9ef9a80e49b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "list_item.h"
#include "types.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;
    }
}

ListItem::ListItem(const QString &text, StatusType status_type, QListWidget *parent, int index) :
    QListWidgetItem(*choose_icon(status_type), text, parent, ArchiveListItemType), status_index(index)
{

}