Skip to content

Commit

Permalink
housekeeping
Browse files Browse the repository at this point in the history
  * updated CodeBlocksLinux project
  * updated changelog, version numbers, and READMEs
  * added Builds/Scripts/cppcheck-filtered.sh
  * addresssed some lint issues
  * added AvCaster::SetWindowTitle()
  * removed MainContent::instantiate(), MainContent::setTitle()
  * removed AvCasterApplication param from MainWindow constructor
  * removed MainWindow param from MainContent constructor
  • Loading branch information
bill-auger committed Nov 15, 2015
1 parent e8cb92d commit 48355fc
Show file tree
Hide file tree
Showing 20 changed files with 212 additions and 177 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# links
mk*
mk
mk-clean
mk-reset
dbg
cppcheck-filtered

# builds
Builds/*
Expand Down
2 changes: 1 addition & 1 deletion Builds/Scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
the build helper scripts contained in this directory should be run from the project root directory

run setup-build-helpers.sh from this directory to link these scripts in the project root
run setup-build-helpers from this directory to link these scripts in the project root
24 changes: 24 additions & 0 deletions Builds/Scripts/cppcheck-filtered
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash


echo "running cppcheck --enable=all on ./Source/ with filters"

# supress warnings for 'unused' event handlers
# so that we can exclude the JUCE library from cppcheck
cppcheck --enable=all --template=gcc --quiet Source/ 2> >(
grep -v "Cppcheck cannot find all the include files" |
grep -v "The function 'initialise' is never used." |
grep -v "The function 'anotherInstanceStarted' is never used." |
grep -v "The function 'moreThanOneInstanceAllowed' is never used." |
grep -v "The function 'closeButtonPressed' is never used." |
grep -v "The function 'timerCallback' is never used." |
grep -v "The function 'getApplicationName' is never used." |
grep -v "The function 'getApplicationVersion' is never used." |
grep -v "The function 'resized' is never used." |
grep -v "The function 'paint' is never used." |
grep -v "The function 'broughtToFront' is never used." |
grep -v "The function 'buttonClicked' is never used." |
grep -v "The function 'comboBoxChanged' is never used." |
grep -v "The function 'sliderValueChanged' is never used." |
grep -v "The function 'textEditorFocusLost' is never used." |
grep -v "The function 'valueTreePropertyChanged' is never used." )
8 changes: 7 additions & 1 deletion Builds/Scripts/mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ export GST_DEBUG_NO_COLOR=1 && export GST_DEBUG_FILE=debug.log # log to file
export DOT_DIR=/code/dot
export GST_DEBUG_DUMP_DOT_DIR=$DOT_DIR

# validate specified build configuration
[ "$CONFIG" == "Release" ] || [ "$CONFIG" == "Release32" ] && BINARY=./build/av-caster
[ "$CONFIG" == "Debug" ] || [ "$CONFIG" == "" ] && BINARY=./build/av-caster-dbg
[ "$CONFIG" == "Release" ] || [ "$CONFIG" == "Release32" ] ||
[ "$CONFIG" == "Debug" ] || [ "$CONFIG" == "" ] || (echo "invlaid CONFIG" && exit)

# build project
cd Builds/GnuMakefile && make && ./build/av-caster-dbg $*
cd Builds/GnuMakefile && make && $BINARY $*

# convert dot graphs to images
cd $DOT_DIR
Expand Down
11 changes: 11 additions & 0 deletions Builds/Scripts/setup-build-helpers
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

SCRIPTS_DIR=`pwd`


cd ../../
ln -s $SCRIPTS_DIR/dbg .
ln -s $SCRIPTS_DIR/mk .
ln -s $SCRIPTS_DIR/mk-clean .
ln -s $SCRIPTS_DIR/mk-reset .
ln -s $SCRIPTS_DIR/cppcheck-filtered .
10 changes: 0 additions & 10 deletions Builds/Scripts/setup-build-helpers.sh

This file was deleted.

25 changes: 19 additions & 6 deletions Source/AvCaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ DEBUG_TRACE_INIT_PHASE_2

DEBUG_TRACE_INIT_PHASE_3

// instantiate GUI
Gui->instantiate() ; RefreshGui() ;
// initialze GUI
SetWindowTitle() ; RefreshGui() ;

DEBUG_TRACE_INIT_PHASE_4

Expand Down Expand Up @@ -210,8 +210,9 @@ void AvCaster::HandleConfigChanged(const Identifier& a_key)
{
StorePreset(GetPresetName()) ;

if (a_key == CONFIG::IS_CONFIG_PENDING_ID ||
a_key == CONFIG::PRESET_ID ) RefreshGui() ;
if (a_key == CONFIG::IS_CONFIG_PENDING_ID ||
a_key == CONFIG::PRESET_ID ) RefreshGui() ;
else if (a_key == CONFIG::IS_OUTPUT_ON_ID ) SetWindowTitle() ;
}
else
{
Expand All @@ -230,6 +231,20 @@ DEBUG_TRACE_REFRESH_GUI
else { Gui->config ->toFront(true) ; Gui->preview->toFront(true) ; }
}

void AvCaster::SetWindowTitle()
{
bool is_output_enabled = bool(Store->config[CONFIG::IS_OUTPUT_ON_ID]) ;
int sink_idx = int (Store->config[CONFIG::OUTPUT_SINK_ID ]) ;
String title_text ;

if (!is_output_enabled ) title_text = GUI::IDLE_TITLE_TEXT ;
else if (sink_idx == CONFIG::FILE_STREAM_IDX) title_text = GUI::FILE_TITLE_TEXT ;
else if (sink_idx == CONFIG::RTMP_STREAM_IDX) title_text = GUI::RTMP_TITLE_TEXT ;
else return ;

Gui->getTopLevelComponent()->setName(APP::APP_NAME + " - " + title_text) ;
}

bool AvCaster::HandleCliParams()
{
DEBUG_TRACE_HANDLE_CLI_PARAMS
Expand Down Expand Up @@ -275,8 +290,6 @@ DEBUG_TRACE_VALIDATE_ENVIRONMENT

void AvCaster::DisplayAlert()
{
if (Alerts.size()) DBG("AvCaster::DisplayAlert() Alerts.size()=" + String(Alerts.size())) ;

if (IsAlertModal || Alerts.size() == 0) return ;

GUI::AlertType message_type = Alerts[0]->messageType ;
Expand Down
1 change: 1 addition & 0 deletions Source/AvCaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class AvCaster
static void UpdateStatusGUI () ;
static void HandleConfigChanged(const Identifier& a_key) ;
static void RefreshGui () ;
static void SetWindowTitle () ;

// helpers
static bool HandleCliParams () ;
Expand Down
2 changes: 2 additions & 0 deletions Source/AvCasterStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ DEBUG_TRACE_VERIFY_CONFIG

ValueTree AvCasterStore::verifyPresets()
{
DEBUG_TRACE_VERIFY_PRESETS

ValueTree presets = this->root.getOrCreateChildWithName(CONFIG::PRESETS_ID , nullptr) ;
PresetSeed* file_seed = new FilePresetSeed() ; ValueTree file_preset = file_seed->preset ;
PresetSeed* rtmp_seed = new RtmpPresetSeed() ; ValueTree rtmp_preset = rtmp_seed->preset ;
Expand Down
1 change: 1 addition & 0 deletions Source/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
|*| along with AvCaster. If not, see <http://www.gnu.org/licenses/>.
\*/


#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED

Expand Down
35 changes: 14 additions & 21 deletions Source/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#define DEBUG_TRACE DEBUG_DEFINED && 1
#define DEBUG_TRACE_EVENTS DEBUG_DEFINED && 1
#define DEBUG_TRACE_GUI DEBUG_DEFINED && 1
#define DEBUG_TRACE_MEDIA DEBUG_DEFINED && 1
#define DEBUG_TRACE_MEDIA DEBUG_DEFINED && 0
#define DEBUG_TRACE_CONFIG DEBUG_DEFINED && 1
#define DEBUG_TRACE_STATE DEBUG_DEFINED && 1
#define DEBUG_TRACE_VB DEBUG_DEFINED && 0
Expand All @@ -74,7 +74,7 @@ namespace APP
static const String APP_NAME = "AvCaster" ;
static const String JACK_CLIENT_NAME = APP_NAME ;
static const String VALID_ID_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_- " ;
static const String VALID_URI_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.:/ " ;
static const String VALID_URI_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.:/?= " ;
static const String DIGITS = "0123456789" ;

// timers
Expand Down Expand Up @@ -124,24 +124,17 @@ namespace GUI
static const Colour TEXT_DISABLED_COLOR = Colour(0xFF808080) ;

// MainWindow
static const int TITLEBAR_H = 24 ;

// Background
static const String BACKGROUND_GUI_ID = "statusbar-gui" ;

// MainContent
static const String CONTENT_GUI_ID = "main-content-gui" ;
static const int TITLEBAR_H = 24 ;
static const int TITLEBAR_BTNS = DocumentWindow::minimiseButton | DocumentWindow::closeButton ;
static const String IDLE_TITLE_TEXT = "(Idle)" ;
static const String FILE_TITLE_TEXT = "(Recording)" ;
static const String RTMP_TITLE_TEXT = "(Broadcasting)" ;

// Controls
static const String CONTROLS_GUI_ID = "controls-gui" ;
static const String CONTROLS_TEXT = "Controls" ;
static const String PRESETS_TEXT = "Presets" ;

// Preview
static const String PREVIEW_GUI_ID = "preview-gui" ;
static const String CONTROLS_TEXT = "Controls" ;
static const String PRESETS_TEXT = "Presets" ;

// Config
static const String CONFIG_GUI_ID = "config-gui" ;
static const String DELETE_BTN_CANCEL_TEXT = "Cancel" ;
static const String DELETE_BTN_DELETE_TEXT = "Delete" ;
static const String DELETE_BTN_RESET_TEXT = "Reset" ;
Expand All @@ -154,7 +147,6 @@ namespace GUI
static const String DEST_LCTV_TEXT = "Stream Key:" ;

// StatusBar
static const String STATUSBAR_GUI_ID = "statusbar-gui" ;
static const String INIT_STATUS_TEXT = "Initializing" ;
static const String READY_STATUS_TEXT = "Ready" ;

Expand Down Expand Up @@ -348,12 +340,13 @@ namespace CONFIG
static const Identifier OUTPUT_DEST_ID = "output-dest" ;

// root defaults
#ifdef _WIN32
#ifdef JUCE_WINDOWS
static const String STORAGE_DIRNAME = "AvCaster\\" ;
#else // _WIN32
static const String STORAGE_DIRNAME = ".av-caster/" ;
#endif // _WIN32
static const String STORAGE_FILENAME = "AvCaster.bin" ;
#else // JUCE_WINDOWS
static const String STORAGE_DIRNAME = ".av-caster/" ;
static const String STORAGE_FILENAME = "av-caster.bin" ;
#endif // JUCE_WINDOWS
static const double CONFIG_VERSION = 0.3 ;
static const int DEFAULT_PRESET_IDX = 0 ; // ASSERT: must be 0
static const int N_STATIC_PRESETS = 3 ; // ASSERT: num PresetSeed subclasses
Expand Down
2 changes: 1 addition & 1 deletion Source/Controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ DEBUG_TRACE_HANDLE_PRESETCOMBO
void Controls::toggleControls()
{
bool is_config_pending = AvCaster::GetIsConfigPending() ;
String group_text = (is_config_pending) ? GUI::CONTROLS_TEXT : GUI::PRESETS_TEXT ;
String group_text = (is_config_pending) ? GUI::PRESETS_TEXT : GUI::CONTROLS_TEXT ;

this->controlsGroup ->setText(group_text) ;
this->screencapToggle ->setVisible(!is_config_pending) ;
Expand Down
Loading

0 comments on commit 48355fc

Please sign in to comment.