Skip to content

Commit

Permalink
Merge pull request #134 from Musicoll/dev/master
Browse files Browse the repository at this point in the history
Dev/master
  • Loading branch information
jean-millot committed May 4, 2018
2 parents d8fb172 + 96a5ff8 commit ccbb12e
Show file tree
Hide file tree
Showing 1,463 changed files with 130,650 additions and 15,880 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Project specific
Build/
ThirdParty/flip
ThirdParty/boost
40 changes: 12 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: cpp
dist: trusty
sudo: required
sudo: false

notifications:
email: false
Expand All @@ -15,6 +15,8 @@ matrix:
env: COMPILER=g++-4.9

before_install:
- python --version
- python -c 'import ssl; print ssl.OPENSSL_VERSION;'
- sudo add-apt-repository ppa:webkit-team/ppa -y
- sudo apt-get update
- sudo apt-get install libfreetype6-dev
Expand All @@ -27,29 +29,17 @@ matrix:
- sudo apt-get install libgtk-3-dev
- sudo apt-get install libwebkit2gtk-4.0-dev


addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: [g++-4.9, 'python-pip', 'python-yaml']
packages: [g++-4.9, 'python-pip', 'python-yaml', 'libssl1.0.0']

install:
# make sure CXX is correctly set
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
- git submodule update --init --recursive ThirdParty/Juce ThirdParty/concurrentqueue ThirdParty/Beast
- pip install --user cpp-coveralls
- wget --no-check-certificate -O ../flip-demo.tar.gz http://developer.irisate.com.s3-website-us-east-1.amazonaws.com/files/flip-demo-linux-c47e41da05.tar.gz
- cd ..
- tar xvzf flip-demo.tar.gz &> /dev/null
- export KIWI_FLIP_LIB=$(pwd)/flip-demo/lib/gcc && export KIWI_FLIP_INCLUDE=$(pwd)/flip-demo/include
- cd ${HOME}
- wget --no-check-certificate -O ./boost_1_63_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz
- tar xvzf ./boost_1_63_0.tar.gz &> /dev/null
- cd ./boost_1_63_0
- ./bootstrap.sh toolset=gcc link=static
- ./b2 --with-system stage
- export KIWI_BOOST_INCLUDE=${HOME}/boost_1_63_0
- export KIWI_BOOST_LIB=${HOME}/boost_1_63_0/stage/lib
- cd ${TRAVIS_BUILD_DIR}

script:
- python ./Scripts/configure.py -coverage
Expand Down Expand Up @@ -104,21 +94,15 @@ matrix:
env: COMPILER=clang++
osx_image: xcode9.2

before_install:
- pyenv install 2.7.11
- pyenv global 2.7.11
- eval "$(pyenv init -)"
- python --version
- python -c 'import ssl; print ssl.OPENSSL_VERSION;'

install:
- git submodule update --init --recursive ThirdParty/Juce ThirdParty/concurrentqueue ThirdParty/Beast
- curl -o ../flip-demo.tar.gz -L http://developer.irisate.com.s3-website-us-east-1.amazonaws.com/files/flip-demo-macos-c47e41da05.tar.gz
- cd ..
- tar xvzf flip-demo.tar.gz &> /dev/null
- export KIWI_FLIP_LIB=$(pwd)/flip-demo/lib && export KIWI_FLIP_INCLUDE=$(pwd)/flip-demo/include
- cd ${HOME}
- curl -o ./boost_1_63_0.tar.gz -L https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz
- tar xvzf ./boost_1_63_0.tar.gz &> /dev/null
- cd ./boost_1_63_0
- ./bootstrap.sh toolset=clang macosx-version-min=10.8 architecture=combined link=static
- ./b2 address-model=32_64 --with-system stage
- export KIWI_BOOST_INCLUDE=${HOME}/boost_1_63_0
- export KIWI_BOOST_LIB=${HOME}/boost_1_63_0/stage/lib
- cd ${TRAVIS_BUILD_DIR}

script:
- python ./Scripts/configure.py -c Release
Expand Down
23 changes: 11 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,18 @@ source_group_rec("${JUCE_SRC}" ${ROOT_DIR}/ThirdParty/Juce/modules)
# Flip
#----------------------------------

set(KIWI_FLIP_INCLUDE ${ROOT_DIR}/ThirdParty/flip/include)

if(WIN32)
if (CMAKE_CL_64)
set(KIWI_FLIP_LIB $ENV{KIWI_FLIP_LIB_x64})
set(KIWI_FLIP_INCLUDE $ENV{KIWI_FLIP_INCLUDE_x64})
set(KIWI_FLIP_LIB ${ROOT_DIR}/ThirdParty/flip/lib/VS2015/x64/Release)
else()
set(KIWI_FLIP_LIB $ENV{KIWI_FLIP_LIB_WIN32})
set(KIWI_FLIP_INCLUDE $ENV{KIWI_FLIP_INCLUDE_WIN32})
set(KIWI_FLIP_LIB ${ROOT_DIR}/ThirdParty/flip/lib/VS2015/Win32/Release)
endif()
elseif(LINUX)
set(KIWI_FLIP_LIB ${ROOT_DIR}/ThirdParty/flip/lib/gcc)
else()
set(KIWI_FLIP_LIB $ENV{KIWI_FLIP_LIB})
set(KIWI_FLIP_INCLUDE $ENV{KIWI_FLIP_INCLUDE})
set(KIWI_FLIP_LIB ${ROOT_DIR}/ThirdParty/flip/lib)
endif()

message(STATUS "Searching flip library")
Expand Down Expand Up @@ -295,18 +296,16 @@ set(FLIP_COMPILE_DEFINITIONS "flip_NOTHING=flip_NOTHING_FATAL")
# Beast
#----------------------------------

set(Boost_INCLUDE_DIR $ENV{KIWI_BOOST_INCLUDE})
set(Boost_INCLUDE_DIR ${ROOT_DIR}/ThirdParty/boost)

if (WIN32)
if (CMAKE_CL_64)
set(Boost_LIBRARY_DIR $ENV{KIWI_BOOST_LIB_x64})
set(Boost_LIBRARY_DIR ${ROOT_DIR}/ThirdParty/boost/stage64/lib)
else()
set(Boost_LIBRARY_DIR $ENV{KIWI_BOOST_LIB_WIN32})
set(Boost_LIBRARY_DIR ${ROOT_DIR}/ThirdParty/boost/stage32/lib)
endif()
else()
set(Boost_LIBRARY_DIR $ENV{KIWI_BOOST_LIB})
set(Boost_NO_BOOST_CMAKE true)
set(Boost_NO_SYSTEM_PATHS true)
set(Boost_LIBRARY_DIR ${ROOT_DIR}/ThirdParty/boost/stage/lib)
endif()

option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON)
Expand Down
88 changes: 51 additions & 37 deletions Client/Source/KiwiApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,22 @@ namespace kiwi

m_settings->network().addListener(*this);

m_menu_model.reset(new MainMenuModel());
m_menu_model.reset(new MainMenuModel());

m_scheduler.reset(new tool::Scheduler<>());

m_api_controller.reset(new ApiController());
m_api.reset(new Api(*m_api_controller));

m_instance = std::make_unique<Instance>();
m_command_manager->registerAllCommandsForTarget(this);

checkLatestRelease();
checkLatestRelease();

startTimer(10);

#if JUCE_WINDOWS
m_instance->openFile(juce::File(commandLine.unquoted()));
openCommandFile(commandLine);
#endif

#if JUCE_MAC
Expand All @@ -137,10 +141,7 @@ namespace kiwi

void KiwiApp::anotherInstanceStarted(juce::String const& command_line)
{
if(m_instance)
{
m_instance->openFile(juce::File(command_line.unquoted()));
}
openCommandFile(command_line);
}

void KiwiApp::declareEngineObjects()
Expand Down Expand Up @@ -201,7 +202,14 @@ namespace kiwi
engine::NumberTilde::declare();
engine::Hub::declare();
engine::Mtof::declare();
engine::Send::declare();
engine::Send::declare();
engine::Gate::declare();
engine::Switch::declare();
engine::GateTilde::declare();
engine::SwitchTilde::declare();
engine::Float::declare();
engine::ClipTilde::declare();
engine::Clip::declare();
}

void KiwiApp::declareObjectViews()
Expand All @@ -220,11 +228,15 @@ namespace kiwi
{
#if JUCE_MAC
juce::MenuBarModel::setMacMainMenu(nullptr);
#endif
#endif

m_api->cancelPendingRequest();
stopTimer();

m_instance.reset();
m_api->cancelAll();
m_api.reset();
m_api_controller.reset();
m_api_controller.reset();
m_scheduler.reset();
m_settings.reset();
}

Expand All @@ -238,8 +250,6 @@ namespace kiwi
{
if(m_instance->closeAllPatcherWindows())
{
m_instance.reset();

quit();
}
}
Expand All @@ -258,6 +268,11 @@ namespace kiwi
bool KiwiApp::moreThanOneInstanceAllowed()
{
return true;
}

void KiwiApp::timerCallback()
{
m_scheduler->process();
}

bool KiwiApp::isMacOSX()
Expand Down Expand Up @@ -306,32 +321,18 @@ namespace kiwi
Api& KiwiApp::useApi()
{
return *KiwiApp::use().m_api;
}

tool::Scheduler<>& KiwiApp::useScheduler()
{
return *KiwiApp::use().m_scheduler;
}

void KiwiApp::login(std::string const& name_or_email,
std::string const& password,
std::function<void()> success_callback,
Api::ErrorCallback error_callback)
{
auto& api_controller = *KiwiApp::use().m_api_controller;
void KiwiApp::setAuthUser(Api::AuthUser const& auth_user)
{
(*KiwiApp::use().m_api_controller).setAuthUser(auth_user);

auto success = [cb = std::move(success_callback)]()
{
KiwiApp::useInstance().login();
cb();
};

api_controller.login(name_or_email, password, std::move(success), std::move(error_callback));
}

void KiwiApp::signup(std::string const& username,
std::string const& email,
std::string const& password,
std::function<void(std::string)> success_callback,
Api::ErrorCallback error_callback)
{
auto& api_controller = *KiwiApp::use().m_api_controller;
api_controller.signup(username, email, password, std::move(success_callback), std::move(error_callback));
KiwiApp::useInstance().login();
}

Api::AuthUser const& KiwiApp::getCurrentUser()
Expand All @@ -352,7 +353,7 @@ namespace kiwi

Api::CallbackFn<std::string const&> on_success = [current_version](std::string const& latest_version)
{
KiwiApp::useInstance().useScheduler().schedule([current_version, latest_version]()
KiwiApp::useScheduler().schedule([current_version, latest_version]()
{
if (current_version.compare(latest_version) != 0)
{
Expand Down Expand Up @@ -382,6 +383,19 @@ namespace kiwi
checkLatestRelease();
}
}

void KiwiApp::openCommandFile(juce::String const& command_line)
{
if (command_line.length() > 0)
{
juce::File file(command_line.unquoted());

if (file.hasFileExtension("kiwi") && m_instance)
{
m_instance->openFile(file);
}
}
}

uint64_t KiwiApp::userID()
{
Expand Down
45 changes: 20 additions & 25 deletions Client/Source/KiwiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
namespace ProjectInfo
{
const char* const projectName = "Kiwi";
const char* const versionString = "v1.0.0-beta";
const int versionNumber = 0x010;
const char* const versionString = "v1.0.0";
const int versionNumber = 0x100;
}

namespace kiwi
Expand All @@ -45,7 +45,8 @@ namespace kiwi
// ================================================================================ //

class KiwiApp : public juce::JUCEApplication,
public NetworkSettings::Listener
public NetworkSettings::Listener,
public juce::Timer
{
public: // methods

Expand All @@ -72,7 +73,10 @@ namespace kiwi
const juce::String getApplicationVersion() override;

//! @brief Checks whether multiple instances of the app are allowed.
bool moreThanOneInstanceAllowed() override;
bool moreThanOneInstanceAllowed() override;

//! @brief Timer call back, processes the scheduler events list.
void timerCallback() override final;

//! @brief Returns true if the app is running in a Mac OSX operating system.
static bool isMacOSX();
Expand All @@ -95,26 +99,13 @@ namespace kiwi
static Instance& useInstance();

//! @brief Get the Api object.
static Api& useApi();

//! @brief Attempt to log-in the user (Async).
//! @param name_or_email The name or email of the user.
//! @param password The user password.
//! @see logout, getCurrentUser
static void login(std::string const& name_or_email,
std::string const& password,
std::function<void()> success_callback,
Api::ErrorCallback error_callback);

//! @brief Attempt to register/signup the user.
//! @param username user name
//! @param email email address
//! @param password password
static void signup(std::string const& username,
std::string const& email,
std::string const& password,
std::function<void(std::string)> success_callback,
Api::ErrorCallback error_callback);
static Api& useApi();

//! @brief Gets the application scheduler.
static tool::Scheduler<>& useScheduler();

//! @brief Sets the auth user.
static void setAuthUser(Api::AuthUser const& auth_user);

//! @brief Returns the current user
static Api::AuthUser const& getCurrentUser();
Expand Down Expand Up @@ -245,6 +236,9 @@ namespace kiwi

// @brief Handles changes of server address.
void networkSettingsChanged(NetworkSettings const& settings, juce::Identifier const& ids) override final;

//! @brief Parse startup command line and open file if exists.
void openCommandFile(juce::String const& command_line);

private: // members

Expand All @@ -257,6 +251,7 @@ namespace kiwi

LookAndFeel m_looknfeel;
TooltipWindow m_tooltip_window;
std::unique_ptr<StoredSettings> m_settings;
std::unique_ptr<StoredSettings> m_settings;
std::unique_ptr<tool::Scheduler<>> m_scheduler;
};
}
2 changes: 1 addition & 1 deletion Client/Source/KiwiApp_Application/KiwiApp_Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ namespace kiwi

void ConsoleContent::consoleHistoryChanged(ConsoleHistory const&)
{
tool::Scheduler<> &scheduler = KiwiApp::useInstance().useScheduler();
tool::Scheduler<> &scheduler = KiwiApp::useScheduler();

scheduler.defer([this]()
{
Expand Down

0 comments on commit ccbb12e

Please sign in to comment.