src/messagelog.cc

changeset 606
3dd6f343ec06
parent 603
47e7773c7841
equal deleted inserted replaced
605:2983f7c7e7c9 606:3dd6f343ec06
37 connect (m_ticker, SIGNAL (timeout()), this, SLOT (tick())); 37 connect (m_ticker, SIGNAL (timeout()), this, SLOT (tick()));
38 } 38 }
39 39
40 // ============================================================================= 40 // =============================================================================
41 // ----------------------------------------------------------------------------- 41 // -----------------------------------------------------------------------------
42 MessageManager::Line::Line (str text) : 42 MessageManager::Line::Line (QString text) :
43 text (text), 43 text (text),
44 alpha (1.0f), 44 alpha (1.0f),
45 expiry (QDateTime::currentDateTime().addSecs (g_expiry)) {} 45 expiry (QDateTime::currentDateTime().addSecs (g_expiry)) {}
46 46
47 // ============================================================================= 47 // =============================================================================
73 } 73 }
74 74
75 // ============================================================================= 75 // =============================================================================
76 // Add a line to the message manager. 76 // Add a line to the message manager.
77 // ----------------------------------------------------------------------------- 77 // -----------------------------------------------------------------------------
78 void MessageManager::addLine (str line) 78 void MessageManager::addLine (QString line)
79 { 79 {
80 // If there's too many entries, pop the excess out 80 // If there's too many entries, pop the excess out
81 while (m_lines.size() >= g_maxMessages) 81 while (m_lines.size() >= g_maxMessages)
82 m_lines.removeFirst(); 82 m_lines.removeFirst();
83 83
124 // log() interface - format the argument list and add the resulting string to 124 // log() interface - format the argument list and add the resulting string to
125 // the main message manager. 125 // the main message manager.
126 // ----------------------------------------------------------------------------- 126 // -----------------------------------------------------------------------------
127 void DoLog (std::initializer_list<StringFormatArg> args) 127 void DoLog (std::initializer_list<StringFormatArg> args)
128 { 128 {
129 const str msg = DoFormat (args); 129 const QString msg = DoFormat (args);
130 130
131 for (str& a : msg.split ("\n", QString::SkipEmptyParts)) 131 for (QString& a : msg.split ("\n", QString::SkipEmptyParts))
132 { 132 {
133 if (g_win) 133 if (g_win)
134 g_win->addMessage (a); 134 g_win->addMessage (a);
135 135
136 // Also print it to stdout 136 // Also print it to stdout

mercurial