Skip to content

Commit 1dd5515

Browse files
committed
Support app relocation & AppImage packing
1 parent 0697e16 commit 1dd5515

File tree

10 files changed

+25
-15
lines changed

10 files changed

+25
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ file(GLOB_RECURSE SRC_LIST
4848
src/*.h
4949
)
5050

51-
file(COPY gs.key assets DESTINATION ${CMAKE_BINARY_DIR}/bin)
51+
file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/bin)
5252

5353
add_executable(${PROJECT_NAME} ${SRC_LIST})
5454

File renamed without changes.

assets/icon.ico

-97.3 KB
Binary file not shown.

build-appimage.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ make -j$(nproc)
88
make install DESTDIR=AppDir
99

1010
cp ./assets/logo.png ./AppDir/usr/share/icons/hicolor/128x128/apps/aviateur.png
11-
cp -r ./appimage-build/assets/ ./appimage-build/AppDir/
11+
cp -r ./bin/assets ./AppDir
12+
cp -r ./bin/aviateur ./AppDir/usr/bin
1213

1314
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
1415

src/gui/control_panel.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void ControlPanel::custom_ready() {
112112
dongle_menu_button_->connect_signal("item_selected", callback);
113113

114114
refresh_dongle_button_ = std::make_shared<revector::Button>();
115-
auto icon = std::make_shared<revector::VectorImage>("assets/Refresh.svg");
115+
auto icon = std::make_shared<revector::VectorImage>(revector::get_asset_dir("Refresh.svg"));
116116
refresh_dongle_button_->set_icon_normal(icon);
117117
refresh_dongle_button_->set_text("");
118118
hbox_container->add_child(refresh_dongle_button_);
@@ -206,8 +206,10 @@ void ControlPanel::custom_ready() {
206206
auto file_dialog = std::make_shared<revector::FileDialog>();
207207
add_child(file_dialog);
208208

209-
auto defaultKeyPath = std::filesystem::absolute(keyPath).string();
210-
file_dialog->set_default_path(defaultKeyPath);
209+
if (!keyPath.empty()) {
210+
auto defaultKeyPath = std::filesystem::absolute(keyPath).string();
211+
file_dialog->set_default_path(defaultKeyPath);
212+
}
211213

212214
auto select_button = std::make_shared<revector::Button>();
213215
select_button->set_text(FTR("open"));

src/gui/player_rect.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void PlayerRect::custom_ready() {
6464
auto vbox = std::make_shared<revector::VBoxContainer>();
6565
collapse_panel_->add_child(vbox);
6666

67-
logo_ = std::make_shared<revector::VectorImage>("assets/openipc-logo-white.svg");
67+
logo_ = std::make_shared<revector::VectorImage>(revector::get_asset_dir("openipc-logo-white.svg"));
6868
texture = logo_;
6969

7070
auto render_server = revector::RenderServer::get_singleton();
@@ -172,7 +172,7 @@ void PlayerRect::custom_ready() {
172172
auto capture_button = std::make_shared<revector::Button>();
173173
vbox->add_child(capture_button);
174174
capture_button->set_text(FTR("capture frame"));
175-
auto icon = std::make_shared<revector::VectorImage>("assets/CaptureImage.svg");
175+
auto icon = std::make_shared<revector::VectorImage>(revector::get_asset_dir("CaptureImage.svg"));
176176
capture_button->set_icon_normal(icon);
177177
auto capture_callback = [this] {
178178
auto output_file = player_->captureJpeg();
@@ -186,7 +186,7 @@ void PlayerRect::custom_ready() {
186186

187187
record_button_ = std::make_shared<revector::Button>();
188188
vbox->add_child(record_button_);
189-
auto icon2 = std::make_shared<revector::VectorImage>("assets/RecordVideo.svg");
189+
auto icon2 = std::make_shared<revector::VectorImage>(revector::get_asset_dir("RecordVideo.svg"));
190190
record_button_->set_icon_normal(icon2);
191191
record_button_->set_text(FTR("record mp4") + " (F10)");
192192

src/gui_interface.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class GuiInterface {
119119
ini_[CONFIG_ADAPTER][ADAPTER_DEVICE] = "";
120120
ini_[CONFIG_ADAPTER][ADAPTER_CHANNEL] = "161";
121121
ini_[CONFIG_ADAPTER][ADAPTER_CHANNEL_WIDTH_MODE] = "0";
122-
ini_[CONFIG_ADAPTER][ADAPTER_CHANNEL_KEY] = "gs.key";
122+
ini_[CONFIG_ADAPTER][ADAPTER_CHANNEL_KEY] = "";
123123
ini_[CONFIG_ADAPTER][ADAPTER_CHANNEL_CODEC] = "AUTO";
124124

125125
ini_[CONFIG_STREAMING][CONFIG_STREAMING_URL] = "udp://239.0.0.1:1234";
@@ -185,7 +185,7 @@ class GuiInterface {
185185
static bool Start(const DeviceId &deviceId,
186186
int channel,
187187
int channelWidthMode,
188-
const std::string &keyPath,
188+
std::string keyPath,
189189
const std::string &codec) {
190190
Instance().ini_[CONFIG_ADAPTER][ADAPTER_DEVICE] = deviceId.display_name;
191191
Instance().ini_[CONFIG_ADAPTER][ADAPTER_CHANNEL] = std::to_string(channel);
@@ -199,6 +199,11 @@ class GuiInterface {
199199

200200
Instance().playerCodec = codec;
201201

202+
// If no custom key provided by the user, use the default key.
203+
if (keyPath.empty()) {
204+
keyPath = revector::get_asset_dir("gs.key");
205+
Instance().PutLog(LogLevel::Info, "Using GS key: {}", keyPath);
206+
}
202207
return WfbReceiver::Instance().Start(deviceId, channel, channelWidthMode, keyPath);
203208
}
204209

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ int main() {
1818

1919
GuiInterface::Instance().PutLog(LogLevel::Info, "revector app created");
2020

21-
revector::TranslationServer::get_singleton()->load_translations("assets/translations.csv");
21+
revector::TranslationServer::get_singleton()->load_translations(revector::get_asset_dir("translations.csv"));
2222

23-
auto font = std::make_shared<revector::Font>("assets/NotoSansSC-Regular.ttf");
23+
auto font = std::make_shared<revector::Font>(revector::get_asset_dir("NotoSansSC-Regular.ttf"));
2424
revector::DefaultResource::get_singleton()->set_default_font(font);
2525

2626
// Initialize the default libusb context.

src/player/YuvRenderer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "YuvRenderer.h"
22

33
#include "libavutil/pixfmt.h"
4+
#include "resources/resource.h"
45

56
std::string vertCode = R"(#version 310 es
67
@@ -222,7 +223,8 @@ void YuvRenderer::updateTextureData(const std::shared_ptr<AVFrame>& curFrameData
222223
mStabXform.v[6] = stabXform.at<double>(0, 2) / mTexY->get_size().x;
223224
mStabXform.v[7] = stabXform.at<double>(1, 2) / mTexY->get_size().y;
224225

225-
mStabXform = mStabXform.scale(Pathfinder::Vec2F(1.0f + (float)HORIZONTAL_BORDER_CROP / mTexY->get_size().x));
226+
mStabXform =
227+
mStabXform.scale(Pathfinder::Vec2F(1.0f + (float)HORIZONTAL_BORDER_CROP / mTexY->get_size().x));
226228
}
227229

228230
mPreviousFrame = frameY.clone();
@@ -281,7 +283,7 @@ void YuvRenderer::updateTextureData(const std::shared_ptr<AVFrame>& curFrameData
281283
texYData = enhancedFrameY.data;
282284
} else if (mLowLightEnhancementAdvanced) {
283285
if (!mNet.has_value()) {
284-
mNet = PairLIE("assets/weights/pairlie_180x320.onnx");
286+
mNet = PairLIE(revector::get_asset_dir("weights/pairlie_180x320.onnx"));
285287
}
286288

287289
cv::Mat originalFrameY =

0 commit comments

Comments
 (0)