Merge pull request #369 from skyedeving/fix-showname-toggle
Fix timestamps when toggling showname
This commit is contained in:
		
						commit
						9486f44770
					
				@ -226,7 +226,7 @@ public:
 | 
			
		||||
  // selected
 | 
			
		||||
  // or the user isn't already scrolled to the top
 | 
			
		||||
  void append_ic_text(QString p_text, QString p_name = "", QString action = "",
 | 
			
		||||
                      int color = 0);
 | 
			
		||||
                      int color = 0, QDateTime timestamp = QDateTime::currentDateTime());
 | 
			
		||||
 | 
			
		||||
  // prints who played the song to IC chat and plays said song(if found on local
 | 
			
		||||
  // filesystem) takes in a list where the first element is the song name and
 | 
			
		||||
 | 
			
		||||
@ -2619,7 +2619,7 @@ void Courtroom::log_ic_text(QString p_name, QString p_showname,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
 | 
			
		||||
                               int color)
 | 
			
		||||
                               int color, QDateTime timestamp)
 | 
			
		||||
{
 | 
			
		||||
  QTextCharFormat bold;
 | 
			
		||||
  QTextCharFormat normal;
 | 
			
		||||
@ -2645,10 +2645,14 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Timestamp if we're doing that meme
 | 
			
		||||
  if (log_timestamp)
 | 
			
		||||
    ui_ic_chatlog->textCursor().insertText(
 | 
			
		||||
        "[" + QDateTime::currentDateTime().toString("h:mm:ss AP") + "] ",
 | 
			
		||||
        normal);
 | 
			
		||||
  if (log_timestamp) {
 | 
			
		||||
    if (timestamp.isValid()) {
 | 
			
		||||
      ui_ic_chatlog->textCursor().insertText(
 | 
			
		||||
        "[" + timestamp.toString("h:mm:ss AP") + "] ", normal);
 | 
			
		||||
    } else {
 | 
			
		||||
      qDebug() << "could not insert invalid timestamp";
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Format the name of the actor
 | 
			
		||||
  ui_ic_chatlog->textCursor().insertText(p_name, bold);
 | 
			
		||||
@ -4788,7 +4792,8 @@ void Courtroom::regenerate_ic_chatlog()
 | 
			
		||||
    append_ic_text(item.get_message(),
 | 
			
		||||
                   ui_showname_enable->isChecked() ? item.get_showname()
 | 
			
		||||
                                                   : item.get_name(),
 | 
			
		||||
                   item.get_action(), item.get_chat_color());
 | 
			
		||||
                   item.get_action(), item.get_chat_color(),
 | 
			
		||||
                   item.get_datetime().toLocalTime());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user