qstring multi-arg, connect/action context object, signal qualification
parent
22b06c465a
commit
95c0af06be
|
@ -182,7 +182,7 @@ void BeatPad::initUI(NodeUIScene* scene) {
|
|||
auto c = f->second;
|
||||
QString n;
|
||||
if (auto smp = c->smp.lock(); smp) n = smp->name.section('/', -1, -1);
|
||||
v.push_back({ f->first, qs("%1 %2").arg(Util::noteName(i)).arg(n) });
|
||||
v.push_back({ f->first, qs("%1 %2").arg(Util::noteName(i), n) });
|
||||
}
|
||||
}
|
||||
return v;
|
||||
|
@ -197,7 +197,7 @@ void BeatPad::initUI(NodeUIScene* scene) {
|
|||
for (int16_t i = 0; i < 12; i++) {
|
||||
int16_t n = oct*12+i;
|
||||
if (auto f = cfg.find(n); f != cfg.end()) mo->addAction(Util::noteName(n))->setDisabled(true);
|
||||
else mo->addAction(Util::noteName(n), [=] { state->selectNote(n); });
|
||||
else mo->addAction(Util::noteName(n), m, [=] { state->selectNote(n); });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -217,7 +217,7 @@ void BeatPad::initUI(NodeUIScene* scene) {
|
|||
sampleSelector->setSample(smp);
|
||||
gain->bind(state->cfg->gain);
|
||||
|
||||
noteSelector->setEntry({n, qs("%1 %2").arg(Util::noteName(n)).arg(smp ? smp->name.section('/', -1, -1) : "")}, false);
|
||||
noteSelector->setEntry({n, qs("%1 %2").arg(Util::noteName(n), smp ? smp->name.section('/', -1, -1) : "")}, false);
|
||||
};
|
||||
state->setSample = [=](std::shared_ptr<Sample> smp) {
|
||||
state->cfg->smp = smp;
|
||||
|
@ -225,7 +225,7 @@ void BeatPad::initUI(NodeUIScene* scene) {
|
|||
if (smp) cfg[n] = state->cfg;
|
||||
else if (auto f = cfg.find(n); f != cfg.end()) cfg.erase(f);
|
||||
|
||||
noteSelector->setEntry({n, qs("%1 %2").arg(Util::noteName(n)).arg(smp ? smp->name : "")}, false);
|
||||
noteSelector->setEntry({n, qs("%1 %2").arg(Util::noteName(n), smp ? smp->name : "")}, false);
|
||||
};
|
||||
|
||||
//ol->updateGeometry();
|
||||
|
|
|
@ -128,7 +128,7 @@ void Capaxitor::onGadgetCreated() {
|
|||
|
||||
KnobGadget::autoCreate(l, adsr);
|
||||
|
||||
QObject::connect(sampleSelector, &SampleSelectorGadget::sampleSelected, [=](auto smp) { this->smp = smp; });
|
||||
QObject::connect(sampleSelector, &SampleSelectorGadget::sampleSelected, sampleSelector, [=](auto smp) { this->smp = smp; });
|
||||
}
|
||||
|
||||
void Capaxitor::onDoubleClick() { emit project->socket->openNodeUI(this); }
|
||||
|
|
|
@ -122,7 +122,7 @@ void SampleSelectorGadget::buildSubmenu(DirectoryNode* dir, QMenu* menu) {
|
|||
wfp->setMinimumSize(192, 48);
|
||||
menu->addAction(wa);
|
||||
if (s == smp) wa->setDisabled(true);
|
||||
else connect(wa, &QWidgetAction::triggered, [this, s] { setSample(s); });
|
||||
else connect(wa, &QWidgetAction::triggered, this, [this, s] { setSample(s); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void SampleSelectorGadget::mousePressEvent(QGraphicsSceneMouseEvent* e) {
|
|||
auto* m = new QMenu();
|
||||
if (project->samples.empty()) m->addAction("(no samples in project)")->setDisabled(true);
|
||||
else {
|
||||
m->addAction("(no sample)", [this] { setSample(nullptr); });
|
||||
m->addAction("(no sample)", this, [this] { setSample(nullptr); });
|
||||
m->addSeparator();
|
||||
DirectoryNode root;
|
||||
for (auto s : project->samples) root.placeData(s->name, s->uuid);
|
||||
|
|
|
@ -60,7 +60,7 @@ void SelectorGadget::mousePressEvent(QGraphicsSceneMouseEvent* e) {
|
|||
for (auto e : v) {
|
||||
if (_entry.first == e.first) {
|
||||
m->addAction(e.second)->setDisabled(true);
|
||||
} else m->addAction(e.second, [this, e] {
|
||||
} else m->addAction(e.second, this, [this, e] {
|
||||
setEntry(e);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -47,6 +47,6 @@ namespace Xybrid::UI {
|
|||
inline SelectorGadget* setEditFunc(const std::function<void(QMenu*)>& f) { fEditMenu = f; return this; }
|
||||
|
||||
signals:
|
||||
void onSelect(const Entry&);
|
||||
void onSelect(const Xybrid::UI::SelectorGadget::Entry&);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void PatchboardScene::contextMenuEvent(QGraphicsSceneContextMenuEvent* e) {
|
|||
|
||||
addItem(new NodeObject(n));
|
||||
}, graph.get());
|
||||
m->addAction("Import...", [this, p] {
|
||||
m->addAction("Import...", this, [this, p] {
|
||||
if (auto fileName = FileOps::showOpenDialog(nullptr, "Import node...", Config::Directories::presets, FileOps::Filter::node); !fileName.isEmpty()) {
|
||||
auto n = FileOps::loadNode(fileName, graph);
|
||||
if (!n) return; // right, that can return null
|
||||
|
|
|
@ -401,7 +401,7 @@ void PatternEditorView::headerContextMenu(QPoint pt) {
|
|||
});
|
||||
if (idx < hdr->count() - 1) {
|
||||
menu->addAction("Delete Channel", this, [this, idx, p]() {
|
||||
if (QMessageBox::warning(this, "Are you sure?", QString("Remove channel %1 from pattern %2?").arg(Util::numAndName(idx, p->channel(idx).name)).arg(Util::numAndName(p->index, p->name)), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) return;
|
||||
if (QMessageBox::warning(this, "Are you sure?", QString("Remove channel %1 from pattern %2?").arg(Util::numAndName(idx, p->channel(idx).name), Util::numAndName(p->index, p->name)), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) return;
|
||||
(new PatternChannelDeleteCommand(p, idx))->commit();
|
||||
});
|
||||
menu->addAction("Rename Channel...", this, [this, idx, p]() {
|
||||
|
|
Loading…
Reference in New Issue