Author: mir3x
Date: Sat Dec  5 19:44:11 2015
New Revision: 30860

URL: http://svn.gna.org/viewcvs/freeciv?rev=30860&view=rev
Log:
Qt-client - Added option with configurable string, which will trigger 
sound when some player types it - only in pregame page. 

See patch #6648


Modified:
    trunk/client/gui-qt/chatline.cpp
    trunk/client/options.c
    trunk/client/options.h

Modified: trunk/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=30860&r1=30859&r2=30860&view=diff
==============================================================================
--- trunk/client/gui-qt/chatline.cpp    (original)
+++ trunk/client/gui-qt/chatline.cpp    Sat Dec  5 19:44:11 2015
@@ -20,6 +20,7 @@
 #include <QStyleFactory>
 
 // client
+#include "audio.h"
 #include "climisc.h"      /* for write_chatline_content */
 #include "climap.h"
 #include "control.h"
@@ -500,12 +501,24 @@
                                    int conn_id)
 {
   QString str;
+  QString wakeup;
+
   str = QString::fromUtf8(astring);
   gui()->set_status_bar(str);
   gui()->update_completer();
 
   str = replace_html(str);
-
+  wakeup = gui_options.gui_qt_wakeup_text;
+
+  /* Format wakeup string if needed */
+  if (wakeup.contains("%1")) {
+    wakeup = wakeup.arg(client.conn.username);
+  }
+
+  /* Play sound if we encountered wakeup string */
+  if (str.contains(wakeup) && client_state() < C_S_RUNNING) {
+    audio_play_sound(get_event_tag(E_IMP_SOLD), NULL);
+  }
   gui()->append_output_window(apply_tags(str, tags, false));
   if (gui()->infotab != NULL) {
     gui()->infotab->chtwdg->append(apply_tags(str, tags, true));

Modified: trunk/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.c?rev=30860&r1=30859&r2=30860&view=diff
==============================================================================
--- trunk/client/options.c      (original)
+++ trunk/client/options.c      Sat Dec  5 19:44:11 2015
@@ -279,7 +279,8 @@
   .gui_qt_font_comment_label = "Sans Serif,9,-1,5,50,1,0,0,0,0",
   .gui_qt_font_city_names = "Sans Serif,10,-1,5,75,0,0,0,0,0",
   .gui_qt_font_city_productions = "Sans Serif,10,-1,5,50,1,0,0,0,0",
-  .gui_qt_font_reqtree_text = "Sans Serif,10,-1,5,50,1,0,0,0,0"
+  .gui_qt_font_reqtree_text = "Sans Serif,10,-1,5,50,1,0,0,0,0",
+  .gui_qt_wakeup_text = "Wake up %1"
 };
 
 /* Set to TRUE after the first call to options_init(), to avoid the usage
@@ -2803,7 +2804,12 @@
                   N_("This font is used to the display the requirement tree "
                      "in the Research report."),
                   COC_FONT, GUI_QT,
-                  "Sans Serif,10,-1,5,50,1,0,0,0,0", NULL)
+                  "Sans Serif,10,-1,5,50,1,0,0,0,0", NULL),
+  GEN_STR_OPTION(gui_qt_wakeup_text,
+                 N_("Wake up sequence"),
+                 N_("String which will trigger sound in pregame page,"
+                    "%1 stands for nick"),
+                 COC_INTERFACE, GUI_QT, "Wake up %1", NULL)
 
 };
 static const int client_options_num = ARRAY_SIZE(client_options);

Modified: trunk/client/options.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.h?rev=30860&r1=30859&r2=30860&view=diff
==============================================================================
--- trunk/client/options.h      (original)
+++ trunk/client/options.h      Sat Dec  5 19:44:11 2015
@@ -298,6 +298,7 @@
   char gui_qt_font_city_names[512];
   char gui_qt_font_city_productions[512];
   char gui_qt_font_reqtree_text[512];
+  char gui_qt_wakeup_text[512];
 
   struct overview overview;
 };


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to