Skip to content

Commit 4c4a203

Browse files
Merge pull request #25755 from RomanPudashkin/444_port_fixes
444_port_fixes
2 parents 055725f + 1e7d798 commit 4c4a203

File tree

8 files changed

+91
-34
lines changed

8 files changed

+91
-34
lines changed

src/engraving/dom/spanner.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,18 @@ bool Spanner::isUserModified() const
15061506

15071507
void Spanner::eraseSpannerSegments()
15081508
{
1509+
for (SpannerSegment* seg : m_segments) {
1510+
if (System* system = seg->system()) {
1511+
system->remove(seg);
1512+
}
1513+
}
1514+
1515+
for (SpannerSegment* seg : m_unusedSegments) {
1516+
if (System* system = seg->system()) {
1517+
system->remove(seg);
1518+
}
1519+
}
1520+
15091521
muse::DeleteAll(m_segments);
15101522
muse::DeleteAll(m_unusedSegments);
15111523
m_segments.clear();

src/framework/audio/internal/synthesizers/fluidsynth/fluidsynth.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ samples_t FluidSynth::process(float* buffer, samples_t samplesPerChannel)
369369
durationInSamples = microSecsToSamples(duration, m_sampleRate);
370370
}
371371

372+
if (durationInSamples == 0) {
373+
continue;
374+
}
375+
372376
IF_ASSERT_FAILED(sampleOffset + durationInSamples <= samplesPerChannel) {
373377
break;
374378
}

src/framework/audio/qml/Muse/Audio/KnobControl.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Dial {
4545
width: implicitWidth
4646
height: width
4747

48-
wheelEnabled: true
48+
wheelEnabled: false
4949

5050
from: 0
5151
to: 1

src/framework/audio/qml/Muse/Audio/VolumeSlider.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Slider {
4444
value: convertor.volumeLevelToLocal(root.volumeLevel)
4545
stepSize: 0.1
4646
orientation: Qt.Vertical
47-
wheelEnabled: true
47+
wheelEnabled: false
4848

4949
signal increaseRequested()
5050
signal decreaseRequested()

src/framework/uicomponents/qml/Muse/UiComponents/PageTabButton.qml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ RadioDelegate {
131131
implicitWidth: root.leftPadding + contentRow.implicitWidth + root.rightPadding
132132
implicitHeight: contentRow.implicitHeight
133133

134+
TextMetrics {
135+
id: textMetricsNormal
136+
font: root.normalStateFont
137+
text: root.title
138+
}
139+
134140
TextMetrics {
135141
id: textMetricsSelected
136142
font: root.selectedStateFont
@@ -155,7 +161,7 @@ RadioDelegate {
155161
horizontalAlignment: root.isVertical ? Text.AlignHCenter : Text.AlignLeft
156162
font: root.normalStateFont
157163
text: root.title
158-
width: textMetricsSelected.advanceWidth
164+
width: Math.max(textMetricsNormal.advanceWidth, textMetricsSelected.advanceWidth)
159165

160166
visible: !root.iconOnly
161167
}

src/framework/vst/internal/synth/vstsynthesiser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ samples_t VstSynthesiser::process(float* buffer, samples_t samplesPerChannel)
217217
durationInSamples = microSecsToSamples(duration, m_sampleRate);
218218
}
219219

220+
if (durationInSamples == 0) {
221+
continue;
222+
}
223+
220224
IF_ASSERT_FAILED(sampleOffset + durationInSamples <= samplesPerChannel) {
221225
break;
222226
}

src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2895,7 +2895,7 @@ void MusicXMLParserPass2::measureLayout(Measure* measure)
28952895
while (m_e.readNextStartElement()) {
28962896
if (m_e.name() == "measure-distance") {
28972897
const Spatium val(m_e.readDouble() / 10.0);
2898-
if (!measure->prev()->isHBox()) {
2898+
if (!measure->prev() || !measure->prev()->isHBox()) {
28992899
MeasureBase* gap = m_score->insertBox(ElementType::HBOX, measure);
29002900
toHBox(gap)->setBoxWidth(val);
29012901
}

src/playback/view/internal/inputresourceitem.cpp

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -179,54 +179,85 @@ bool InputResourceItem::hasNativeEditorSupport() const
179179

180180
QVariantMap InputResourceItem::buildMuseMenuItem(const ResourceByVendorMap& resourcesByVendor) const
181181
{
182-
muse::String currentPack = m_currentInputParams.resourceMeta.attributeVal(u"musePack");
183-
muse::String currentVendorName = m_currentInputParams.resourceMeta.attributeVal(u"museVendorName");
184-
185182
QVariantList subItemsByType;
183+
184+
// Vendor -> Pack -> Category -> Instruments
185+
using Instruments = std::vector<std::pair<std::string /*id*/, String /*name*/> >;
186+
using CategoryMap = std::map<String, Instruments>;
187+
using PackMap = std::map<String, CategoryMap>;
188+
using VendorMap = std::map<String, PackMap>;
189+
186190
for (const auto& pair : resourcesByVendor) {
187-
std::map<muse::String,
188-
std::map<muse::String,
189-
std::vector<
190-
std::tuple<int, muse::String, const AudioResourceMeta&> > > > vendorMap;
191+
VendorMap vendorMap;
192+
191193
for (const AudioResourceMeta& resourceMeta : pair.second) {
194+
const muse::String& vendorName = resourceMeta.attributeVal(u"museVendorName");
192195
const muse::String& pack = resourceMeta.attributeVal(u"musePack");
196+
const muse::String& category = resourceMeta.attributeVal(u"museCategory");
193197
const muse::String& name = resourceMeta.attributeVal(u"museName");
194-
const muse::String& vendorName = resourceMeta.attributeVal(u"museVendorName");
195-
int unique_id = resourceMeta.attributeVal(u"museUID").toInt();
196198

197-
vendorMap[vendorName][pack].push_back({ unique_id, name, resourceMeta });
199+
vendorMap[vendorName][pack][category].emplace_back(std::make_pair(resourceMeta.id, name));
198200
}
201+
199202
for (const auto& vendor : vendorMap) {
200203
QVariantList subItemsByVendor;
201204
bool isCurrentVendor = false;
205+
202206
for (const auto& pack : vendor.second) {
203207
QVariantList subItemsByPack;
204208
bool isCurrentPack = false;
205-
for (const auto& inst : pack.second) {
206-
QString instName = std::get<1>(inst).toQString();
207-
auto instId = std::get<2>(inst).id;
208-
bool isCurrentInstrument = m_currentInputParams.resourceMeta.id == instId;
209-
subItemsByPack << buildMenuItem(QString::fromStdString(instId),
210-
instName,
211-
isCurrentInstrument);
212-
isCurrentPack = isCurrentPack || isCurrentInstrument;
209+
210+
for (const auto& category : pack.second) {
211+
QVariantList subItemsByCategory;
212+
bool isCurrentCategory = false;
213+
214+
for (const auto& inst : category.second) {
215+
const std::string& instId = inst.first;
216+
QString instName = inst.second.toQString();
217+
bool isCurrentInstrument = m_currentInputParams.resourceMeta.id == instId;
218+
subItemsByCategory << buildMenuItem(QString::fromStdString(instId),
219+
instName,
220+
isCurrentInstrument);
221+
isCurrentCategory = isCurrentCategory || isCurrentInstrument;
222+
}
223+
224+
// Create submenu only if there are 2 or more categories
225+
if (pack.second.size() > 1 && !category.first.empty()) {
226+
QString categoryString = category.first.toQString();
227+
subItemsByPack << buildMenuItem(categoryString,
228+
categoryString,
229+
isCurrentCategory,
230+
subItemsByCategory);
231+
} else {
232+
subItemsByPack << subItemsByCategory;
233+
}
234+
235+
isCurrentPack = isCurrentPack || isCurrentCategory;
236+
}
237+
238+
// Create submenu only if there are 2 or more packs
239+
if (vendor.second.size() > 1 && !pack.first.empty()) {
240+
QString packString = pack.first.toQString();
241+
subItemsByVendor << buildMenuItem(packString,
242+
packString,
243+
isCurrentPack,
244+
subItemsByPack);
245+
} else {
246+
subItemsByVendor << subItemsByPack;
213247
}
214-
isCurrentVendor = isCurrentVendor || isCurrentPack;
215248

216-
QString packString = pack.first.toQString();
217-
subItemsByVendor << buildMenuItem(packString,
218-
packString,
219-
isCurrentPack,
220-
subItemsByPack);
249+
isCurrentVendor = isCurrentVendor || isCurrentPack;
221250
}
222-
// In case we don't have a vendor name, we just add the packages to the top level
223-
if (vendor.first.empty()) {
224-
subItemsByType << subItemsByVendor;
225-
} else {
226-
subItemsByType << buildMenuItem(vendor.first.toQString(),
227-
vendor.first.toQString(),
251+
252+
// Create submenu only if there are 2 or more vendors
253+
if (vendorMap.size() > 1 && !vendor.first.empty()) {
254+
QString vendorString = vendor.first.toQString();
255+
subItemsByType << buildMenuItem(vendorString,
256+
vendorString,
228257
isCurrentVendor,
229258
subItemsByVendor);
259+
} else {
260+
subItemsByType << subItemsByVendor;
230261
}
231262
}
232263
}

0 commit comments

Comments
 (0)