implement #153 (emoticons for chat)
@@ -29,8 +29,7 @@ using namespace std;
|
||||
ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, ChatType ct, QTextBrowser *b, QStandardItemModel *m, gameLobbyDialogImpl *lo) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickListModel(m), myNickStringList(NULL), myTextBrowser(b), myChatType(ct), myConfig(c), myNick(""), myLobby(lo)
|
||||
{
|
||||
myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str());
|
||||
ignoreList = myConfig->readConfigStringList("PlayerIgnoreList");
|
||||
|
||||
ignoreList = myConfig->readConfigStringList("PlayerIgnoreList");
|
||||
}
|
||||
|
||||
ChatTools::~ChatTools()
|
||||
@@ -154,12 +153,14 @@ void ChatTools::receiveMessage(QString playerName, QString message, bool pm)
|
||||
|
||||
if(!nickFoundOnIgnoreList) {
|
||||
|
||||
tempMsg = checkForEmotes(tempMsg);
|
||||
|
||||
if(message.indexOf(QString("/me "))==0) {
|
||||
myTextBrowser->append(tempMsg.replace("/me ","<i>*"+playerName+" ")+"</i>");
|
||||
} else if(pm == true) {
|
||||
myTextBrowser->append("<i>"+playerName+"(pm): " + tempMsg+"</i>");
|
||||
} else {
|
||||
myTextBrowser->append(playerName + ": " + tempMsg);
|
||||
myTextBrowser->append(playerName + ": " + tempMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,3 +314,39 @@ unsigned ChatTools::parsePrivateMessageTarget(QString &chatText)
|
||||
return playerId;
|
||||
}
|
||||
|
||||
QString ChatTools::checkForEmotes(QString msg) {
|
||||
|
||||
msg.replace("0:-)", "<img src=\":emotes/emotes/face-angel.png\" />");
|
||||
msg.replace("X-(", "<img src=\":emotes/emotes/face-angry.png\" />");
|
||||
msg.replace("B-)", "<img src=\":emotes/emotes/face-cool.png\" />");
|
||||
msg.replace("8-)", "<img src=\":emotes/emotes/face-cool.png\" />");
|
||||
msg.replace(":'(", "<img src=\":emotes/emotes/face-crying.png\" />");
|
||||
msg.replace(">:-)", "<img src=\":emotes/emotes/face-devilish.png\" />");
|
||||
msg.replace(":-[", "<img src=\":emotes/emotes/face-embarrassed.png\" />");
|
||||
msg.replace(":-*", "<img src=\":emotes/emotes/face-kiss.png\" />");
|
||||
msg.replace(":-))", "<img src=\":emotes/emotes/face-laugh.png\" />");
|
||||
msg.replace(":))", "<img src=\":emotes/emotes/face-laugh.png\" />");
|
||||
msg.replace(":-|", "<img src=\":emotes/emotes/face-plain.png\" />");
|
||||
msg.replace(":-P", "<img src=\":emotes/emotes/face-raspberry.png\" />");
|
||||
msg.replace(":-p", "<img src=\":emotes/emotes/face-raspberry.png\" />");
|
||||
msg.replace(":-(", "<img src=\":emotes/emotes/face-sad.png\" />");
|
||||
msg.replace(":(", "<img src=\":emotes/emotes/face-sad.png\" />");
|
||||
msg.replace(":-&", "<img src=\":emotes/emotes/face-sick.png\" />");
|
||||
msg.replace(":-D", "<img src=\":emotes/emotes/face-smile-big.png\" />");
|
||||
msg.replace(":D", "<img src=\":emotes/emotes/face-smile-big.png\" />");
|
||||
msg.replace(":-!", "<img src=\":emotes/emotes/face-smirk.png\" />");
|
||||
msg.replace(":-0", "<img src=\":emotes/emotes/face-surprise.png\" />");
|
||||
msg.replace(":-O", "<img src=\":emotes/emotes/face-surprise.png\" />");
|
||||
msg.replace(":-o", "<img src=\":emotes/emotes/face-surprise.png\" />");
|
||||
msg.replace(":-/", "<img src=\":emotes/emotes/face-uncertain.png\" />");
|
||||
msg.replace(":/", "<img src=\":emotes/emotes/face-uncertain.png\" />");
|
||||
msg.replace(";-)", "<img src=\":emotes/emotes/face-wink.png\" />");
|
||||
msg.replace(";)", "<img src=\":emotes/emotes/face-wink.png\" />");
|
||||
msg.replace(":-S", "<img src=\":emotes/emotes/face-worried.png\" />");
|
||||
msg.replace(":-s", "<img src=\":emotes/emotes/face-worried.png\" />");
|
||||
msg.replace(":-)", "<img src=\":emotes/emotes/face-smile.png\" />");
|
||||
msg.replace(":)", "<img src=\":emotes/emotes/face-smile.png\" />");
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ public slots:
|
||||
myStyle = theValue;
|
||||
}
|
||||
void refreshIgnoreList();
|
||||
QString checkForEmotes(QString);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@@ -1,4 +1,4 @@
|
||||
<RCC>
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/gfx">
|
||||
<file>view-fullscreen.png</file>
|
||||
<file>swbuttoninternetgame.png</file>
|
||||
@@ -309,4 +309,31 @@
|
||||
<file>cflags/np.png</file>
|
||||
<file>cflags/undefined.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/emotes">
|
||||
<file>emotes/face-angel.png</file>
|
||||
<file>emotes/face-angry.png</file>
|
||||
<file>emotes/face-confused.png</file>
|
||||
<file>emotes/face-cool.png</file>
|
||||
<file>emotes/face-crying.png</file>
|
||||
<file>emotes/face-devilish.png</file>
|
||||
<file>emotes/face-embarrassed.png</file>
|
||||
<file>emotes/face-in-love.png</file>
|
||||
<file>emotes/face-kiss.png</file>
|
||||
<file>emotes/face-laugh.png</file>
|
||||
<file>emotes/face-plain.png</file>
|
||||
<file>emotes/face-quiet.png</file>
|
||||
<file>emotes/face-raspberry.png</file>
|
||||
<file>emotes/face-sad.png</file>
|
||||
<file>emotes/face-sick.png</file>
|
||||
<file>emotes/face-sleep.png</file>
|
||||
<file>emotes/face-smile-big.png</file>
|
||||
<file>emotes/face-smile-grin.png</file>
|
||||
<file>emotes/face-smile.png</file>
|
||||
<file>emotes/face-smirk.png</file>
|
||||
<file>emotes/face-surprise.png</file>
|
||||
<file>emotes/face-uncertain.png</file>
|
||||
<file>emotes/face-wink.png</file>
|
||||
<file>emotes/face-worried.png</file>
|
||||
<file>emotes/face-yawn.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -72,8 +72,9 @@ int main( int argc, char **argv )
|
||||
|
||||
/////// can be removed for non-qt-guis ////////////
|
||||
QtSingleApplication a( argc, argv );
|
||||
Q_INIT_RESOURCE(pokerth);
|
||||
|
||||
if (a.sendMessage("Wake up!")) {
|
||||
if (a.sendMessage("Wake up!")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||