Commit 1862b804 authored by Emil Axelsson's avatar Emil Axelsson
Browse files

Use libtorrent as a git submodule. Support base library functions in Lua execution of the Launcher.

parent ed895874
master content/2012EventProfile elumenati/spout-implementation elumenati/spoutImplementation feature/2012Fieldlines feature/WSA feature/apollo-missions feature/arrow-renderable feature/asset-helper feature/asset-meta-update-part2 feature/asset-require feature/atmosphere-stars-rendering feature/bufferTransferTestings feature/camera-control-during-path feature/camera-path-stability feature/cef-update feature/change-renderbin-runtime feature/cmake feature/codegen-lua feature/codegen-lua-jenkins feature/compile-times feature/direction-hint-renderable feature/downscaledATM feature/du-meshes-selection feature/fieldlines feature/gamma-correction feature/geojson feature/geojson-renderable feature/getting-started-tour feature/grid-labels feature/grids-update feature/gui-mouseinteraction-fix feature/horizons-framework feature/horizons-unit-tests feature/idle-behavior-updates feature/imageTestKeys2Actions feature/jenkins-codegen feature/jenkins-fix feature/jenkins-timeout feature/juice feature/jwst-pointing feature/jwst-trail-update feature/jwst-update feature/labels-rendering feature/location-measure feature/macos feature/mars-moons feature/mas-model feature/missions feature/model-opacity feature/molecule_rendering feature/mollwide-projection feature/multiple-endpoints feature/multiresvolume feature/orientation-check feature/paper-atmosphere feature/properties-visibility feature/renderable-enabled-event feature/rover-visualization feature/satellites feature/saturn-shepherd-moons feature/science-on-the-sphere feature/sgct-framebuffer-fixes feature/sgct-gui feature/sgct-gui-editable feature/sgct-gui-jenkins feature/sgct-json feature/sgct-ui feature/side-by-side-removal feature/skybrowser feature/skybrowser-cleanup feature/skybrowser-drag-and-drop feature/skybrowser-reload feature/solarbrowsing feature/spacecraft-instruments feature/spaceweather-stream feature/spice-update feature/state-with-time feature/tileprovider-minlevel feature/tileproviders feature/tle-bodymass feature/touchEventListener feature/transparency-rendering-last feature/ubuntu2204 feature/unit-tests feature/updateTSP feature/userproperties feature/various-changes feature/video-on-globe feature/visual-testing feature/visual-testing-try2 feature/volume-fixes feature/warnings feature/wormhole feature/xbox-update hotfix/scaling integration/atm-paper-fixes-2 integration/moon-mars-show integration/paper-atmosphere issue/1043 issue/1161 issue/1279 issue/1366-2 issue/1479 issue/1559 issue/1607 issue/1666 issue/1707 issue/1751 issue/1814 issue/1827 issue/1842 issue/1845 issue/1851 issue/1905 issue/1908 issue/1910 issue/1911 issue/1964 issue/1989 issue/1995 issue/2029 issue/2055 issue/2093 issue/2111 issue/2118 issue/2121 issue/2127 issue/2133 issue/2137 issue/2194 issue/2207 issue/2209 issue/2212 issue/2236 issue/2259 issue/2261 issue/2266 issue/2269 issue/843 issue/888 issue/hdrModels jenkins/1 jenkins/2 jenkins/2286 jenkins/utah-test-1 project/2021-wisdome-installation project/climate project/exoplanet-explorer project/exoplanets-expert-tool project/lights-2020-installation project/spaceship-installation project/spvl rc/0.18.1 temp/skybrowser-animation-fixes-merge thesis/2017/mars-rover-visualization thesis/2018/data-loader thesis/2018/dsn thesis/2018/flightcontroller thesis/2018/mas-model thesis/2019/spaceDebris thesis/2019/spaceweather-stream thesis/2020/software-integration thesis/2020/sonification thesis/2021/airtraffic thesis/2021/fieldlines thesis/2021/multiuser-collab thesis/2021/multiuser-collab3 thesis/2021/skybrowser thesis/2022/climate thesis/2022/cosmic-view thesis/2022/fieldline-rendering thesis/2022/remote-streaming thesis/2022/software-integration thesis/2022/software-integration_dod thesis/2022/software-integration_receive-ra-dec thesis/2022/software-integration_refactor-simp thesis/2022/software-integration_velocity-support thesis/2022/streaming vislabs/release/2.1 research/atmospheres releases/v0.18.0 releases/v0.17.2 releases/v0.17.1 releases/v0.17.0 releases/v0.16.1 releases/v0.16.0 releases/v0.15.2 releases/v0.15.1 releases/v0.15.0 releases/v0.14.1 releases/v0.14.0 releases/v0.13.0 releases/v0.12.0 releases/v0.11.1 releases/v0.11.0 releases/v0.10.0 releases/prerelease/astc-2017 releases/beta/beta-9 releases/beta/beta-8 releases/beta/beta-7 releases/beta/beta-5 releases/beta/beta-4_2 releases/beta/beta-4 releases/beta/beta-3 releases/beta/beta-2 releases/beta/beta-1_2 releases/beta/beta-1 dev/fc-port-change beta/beta-4_2 beta/beta-4 beta/beta-3 beta/beta-2 beta/beta-1_2 beta/beta-1
No related merge requests found
Showing with 44 additions and 18 deletions
+44 -18
......@@ -13,3 +13,6 @@
[submodule "modules/touch/ext/libTUIO11"]
path = modules/touch/ext/libTUIO11
url = https://github.com/mkalten/TUIO11_CPP
[submodule "apps/Launcher/ext/libtorrent"]
path = apps/Launcher/ext/libtorrent
url = https://github.com/OpenSpace/libtorrent.git
......@@ -65,9 +65,14 @@ target_link_libraries(
#####
# Libtorrent
#####
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
SET(LIBTORRENT_encryption OFF)
SET(LIBTORRENT_shared OFF)
include_external_library(
Launcher
libtorrent
torrent-rasterbar
${CMAKE_CURRENT_SOURCE_DIR}/ext/libtorrent
)
target_include_directories(
......
Subproject commit 600dad575a4b12cbe50195538dccd26ccfdce6ee
......@@ -30,6 +30,8 @@
#include <QLabel>
#include <QProgressBar>
#include <libtorrent/torrent_status.hpp>
InfoWidget::InfoWidget(QString name, int totalBytes)
: QGroupBox(nullptr)
, _name(nullptr)
......
......@@ -33,6 +33,7 @@
#include <ghoul/filesystem/file.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/luastate.h>
#include <ghoul/misc/dictionary.h>
#include <QApplication>
......@@ -53,6 +54,7 @@
#include <libtorrent/bencode.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/torrent_info.hpp>
#include <fstream>
......@@ -137,19 +139,19 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
libtorrent::error_code ec;
_session->listen_on(std::make_pair(20280, 20290), ec);
libtorrent::session_settings settings = _session->settings();
settings.user_agent =
"OpenSpace/" +
libtorrent::settings_pack settings;
settings.set_str(libtorrent::settings_pack::user_agent, "OpenSpace/" +
std::to_string(openspace::OPENSPACE_VERSION_MAJOR) + "." +
std::to_string(openspace::OPENSPACE_VERSION_MINOR) + "." +
std::to_string(openspace::OPENSPACE_VERSION_PATCH);
settings.allow_multiple_connections_per_ip = true;
settings.ignore_limits_on_local_network = true;
settings.connection_speed = 20;
settings.active_downloads = -1;
settings.active_seeds = -1;
settings.active_limit = 30;
settings.dht_announce_interval = 60;
std::to_string(openspace::OPENSPACE_VERSION_PATCH));
settings.set_bool(libtorrent::settings_pack::allow_multiple_connections_per_ip, true);
settings.set_bool(libtorrent::settings_pack::ignore_limits_on_local_network, true);
settings.set_int(libtorrent::settings_pack::connection_speed, 20);
settings.set_int(libtorrent::settings_pack::active_downloads, -1);
settings.set_int(libtorrent::settings_pack::active_seeds, -1);
settings.set_int(libtorrent::settings_pack::active_limit, 30);
settings.set_int(libtorrent::settings_pack::dht_announce_interval, 60);
_session->apply_settings(settings);
if (ec) {
LFATAL("Failed to open socket: " << ec.message());
......@@ -187,6 +189,8 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
timer->start(100);
_mutex.clear();
_scriptEngine.initialize();
}
SyncWidget::~SyncWidget() {
......@@ -325,10 +329,9 @@ void SyncWidget::handleTorrentFiles() {
//p.save_path =
p.save_path = absPath(f.destination.toStdString());
p.ti = new libtorrent::torrent_info(file.toStdString(), ec);
p.ti = std::make_shared<libtorrent::torrent_info>(file.toStdString(), ec);
p.name = f.file.toStdString();
p.storage_mode = libtorrent::storage_mode_allocate;
p.auto_managed = true;
if (ec) {
LERROR(f.file.toStdString() << ": " << ec.message());
continue;
......@@ -358,13 +361,23 @@ void SyncWidget::handleTorrentFiles() {
void SyncWidget::syncButtonPressed() {
clear();
ghoul::lua::LuaState state;
_scriptEngine.initializeLuaState(state);
for (const QString& scene : selectedScenes()) {
LDEBUG(scene.toStdString());
ghoul::Dictionary sceneDictionary;
ghoul::lua::loadDictionaryFromFile(
scene.toStdString(),
sceneDictionary
);
try {
ghoul::lua::loadDictionaryFromFile(
scene.toStdString(),
sceneDictionary,
state
);
} catch (const ghoul::lua::LuaRuntimeException& e) {
LERROR(e.message);
return;
}
ghoul::Dictionary modules;
bool success = sceneDictionary.getValue<ghoul::Dictionary>("Modules", modules);
......
......@@ -30,6 +30,7 @@
#include <QMap>
#include <openspace/engine/downloadmanager.h>
#include <openspace/scripting/scriptengine.h>
#include <libtorrent/torrent_handle.hpp>
......@@ -118,6 +119,7 @@ private:
std::atomic_flag _mutex;
std::unique_ptr<openspace::DownloadManager> _downloadManager;
openspace::scripting::ScriptEngine _scriptEngine;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment