Author: mir3x
Date: Sat Dec  5 19:43:54 2015
New Revision: 30859

URL: http://svn.gna.org/viewcvs/freeciv?rev=30859&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:
    branches/S2_6/client/gui-qt/chatline.cpp
    branches/S2_6/client/options.c
    branches/S2_6/client/options.h

Modified: branches/S2_6/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/chatline.cpp?rev=30859&r1=30858&r2=30859&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/chatline.cpp    (original)
+++ branches/S2_6/client/gui-qt/chatline.cpp    Sat Dec  5 19:43:54 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: branches/S2_6/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/options.c?rev=30859&r1=30858&r2=30859&view=diff
==============================================================================
--- branches/S2_6/client/options.c      (original)
+++ branches/S2_6/client/options.c      Sat Dec  5 19:43:54 2015
@@ -277,7 +277,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
@@ -2813,7 +2814,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: branches/S2_6/client/options.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/options.h?rev=30859&r1=30858&r2=30859&view=diff
==============================================================================
--- branches/S2_6/client/options.h      (original)
+++ branches/S2_6/client/options.h      Sat Dec  5 19:43:54 2015
@@ -295,6 +295,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