diff --git a/pokerth_game.pro b/pokerth_game.pro index b3337e79..a576ac5a 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -210,7 +210,8 @@ HEADERS += src/engine/game.h \ src/gui/qt/gametable/mycashlabel.h \ src/gui/qt/sound/soundevents.h \ src/gui/qt/mymessagebox/mymessagebox.h \ - src/gui/qt/logfiledialog/logfiledialog.h + src/gui/qt/logfiledialog/logfiledialog.h \ + src/gui/qt/logfiledialog/callback.h !gui_800x480 { FORMS += src/gui/qt/gametable.ui \ @@ -230,6 +231,7 @@ HEADERS += src/engine/game.h \ src/gui/qt/manualblindsorderdialog.ui \ src/gui/qt/serverlistdialog.ui \ src/gui/qt/internetgamelogindialog.ui \ + src/gui/qt/logfiledialog.ui \ src/gui/qt/changecontentdialog.ui } @@ -287,7 +289,8 @@ SOURCES += src/pokerth.cpp \ src/gui/qt/gametable/mycashlabel.cpp \ src/gui/qt/sound/soundevents.cpp \ src/gui/qt/mymessagebox/mymessagebox.cpp \ - src/gui/qt/logfiledialog/logfiledialog.cpp + src/gui/qt/logfiledialog/logfiledialog.cpp \ + src/gui/qt/logfiledialog/callback.cpp TRANSLATIONS = ts/pokerth_af.ts \ ts/pokerth_bg.ts \ ts/pokerth_zhcn.ts \ @@ -505,7 +508,7 @@ unix:!mac { LIBS += -ltinyxml LIBS += $$BOOST_LIBS LIBS += -lgsasl -lidn - LIBS += -lssl -lcrypto -lgcrypt -lgpg-error + LIBS += -lssl -lcrypto -lgcrypt -lgpg-error -lprotobuf } TARGETDEPS += ./lib/libpokerth_lib.a \ ./lib/libpokerth_db.a \ @@ -613,6 +616,7 @@ gui_800x480 { src/gui/qt/gui_800x480/serverlistdialog_800x480.ui \ src/gui/qt/gui_800x480/internetgamelogindialog_800x480.ui \ src/gui/qt/gui_800x480/changecontentdialog_800x480.ui \ + src/gui/qt/gui_800x480/logfiledialog_800x480.ui \ src/gui/qt/gui_800x480/tabs_800x480.ui } @@ -630,6 +634,3 @@ maemo{ android_test{ DEFINES += ANDROID } - -FORMS += \ - src/gui/qt/logfiledialog.ui diff --git a/pokerth_protocol.pro b/pokerth_protocol.pro index 7b06edbc..4b1be2bf 100644 --- a/pokerth_protocol.pro +++ b/pokerth_protocol.pro @@ -106,6 +106,7 @@ win32 { DEFINES += _WIN32_WINNT=0x0501 } unix : !mac { + INCLUDEPATH += $${PREFIX}/include system(protoc pokerth.proto --cpp_out=src/third_party/protobuf) system(protoc pokerth.proto --java_out=tests/src) } diff --git a/src/gui/qt/chattools/chattools.cpp b/src/gui/qt/chattools/chattools.cpp index 78eec464..39f78752 100644 --- a/src/gui/qt/chattools/chattools.cpp +++ b/src/gui/qt/chattools/chattools.cpp @@ -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 ","*"+playerName+" ")+""); } else if(pm == true) { myTextBrowser->append(""+playerName+"(pm): " + tempMsg+""); } 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:-)", ""); + msg.replace("X-(", ""); + msg.replace("B-)", ""); + msg.replace("8-)", ""); + msg.replace(":'(", ""); + msg.replace(">:-)", ""); + msg.replace(":-[", ""); + msg.replace(":-*", ""); + msg.replace(":-))", ""); + msg.replace(":))", ""); + msg.replace(":-|", ""); + msg.replace(":-P", ""); + msg.replace(":-p", ""); + msg.replace(":-(", ""); + msg.replace(":(", ""); + msg.replace(":-&", ""); + msg.replace(":-D", ""); + msg.replace(":D", ""); + msg.replace(":-!", ""); + msg.replace(":-0", ""); + msg.replace(":-O", ""); + msg.replace(":-o", ""); + msg.replace(":-/", ""); + msg.replace(":/", ""); + msg.replace(";-)", ""); + msg.replace(";)", ""); + msg.replace(":-S", ""); + msg.replace(":-s", ""); + msg.replace(":-)", ""); + msg.replace(":)", ""); + + return msg; +} + diff --git a/src/gui/qt/chattools/chattools.h b/src/gui/qt/chattools/chattools.h index 13a08edc..dd23c096 100644 --- a/src/gui/qt/chattools/chattools.h +++ b/src/gui/qt/chattools/chattools.h @@ -74,6 +74,7 @@ public slots: myStyle = theValue; } void refreshIgnoreList(); + QString checkForEmotes(QString); protected: diff --git a/src/gui/qt/gui_800x480/logfiledialog_800x480.ui b/src/gui/qt/gui_800x480/logfiledialog_800x480.ui new file mode 100644 index 00000000..31452b7a --- /dev/null +++ b/src/gui/qt/gui_800x480/logfiledialog_800x480.ui @@ -0,0 +1,220 @@ + + + LogFileDialog + + + + 0 + 0 + 618 + 392 + + + + Dialog + + + + + + + + Export as HTML + + + + :/gfx/text-html.png:/gfx/text-html.png + + + + + + + Export as txt + + + + :/gfx/text-plain.png:/gfx/text-plain.png + + + + + + + Save as ... + + + + :/gfx/filesave.png:/gfx/filesave.png + + + + + + + Delete + + + + :/gfx/editdelete.png:/gfx/editdelete.png + + + + + + + + + + + Preview: + + + + + + + + 0 + 0 + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + + 0 + 0 + + + + Game: + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + + 200 + 16777215 + + + + true + + + QAbstractItemView::ExtendedSelection + + + 5 + + + false + + + true + + + + Log File + + + + + + + + + + Qt::Horizontal + + + + + + + Analyse Logfile ... + + + + :/gfx/view-statistics.png:/gfx/view-statistics.png + + + + + + + + + + + buttonBox + accepted() + LogFileDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + LogFileDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/gui/qt/logfiledialog.ui b/src/gui/qt/logfiledialog.ui index 84176c2c..31452b7a 100644 --- a/src/gui/qt/logfiledialog.ui +++ b/src/gui/qt/logfiledialog.ui @@ -14,6 +14,85 @@ Dialog + + + + + + Export as HTML + + + + :/gfx/text-html.png:/gfx/text-html.png + + + + + + + Export as txt + + + + :/gfx/text-plain.png:/gfx/text-plain.png + + + + + + + Save as ... + + + + :/gfx/filesave.png:/gfx/filesave.png + + + + + + + Delete + + + + :/gfx/editdelete.png:/gfx/editdelete.png + + + + + + + + + + + Preview: + + + + + + + + 0 + 0 + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + @@ -81,89 +160,21 @@ - - - - - - Preview: - - - - - - - - 0 - 0 - - - - - - - - - - - - Export as HTML - - - - :/gfx/text-html.png:/gfx/text-html.png - - - - - - - Export as txt - - - - :/gfx/text-plain.png:/gfx/text-plain.png - - - - - - - Save as ... - - - - :/gfx/filesave.png:/gfx/filesave.png - - - - - - - Delete - - - - :/gfx/editdelete.png:/gfx/editdelete.png - - - - - - + Qt::Horizontal - - - - Qt::Horizontal + + + + Analyse Logfile ... - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + :/gfx/view-statistics.png:/gfx/view-statistics.png diff --git a/src/gui/qt/logfiledialog/callback.cpp b/src/gui/qt/logfiledialog/callback.cpp new file mode 100644 index 00000000..086c2dcc --- /dev/null +++ b/src/gui/qt/logfiledialog/callback.cpp @@ -0,0 +1,19 @@ +#include "callback.h" + +Callback::Callback() +{ + +} + + +size_t +Callback::writeCallback(char* buf, size_t size, size_t nmemb, void* up) +{ + data = ""; + + for (int c = 0; c + +class Callback +{ +public: + Callback(); + + size_t writeCallback(char* buf, size_t size, size_t nmemb, void* up); + + std::string getData() { return data; } + +private: + + std::string data; + +}; + +#endif // CALLBACK_H diff --git a/src/gui/qt/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index 5aac2f43..d7798284 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.cpp +++ b/src/gui/qt/logfiledialog/logfiledialog.cpp @@ -17,23 +17,31 @@ *****************************************************************************/ #include "logfiledialog.h" +#ifdef GUI_800x480 +#include "ui_logfiledialog_800x480.h" +#else #include "ui_logfiledialog.h" +#endif + #include #include "guilog.h" #include "configfile.h" #include "mymessagebox.h" +#include "callback.h" +#include "curl/curl.h" LogFileDialog::LogFileDialog(QWidget *parent, ConfigFile *c) : QDialog(parent), myConfig(c), ui(new Ui::LogFileDialog) { - ui->setupUi(this); + ui->setupUi(this); connect( ui->pushButton_deleteLog, SIGNAL(clicked()), this, SLOT (deleteLogFile())); connect( ui->pushButton_exportLogHtml, SIGNAL(clicked()), this, SLOT (exportLogToHtml())); connect( ui->pushButton_exportLogTxt, SIGNAL(clicked()), this, SLOT (exportLogToTxt())); connect( ui->pushButton_saveLogAs, SIGNAL(clicked()), this, SLOT (saveLogFileAs())); connect( ui->treeWidget_logFiles, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreview())); + connect( ui->pushButton_analyseLogfile, SIGNAL(clicked()), this, SLOT (uploadFile())); } LogFileDialog::~LogFileDialog() @@ -167,3 +175,61 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event ) } } } + + +Callback* curl_writedata = new Callback(); +void writeCallback(char* buf, size_t size, size_t nmemb, void* up) +{ + curl_writedata->writeCallback(buf, size, nmemb, up); +} + +void LogFileDialog::uploadFile() +{ + QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); + + if(selectedItem) { + file.setFileName(selectedItem->data(0, Qt::UserRole).toString()); + + CURL *curl; + CURLcode res; + + struct curl_httppost* post = NULL; + struct curl_httppost* last = NULL; + + curl = curl_easy_init(); + + if(curl) { + + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "pdb_file", + CURLFORM_FILE, file.fileName().toStdString().c_str(), + CURLFORM_END); + + curl_easy_setopt(curl, CURLOPT_URL, "http://pokerth.net/floty_upload/upload.php"); + curl_easy_setopt(curl, CURLOPT_HTTPPOST, post); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); + + res = curl_easy_perform(curl); + + if(res) { + qDebug() << "curl_easy_perform failed: " << res << endl; + } + + id = QString(curl_writedata->getData().data()).trimmed(); + + curl_formfree(post); + + if(id.length() == 40 && !id.contains("ERROR")) { + + qDebug() << id << endl; + QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id)); + + } else { + qDebug() << QString::fromStdString(curl_writedata->getData()) << endl; + } + } else { + qDebug() << "curl_easy_init failed\n" << endl; + } + } + +} diff --git a/src/gui/qt/logfiledialog/logfiledialog.h b/src/gui/qt/logfiledialog/logfiledialog.h index 7ba586a4..2ef2c929 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.h +++ b/src/gui/qt/logfiledialog/logfiledialog.h @@ -20,7 +20,7 @@ #define LOGFILEDIALOG_H #include - +#include namespace Ui { class LogFileDialog; @@ -29,6 +29,7 @@ namespace Ui { class guiLog; class ConfigFile; +class Callback; class LogFileDialog : public QDialog { @@ -48,12 +49,17 @@ public slots: void exportLogToTxt(); void saveLogFileAs(); void showLogFilePreview(); - void keyPressEvent ( QKeyEvent * event ); + void keyPressEvent ( QKeyEvent * event ); + void uploadFile(); -private: +private: ConfigFile *myConfig; guiLog *myGuiLog; - Ui::LogFileDialog *ui; + Ui::LogFileDialog *ui; + int writer(char *data, size_t size, size_t nmemb,std::string *buffer); + QFile file; + QString id; + }; #endif // LOGFILEDIALOG_H diff --git a/src/gui/qt/resources/emotes/face-angel.png b/src/gui/qt/resources/emotes/face-angel.png new file mode 100644 index 00000000..ee48c5f7 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-angel.png differ diff --git a/src/gui/qt/resources/emotes/face-angry.png b/src/gui/qt/resources/emotes/face-angry.png new file mode 100644 index 00000000..c604fae5 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-angry.png differ diff --git a/src/gui/qt/resources/emotes/face-confused.png b/src/gui/qt/resources/emotes/face-confused.png new file mode 100644 index 00000000..0d25c192 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-confused.png differ diff --git a/src/gui/qt/resources/emotes/face-cool.png b/src/gui/qt/resources/emotes/face-cool.png new file mode 100644 index 00000000..20ce403b Binary files /dev/null and b/src/gui/qt/resources/emotes/face-cool.png differ diff --git a/src/gui/qt/resources/emotes/face-crying.png b/src/gui/qt/resources/emotes/face-crying.png new file mode 100644 index 00000000..57325036 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-crying.png differ diff --git a/src/gui/qt/resources/emotes/face-devilish.png b/src/gui/qt/resources/emotes/face-devilish.png new file mode 100644 index 00000000..189233f8 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-devilish.png differ diff --git a/src/gui/qt/resources/emotes/face-embarrassed.png b/src/gui/qt/resources/emotes/face-embarrassed.png new file mode 100644 index 00000000..b8be9ef7 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-embarrassed.png differ diff --git a/src/gui/qt/resources/emotes/face-in-love.png b/src/gui/qt/resources/emotes/face-in-love.png new file mode 100644 index 00000000..483d4d68 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-in-love.png differ diff --git a/src/gui/qt/resources/emotes/face-kiss.png b/src/gui/qt/resources/emotes/face-kiss.png new file mode 100644 index 00000000..25eaf9f4 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-kiss.png differ diff --git a/src/gui/qt/resources/emotes/face-laugh.png b/src/gui/qt/resources/emotes/face-laugh.png new file mode 100644 index 00000000..ec21ffba Binary files /dev/null and b/src/gui/qt/resources/emotes/face-laugh.png differ diff --git a/src/gui/qt/resources/emotes/face-plain.png b/src/gui/qt/resources/emotes/face-plain.png new file mode 100644 index 00000000..cf0eda4c Binary files /dev/null and b/src/gui/qt/resources/emotes/face-plain.png differ diff --git a/src/gui/qt/resources/emotes/face-quiet.png b/src/gui/qt/resources/emotes/face-quiet.png new file mode 100644 index 00000000..101aa00f Binary files /dev/null and b/src/gui/qt/resources/emotes/face-quiet.png differ diff --git a/src/gui/qt/resources/emotes/face-raspberry.png b/src/gui/qt/resources/emotes/face-raspberry.png new file mode 100644 index 00000000..0731afb6 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-raspberry.png differ diff --git a/src/gui/qt/resources/emotes/face-sad.png b/src/gui/qt/resources/emotes/face-sad.png new file mode 100644 index 00000000..a9d6e27d Binary files /dev/null and b/src/gui/qt/resources/emotes/face-sad.png differ diff --git a/src/gui/qt/resources/emotes/face-sick.png b/src/gui/qt/resources/emotes/face-sick.png new file mode 100644 index 00000000..c05b89a6 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-sick.png differ diff --git a/src/gui/qt/resources/emotes/face-sleep.png b/src/gui/qt/resources/emotes/face-sleep.png new file mode 100644 index 00000000..662c283b Binary files /dev/null and b/src/gui/qt/resources/emotes/face-sleep.png differ diff --git a/src/gui/qt/resources/emotes/face-smile-big.png b/src/gui/qt/resources/emotes/face-smile-big.png new file mode 100644 index 00000000..e9022031 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-smile-big.png differ diff --git a/src/gui/qt/resources/emotes/face-smile-grin.png b/src/gui/qt/resources/emotes/face-smile-grin.png new file mode 100644 index 00000000..d67ffa66 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-smile-grin.png differ diff --git a/src/gui/qt/resources/emotes/face-smile.png b/src/gui/qt/resources/emotes/face-smile.png new file mode 100644 index 00000000..df52d2dc Binary files /dev/null and b/src/gui/qt/resources/emotes/face-smile.png differ diff --git a/src/gui/qt/resources/emotes/face-smirk.png b/src/gui/qt/resources/emotes/face-smirk.png new file mode 100644 index 00000000..dee3a73c Binary files /dev/null and b/src/gui/qt/resources/emotes/face-smirk.png differ diff --git a/src/gui/qt/resources/emotes/face-surprise.png b/src/gui/qt/resources/emotes/face-surprise.png new file mode 100644 index 00000000..4aa2cbdd Binary files /dev/null and b/src/gui/qt/resources/emotes/face-surprise.png differ diff --git a/src/gui/qt/resources/emotes/face-uncertain.png b/src/gui/qt/resources/emotes/face-uncertain.png new file mode 100644 index 00000000..8b07f78d Binary files /dev/null and b/src/gui/qt/resources/emotes/face-uncertain.png differ diff --git a/src/gui/qt/resources/emotes/face-wink.png b/src/gui/qt/resources/emotes/face-wink.png new file mode 100644 index 00000000..aed02d7f Binary files /dev/null and b/src/gui/qt/resources/emotes/face-wink.png differ diff --git a/src/gui/qt/resources/emotes/face-worried.png b/src/gui/qt/resources/emotes/face-worried.png new file mode 100644 index 00000000..9edcd127 Binary files /dev/null and b/src/gui/qt/resources/emotes/face-worried.png differ diff --git a/src/gui/qt/resources/emotes/face-yawn.png b/src/gui/qt/resources/emotes/face-yawn.png new file mode 100644 index 00000000..d315cc8f Binary files /dev/null and b/src/gui/qt/resources/emotes/face-yawn.png differ diff --git a/src/gui/qt/resources/pokerth.qrc b/src/gui/qt/resources/pokerth.qrc index 10b8894a..8d255717 100644 --- a/src/gui/qt/resources/pokerth.qrc +++ b/src/gui/qt/resources/pokerth.qrc @@ -1,4 +1,4 @@ - + view-fullscreen.png swbuttoninternetgame.png @@ -309,4 +309,31 @@ cflags/np.png cflags/undefined.png + + emotes/face-angel.png + emotes/face-angry.png + emotes/face-confused.png + emotes/face-cool.png + emotes/face-crying.png + emotes/face-devilish.png + emotes/face-embarrassed.png + emotes/face-in-love.png + emotes/face-kiss.png + emotes/face-laugh.png + emotes/face-plain.png + emotes/face-quiet.png + emotes/face-raspberry.png + emotes/face-sad.png + emotes/face-sick.png + emotes/face-sleep.png + emotes/face-smile-big.png + emotes/face-smile-grin.png + emotes/face-smile.png + emotes/face-smirk.png + emotes/face-surprise.png + emotes/face-uncertain.png + emotes/face-wink.png + emotes/face-worried.png + emotes/face-yawn.png + diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index 880bfcb3..84802498 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -1,6 +1,6 @@ /***************************************************************************** * PokerTH - The open source texas holdem engine * - * Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May * + * Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU Affero General Public License as * diff --git a/src/pokerth.cpp b/src/pokerth.cpp index 5fa8c3f3..5b769745 100755 --- a/src/pokerth.cpp +++ b/src/pokerth.cpp @@ -73,7 +73,7 @@ int main( int argc, char **argv ) /////// can be removed for non-qt-guis //////////// QtSingleApplication a( argc, argv ); - if (a.sendMessage("Wake up!")) { + if (a.sendMessage("Wake up!")) { return 0; } @@ -138,8 +138,8 @@ int main( int argc, char **argv ) qRegisterMetaType("DenyGameInvitationReason"); /////////////////////////////////////////////////// - startWindowImpl mainWin(myConfig,myLog); - a.setActivationWindow(&mainWin, true); + startWindowImpl mainWin(myConfig,myLog); + a.setActivationWindow(&mainWin, true); int retVal = a.exec();