Google Code-in: Hide "video record" keybind option
authorMitchell Kember <mk12360@gmail.com>
Thu, 29 Nov 2012 19:44:18 -0500
changeset 8144 f3ba33d5d2b1
parent 8142 b10219ef05d3
child 8146 1fba650c2aa4
child 8147 53190e590919
Google Code-in: Hide "video record" keybind option Removes the recording keybinding option using preprocessor conditions when it is unavailable. This includes when Hedgewars is being built either with the recording feature explicitly disabled or when FFMPEG/LibAV were not found. https://google-melange.appspot.com/gci/task/view/google/gci2012/7948213
QTfrontend/CMakeLists.txt
QTfrontend/binds.cpp
QTfrontend/binds.h
--- a/QTfrontend/CMakeLists.txt	Thu Nov 29 14:48:38 2012 -0500
+++ b/QTfrontend/CMakeLists.txt	Thu Nov 29 19:44:18 2012 -0500
@@ -20,6 +20,9 @@
 find_package(SDL_net REQUIRED)   #network frontlib
 if(NOT NOVIDEOREC)
     find_package(FFMPEG)
+    if(${FFMPEG_FOUND})
+        add_definitions(-DUSE_VIDEO_RECORDING)
+    endif()
 endif()
 
 include_directories(.)
--- a/QTfrontend/binds.cpp	Thu Nov 29 14:48:38 2012 -0500
+++ b/QTfrontend/binds.cpp	Thu Nov 29 19:44:18 2012 -0500
@@ -66,5 +66,7 @@
     {"fullscr",   "f12",        QT_TRANSLATE_NOOP("binds", "change mode"),     NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle fullscreen mode:")},
     {"capture",   "c",          QT_TRANSLATE_NOOP("binds", "capture"),         NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Take a screenshot:")},
     {"rotmask",   "delete",     QT_TRANSLATE_NOOP("binds", "hedgehogs\ninfo"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle labels above hedgehogs:")},
+#ifdef USE_VIDEO_RECORDING
     {"record",    "r",          QT_TRANSLATE_NOOP("binds", "record"),          NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Record video:")}
+#endif
 };
--- a/QTfrontend/binds.h	Thu Nov 29 14:48:38 2012 -0500
+++ b/QTfrontend/binds.h	Thu Nov 29 19:44:18 2012 -0500
@@ -21,7 +21,11 @@
 
 #include <QString>
 
+#ifdef USE_VIDEO_RECORDING
 #define BINDS_NUMBER 46
+#else
+#define BINDS_NUMBER 45
+#endif
 
 struct BindAction
 {