MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / start

Method start

pj_widgets/src/RasterStreamView.cpp:29–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void RasterStreamView::start(const QString& helper_path, const QString& wad_path) {
30 if (helper_path.isEmpty() || wad_path.isEmpty()) {
31 endSession();
32 return;
33 }
34 const QString unique = QUuid::createUuid().toString(QUuid::Id128);
35 const QString shm_key = QStringLiteral("pjr-shm-") + unique;
36 const QString sock_name = QStringLiteral("pjr-sock-") + unique;
37
38 shm_ = new QSharedMemory(shm_key, this);
39 const int total = static_cast<int>(pj_raster::shmTotalSize(kWidth, kHeight, pj_raster::kBytesPerPixel));
40 if (!shm_->create(total)) {
41 endSession();
42 return;
43 }
44
45 server_ = new QLocalServer(this);
46 connect(server_, &QLocalServer::newConnection, this, &RasterStreamView::onHelperConnected);
47 QLocalServer::removeServer(sock_name);
48 if (!server_->listen(sock_name)) {
49 endSession();
50 return;
51 }
52
53 process_ = new QProcess(this);
54 connect(process_, &QProcess::finished, this, [this](int, QProcess::ExitStatus) { endSession(); });
55 connect(process_, &QProcess::errorOccurred, this, [this](QProcess::ProcessError) { endSession(); });
56 process_->start(
57 helper_path,
58 {QStringLiteral("--shm"), shm_key, QStringLiteral("--sock"), sock_name, QStringLiteral("--wad"), wad_path});
59}
60
61void RasterStreamView::setKeyTranslator(std::function<int(int)> translator) {
62 key_translator_ = translator ? std::move(translator) : std::function<int(int)>([](int key) { return key; });

Callers 15

mainFunction · 0.45
scheduleRefreshMethod · 0.45
TESTFunction · 0.45
startAutoRepeatMethod · 0.45
onAutoRepeatTickMethod · 0.45
animateHoverMethod · 0.45
setCheckedMethod · 0.45
showAnimatedMethod · 0.45
hideAnimatedMethod · 0.45
updateTargetPositionMethod · 0.45
animateSelectedIndexMethod · 0.45
setShownMethod · 0.45

Calls 4

shmTotalSizeFunction · 0.85
toStringMethod · 0.80
createMethod · 0.80
isEmptyMethod · 0.45

Tested by 4

TESTFunction · 0.36
mainFunction · 0.36
TESTFunction · 0.36
TEST_FFunction · 0.36