• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 44990834010

22 Nov 2026 05:46AM UTC coverage: 61.818% (+0.2%) from 61.617%
44990834010

push

github

jcelerier
UI: the main window opens centred on the screen under the mouse and fits a 4K screen at 300%

The window was sized from the primary screen, while Qt opens it on the
screen under the mouse. When it did not fit there, Qt left it at logical
0,0, which a screen of another scale maps outside the desktop
(x=-10248 on a 100% primary with 300% screens beside it). It is now sized
from the screen it opens on and placed at its centre, with room kept for
the title bar, and on Wayland for a panel the compositor does not report:
three quarters of the screen, but at least 1000x680 when the screen allows.

The inspector and the object tree ask for 200 and 100 px instead of 400
and 160, so the window's minimum height drops from 744 to 484 logical px.
The start screen's header shrinks from 220 to 140 px on a window shorter
than 640, so the start screen fits down to 560: a 4K screen at 300% leaves
about 590 under the macOS menu bar, dock and title bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgugz48pdcaqHJAg2vid

266655 of 799939 branches covered (33.33%)

36 of 38 new or added lines in 4 files covered. (94.74%)

3164 existing lines in 91 files now uncovered.

271878 of 439807 relevant lines covered (61.82%)

767748.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.13
/src/plugins/score-plugin-engine/Engine/ApplicationPlugin.cpp
1
//// This is an open source non-commercial project. Dear PVS-Studio, please
2
/// check / it. PVS-Studio Static Code Analyzer for C, C++ and C#:
3
/// http://www.viva64.com
4
#include "ApplicationPlugin.hpp"
5

6
#include <Explorer/DocumentPlugin/DeviceDocumentPlugin.hpp>
7
#include <Explorer/Settings/ExplorerModel.hpp>
8

9
#include <Scenario/Application/Menus/TransportDisplay.hpp>
10
#include <Scenario/Application/ScenarioActions.hpp>
11
#include <Scenario/Application/ScenarioApplicationPlugin.hpp>
12
#include <Scenario/Inspector/Interval/SpeedSlider.hpp>
13
#include <Scenario/Settings/ScenarioSettingsModel.hpp>
14

15
#include <Execution/DocumentPlugin.hpp>
16
#include <LocalTree/Device/LocalProtocolFactory.hpp>
17
#include <LocalTree/LocalTreeDocumentPlugin.hpp>
18
#include <LocalTree/ReferencesDialog.hpp>
19

20
#include <score/actions/ActionManager.hpp>
21
#include <score/actions/MenuManager.hpp>
22

23
#include <QMenu>
24
#include <score/actions/ToolbarManager.hpp>
25
#include <score/plugins/documentdelegate/plugin/DocumentPluginCreator.hpp>
26
#include <score/tools/Bind.hpp>
27
#include <score/widgets/HelpInteraction.hpp>
28
#include <score/widgets/SetIcons.hpp>
29
#include <score/widgets/TimeSpinBox.hpp>
30

31
#include <Process/ApplicationPlugin.hpp>
32
#include <core/application/ApplicationInterface.hpp>
33
#include <core/application/ApplicationSettings.hpp>
34
#include <core/presenter/DocumentManager.hpp>
35

36
#include <ossia-qt/invoke.hpp>
37

38
#include <QCommandLineParser>
39
#include <QLabel>
40
#include <QMainWindow>
41
#include <QTabWidget>
42
#include <QTimer>
43
#include <QToolBar>
44

45
#include <wobjectimpl.h>
46

47
namespace Engine
48
{
49
ApplicationPlugin::ApplicationPlugin(const score::GUIApplicationContext& ctx)
9,868 ✔
50
    : score::GUIApplicationPlugin{ctx}
4,934 !
51
    , m_playActions{*this, ctx}
4,934 !
52
    , m_execution{ctx}
4,934 !
53
{
4,934 ✔
54
  if(ctx.applicationSettings.gui)
4,934 ✔
55
  {
56
    auto& ctrl = ctx
4,812 ✔
57
            .applicationPlugin<Process::ApplicationPlugin>();
4,812 !
58
    m_playActions.setupContextMenu(ctrl.layerContextMenuRegistrar());
4,812 !
59
  }
4,812 ✔
60

61
  {
62
    // Command-line options for the local device tree default ports.
63
    // CLI flag wins, then $SCORE_LOCAL_{OSC,WS}_PORT, then 6666 / 9999.
64
    QCommandLineParser parser;
4,934 !
65

66
    QCommandLineOption osc_port_opt(
4,934 !
67
        "local-osc-port",
4,934 !
68
        QCoreApplication::translate("engine", "Local device tree OSC port"), "port");
4,934 !
69
    parser.addOption(osc_port_opt);
4,934 !
70
    QCommandLineOption ws_port_opt(
4,934 !
71
        "local-ws-port",
4,934 !
72
        QCoreApplication::translate("engine", "Local device tree WebSocket port"),
4,934 !
73
        "port");
4,934 !
74
    parser.addOption(ws_port_opt);
4,934 !
75

76
    parser.parse(ctx.applicationSettings.arguments);
4,934 !
77

78
    using Protocols::LocalProtocolFactory;
79
    if(parser.isSet(osc_port_opt))
4,934 !
UNCOV
80
      LocalProtocolFactory::defaultOscPort = parser.value(osc_port_opt).toInt();
×
81
    else if(qEnvironmentVariableIsSet("SCORE_LOCAL_OSC_PORT"))
4,934 ✔
82
      LocalProtocolFactory::defaultOscPort
4,932 ✔
83
          = qEnvironmentVariableIntValue("SCORE_LOCAL_OSC_PORT");
4,932 ✔
84

85
    if(parser.isSet(ws_port_opt))
4,934 !
UNCOV
86
      LocalProtocolFactory::defaultWsPort = parser.value(ws_port_opt).toInt();
×
87
    else if(qEnvironmentVariableIsSet("SCORE_LOCAL_WS_PORT"))
4,934 ✔
88
      LocalProtocolFactory::defaultWsPort
4,932 ✔
89
          = qEnvironmentVariableIntValue("SCORE_LOCAL_WS_PORT");
4,932 ✔
90
  }
4,934 ✔
91
}
4,934 ✔
92

93
ApplicationPlugin::~ApplicationPlugin()
9,866 ✔
94
{
4,933 ✔
95
  // The scenarios playing should already have been stopped by virtue of
96
  // aboutToClose.
97
}
9,866 ✔
98

99
void ApplicationPlugin::afterStartup()
123 ✔
100
{
101
  if(!context.documents.documents().empty())
123 !
102
  {
103
    if(context.applicationSettings.autoplay)
123 ✔
104
    {
105
      // TODO what happens if we load multiple documents ?
106
      QTimer::singleShot(
23 ✔
107
          (1 + context.applicationSettings.waitAfterLoad) * 1000, &m_execution,
23 ✔
108
          [this] { m_execution.request_play_local(true); });
46 ✔
109
    }
23 ✔
110
  }
123 ✔
111
}
123 ✔
112

113
void ApplicationPlugin::initialize()
4,934 ✔
114
{
115
  // Update the clock widget
116
  // See TransportActions::makeGUIElements
117
  auto& toolbars = this->context.toolbars.get();
4,934 ✔
118
  auto transport_toolbar = toolbars.find(StringKey<score::Toolbar>("Transport"));
4,934 !
119
  if(transport_toolbar != toolbars.end())
4,934 ✔
120
  {
121
    const auto& tb = transport_toolbar->second.toolbar();
4,812 ✔
122
    if(tb)
4,812 !
123
    {
124
      auto cld = tb->children();
4,812 ✔
125
      if(!cld.empty())
4,812 !
126
      {
127
        if(auto display = dynamic_cast<Scenario::TransportDisplay*>(
4,812 !
128
               tb->findChild<QWidget*>("TimeLabel")))
4,812 !
129
          setupTimingWidget(display);
4,812 !
130

131
        m_speedSlider = dynamic_cast<Scenario::SpeedWidget*>(cld.back());
4,812 !
132
      }
4,812 ✔
133
    }
4,812 ✔
134
  }
4,812 ✔
135

136
  if(m_musicalAct)
4,934 ✔
137
  {
138
    auto& settings = this->context.settings<Scenario::Settings::Model>();
4,812 ✔
139
    m_musicalAct->setChecked(settings.getMeasureBars());
4,812 ✔
140

141
    score::setGlobalTimeMode(
4,812 ✔
142
        settings.getMeasureBars() ? score::TimeMode::Bars : score::TimeMode::Seconds);
4,812 ✔
143

144
    connect(m_musicalAct, &QAction::toggled, this, [this](bool ok) {
4,812 ✔
145
      auto& settings = this->context.settings<Scenario::Settings::Model>();
×
146
      settings.setMeasureBars(ok);
×
147
      settings.setMagneticMeasures(ok);
×
UNCOV
148
      score::setGlobalTimeMode(ok ? score::TimeMode::Bars : score::TimeMode::Seconds);
×
149

150
      //if (auto doc = this->currentDocument())
151
      //{
152
      //  auto& mod = doc->model().modelDelegate();
153
      //  auto scenar = dynamic_cast<Scenario::ScenarioDocumentModel*>(&mod);
154
      //  if (scenar)
155
      //  {
156
      //    auto& itv = scenar->baseInterval();
157
      //    itv.setHasTimeSignature(ok);
158
      //  }
159
      //}
UNCOV
160
    });
×
161
  }
4,812 ✔
162

163
  m_execution.init_transport();
4,934 ✔
164
}
4,934 ✔
165

166
QWidget* ApplicationPlugin::setupTimingWidget(Scenario::TransportDisplay* display)
4,812 ✔
167
{
168
  score::setHelp(display, tr("Elapsed time since the beginning of playback"));
4,812 !
169

170
  auto& settings = this->context.settings<Scenario::Settings::Model>();
4,812 ✔
171
  display->setMusical(settings.getMeasureBars());
4,812 ✔
172
  con(settings, &Scenario::Settings::Model::MeasureBarsChanged, display,
9,624 ✔
173
      [display](bool musical) { display->setMusical(musical); });
4,812 ✔
174

175
  connect(&execution_ui_clock_timer, &QTimer::timeout, display, [this, display] {
22,071 ✔
176
    display->setPosition(
34,518 ✔
177
        m_execution.execution_time(), m_execution.execution_interval(),
17,259 ✔
178
        m_execution.has_execution());
17,259 ✔
179
  });
17,259 ✔
180
  execution_ui_clock_timer.start(1000 / 20);
4,812 ✔
181
  return display;
4,812 ✔
UNCOV
182
}
×
183

184
score::GUIElements ApplicationPlugin::makeGUIElements()
4,812 ✔
185
{
186
  GUIElements e;
4,812 ✔
187

188
  auto& toolbars = e.toolbars;
4,812 ✔
189

190
  toolbars.reserve(4);
4,812 !
191

192
  // The toolbar with the interval controls
193
  {
194
    auto ui_toolbar = new QToolBar(tr("Interval"));
4,812 !
195
    toolbars.emplace_back(
9,624 !
196
        ui_toolbar, StringKey<score::Toolbar>("UISetup"), Qt::BottomToolBarArea, 10);
4,812 ✔
197

198
    {
199
      auto timeline_act = new QAction{tr("Timeline interval"), ui_toolbar};
4,812 !
200
      timeline_act->setCheckable(true);
4,812 !
201
      timeline_act->setChecked(false);
4,812 !
202
      timeline_act->setShortcut(QKeySequence("Ctrl+Alt+N"));
4,812 !
203
      score::setHelp(timeline_act, tr("Change between nodal and timeline mode"));
4,812 !
204
      setIcons(
4,812 !
205
          timeline_act, QStringLiteral(":/icons/nodal_on.png"),
4,812 !
206
          QStringLiteral(":/icons/nodal_hover.png"),
4,812 !
207
          QStringLiteral(":/icons/nodal_on.png"),
4,812 !
208
          QStringLiteral(":/icons/nodal_disabled.png"));
4,812 !
209

210
      connect(timeline_act, &QAction::toggled, this, [timeline_act](bool checked) {
5,817 !
211
        if(!checked)
1,005 ✔
212
        {
213
          setIcons(
12 !
214
              timeline_act, QStringLiteral(":/icons/timeline_on.png"),
12 !
215
              QStringLiteral(":/icons/timeline_hover.png"),
12 !
216
              QStringLiteral(":/icons/timeline_on.png"),
12 !
217
              QStringLiteral(":/icons/timeline_disabled.png"));
12 !
218
        }
12 ✔
219
        else
220
        {
221
          setIcons(
993 !
222
              timeline_act, QStringLiteral(":/icons/nodal_on.png"),
993 !
223
              QStringLiteral(":/icons/nodal_hover.png"),
993 !
224
              QStringLiteral(":/icons/nodal_on.png"),
993 !
225
              QStringLiteral(":/icons/nodal_disabled.png"));
993 !
226
        }
227
      });
1,005 ✔
228
      ui_toolbar->addAction(timeline_act);
4,812 !
229
    }
230

231
    {
232
      m_musicalAct = new QAction{tr("Enable musical mode"), this};
4,812 !
233
      m_musicalAct->setCheckable(true);
4,812 !
234
      score::setHelp(m_musicalAct, tr("Enable musical mode"));
4,812 !
235
      setIcons(
4,812 !
236
          m_musicalAct, QStringLiteral(":/icons/music_on.png"),
4,812 !
237
          QStringLiteral(":/icons/music_hover.png"),
4,812 !
238
          QStringLiteral(":/icons/music_off.png"),
4,812 !
239
          QStringLiteral(":/icons/music_disabled.png"));
4,812 !
240

241
      ui_toolbar->addAction(m_musicalAct);
4,812 !
242
    }
243

244
    {
245
      auto show_cables_act = context.actions.action<Actions::ShowCables>();
4,812 !
246
      ui_toolbar->addAction(show_cables_act.action());
4,812 !
247
    }
4,812 ✔
248
  }
249

250
  {
251
    auto act = new QAction{tr("Broken references..."), this};
4,812 !
252
    score::setHelp(act, tr("List the addresses of the document that point at nothing"));
4,812 !
253
    connect(act, &QAction::triggered, this, [this] {
4,812 !
UNCOV
254
      if(!m_references)
×
255
      {
UNCOV
256
        m_references = new LocalTree::ReferencesDialog{context, context.mainWindow};
×
UNCOV
257
        m_references->setAttribute(Qt::WA_DeleteOnClose);
×
UNCOV
258
        m_references->setDocument(
×
UNCOV
259
            currentDocument() ? &currentDocument()->context() : nullptr);
×
UNCOV
260
      }
×
UNCOV
261
      m_references->show();
×
UNCOV
262
      m_references->raise();
×
UNCOV
263
      m_references->activateWindow();
×
UNCOV
264
    });
×
265
    context.menus.get().at(score::Menus::Windows()).menu()->addAction(act);
4,812 !
266
  }
267

268
  return e;
4,812 ✔
269
}
4,812 ✔
270

271
void ApplicationPlugin::on_initDocument(score::Document& doc)
2,202 ✔
272
{
273
  score::addDocumentPlugin<LocalTree::DocumentPlugin>(doc);
2,202 ✔
274
}
2,202 ✔
275

276
void ApplicationPlugin::on_createdDocument(score::Document& doc)
2,202 ✔
277
{
278
  LocalTree::DocumentPlugin* lt = doc.context().findPlugin<LocalTree::DocumentPlugin>();
2,202 ✔
279
  if(lt)
2,202 !
280
  {
281
    lt->init();
2,202 ✔
282
    initLocalTreeNodes(*lt);
2,202 ✔
283
  }
2,202 ✔
284
  score::addDocumentPlugin<Execution::DocumentPlugin>(doc);
2,202 ✔
285
  if(lt)
2,202 !
286
    lt->connectToStop();
2,202 ✔
287
}
2,202 ✔
288

289
void ApplicationPlugin::on_documentChanged(
4,228 ✔
290
    score::Document* olddoc, score::Document* newdoc)
291
{
292
  if(m_references)
4,228 !
UNCOV
293
    m_references->setDocument(newdoc ? &newdoc->context() : nullptr);
×
294
  if(olddoc)
4,228 ✔
295
  {
296
    // Disable the local tree for this document by removing
297
    // the node temporarily
298
    /*
299
    auto& doc_plugin = olddoc->context().plugin<DeviceDocumentPlugin>();
300
    doc_plugin.setConnection(false);
301
    */
302

303
    if(m_speedSlider)
2,130 ✔
304
      m_speedSlider->unsetInterval();
2,106 ✔
305
    // TODO check whether the widget gets deleted
306
  }
2,130 ✔
307

308
  if(newdoc)
4,228 ✔
309
  {
310
    // Enable the local tree for this document.
311

312
    /*
313
    auto& doc_plugin = newdoc->context().plugin<DeviceDocumentPlugin>();
314
    doc_plugin.setConnection(true);
315
    */
316

317
    // Setup speed toolbar
318
    auto& root = score::IDocument::get<Scenario::ScenarioDocumentModel>(*newdoc);
2,231 ✔
319

320
    if(context.applicationSettings.gui)
2,231 ✔
321
    {
322
      if(m_speedSlider)
2,107 !
323
        m_speedSlider->setInterval(root.baseInterval());
2,107 ✔
324
    }
2,107 ✔
325

326
    // Setup audio & devices
327
    auto& doc_plugin = newdoc->context().plugin<Explorer::DeviceDocumentPlugin>();
2,231 ✔
328
    auto* set = newdoc->context().findPlugin<Explorer::ProjectSettings::Model>();
2,231 ✔
329
    if(set)
2,231 !
330
    {
331
      if(set->getReconnectOnStart())
2,231 !
332
      {
UNCOV
333
        auto& list = doc_plugin.list();
×
UNCOV
334
        list.apply([&](Device::DeviceInterface& dev) {
×
UNCOV
335
          if(&dev != list.audioDevice() && &dev != list.localDevice())
×
UNCOV
336
            dev.reconnect();
×
UNCOV
337
        });
×
338

UNCOV
339
        if(set->getRefreshOnStart())
×
340
        {
UNCOV
341
          list.apply([&](Device::DeviceInterface& dev) {
×
UNCOV
342
            if(&dev != list.audioDevice() && &dev != list.localDevice())
×
UNCOV
343
              if(dev.connected())
×
344
              {
UNCOV
345
                auto old_name = dev.name();
×
UNCOV
346
                auto new_node = dev.refresh();
×
347

UNCOV
348
                auto& explorer = doc_plugin.explorer();
×
349
                const auto& cld = explorer.rootNode().children();
×
350
                for(auto it = cld.begin(); it != cld.end(); ++it)
×
351
                {
352
                  auto ds = it->get<Device::DeviceSettings>();
×
353
                  if(ds.name == old_name)
×
354
                  {
355
                    explorer.removeNode(it);
×
UNCOV
356
                    break;
×
357
                  }
358
                }
×
359

UNCOV
360
                explorer.addDevice(std::move(new_node));
×
361
              }
×
362
          });
×
UNCOV
363
        }
×
364
      }
×
365
    }
2,231 ✔
366
  }
2,231 ✔
367
}
4,228 ✔
368

369
void ApplicationPlugin::prepareNewDocument()
3,322 ✔
370
{
371
  execution().request_stop();
3,322 ✔
372
  // TODO what if JACK is stuck? force-stop after some time ?
373
}
3,322 ✔
374

375
void ApplicationPlugin::initLocalTreeNodes(LocalTree::DocumentPlugin& lt)
2,202 ✔
376
{
377
  auto& root = lt.device().get_root_node();
2,202 ✔
378

379
  {
380
    auto n = root.create_child("running");
2,202 !
381
    auto p = n->create_parameter(ossia::val_type::BOOL);
2,202 ✔
382
    p->set_value(false);
2,202 !
383
    p->set_access(ossia::access_mode::GET);
2,202 ✔
384

385
    connect(
2,202 ✔
386
        &execution(), &Execution::ExecutionController::playStarted, &lt,
2,202 ✔
387
        [p] { p->push_value(true); });
2,780 !
388
    connect(
2,202 ✔
389
        &execution(), &Execution::ExecutionController::playStopped, &lt,
2,202 ✔
390
        [p] { p->push_value(false); });
2,749 !
391
  }
392
  {
393
    auto local_play_node = root.create_child("play");
2,202 !
394
    auto local_play_address = local_play_node->create_parameter(ossia::val_type::BOOL);
2,202 ✔
395
    local_play_address->set_value(bool{false});
2,202 !
396
    local_play_address->set_access(ossia::access_mode::SET);
2,202 ✔
397
    local_play_address->add_callback([&](const ossia::value& v) {
2,202 !
UNCOV
398
      ossia::qt::run_async(this, [this, v] {
×
UNCOV
399
        if(auto val = v.target<bool>())
×
400
        {
UNCOV
401
          execution().request_play_from_localtree(*val);
×
UNCOV
402
        }
×
UNCOV
403
      });
×
UNCOV
404
    });
×
405
  }
406

407
  {
408
    auto local_play_node = root.create_child("global_play");
2,202 !
409
    auto local_play_address = local_play_node->create_parameter(ossia::val_type::BOOL);
2,202 ✔
410
    local_play_address->set_value(bool{false});
2,202 !
411
    local_play_address->set_access(ossia::access_mode::SET);
2,202 ✔
412
    local_play_address->add_callback([&](const ossia::value& v) {
2,202 !
UNCOV
413
      ossia::qt::run_async(this, [this, v] {
×
414
        if(auto val = v.target<bool>())
×
415
        {
UNCOV
416
          execution().request_play_global_from_localtree(*val);
×
417
        }
×
418
      });
×
419
    });
×
420
  }
421

422
  {
423
    auto local_transport_node = root.create_child("transport");
2,202 !
424
    auto local_transport_address
2,202 ✔
425
        = local_transport_node->create_parameter(ossia::val_type::FLOAT);
2,202 ✔
426
    local_transport_address->set_value(bool{false});
2,202 !
427
    local_transport_address->set_access(ossia::access_mode::SET);
2,202 ✔
428
    local_transport_address->set_unit(ossia::millisecond_u{});
2,202 !
429
    local_transport_address->add_callback([&](const ossia::value& v) {
2,202 !
430
      ossia::qt::run_async(this, [this, v] {
×
UNCOV
431
        execution().request_transport_from_localtree(
×
432
            TimeVal::fromMsecs(ossia::convert<float>(v)));
×
433
      });
×
434
    });
×
435
  }
436

437
  {
438
    auto local_stop_node = root.create_child("stop");
2,202 !
439
    auto local_stop_address
2,202 ✔
440
        = local_stop_node->create_parameter(ossia::val_type::IMPULSE);
2,202 ✔
441
    local_stop_address->set_value(ossia::impulse{});
2,202 !
442
    local_stop_address->set_access(ossia::access_mode::SET);
2,202 ✔
443
    local_stop_address->add_callback([&](const ossia::value&) {
2,202 !
UNCOV
444
      ossia::qt::run_async(this, [this] { execution().request_stop_from_localtree(); });
×
UNCOV
445
    });
×
446
  }
447

448
  {
449
    auto local_stop_node = root.create_child("reinit");
2,202 !
450
    auto local_stop_address
2,202 ✔
451
        = local_stop_node->create_parameter(ossia::val_type::IMPULSE);
2,202 ✔
452
    local_stop_address->set_value(ossia::impulse{});
2,202 !
453
    local_stop_address->set_access(ossia::access_mode::SET);
2,202 ✔
454
    local_stop_address->add_callback([&](const ossia::value&) {
2,202 !
UNCOV
455
      ossia::qt::run_async(
×
UNCOV
456
          this, [this] { execution().request_reinitialize_from_localtree(); });
×
UNCOV
457
    });
×
458
  }
459
  {
460
    auto node = root.create_child("exit");
2,202 !
461
    auto address = node->create_parameter(ossia::val_type::STRING);
2,202 ✔
462
    address->set_value(std::string{});
2,202 !
463
    address->set_access(ossia::access_mode::SET);
2,202 ✔
464
    address->add_callback([&](const ossia::value& v) {
2,225 !
465
      bool force = ossia::convert<std::string>(v) == "force";
23 !
466
      ossia::qt::run_async(this, [this, force] {
46 ✔
467
        execution().request_stop_from_localtree();
23 ✔
468

469
        QTimer::singleShot(500, [force] {
46 ✔
470
          if(force)
23 !
471
          {
472
            for(auto& doc : score::GUIAppContext().docManager.documents())
46 ✔
473
            {
474
              doc->commandStack().markCurrentIndexAsSaved();
23 ✔
475
            }
476
          }
23 ✔
477

478
          score::GUIApplicationInterface::instance().forceExit();
23 ✔
479
        });
23 ✔
480
      });
23 ✔
481
    });
23 ✔
482
  }
483

484
  {
485
    auto node = root.create_child("document");
2,202 !
486
    auto address = node->create_parameter(ossia::val_type::INT);
2,202 ✔
487
    address->set_value(0);
2,202 !
488
    address->set_access(ossia::access_mode::BI);
2,202 ✔
489
    address->add_callback([&](const ossia::value& v) {
2,202 !
UNCOV
490
      int val = v.get<int>();
×
UNCOV
491
      ossia::qt::run_async(this, [this, val] {
×
UNCOV
492
        if(context.applicationSettings.gui)
×
493
        {
UNCOV
494
          QTabWidget* docs = context.mainWindow->centralWidget()->findChild<QTabWidget*>(
×
UNCOV
495
              "Documents", Qt::FindDirectChildrenOnly);
×
UNCOV
496
          SCORE_ASSERT(docs);
×
UNCOV
497
          if(docs)
×
498
          {
UNCOV
499
            docs->setCurrentIndex(std::clamp(val, 0, docs->count() - 1));
×
UNCOV
500
          }
×
UNCOV
501
        }
×
UNCOV
502
      });
×
UNCOV
503
    });
×
504
  }
505

506
  {
507
    auto node = root.create_child("reconnect");
2,202 !
508
    auto address = node->create_parameter(ossia::val_type::STRING);
2,202 ✔
509
    address->set_value("");
2,202 !
510
    address->set_access(ossia::access_mode::BI);
2,202 ✔
511
    address->add_callback([&](const ossia::value& v) {
2,202 !
512
      auto val = QString::fromStdString(v.get<std::string>());
×
513
      ossia::qt::run_async(this, [this, device = std::move(val)] {
×
UNCOV
514
        auto doc = currentDocument();
×
515
        if(!doc)
×
516
          return;
×
517

518
        auto& plug = doc->context().plugin<Explorer::DeviceDocumentPlugin>();
×
519
        plug.reconnect(device);
×
UNCOV
520
      });
×
UNCOV
521
    });
×
522
  }
523
// FIXME
524
#if 0
525
  {
526
    auto settings = root.create_child("settings");
527
    auto audio = settings->create_child("audio");
528
    {
529
      {
530
        auto node = audio->create_child("backend");
531
        auto address = node->create_parameter(ossia::val_type::STRING);
532
        address->add_callback([&](const ossia::value& v) {
533
          QString val = QString::fromStdString(v.get<std::string>());
534
          ossia::qt::run_async(this, [this, val] {
535
            auto& set = score::AppContext().settings<Audio::Settings::Model>();
536
          });
537
        });
538
      }
539

540
      {
541
        auto node = audio->create_child("buffer_size");
542
        auto address = node->create_parameter(ossia::val_type::INT);
543
        address->add_callback([&](const ossia::value& v) {
544
          int val = v.get<int>();
545
          ossia::qt::run_async(this, [this, val] {
546
            auto& set = score::AppContext().settings<Audio::Settings::Model>();
547
            set.setBufferSize(val);
548
          });
549
        });
550
      }
551

552
      {
553
        auto node = audio->create_child("rate");
554
        auto address = node->create_parameter(ossia::val_type::INT);
555
        address->add_callback([&](const ossia::value& v) {
556
          int val = v.get<int>();
557
          ossia::qt::run_async(this, [this, val] {
558
            auto& set = score::AppContext().settings<Audio::Settings::Model>();
559
            set.setRate(val);
560
          });
561
        });
562
      }
563
    }
564
  }
565
#endif
566
}
2,202 ✔
567
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc