aboutsummaryrefslogtreecommitdiff
path: root/src/chatlogpiece.cpp
blob: 9017b9612d5a7a0bb46fa85d8da9877795a9dd05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "chatlogpiece.h"

chatlogpiece::chatlogpiece()
{
  name = "UNKNOWN";
  showname = "UNKNOWN";
  message = "UNKNOWN";
  color = 0;
  is_song = false;
  datetime = QDateTime::currentDateTime().toUTC();
}

chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
                           QString p_message, bool p_song, int p_color)
{
  name = p_name;
  showname = p_showname;
  message = p_message;
  is_song = p_song;
  color = p_color;
  datetime = QDateTime::currentDateTime().toUTC();
}

chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
                           QString p_message, bool p_song, int p_color,
                           QDateTime p_datetime)
{
  name = p_name;
  showname = p_showname;
  message = p_message;
  is_song = p_song;
  color = p_color;
  datetime = p_datetime.toUTC();
}

QString chatlogpiece::get_name() { return name; }

QString chatlogpiece::get_showname() { return showname; }

QString chatlogpiece::get_message() { return message; }

QDateTime chatlogpiece::get_datetime() { return datetime; }

bool chatlogpiece::get_is_song() { return is_song; }

QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
int chatlogpiece::get_chat_color() { return color; }

QString chatlogpiece::get_full()
{
  QString full = "[";

  full.append(get_datetime_as_string());
  full.append(" UTC] ");
  full.append(get_showname());
  full.append(" (");
  full.append(get_name());
  full.append(")");
  if (is_song)
    full.append(" has played a song: ");
  full.append(get_message());

  return full;
}