Skip to content

Commit

Permalink
Fix build on qt 6.2, name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Dec 11, 2024
1 parent 808c663 commit 4447b84
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 38 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

if(NOT TARGET score_lib_base)
include("${SCORE_SOURCE_DIR}/cmake/ScoreExternalAddon.cmake")
endif()
Expand Down
2 changes: 1 addition & 1 deletion Pico/BasicSourcePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ QString BasicSourcePrinter::print(

source += fmt::format(
R"_(
extern "C" void run_graph(void)
extern "C" void ossia_run_graph(void)
{{
{}
}}
Expand Down
20 changes: 10 additions & 10 deletions Pico/ESPSourcePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

namespace Pico
{
static const std::string error_string = ":*:ERROR:*:";
static const std::string todo_string = ":*:TODO:*:";
static const std::string error_string_esp = ":*:ERROR:*:";
static const std::string todo_string_esp = ":*:TODO:*:";
static std::string address_to_device_read_index(const State::Address& addr)
{
if (addr.path.size() < 2)
return error_string;
return error_string_esp;

// Format:
// /gpio/1
// /adc/2
bool ok{};
int num = addr.path[1].toInt(&ok);
if (!ok)
return error_string;
return error_string_esp;
if (addr.path.startsWith("gpio"))
{
return fmt::format("gpio_get_level(GPIO_NUM_{})", num);
Expand All @@ -34,24 +34,24 @@ static std::string address_to_device_read_index(const State::Address& addr)
{
return fmt::format("adc1_get_raw(ADC1_CHANNEL_{})", num);
}
return todo_string;
return todo_string_esp;
}

static std::string address_to_network_read_index(const State::Address& addr)
{
return todo_string;
return todo_string_esp;
}

static std::string
address_to_device_write_index(const State::Address& addr, std::string var)
{
if (addr.path.size() < 2)
return error_string;
return error_string_esp;

bool ok{};
int num = addr.path[1].toInt(&ok);
if (!ok)
return error_string;
return error_string_esp;
if (addr.path.startsWith("gpio"))
{
return fmt::format("gpio_set_level(GPIO_NUM_{}, {})", num, var);
Expand All @@ -67,12 +67,12 @@ address_to_device_write_index(const State::Address& addr, std::string var)
var);
}

return todo_string;
return todo_string_esp;
}

static std::string address_to_network_write_index(const State::Address& addr)
{
return todo_string;
return todo_string_esp;
}

QString ESPSourcePrinter::printTask(
Expand Down
50 changes: 26 additions & 24 deletions Pico/ExportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <Scenario/Document/BaseScenario/BaseScenario.hpp>
#include <Scenario/Document/ScenarioDocument/ScenarioDocumentModel.hpp>

#include <core/document/Document.hpp>

#include <ossia/network/base/device.hpp>
#include <ossia/network/base/node.hpp>

Expand Down Expand Up @@ -42,7 +44,7 @@ static void copy_folder_recursively(const QString& src, const QString& dst)

while(it.hasNext())
{
const auto fi = it.nextFileInfo();
const auto fi = QFileInfo{it.next()};
const QString abs_path = dst + fi.absoluteFilePath().mid(absSourcePathLength);

if(fi.isDir())
Expand All @@ -62,7 +64,7 @@ ExportDialog::ExportDialog(AppPlug& plug, QWidget* parent)
lay->addRow(tr("Mode"), m_mode);

m_template = new QLineEdit{this};
m_template->setText(PICO_SOURCE_DIR "/templates/totem-tinypico-firmware");
m_template->setText(PICO_SOURCE_DIR "/templates/teensy-minimal");
lay->addRow(tr("Path to template"), m_template);

m_destination = new QLineEdit{this};
Expand Down Expand Up @@ -170,34 +172,34 @@ bool ExportDialog::export_scenario(const score::DocumentContext& ctx)
return false;

QString root = m_destination->text() + QDir::separator();

//
ProcessScenario ps{ctx};
{
QString scenario = ps.process(baseInterval);
QFile f(root + "ossia-scenario.generated.cpp");
QFile f(root + "src/ossia-scenario.generated.cpp");
f.open(QIODevice::WriteOnly);
f.write(scenario.toUtf8());
}

IntervalSplit is{ctx};
{
auto task_text = is.process(baseInterval);

QFile f(root + "ossia-tasks.generated.cpp");
f.open(QIODevice::WriteOnly);
f.write(task_text.toUtf8());
}

ComponentBasedSplit p{ctx};
{
auto res = p.process(baseInterval);
for(const auto& [devname, content] : res)
{
QFile f(root + "ossia-component." + devname + ".generated.cpp");
f.open(QIODevice::WriteOnly);
f.write(content.toUtf8());
}
}
//
// IntervalSplit is{ctx};
// {
// auto task_text = is.process(baseInterval);
//
// QFile f(root + "src/ossia-tasks.generated.cpp");
// f.open(QIODevice::WriteOnly);
// f.write(task_text.toUtf8());
// }

// ComponentBasedSplit p{ctx};
// {
// auto res = p.process(baseInterval);
// for(const auto& [devname, content] : res)
// {
// QFile f(root + "src/ossia-component." + devname + ".generated.cpp");
// f.open(QIODevice::WriteOnly);
// f.write(content.toUtf8());
// }
// }
return true;
}

Expand Down
2 changes: 2 additions & 0 deletions Pico/ExportDialog.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#include <score/document/DocumentContext.hpp>

#include <QDialog>
class QComboBox;
class QLineEdit;
Expand Down
2 changes: 1 addition & 1 deletion Pico/OSCQueryGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ oscquery_generate_namespace_rec(ossia::net::generic_device& odev, const Device::
oscquery_generate_namespace_rec(odev, child);
}

QString oscquery_generate_namespace(const Device::Node& root)
QString oscquery_generate_namespace(const ::Device::Node& root)
{
// 1. Load the data model into an ossia device
ossia::net::generic_device odev;
Expand Down
2 changes: 1 addition & 1 deletion Pico/OSCQueryGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
//}
namespace Pico
{
QString oscquery_generate_namespace(const Device::Node& dev);
QString oscquery_generate_namespace(const ::Device::Node& dev);
}
1 change: 1 addition & 0 deletions Pico/SourcePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ std::string defaultIncludesGraph()
#include <avnd/wrappers/metadatas.hpp>
#include <avnd/../../examples/Advanced/Utilities/Math.hpp>
#include <ExprtkMapper.hpp>
#include <ScoreHelpers.hpp>
)_";
Expand Down

0 comments on commit 4447b84

Please sign in to comment.