Updated formatting for lambda

This commit is contained in:
Eism 2020-12-23 11:26:43 +02:00 committed by Igor Korsukov
parent 6fdcf30b23
commit 30ec4a7433
75 changed files with 708 additions and 697 deletions

View file

@ -215,13 +215,13 @@ void DockWindow::showPage(DockPage* page)
}
auto panelByName = [](const QList<DockPanel*> panels, const QString& objectName) -> DockPanel* {
for (DockPanel* panel : panels) {
if (panel->objectName() == objectName) {
return panel;
}
}
return nullptr;
};
for (DockPanel* panel : panels) {
if (panel->objectName() == objectName) {
return panel;
}
}
return nullptr;
};
for (DockPanel* panel : panels) {
DockPanel::Widget dw = panel->widget();

View file

@ -309,17 +309,17 @@ void CloudManager::onReplyFinished(ApiRequest* request, RequestType requestType)
refreshRequest->setParent(this);
connect(refreshRequest, &ApiRequest::replyFinished, this,
[this, request, requestType](ApiRequest* refreshRequest) {
m_accessToken.clear();
onReplyFinished(refreshRequest, RequestType::LOGIN_REFRESH);
if (!m_accessToken.isEmpty()) {
// try to execute the request once more with the new token
request->setToken(m_accessToken);
request->executeRequest(m_networkManager);
} else {
handleReply(request->reply(), requestType);
request->deleteLater();
}
});
m_accessToken.clear();
onReplyFinished(refreshRequest, RequestType::LOGIN_REFRESH);
if (!m_accessToken.isEmpty()) {
// try to execute the request once more with the new token
request->setToken(m_accessToken);
request->executeRequest(m_networkManager);
} else {
handleReply(request->reply(), requestType);
request->deleteLater();
}
});
refreshRequest->executeRequest(m_networkManager);
return;
}
@ -444,11 +444,11 @@ static void clearHttpCacheOnRenderFinish(QWebEngineView* webView)
// workaround for the crashes sometimes happening in Chromium on macOS with Qt 5.12
QObject::connect(webView, &QWebEngineView::renderProcessTerminated, webView,
[profile, webView](QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode)
{
qDebug() << "Login page loading terminated" << terminationStatus << " " << exitCode;
profile->clearHttpCache();
webView->show();
});
{
qDebug() << "Login page loading terminated" << terminationStatus << " " << exitCode;
profile->clearHttpCache();
webView->show();
});
}
#endif
@ -485,22 +485,22 @@ void CloudManager::showWebViewDialog(const QUrl& url)
connect(page, &QWebEnginePage::loadFinished, this, [this, page, webView](
bool ok) {
if (!ok) {
return;
}
constexpr QUrl::FormattingOptions cmpOpt = QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::StripTrailingSlash;
if (!page->url().matches(ApiInfo::LOGIN_SUCCESS_URL, cmpOpt)) {
return;
}
if (!ok) {
return;
}
constexpr QUrl::FormattingOptions cmpOpt = QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::StripTrailingSlash;
if (!page->url().matches(ApiInfo::LOGIN_SUCCESS_URL, cmpOpt)) {
return;
}
page->runJavaScript("JSON.stringify(muGetAuthInfo())", [this, page, webView](const QVariant& v) {
onLoginReply(nullptr, HTTP_OK, QJsonDocument::fromJson(v.toString().toUtf8()).object());
// We have retrieved an access token, do not remain logged
// in with web view profile.
page->profile()->cookieStore()->deleteAllCookies();
webView->close();
});
page->runJavaScript("JSON.stringify(muGetAuthInfo())", [this, page, webView](const QVariant& v) {
onLoginReply(nullptr, HTTP_OK, QJsonDocument::fromJson(v.toString().toUtf8()).object());
// We have retrieved an access token, do not remain logged
// in with web view profile.
page->profile()->cookieStore()->deleteAllCookies();
webView->close();
});
});
webView->load(url);
webView->show();
@ -525,8 +525,8 @@ void CloudManager::login(QString login, QString password)
.addPostParameter("password", password);
connect(r, &ApiRequest::replyFinished, this, [this](ApiRequest* r) {
onReplyFinished(r, RequestType::LOGIN);
});
onReplyFinished(r, RequestType::LOGIN);
});
r->executeRequest(m_networkManager);
}
@ -602,8 +602,8 @@ void CloudManager::getUser()
.setToken(m_accessToken);
connect(r, &ApiRequest::replyFinished, this, [this](ApiRequest* r) {
onReplyFinished(r, RequestType::GET_USER_INFO);
});
onReplyFinished(r, RequestType::GET_USER_INFO);
});
r->executeRequest(m_networkManager);
}
@ -670,8 +670,8 @@ void CloudManager::getScoreInfo(int nid)
.addGetParameter("score_id", QString::number(nid));
connect(r, &ApiRequest::replyFinished, this, [this](ApiRequest* r) {
onReplyFinished(r, RequestType::GET_SCORE_INFO);
});
onReplyFinished(r, RequestType::GET_SCORE_INFO);
});
r->executeRequest(m_networkManager);
}
@ -751,8 +751,8 @@ void CloudManager::getMediaUrl(const QString& nid, const QString& vid, const QSt
.addGetParameter("revision_id", vid);
connect(r, &ApiRequest::replyFinished, this, [this](ApiRequest* r) {
onReplyFinished(r, RequestType::GET_MEDIA_URL);
});
onReplyFinished(r, RequestType::GET_MEDIA_URL);
});
r->executeRequest(m_networkManager);
}
@ -899,8 +899,8 @@ void CloudManager::upload(const QString& path, int nid, const QString& title)
}
connect(r, &ApiRequest::replyFinished, this, [this](ApiRequest* r) {
onReplyFinished(r, RequestType::UPLOAD_SCORE);
});
onReplyFinished(r, RequestType::UPLOAD_SCORE);
});
r->executeRequest(m_networkManager);
}

View file

@ -108,28 +108,28 @@ void AudioEngineDevTools::makeArpeggio()
m_midiStream->initData.initEvents.push_back(e);
auto makeChunk = [](Chunk& chunk, uint32_t tick, int pitch) {
UNUSED(pitch);
/* notes of the arpeggio */
static std::vector<int> notes = { 60, 64, 67, 72, 76, 79, 84, 79, 76, 72, 67, 64 };
static uint32_t duration = 4440;
UNUSED(pitch);
/* notes of the arpeggio */
static std::vector<int> notes = { 60, 64, 67, 72, 76, 79, 84, 79, 76, 72, 67, 64 };
static uint32_t duration = 4440;
chunk.beginTick = tick;
chunk.endTick = chunk.beginTick + duration;
chunk.beginTick = tick;
chunk.endTick = chunk.beginTick + duration;
uint32_t note_duration = static_cast<uint32_t>(duration / notes.size());
uint32_t note_time = tick + (tick > 0 ? note_duration : 0);
uint32_t note_duration = static_cast<uint32_t>(duration / notes.size());
uint32_t note_time = tick + (tick > 0 ? note_duration : 0);
for (int n : notes) {
auto noteOn = Event(Event::Opcode::NoteOn);
noteOn.setNote(n);
noteOn.setVelocityFraction(0.8f);
chunk.events.insert({ note_time, noteOn });
note_time += note_duration;
auto noteOff = noteOn;
noteOff.setOpcode(Event::Opcode::NoteOff);
chunk.events.insert({ note_time, noteOff });
}
};
for (int n : notes) {
auto noteOn = Event(Event::Opcode::NoteOn);
noteOn.setNote(n);
noteOn.setVelocityFraction(0.8f);
chunk.events.insert({ note_time, noteOn });
note_time += note_duration;
auto noteOff = noteOn;
noteOff.setOpcode(Event::Opcode::NoteOff);
chunk.events.insert({ note_time, noteOff });
}
};
Chunk chunk;
makeChunk(chunk, 0, 0);

View file

@ -58,8 +58,8 @@ void RpcStreamController::callRpc(const StreamID& id, CallID method, const Args&
#define CHECK_ARGS(args, n) IF_ASSERT_FAILED(args.count() >= n) { return; }
auto bindMethod = [this](CallID method, const Call& call) {
m_calls.insert({ method, call });
};
m_calls.insert({ method, call });
};
if (m_calls.empty()) {
bindMethod(callID(CallType::Midi, CallMethod::Create), [this](const StreamID& id, const Args& args) {

View file

@ -53,20 +53,20 @@ int Interactive::question(const std::string& title, const Text& text, const Butt
//! NOTE Temporarily, need to replace the qml dialog
auto format = [](IInteractive::TextFormat f) {
switch (f) {
case IInteractive::TextFormat::PlainText: return Qt::PlainText;
case IInteractive::TextFormat::RichText: return Qt::RichText;
}
return Qt::PlainText;
};
switch (f) {
case IInteractive::TextFormat::PlainText: return Qt::PlainText;
case IInteractive::TextFormat::RichText: return Qt::RichText;
}
return Qt::PlainText;
};
QMap<QAbstractButton*, int> btnsMap;
auto makeButton = [&btnsMap](const ButtonData& b, QWidget* parent) {
QPushButton* btn = new QPushButton(parent);
btn->setText(QString::fromStdString(b.text));
btnsMap[btn] = b.btn;
return btn;
};
QPushButton* btn = new QPushButton(parent);
btn->setText(QString::fromStdString(b.text));
btnsMap[btn] = b.btn;
return btn;
};
QMessageBox msgBox;
msgBox.setWindowTitle(QString::fromStdString(title));
@ -127,13 +127,13 @@ void Interactive::message(Type type, const std::string& title, const std::string
//! NOTE Temporarily, need to replace the qml dialog
auto icon = [](Type type) {
switch (type) {
case Type::Info: return QMessageBox::Information;
case Type::Warning: return QMessageBox::Warning;
case Type::Critical: return QMessageBox::Critical;
}
return QMessageBox::NoIcon;
};
switch (type) {
case Type::Info: return QMessageBox::Information;
case Type::Warning: return QMessageBox::Warning;
case Type::Critical: return QMessageBox::Critical;
}
return QMessageBox::NoIcon;
};
QMessageBox msgBox;
msgBox.setWindowTitle(QString::fromStdString(title));

View file

@ -107,7 +107,7 @@ void Settings::setValue(const Key& key, const Val& value)
Item& item = findItem(key);
if (!item.isNull() && item.value == value) {
return;
return;
}
writeValue(key, value);

View file

@ -24,7 +24,8 @@
using namespace mu::framework;
static XmlReader::TokenType convertTokenType(QXmlStreamReader::TokenType type) {
static XmlReader::TokenType convertTokenType(QXmlStreamReader::TokenType type)
{
switch (type) {
case QXmlStreamReader::TokenType::NoToken:
case QXmlStreamReader::TokenType::Invalid:

View file

@ -63,27 +63,27 @@ SoundFontFormats FluidSynth::soundFontFormats() const
Ret FluidSynth::init(float samplerate)
{
auto fluid_log_out = [](int level, const char* message, void*) {
switch (level) {
case FLUID_PANIC:
case FLUID_ERR: {
LOGE() << message;
} break;
case FLUID_WARN: {
LOGW() << message;
} break;
case FLUID_INFO: {
LOGI() << message;
} break;
case FLUID_DBG: {
LOGD() << message;
} break;
}
switch (level) {
case FLUID_PANIC:
case FLUID_ERR: {
LOGE() << message;
} break;
case FLUID_WARN: {
LOGW() << message;
} break;
case FLUID_INFO: {
LOGI() << message;
} break;
case FLUID_DBG: {
LOGD() << message;
} break;
}
if (level < FLUID_DBG) {
bool debugme = true;
(void)debugme;
}
};
if (level < FLUID_DBG) {
bool debugme = true;
(void)debugme;
}
};
fluid_set_log_function(FLUID_PANIC, fluid_log_out, nullptr);
fluid_set_log_function(FLUID_ERR, fluid_log_out, nullptr);

View file

@ -471,10 +471,10 @@ void Sequencer::setIsTrackMuted(track_t trackIndex, bool mute)
}
auto setMuted = [this, mute](channel_t ch) {
ChanState& state = m_chanStates[ch];
state.muted = mute;
synth(ch)->channelSoundsOff(ch);
};
ChanState& state = m_chanStates[ch];
state.muted = mute;
synth(ch)->channelSoundsOff(ch);
};
const Track& track = m_midiData.tracks[trackIndex];
for (channel_t ch : track.channels) {

View file

@ -31,16 +31,16 @@ void SynthesizerController::init()
}
auto init = [this](float sampleRate) {
std::vector<std::shared_ptr<ISynthesizer> > synthesizers = synthRegister()->synthesizers();
std::vector<std::shared_ptr<ISynthesizer> > synthesizers = synthRegister()->synthesizers();
for (std::shared_ptr<ISynthesizer> synth : synthesizers) {
synth->init(sampleRate);
for (std::shared_ptr<ISynthesizer> synth : synthesizers) {
synth->init(sampleRate);
reloadSoundFonts(synth);
auto notification = sfprovider()->soundFontPathsForSynthChanged(synth->name());
notification.onNotify(this, [this, synth]() { reloadSoundFonts(synth); });
}
};
reloadSoundFonts(synth);
auto notification = sfprovider()->soundFontPathsForSynthChanged(synth->name());
notification.onNotify(this, [this, synth]() { reloadSoundFonts(synth); });
}
};
if (audioEngine()->isInited()) {
init(audioEngine()->sampleRate());

View file

@ -202,35 +202,35 @@ float ZFilter::apply(float inputValue, bool leftChannel)
{
float value = 0.f;
const auto applyBqEquation = [this, &inputValue](float& histX1, float& histX2, float& histY1, float& histY2) {
//apply filter
/*
float y = d.b0 * x + d.b1 * d.x1 + d.b2 * d.x2 +
d.a1 * d.y1 + d.a2 * d.y2;
d.x2 = d.x1;
d.x1 = x;
d.y2 = d.y1;
d.y1 = y;
return y;
*/
float value = b0 * inputValue + b1 * histX1 + b2 * histX2 + a1 * histY1 + a2
* histY2;
histX2 = histX1;
histX1 = inputValue;
histY2 = histY1;
histY1 = value;
return value;
};
//apply filter
/*
float y = d.b0 * x + d.b1 * d.x1 + d.b2 * d.x2 +
d.a1 * d.y1 + d.a2 * d.y2;
d.x2 = d.x1;
d.x1 = x;
d.y2 = d.y1;
d.y1 = y;
return y;
*/
float value = b0 * inputValue + b1 * histX1 + b2 * histX2 + a1 * histY1 + a2
* histY2;
histX2 = histX1;
histX1 = inputValue;
histY2 = histY1;
histY1 = value;
return value;
};
const auto applyHPF1PEquation = [this, &inputValue](float& histX1, float& histY1) {
float value = b0 * inputValue + b1 * histX1 - a1 * histY1;
histX1 = inputValue;
histY1 = value;
return value;
};
float value = b0 * inputValue + b1 * histX1 - a1 * histY1;
histX1 = inputValue;
histY1 = value;
return value;
};
const auto applyLPF1PEquation = [this, &inputValue](float& histY1) {
float value = b0 * inputValue - a1 * histY1;
histY1 = value;
return value;
};
float value = b0 * inputValue - a1 * histY1;
histY1 = value;
return value;
};
if (leftChannel) {
switch (sampleZone->fil_type) {
case FilterType::hpf_2p:

View file

@ -859,12 +859,12 @@ struct Event {
{
std::string str;
auto dataToStr = [&str, this]() {
str += " {";
for (auto& d : m_data) {
str += " " + std::to_string(d);
}
str += "}";
};
str += " {";
for (auto& d : m_data) {
str += " " + std::to_string(d);
}
str += "}";
};
switch (messageType()) {
case MessageType::ChannelVoice10: {

View file

@ -32,14 +32,14 @@ void SynthsSettingsModel::load()
m_state = configuration()->synthesizerState();
auto doLoad = [this](const QString& name) {
auto synth = synthRegister()->synthesizer(name.toStdString());
std::vector<io::path> avalaibleSFPaths = sfprovider()->soundFontPaths(synth->soundFontFormats());
for (const io::path& path : avalaibleSFPaths) {
m_avalaibleSoundFonts[name] << io::filename(path).toQString();
}
emit avalaibleChanged(name);
emit selectedChanged(name);
};
auto synth = synthRegister()->synthesizer(name.toStdString());
std::vector<io::path> avalaibleSFPaths = sfprovider()->soundFontPaths(synth->soundFontFormats());
for (const io::path& path : avalaibleSFPaths) {
m_avalaibleSoundFonts[name] << io::filename(path).toQString();
}
emit avalaibleChanged(name);
emit selectedChanged(name);
};
doLoad("Fluid");
doLoad("Zerberus");

View file

@ -21,7 +21,6 @@
#include "libmscore/score.h"
namespace Ms {
//---------------------------------------------------------
// Event::Event
//---------------------------------------------------------

View file

@ -203,10 +203,10 @@ Ret NetworkManager::waitForReplyFinished(QNetworkReply* reply, int timeoutMs)
});
auto restartTimeoutTimer = [&timeoutTimer, &isTimeout](qint64, qint64) {
if (!isTimeout) {
timeoutTimer.start();
}
};
if (!isTimeout) {
timeoutTimer.start();
}
};
connect(reply, &QNetworkReply::downloadProgress, this, restartTimeoutTimer);
connect(reply, &QNetworkReply::uploadProgress, this, restartTimeoutTimer);

View file

@ -41,7 +41,8 @@ public:
IncludeSubdirs
};
virtual RetVal<io::paths> scanFiles(const io::path& rootDir, const QStringList& filters, ScanMode mode = ScanMode::IncludeSubdirs) const = 0;
virtual RetVal<io::paths> scanFiles(const io::path& rootDir, const QStringList& filters,
ScanMode mode = ScanMode::IncludeSubdirs) const = 0;
virtual RetVal<QByteArray> readFile(const io::path& filePath) const = 0;
};

View file

@ -30,7 +30,8 @@ public:
Ret makePath(const io::path& path) const override;
RetVal<io::paths> scanFiles(const io::path& rootDir, const QStringList& filters, ScanMode mode = ScanMode::IncludeSubdirs) const override;
RetVal<io::paths> scanFiles(const io::path& rootDir, const QStringList& filters,
ScanMode mode = ScanMode::IncludeSubdirs) const override;
RetVal<QByteArray> readFile(const io::path& filePath) const override;

View file

@ -25,13 +25,12 @@
#include "framework/global/modularity/imodulesetup.h"
namespace mu::testing {
class Environment
{
public:
using Modules = std::vector<framework::IModuleSetup*>;
using PostInit = std::function<void()>;
using PostInit = std::function<void ()>;
Environment() = default;
@ -49,12 +48,12 @@ class SuiteEnvironment
{
public:
SuiteEnvironment(const Environment::Modules& dependencyModules, const Environment::PostInit& postInit = nullptr) {
SuiteEnvironment(const Environment::Modules& dependencyModules, const Environment::PostInit& postInit = nullptr)
{
Environment::setDependency(dependencyModules);
Environment::setPostInit(postInit);
}
};
}
#endif // MU_TESTING_ENVIRONMENT_H

View file

@ -8,12 +8,12 @@ DoubleInputValidator::DoubleInputValidator(QObject* parent)
void DoubleInputValidator::fixup(QString& string) const
{
auto zeros = [](int num)->QString {
QString s = QString();
for (int i = 0; i < num; i++) {
s.append("0");
}
return s;
};
QString s = QString();
for (int i = 0; i < num; i++) {
s.append("0");
}
return s;
};
if (!string.contains(".")) {
string.append("." + zeros(m_decimal));

View file

@ -88,34 +88,34 @@ void VSTDevTools::makeArpeggio()
m_midiStream->initData.initEvents.push_back(e);
auto makeChunk = [](Chunk& chunk, uint32_t tick, bool pitch) {
/* notes of the arpeggio */
static std::vector<int> notes = { 60, 64, 67, 72, 76, 79, 84, 79, 76, 72, 67, 64 };
static uint32_t duration = 4440;
uint16_t velocity = 65535;
chunk.beginTick = tick;
/* notes of the arpeggio */
static std::vector<int> notes = { 60, 64, 67, 72, 76, 79, 84, 79, 76, 72, 67, 64 };
static uint32_t duration = 4440;
uint16_t velocity = 65535;
chunk.beginTick = tick;
uint32_t note_duration = duration / notes.size();
uint32_t note_time = tick + (tick > 0 ? note_duration : 0);
uint32_t note_duration = duration / notes.size();
uint32_t note_time = tick + (tick > 0 ? note_duration : 0);
for (int n : notes) {
auto noteOn = Event(Event::Opcode::NoteOn);
for (int n : notes) {
auto noteOn = Event(Event::Opcode::NoteOn);
noteOn.setNote(n);
noteOn.setVelocity(velocity);
if (pitch) {
noteOn.setPitchNote(n + 12, 1.f);//1 octave + 1 semitone
}
velocity -= 5461;
chunk.events.insert({ note_time, noteOn });
note_time += note_duration;
noteOn.setNote(n);
noteOn.setVelocity(velocity);
if (pitch) {
noteOn.setPitchNote(n + 12, 1.f); //1 octave + 1 semitone
}
velocity -= 5461;
chunk.events.insert({ note_time, noteOn });
note_time += note_duration;
//NoteOff should copy noteId and pitch from NoteOn
auto noteOff = noteOn;
noteOff.setOpcode(Event::Opcode::NoteOff);
chunk.events.insert({ note_time, noteOff });
}
chunk.endTick = note_time + note_duration;
};
//NoteOff should copy noteId and pitch from NoteOn
auto noteOff = noteOn;
noteOff.setOpcode(Event::Opcode::NoteOff);
chunk.events.insert({ note_time, noteOff });
}
chunk.endTick = note_time + note_duration;
};
Chunk chunk;
makeChunk(chunk, 0, false);

View file

@ -113,19 +113,19 @@ void PluginInstance::process(float* input, float* output, unsigned int samples)
}
AudioBusBuffers out[m_busInfo.audioOutput.size()], in[m_busInfo.audioInput.size()];
auto initBuffers = [&samples](AudioBusBuffers* buffers, std::vector<unsigned int>& busInfo, float* stream) {
for (unsigned int i = 0; i < busInfo.size(); ++i) {
auto channels = busInfo[i];
buffers[i].numChannels = channels;
buffers[i].silenceFlags = 0;
buffers[i].channelBuffers32 = new Sample32*[channels];
for (unsigned int j = 0; j < channels; ++j) {
buffers[i].channelBuffers32[j] = new Sample32[samples];
if (stream) {
//TODO: fill buffer from stream if given (for audio plugins)
}
}
}
};
for (unsigned int i = 0; i < busInfo.size(); ++i) {
auto channels = busInfo[i];
buffers[i].numChannels = channels;
buffers[i].silenceFlags = 0;
buffers[i].channelBuffers32 = new Sample32*[channels];
for (unsigned int j = 0; j < channels; ++j) {
buffers[i].channelBuffers32[j] = new Sample32[samples];
if (stream) {
//TODO: fill buffer from stream if given (for audio plugins)
}
}
}
};
initBuffers(in, m_busInfo.audioInput, input);
initBuffers(out, m_busInfo.audioOutput, nullptr);

View file

@ -31,7 +31,7 @@ void CurrentWorkspaceModel::load()
emit currentWorkspaceNameChanged();
configuration()->currentWorkspaceName().ch.onReceive(this, [this](const std::string&) {
emit currentWorkspaceNameChanged();
emit currentWorkspaceNameChanged();
});
}

View file

@ -74,4 +74,3 @@ private:
}
#endif // MU_WORKSPACE_WORKSPACELISTMODEL_H

View file

@ -25,7 +25,6 @@
#include "val.h"
namespace mu::workspace {
enum class WorkspaceTag
{
UiArrangement,

View file

@ -47,7 +47,6 @@
#include "libmscore/volta.h"
#include "libmscore/segment.h"
namespace Bww {
/**
The writer that imports into MuseScore.

View file

@ -1891,7 +1891,7 @@ void GuitarPro6::readBars(QDomNode* barList, Measure* measure, ClefType oldClefI
int staffIdx = 0;
// used to keep track of tuplets
std::vector<Tuplet*> tuplets(staves * VOICES);
std::vector<Tuplet*> tuplets(staves* VOICES);
for (int track = 0; track < staves * VOICES; ++track) {
tuplets[track] = 0;
}

View file

@ -330,32 +330,32 @@ void sortInstrumentTemplates(
{
std::stable_sort(templates.begin(), templates.end(),
[minMaxPitch](const InstrumentTemplate* templ1, const InstrumentTemplate* templ2) {
const int diff1 = findMaxPitchDiff(minMaxPitch, templ1);
const int diff2 = findMaxPitchDiff(minMaxPitch, templ2);
const int diff1 = findMaxPitchDiff(minMaxPitch, templ1);
const int diff2 = findMaxPitchDiff(minMaxPitch, templ2);
if (diff1 != diff2) {
return diff1 < diff2;
}
// if drumset is not null - it's a particular drum instrument
// if drum set is null - it's a common drumset
// so prefer particular drum instruments
if (templ1->drumset && !templ2->drumset) {
return true;
}
if (!templ1->drumset && templ2->drumset) {
return false;
}
// prefer instruments with the "common" genre
const bool hasCommon1 = hasCommonGenre(templ1->genres);
const bool hasCommon2 = hasCommonGenre(templ2->genres);
if (hasCommon1 && !hasCommon2) {
return true;
}
if (!hasCommon1 && hasCommon2) {
return false;
}
return templ1->genres.size() > templ2->genres.size();
});
if (diff1 != diff2) {
return diff1 < diff2;
}
// if drumset is not null - it's a particular drum instrument
// if drum set is null - it's a common drumset
// so prefer particular drum instruments
if (templ1->drumset && !templ2->drumset) {
return true;
}
if (!templ1->drumset && templ2->drumset) {
return false;
}
// prefer instruments with the "common" genre
const bool hasCommon1 = hasCommonGenre(templ1->genres);
const bool hasCommon2 = hasCommonGenre(templ2->genres);
if (hasCommon1 && !hasCommon2) {
return true;
}
if (!hasCommon1 && hasCommon2) {
return false;
}
return templ1->genres.size() > templ2->genres.size();
});
}
std::vector<const InstrumentTemplate*> findSuitableInstruments(const MTrack& track)

View file

@ -581,7 +581,6 @@ static void setPartInstruments(MxmlLogger* logger, const QXmlStreamReader* const
Convert SMuFL code points to MuseScore <sym>...</sym>
*/
namespace xmlpass2 {
static QString text2syms(const QString& t)
{
//QTime time;
@ -652,7 +651,6 @@ static QString text2syms(const QString& t)
*/
namespace xmlpass2 {
static QString decodeEntities(const QString& src)
{
QString ret(src);
@ -666,7 +664,6 @@ static QString decodeEntities(const QString& src)
}
return ret;
}
}
//---------------------------------------------------------
@ -680,7 +677,6 @@ static QString decodeEntities(const QString& src)
*/
namespace xmlpass2 {
static QString nextPartOfFormattedString(QXmlStreamReader& e)
{
//QString lang = e.attribute(QString("xml:lang"), "it");
@ -743,7 +739,6 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
//qDebug("importedtext '%s'", qPrintable(importedtext));
return importedtext;
}
}
//---------------------------------------------------------

View file

@ -352,8 +352,8 @@ PropertyItem* AbstractInspectorModel::buildPropertyItem(const Ms::Pid& propertyI
if (!callback) {
callback = [this](const int propertyId, const QVariant& newValue) {
onPropertyValueChanged(static_cast<Ms::Pid>(propertyId), newValue);
};
onPropertyValueChanged(static_cast<Ms::Pid>(propertyId), newValue);
};
}
connect(newPropertyItem, &PropertyItem::propertyModified, this, callback);

View file

@ -37,8 +37,8 @@ void AppearanceSettingsModel::requestElements()
void AppearanceSettingsModel::loadProperties()
{
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_leadingSpace, formatDoubleFunc);
loadPropertyItem(m_minimumDistance, formatDoubleFunc);

View file

@ -21,7 +21,8 @@ InspectorListModel::InspectorListModel(QObject* parent)
void InspectorListModel::buildModelsForSelectedElements(const QSet<Ms::ElementType>& selectedElementSet)
{
static QList<AbstractInspectorModel::InspectorSectionType> persistentSectionList = { AbstractInspectorModel::InspectorSectionType::SECTION_GENERAL };
static QList<AbstractInspectorModel::InspectorSectionType> persistentSectionList
= { AbstractInspectorModel::InspectorSectionType::SECTION_GENERAL };
removeUnusedModels(selectedElementSet, persistentSectionList);
@ -38,9 +39,11 @@ void InspectorListModel::buildModelsForSelectedElements(const QSet<Ms::ElementTy
void InspectorListModel::buildModelsForEmptySelection(const QSet<Ms::ElementType>& selectedElementSet)
{
static QList<AbstractInspectorModel::InspectorSectionType> persistentSectionList = { AbstractInspectorModel::InspectorSectionType::SECTION_SCORE_DISPLAY,
AbstractInspectorModel::InspectorSectionType::SECTION_SCORE_APPEARANCE
};
static QList<AbstractInspectorModel::InspectorSectionType> persistentSectionList
= { AbstractInspectorModel::InspectorSectionType::SECTION_SCORE_DISPLAY,
AbstractInspectorModel::InspectorSectionType::
SECTION_SCORE_APPEARANCE
};
removeUnusedModels(selectedElementSet, persistentSectionList);

View file

@ -74,8 +74,8 @@ void CrescendoSettingsModel::loadProperties()
loadPropertyItem(m_endHookType);
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_thickness, formatDoubleFunc);
loadPropertyItem(m_hookHeight, formatDoubleFunc);

View file

@ -69,8 +69,8 @@ void HairpinSettingsModel::requestElements()
void HairpinSettingsModel::loadProperties()
{
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_lineStyle);
loadPropertyItem(m_placement);

View file

@ -55,8 +55,8 @@ void ImageSettingsModel::requestElements()
void ImageSettingsModel::loadProperties()
{
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_shouldScaleToFrameSize);
loadPropertyItem(m_height, formatDoubleFunc);

View file

@ -31,8 +31,8 @@ void PedalSettingsModel::loadProperties()
loadPropertyItem(m_hookType);
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_thickness, formatDoubleFunc);

View file

@ -39,8 +39,8 @@ void StaffTypeSettingsModel::requestElements()
void StaffTypeSettingsModel::loadProperties()
{
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_isSmall);
loadPropertyItem(m_verticalOffset, formatDoubleFunc);

View file

@ -58,17 +58,17 @@ void TextSettingsModel::loadProperties()
{
loadPropertyItem(m_fontFamily, [](const QVariant& elementPropertyValue) -> QVariant {
return elementPropertyValue.toString() == Ms::TextBase::UNDEFINED_FONT_FAMILY ? QVariant()
: elementPropertyValue.toString();
: elementPropertyValue.toString();
});
loadPropertyItem(m_fontStyle, [](const QVariant& elementPropertyValue) -> QVariant {
return elementPropertyValue.toInt() == static_cast<int>(Ms::FontStyle::Undefined) ? QVariant()
: elementPropertyValue.toInt();
: elementPropertyValue.toInt();
});
loadPropertyItem(m_fontSize, [](const QVariant& elementPropertyValue) -> QVariant {
return elementPropertyValue.toInt() == Ms::TextBase::UNDEFINED_FONT_SIZE ? QVariant()
: elementPropertyValue.toInt();
: elementPropertyValue.toInt();
});
loadPropertyItem(m_horizontalAlignment, [](const QVariant& elementPropertyValue) -> QVariant {
@ -104,8 +104,8 @@ void TextSettingsModel::loadProperties()
loadPropertyItem(m_frameHighlightColor);
auto formatDoubleFunc = [](const QVariant& elementPropertyValue) -> QVariant {
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
return DataFormatter::formatDouble(elementPropertyValue.toDouble());
};
loadPropertyItem(m_frameThickness, formatDoubleFunc);
loadPropertyItem(m_frameMargin, formatDoubleFunc);
@ -115,7 +115,7 @@ void TextSettingsModel::loadProperties()
loadPropertyItem(m_textPlacement);
loadPropertyItem(m_textScriptAlignment, [](const QVariant& elementPropertyValue) -> QVariant {
return elementPropertyValue.toInt() == static_cast<int>(Ms::VerticalAlignment::AlignUndefined) ? QVariant()
: elementPropertyValue.toInt();
: elementPropertyValue.toInt();
});
updateFramePropertiesAvailability();

View file

@ -184,18 +184,18 @@ void GridCanvas::paint(QPainter* painter)
// this lambda takes as input a pitch value, and determines where what are its x and y coordinates
auto getPosition = [this, columnWidth, rowHeight, leftPos, topPos, bottomPos](const PitchValue& v) -> QPointF {
const qreal x = round((qreal(v.time) / 60) * (m_columns - 1)) * columnWidth + leftPos;
qreal y = 0;
if (m_showNegativeRows) { // get the middle pos and add the top margin and half of the rows
y = topPos + rowHeight * (m_rows - 1) * .5;
} else { // from the bottom
y = bottomPos;
}
// add the offset
y -= round((qreal(v.pitch) / (100 * (m_rows / m_primaryRowsInterval))) * (m_rows - 1))
* rowHeight;
return QPointF(x, y);
};
const qreal x = round((qreal(v.time) / 60) * (m_columns - 1)) * columnWidth + leftPos;
qreal y = 0;
if (m_showNegativeRows) { // get the middle pos and add the top margin and half of the rows
y = topPos + rowHeight * (m_rows - 1) * .5;
} else { // from the bottom
y = bottomPos;
}
// add the offset
y -= round((qreal(v.pitch) / (100 * (m_rows / m_primaryRowsInterval))) * (m_rows - 1))
* rowHeight;
return QPointF(x, y);
};
static constexpr int GRIP_HALF_RADIUS = 5;
QPointF lastPoint(0, 0);

View file

@ -77,10 +77,10 @@ void InstrumentsRepository::load()
int globalGroupsSequenceOrder = 0;
auto correctGroupSequenceOrder = [&globalGroupsSequenceOrder](const InstrumentGroup& group) {
InstrumentGroup correctedGroup = group;
correctedGroup.sequenceOrder += globalGroupsSequenceOrder;
return correctedGroup;
};
InstrumentGroup correctedGroup = group;
correctedGroup.sequenceOrder += globalGroupsSequenceOrder;
return correctedGroup;
};
for (const io::path& filePath: instrumentsFiles) {
RetVal<InstrumentsMeta> metaInstrument = reader()->readMeta(filePath);

View file

@ -79,9 +79,9 @@ bool defaultSort(const Language& l, const Language& r)
}
auto installed = [](const Language& language) -> bool {
return language.status == LanguageStatus::Status::Installed
|| language.status == LanguageStatus::Status::NeedUpdate;
};
return language.status == LanguageStatus::Status::Installed
|| language.status == LanguageStatus::Status::NeedUpdate;
};
if (installed(l) && installed(r)) {
return l.code < r.code;

View file

@ -802,14 +802,14 @@ std::set<SymId> joinArticulations(const std::set<SymId>& articulationSymbolIds)
std::vector<SymId> vsymbolIds(articulationSymbolIds.begin(), articulationSymbolIds.end());
std::sort(vsymbolIds.begin(), vsymbolIds.end(), [](SymId l, SymId r) {
return l > r;
});
return l > r;
});
std::set<SymId> splittedSymbols;
auto symbolSelected = [&splittedSymbols](const SymId& symbolId) -> bool {
return splittedSymbols.find(symbolId) != splittedSymbols.end();
};
return splittedSymbols.find(symbolId) != splittedSymbols.end();
};
for (size_t i = 0; i < vsymbolIds.size(); i++) {
if (symbolSelected(vsymbolIds[i])) {
@ -839,8 +839,8 @@ std::set<SymId> joinArticulations(const std::set<SymId>& articulationSymbolIds)
}
std::sort(result.begin(), result.end(), [](SymId l, SymId r) {
return l < r;
});
return l < r;
});
return std::set<SymId>(result.begin(), result.end());
}

View file

@ -47,69 +47,69 @@ int ChangeMap::interpolate(Fraction& eventTick, ChangeEvent& event, Fraction& ti
// so treat it as a piecewise function.
if (exprDiff > 0) {
valueFunction = [&](int ct) {
return int(
pow(
pow((exprDiff + 1), 1.0 / double(exprTicks)), // the exprTicks root of d+1
double(ct) // to the power of the current tick (exponential)
) - 1
);
};
return int(
pow(
pow((exprDiff + 1), 1.0 / double(exprTicks)), // the exprTicks root of d+1
double(ct) // to the power of the current tick (exponential)
) - 1
);
};
} else {
valueFunction = [&](int ct) {
return -int(
pow(
pow((-exprDiff + 1), 1.0 / double(exprTicks)), // the exprTicks root of 1-d
double(ct) // again to the power of ct
) + 1
);
};
return -int(
pow(
pow((-exprDiff + 1), 1.0 / double(exprTicks)), // the exprTicks root of 1-d
double(ct) // again to the power of ct
) + 1
);
};
}
break;
// Uses sin x transformed, which _does_ flip with negative numbers
case ChangeMethod::EASE_IN_OUT:
valueFunction = [&](int ct) {
return int(
(double(exprDiff) / 2.0) * (
sin(
double(ct) * (
double(M_PI / double(exprTicks))
) - double(M_PI / 2.0)
) + 1
)
);
};
return int(
(double(exprDiff) / 2.0) * (
sin(
double(ct) * (
double(M_PI / double(exprTicks))
) - double(M_PI / 2.0)
) + 1
)
);
};
break;
case ChangeMethod::EASE_IN:
valueFunction = [&](int ct) {
return int(
double(exprDiff) * (
sin(
double(ct - double(exprTicks)) * (
double(M_PI / double(2 * exprTicks))
)
) + 1
)
);
};
return int(
double(exprDiff) * (
sin(
double(ct - double(exprTicks)) * (
double(M_PI / double(2 * exprTicks))
)
) + 1
)
);
};
break;
case ChangeMethod::EASE_OUT:
valueFunction = [&](int ct) {
return int(
double(exprDiff) * sin(
double(ct) * (
double(M_PI / double(2 * exprTicks))
)
)
);
};
return int(
double(exprDiff) * sin(
double(ct) * (
double(M_PI / double(2 * exprTicks))
)
)
);
};
break;
case ChangeMethod::NORMAL:
default:
valueFunction = [&](int ct) {
return int(
double(exprDiff) * (double(ct) / double(exprTicks))
);
};
return int(
double(exprDiff) * (double(ct) / double(exprTicks))
);
};
break;
}

View file

@ -3670,8 +3670,8 @@ void Chord::undoChangeProperty(Pid id, const QVariant& newValue, PropertyFlags p
{
if (id == Pid::VISIBLE) {
processSiblings([=](Element* element) {
element->undoChangeProperty(id, newValue, ps);
});
element->undoChangeProperty(id, newValue, ps);
});
}
Element::undoChangeProperty(id, newValue, ps);

View file

@ -4498,20 +4498,20 @@ void Score::cmd(const QAction* a, EditData& ed)
{ "beam64", [](Score* cs, EditData&) { cs->cmdSetBeamMode(Beam::Mode::BEGIN64); } },
{ "auto-beam", [](Score* cs, EditData&) { cs->cmdSetBeamMode(Beam::Mode::AUTO); } },
{ "sharp2", [](Score* cs, EditData& ed) {
cs->toggleAccidental(AccidentalType::SHARP2, ed);
} },
cs->toggleAccidental(AccidentalType::SHARP2, ed);
} },
{ "sharp", [](Score* cs, EditData& ed) {
cs->toggleAccidental(AccidentalType::SHARP, ed);
} },
cs->toggleAccidental(AccidentalType::SHARP, ed);
} },
{ "nat", [](Score* cs, EditData& ed) {
cs->toggleAccidental(AccidentalType::NATURAL, ed);
} },
cs->toggleAccidental(AccidentalType::NATURAL, ed);
} },
{ "flat", [](Score* cs, EditData& ed) {
cs->toggleAccidental(AccidentalType::FLAT, ed);
} },
cs->toggleAccidental(AccidentalType::FLAT, ed);
} },
{ "flat2", [](Score* cs, EditData& ed) {
cs->toggleAccidental(AccidentalType::FLAT2, ed);
} },
cs->toggleAccidental(AccidentalType::FLAT2, ed);
} },
{ "flip", [](Score* cs, EditData&) { cs->cmdFlip(); } },
{ "stretch+", [](Score* cs, EditData&) { cs->cmdAddStretch(0.1); } },
{ "stretch-", [](Score* cs, EditData&) { cs->cmdAddStretch(-0.1); } },
@ -4522,29 +4522,29 @@ void Score::cmd(const QAction* a, EditData& ed)
{ "add-parentheses", [](Score* cs, EditData&) { cs->cmdAddParentheses(); } },
{ "add-braces", [](Score* cs, EditData&) { cs->cmdAddBraces(); } },
{ "acciaccatura", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::ACCIACCATURA, MScore::division / 2);
} },
cs->cmdAddGrace(NoteType::ACCIACCATURA, MScore::division / 2);
} },
{ "appoggiatura", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::APPOGGIATURA, MScore::division / 2);
} },
cs->cmdAddGrace(NoteType::APPOGGIATURA, MScore::division / 2);
} },
{ "grace4", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::GRACE4, MScore::division);
} },
cs->cmdAddGrace(NoteType::GRACE4, MScore::division);
} },
{ "grace16", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::GRACE16, MScore::division / 4);
} },
cs->cmdAddGrace(NoteType::GRACE16, MScore::division / 4);
} },
{ "grace32", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::GRACE32, MScore::division / 8);
} },
cs->cmdAddGrace(NoteType::GRACE32, MScore::division / 8);
} },
{ "grace8after", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::GRACE8_AFTER, MScore::division / 2);
} },
cs->cmdAddGrace(NoteType::GRACE8_AFTER, MScore::division / 2);
} },
{ "grace16after", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::GRACE16_AFTER, MScore::division / 4);
} },
cs->cmdAddGrace(NoteType::GRACE16_AFTER, MScore::division / 4);
} },
{ "grace32after", [](Score* cs, EditData&) {
cs->cmdAddGrace(NoteType::GRACE32_AFTER, MScore::division / 8);
} },
cs->cmdAddGrace(NoteType::GRACE32_AFTER, MScore::division / 8);
} },
{ "explode", [](Score* cs, EditData&) { cs->cmdExplode(); } },
{ "implode", [](Score* cs, EditData&) { cs->cmdImplode(); } },
{ "realize-chord-symbols", [](Score* cs, EditData&) { cs->cmdRealizeChordSymbols(); } },
@ -4572,14 +4572,14 @@ void Score::cmd(const QAction* a, EditData& ed)
{ "set-visible", [](Score* cs, EditData&) { cs->cmdSetVisible(); } },
{ "unset-visible", [](Score* cs, EditData&) { cs->cmdUnsetVisible(); } },
{ "system-break", [](Score* cs, EditData&) {
cs->cmdToggleLayoutBreak(LayoutBreak::Type::LINE);
} },
cs->cmdToggleLayoutBreak(LayoutBreak::Type::LINE);
} },
{ "page-break", [](Score* cs, EditData&) {
cs->cmdToggleLayoutBreak(LayoutBreak::Type::PAGE);
} },
cs->cmdToggleLayoutBreak(LayoutBreak::Type::PAGE);
} },
{ "section-break", [](Score* cs, EditData&) {
cs->cmdToggleLayoutBreak(LayoutBreak::Type::SECTION);
} },
cs->cmdToggleLayoutBreak(LayoutBreak::Type::SECTION);
} },
{ "relayout", [](Score* cs, EditData&) { cs->cmdRelayout(); } },
{ "toggle-autoplace", [](Score* cs, EditData&) { cs->cmdToggleAutoplace(false); } },
{ "autoplace-enabled", [](Score* cs, EditData&) { cs->cmdToggleAutoplace(true); } },

View file

@ -1194,23 +1194,23 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
auto getStaffIdxRange
= [this, local, staffIdx](const Score* score) -> std::pair<int /*start*/, int /*end*/> {
int startStaffIdx, endStaffIdx;
if (local) {
if (score == this) {
startStaffIdx = staffIdx;
endStaffIdx = startStaffIdx + 1;
} else {
// TODO: get index for this score
qDebug("cmdAddTimeSig: unable to write local time signature change to linked score");
startStaffIdx = 0;
endStaffIdx = 0;
}
} else {
startStaffIdx = 0;
endStaffIdx = score->nstaves();
}
return std::make_pair(startStaffIdx, endStaffIdx);
};
int startStaffIdx, endStaffIdx;
if (local) {
if (score == this) {
startStaffIdx = staffIdx;
endStaffIdx = startStaffIdx + 1;
} else {
// TODO: get index for this score
qDebug("cmdAddTimeSig: unable to write local time signature change to linked score");
startStaffIdx = 0;
endStaffIdx = 0;
}
} else {
startStaffIdx = 0;
endStaffIdx = score->nstaves();
}
return std::make_pair(startStaffIdx, endStaffIdx);
};
if (ots && ots->sig() == ns && ots->stretch() == ts->stretch()) {
//
@ -2026,11 +2026,11 @@ void Score::cmdFlip()
std::set<const Element*> alreadyFlippedElements;
auto flipOnce = [&alreadyFlippedElements](const Element* element, std::function<void()> flipFunction) -> void {
if (alreadyFlippedElements.count(element) == 0) {
alreadyFlippedElements.insert(element);
flipFunction();
}
};
if (alreadyFlippedElements.count(element) == 0) {
alreadyFlippedElements.insert(element);
flipFunction();
}
};
for (Element* e : el) {
if (e->isNote() || e->isStem() || e->isHook()) {
Chord* chord = nullptr;
@ -2051,59 +2051,59 @@ void Score::cmdFlip()
}
} else {
flipOnce(chord, [this, chord]() {
Direction dir = chord->up() ? Direction::DOWN : Direction::UP;
chord->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir),
propertyFlags(Pid::STEM_DIRECTION));
});
Direction dir = chord->up() ? Direction::DOWN : Direction::UP;
chord->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir),
propertyFlags(Pid::STEM_DIRECTION));
});
}
}
if (e->isBeam()) {
auto beam = toBeam(e);
flipOnce(beam, [beam]() {
Direction dir = beam->up() ? Direction::DOWN : Direction::UP;
beam->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir));
});
Direction dir = beam->up() ? Direction::DOWN : Direction::UP;
beam->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir));
});
} else if (e->isSlurTieSegment()) {
auto slurTieSegment = toSlurTieSegment(e)->slurTie();
flipOnce(slurTieSegment, [slurTieSegment]() {
Direction dir = slurTieSegment->up() ? Direction::DOWN : Direction::UP;
slurTieSegment->undoChangeProperty(Pid::SLUR_DIRECTION, QVariant::fromValue<Direction>(dir));
});
Direction dir = slurTieSegment->up() ? Direction::DOWN : Direction::UP;
slurTieSegment->undoChangeProperty(Pid::SLUR_DIRECTION, QVariant::fromValue<Direction>(dir));
});
} else if (e->isArticulation()) {
auto articulation = toArticulation(e);
flipOnce(articulation, [articulation]() {
ArticulationAnchor articAnchor = articulation->anchor();
switch (articAnchor) {
case ArticulationAnchor::TOP_CHORD:
articAnchor = ArticulationAnchor::BOTTOM_CHORD;
break;
case ArticulationAnchor::BOTTOM_CHORD:
articAnchor = ArticulationAnchor::TOP_CHORD;
break;
case ArticulationAnchor::CHORD:
articAnchor = articulation->up() ? ArticulationAnchor::BOTTOM_CHORD : ArticulationAnchor::TOP_CHORD;
break;
case ArticulationAnchor::TOP_STAFF:
articAnchor = ArticulationAnchor::BOTTOM_STAFF;
break;
case ArticulationAnchor::BOTTOM_STAFF:
articAnchor = ArticulationAnchor::TOP_STAFF;
break;
}
PropertyFlags pf = articulation->propertyFlags(Pid::ARTICULATION_ANCHOR);
if (pf == PropertyFlags::STYLED) {
pf = PropertyFlags::UNSTYLED;
}
articulation->undoChangeProperty(Pid::ARTICULATION_ANCHOR, int(articAnchor), pf);
});
ArticulationAnchor articAnchor = articulation->anchor();
switch (articAnchor) {
case ArticulationAnchor::TOP_CHORD:
articAnchor = ArticulationAnchor::BOTTOM_CHORD;
break;
case ArticulationAnchor::BOTTOM_CHORD:
articAnchor = ArticulationAnchor::TOP_CHORD;
break;
case ArticulationAnchor::CHORD:
articAnchor = articulation->up() ? ArticulationAnchor::BOTTOM_CHORD : ArticulationAnchor::TOP_CHORD;
break;
case ArticulationAnchor::TOP_STAFF:
articAnchor = ArticulationAnchor::BOTTOM_STAFF;
break;
case ArticulationAnchor::BOTTOM_STAFF:
articAnchor = ArticulationAnchor::TOP_STAFF;
break;
}
PropertyFlags pf = articulation->propertyFlags(Pid::ARTICULATION_ANCHOR);
if (pf == PropertyFlags::STYLED) {
pf = PropertyFlags::UNSTYLED;
}
articulation->undoChangeProperty(Pid::ARTICULATION_ANCHOR, int(articAnchor), pf);
});
} else if (e->isTuplet()) {
auto tuplet = toTuplet(e);
flipOnce(tuplet, [tuplet]() {
Direction dir = tuplet->isUp() ? Direction::DOWN : Direction::UP;
tuplet->undoChangeProperty(Pid::DIRECTION, QVariant::fromValue<Direction>(dir),
PropertyFlags::UNSTYLED);
});
Direction dir = tuplet->isUp() ? Direction::DOWN : Direction::UP;
tuplet->undoChangeProperty(Pid::DIRECTION, QVariant::fromValue<Direction>(dir),
PropertyFlags::UNSTYLED);
});
} else if (e->isNoteDot() && e->parent()->isNote()) {
Note* note = toNote(e->parent());
Direction d = note->dotIsUp() ? Direction::DOWN : Direction::UP;

View file

@ -215,12 +215,12 @@ void ImageStore::clearUnused()
{
_items.erase(
std::remove_if(_items.begin(), _items.end(), [](ImageStoreItem* i) {
const bool remove = !i->isUsed();
if (remove) {
delete i;
}
return remove;
}),
const bool remove = !i->isUsed();
if (remove) {
delete i;
}
return remove;
}),
_items.end()
);
}

View file

@ -1663,8 +1663,8 @@ static void layoutPage(Page* page, qreal restHeight)
// allocate space as needed to normalize system distance (bottom of one system to top of next)
std::sort(sList.begin(), sList.end(), [](System* a, System* b) {
return a->distance() - a->height() < b->distance() - b->height();
});
return a->distance() - a->height() < b->distance() - b->height();
});
System* s0 = sList[0];
qreal dist = s0->distance() - s0->height(); // distance for shortest system
for (int i = 1; i < sList.size(); ++i) {

View file

@ -674,17 +674,17 @@ void Lyrics::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
if (Placement(v.toInt()) == Placement::ABOVE) {
// change placment of all verse for the same voice upto this one to ABOVE
score()->forAllLyrics([this,id,v,ps](Lyrics* l) {
if (l->no() <= no() && l->voice() == voice()) {
l->TextBase::undoChangeProperty(id, v, ps);
}
});
if (l->no() <= no() && l->voice() == voice()) {
l->TextBase::undoChangeProperty(id, v, ps);
}
});
} else {
// change placment of all verse for the same voce starting from this one to BELOW
score()->forAllLyrics([this,id,v,ps](Lyrics* l) {
if (l->no() >= no() && l->voice() == voice()) {
l->TextBase::undoChangeProperty(id, v, ps);
}
});
if (l->no() >= no() && l->voice() == voice()) {
l->TextBase::undoChangeProperty(id, v, ps);
}
});
}
return;
}

View file

@ -182,8 +182,8 @@ SpannerSegment* LyricsLine::layoutSystem(System* system)
Fraction etick = system->lastMeasure()->endTick();
LyricsLineSegment* lineSegm = toLyricsLineSegment(getNextLayoutSystemSegment(system, [this]() {
return createLineSegment();
}));
return createLineSegment();
}));
SpannerSegmentType sst;
if (tick() >= stick) {

View file

@ -131,36 +131,36 @@ std::vector<MScoreError> MScore::errorList {
{ MsError::MS_NO_ERROR, 0, 0 },
{ MsError::NO_NOTE_SELECTED, "s1", QT_TRANSLATE_NOOP("error",
"No note selected:\nPlease select a note and retry") },
"No note selected:\nPlease select a note and retry") },
{ MsError::NO_CHORD_REST_SELECTED, "s2", QT_TRANSLATE_NOOP("error",
"No chord/rest selected:\nPlease select a chord or rest and retry") },
"No chord/rest selected:\nPlease select a chord or rest and retry") },
{ MsError::NO_LYRICS_SELECTED, "s3", QT_TRANSLATE_NOOP("error",
"No note or lyrics selected:\nPlease select a note or lyrics and retry") },
"No note or lyrics selected:\nPlease select a note or lyrics and retry") },
{ MsError::NO_NOTE_REST_SELECTED, "s4", QT_TRANSLATE_NOOP("error",
"No note or rest selected:\nPlease select a note or rest and retry") },
"No note or rest selected:\nPlease select a note or rest and retry") },
{ MsError::NO_FLIPPABLE_SELECTED, "s5", QT_TRANSLATE_NOOP("error",
"No flippable element selected:\nPlease select an element that can be flipped and retry") },
"No flippable element selected:\nPlease select an element that can be flipped and retry") },
{ MsError::NO_STAFF_SELECTED, "s6", QT_TRANSLATE_NOOP("error",
"No staff selected:\nPlease select one or more staves and retry") },
"No staff selected:\nPlease select one or more staves and retry") },
{ MsError::NO_NOTE_FIGUREDBASS_SELECTED, "s7", QT_TRANSLATE_NOOP("error",
"No note or figured bass selected:\nPlease select a note or figured bass and retry") },
"No note or figured bass selected:\nPlease select a note or figured bass and retry") },
{ MsError::CANNOT_INSERT_TUPLET, "t1", QT_TRANSLATE_NOOP("error", "Cannot insert chord/rest in tuplet") },
{ MsError::CANNOT_SPLIT_TUPLET, "t2", QT_TRANSLATE_NOOP("error", "Cannot split tuplet") },
{ MsError::CANNOT_SPLIT_MEASURE_FIRST_BEAT, "m1", QT_TRANSLATE_NOOP("error",
"Cannot split measure here:\n"
"First beat of measure") },
"Cannot split measure here:\n"
"First beat of measure") },
{ MsError::CANNOT_SPLIT_MEASURE_TUPLET, "m2", QT_TRANSLATE_NOOP("error",
"Cannot split measure here:\n" "Cannot split tuplet") },
"Cannot split measure here:\n" "Cannot split tuplet") },
{ MsError::INSUFFICIENT_MEASURES, "m3", QT_TRANSLATE_NOOP("error",
"Measure repeat cannot be added here:\nInsufficient or unequal measures") },
"Measure repeat cannot be added here:\nInsufficient or unequal measures") },
{ MsError::CANNOT_SPLIT_MEASURE_REPEAT, "m4", QT_TRANSLATE_NOOP("error", "Cannot split measure repeat") },
{ MsError::CANNOT_REMOVE_TIME_TUPLET, "d1", QT_TRANSLATE_NOOP("error",
"Cannot remove time from tuplet:\nPlease select the complete tuplet and retry") },
"Cannot remove time from tuplet:\nPlease select the complete tuplet and retry") },
{ MsError::CANNOT_REMOVE_TIME_MEASURE_REPEAT, "d2", QT_TRANSLATE_NOOP("error",
"Cannot remove time from measure repeat:\nPlease select the complete measure repeat and retry") },
"Cannot remove time from measure repeat:\nPlease select the complete measure repeat and retry") },
{ MsError::NO_DEST, "p1", QT_TRANSLATE_NOOP("error", "No destination to paste") },
{ MsError::DEST_TUPLET, "p2", QT_TRANSLATE_NOOP("error", "Cannot paste into tuplet") },
@ -170,7 +170,7 @@ std::vector<MScoreError> MScore::errorList {
{ MsError::NO_MIME, "p6", QT_TRANSLATE_NOOP("error", "Nothing to paste") },
{ MsError::DEST_NO_CR, "p7", QT_TRANSLATE_NOOP("error", "Destination is not a chord or rest") },
{ MsError::CANNOT_CHANGE_LOCAL_TIMESIG, "l1", QT_TRANSLATE_NOOP("error",
"Cannot change local time signature:\nMeasure is not empty") },
"Cannot change local time signature:\nMeasure is not empty") },
};
MsError MScore::_error { MsError::MS_NO_ERROR };

View file

@ -62,8 +62,8 @@ public:
int offtime()
{
return empty() ? 0 : std::max_element(cbegin(), cend(), [](const NoteEvent& n1, const NoteEvent& n2) {
return n1.offtime() < n2.offtime();
})->offtime();
return n1.offtime() < n2.offtime();
})->offtime();
}
};
} // namespace Ms

View file

@ -613,11 +613,11 @@ int Part::harmonyCount() const
void Part::updateHarmonyChannels(bool isDoOnInstrumentChanged, bool checkRemoval)
{
auto onInstrumentChanged = [this]() {
masterScore()->rebuildMidiMapping();
masterScore()->updateChannel();
score()->setInstrumentsChanged(true);
score()->setLayoutAll(); //do we need this?
};
masterScore()->rebuildMidiMapping();
masterScore()->updateChannel();
score()->setInstrumentsChanged(true);
score()->setLayoutAll(); //do we need this?
};
// usage of harmony count is okay even if expensive since checking harmony channel will shortcircuit if existent
// harmonyCount will only be called on loading of a score (where it will need to be scanned for harmony anyway)

View file

@ -1717,25 +1717,25 @@ bool renderNoteArticulation(NoteEventList* events, Note* note, bool chromatic, i
// of a different pitch.
// The total duration of the tied note is returned, and the index is modified.
auto tieForward = [millespernote](int& j, const std::vector<int>& vec) {
int size = int(vec.size());
int duration = millespernote;
while (j < size - 1 && vec[j] == vec[j + 1]) {
duration += millespernote;
j++;
}
return duration;
};
int size = int(vec.size());
int duration = millespernote;
while (j < size - 1 && vec[j] == vec[j + 1]) {
duration += millespernote;
j++;
}
return duration;
};
// local function:
// append a NoteEvent either by calculating an articulationExcursion or by
// the given chromatic relative pitch.
// RETURNS the new ontime value. The caller is expected to assign this value.
auto makeEvent = [note,chord,chromatic,events](int pitch, int ontime, int duration) {
events->append(NoteEvent(chromatic ? pitch : articulationExcursion(note,note,pitch),
ontime / chord->actualTicks().ticks(),
duration / chord->actualTicks().ticks()));
return ontime + duration;
};
events->append(NoteEvent(chromatic ? pitch : articulationExcursion(note,note,pitch),
ontime / chord->actualTicks().ticks(),
duration / chord->actualTicks().ticks()));
return ontime + duration;
};
// local function:
// Given a chord from a grace note, (normally the chord contains a single note) and create
@ -1746,20 +1746,20 @@ bool renderNoteArticulation(NoteEventList* events, Note* note, bool chromatic, i
// but still updates ontime +=millespernote.
// RETURNS the new value of ontime, so caller must make an assignment to the return value.
auto graceExtend = [millespernote,chord,events](int notePitch, QVector<Chord*> graceNotes, int ontime) {
for (Chord* c : graceNotes) {
for (Note* n : c->notes()) {
// NoteEvent takes relative pitch as first argument.
// The pitch is relative to the pitch of the note, the event is rendering
if (n->play()) {
events->append(NoteEvent(n->pitch() - notePitch,
ontime / chord->actualTicks().ticks(),
millespernote / chord->actualTicks().ticks()));
}
}
ontime += millespernote;
}
return ontime;
};
for (Chord* c : graceNotes) {
for (Note* n : c->notes()) {
// NoteEvent takes relative pitch as first argument.
// The pitch is relative to the pitch of the note, the event is rendering
if (n->play()) {
events->append(NoteEvent(n->pitch() - notePitch,
ontime / chord->actualTicks().ticks(),
millespernote / chord->actualTicks().ticks()));
}
}
ontime += millespernote;
}
return ontime;
};
// calculate the number of times to repeat the body, and sustain the last note of the body
// 1000 = P + numrepeat*B+sustain + S
@ -2644,8 +2644,8 @@ MidiRenderer::Chunk MidiRenderer::getChunkAt(int utick)
updateState();
auto it = std::upper_bound(chunks.begin(), chunks.end(), utick, [](int utick, const Chunk& ch) {
return utick < ch.utick1();
});
return utick < ch.utick1();
});
if (it == chunks.begin()) {
return Chunk();
}
@ -2661,8 +2661,8 @@ MidiRenderer::Chunk MidiRenderer::chunkAt(int utick)
{
updateState();
auto it = std::upper_bound(chunks.begin(), chunks.end(), utick, [](int utick, const Chunk& ch) {
return utick <= ch.utick1();
});
return utick <= ch.utick1();
});
if (it == chunks.end()) {
return Chunk();

View file

@ -254,9 +254,9 @@ int RepeatList::utime2utick(qreal t) const
QList<RepeatSegment*>::const_iterator RepeatList::findRepeatSegmentFromUTick(int utick) const
{
return std::lower_bound(this->cbegin(), this->cend(), utick, [](RepeatSegment const* rs, int utick) {
// Skip RS where endtick is less than us
return utick > (rs->utick + rs->len());
});
// Skip RS where endtick is less than us
return utick > (rs->utick + rs->len());
});
}
//---------------------------------------------------------
@ -403,8 +403,8 @@ void RepeatList::collectRepeatListElements()
// Cross-section of the repeatList
std::list<int> endings(remainder->endings().begin(), remainder->endings().end());
endings.remove_if([&volta](const int& ending) {
return !(volta->hasEnding(ending));
});
return !(volta->hasEnding(ending));
});
remainder->setEndings(QList<int>(endings.begin(), endings.end()));
// Split and merge done
preProcessedVoltas.push_back(remainder);

View file

@ -3145,11 +3145,11 @@ void Score::padToggle(Pad p, const EditData& ed)
if (canAdjustLength) {
// Change length from last to first chord/rest
std::sort(crs.begin(), crs.end(), [](const ChordRest* cr1, const ChordRest* cr2) {
if (cr2->track() == cr1->track()) {
return cr2->isBefore(cr1);
}
return cr2->track() < cr1->track();
});
if (cr2->track() == cr1->track()) {
return cr2->isBefore(cr1);
}
return cr2->track() < cr1->track();
});
// Remove duplicates from the list
crs.erase(std::unique(crs.begin(), crs.end()), crs.end());
} else {

View file

@ -714,66 +714,66 @@ ScoreElement* LinkedElements::mainElement()
const bool elements = at(0)->isElement();
const bool staves = at(0)->isStaff();
return *std::min_element(begin(), end(), [ms, elements, staves](ScoreElement* s1, ScoreElement* s2) {
if (s1->score() == ms && s2->score() != ms) {
return true;
}
if (s1->score() != s2->score()) {
return false;
}
if (staves) {
return toStaff(s1)->idx() < toStaff(s2)->idx();
}
if (elements) {
// Now we compare either two elements from master score
// or two elements from excerpt.
Element* e1 = toElement(s1);
Element* e2 = toElement(s2);
const int tr1 = e1->track();
const int tr2 = e2->track();
if (tr1 == tr2) {
const Fraction tick1 = e1->tick();
const Fraction tick2 = e2->tick();
if (tick1 == tick2) {
Measure* m1 = e1->findMeasure();
Measure* m2 = e2->findMeasure();
if (!m1 || !m2) {
return false;
}
// MM rests are written to MSCX in the following order:
// 1) first measure of MM rest (m->hasMMRest() == true);
// 2) MM rest itself (m->isMMRest() == true);
// 3) other measures of MM rest (m->hasMMRest() == false).
//
// As mainElement() must find the first element that
// is going to be written to a file, MM rest writing
// order should also be considered.
if (m1->isMMRest() == m2->isMMRest()) {
// no difference if both are MM rests or both are usual measures
return false;
}
// MM rests may be generated but not written (e.g. if
// saving a file right after disabling MM rests)
const bool mmRestsWritten = e1->score()->styleB(Sid::createMultiMeasureRests);
if (m1->isMMRest()) {
// m1 is earlier if m2 is *not* the first MM rest measure
return mmRestsWritten && !m2->hasMMRest();
}
if (m2->isMMRest()) {
// m1 is earlier if it *is* the first MM rest measure
return !mmRestsWritten || m1->hasMMRest();
}
if (s1->score() == ms && s2->score() != ms) {
return true;
}
if (s1->score() != s2->score()) {
return false;
}
if (staves) {
return toStaff(s1)->idx() < toStaff(s2)->idx();
}
if (elements) {
// Now we compare either two elements from master score
// or two elements from excerpt.
Element* e1 = toElement(s1);
Element* e2 = toElement(s2);
const int tr1 = e1->track();
const int tr2 = e2->track();
if (tr1 == tr2) {
const Fraction tick1 = e1->tick();
const Fraction tick2 = e2->tick();
if (tick1 == tick2) {
Measure* m1 = e1->findMeasure();
Measure* m2 = e2->findMeasure();
if (!m1 || !m2) {
return false;
}
return tick1 < tick2;
// MM rests are written to MSCX in the following order:
// 1) first measure of MM rest (m->hasMMRest() == true);
// 2) MM rest itself (m->isMMRest() == true);
// 3) other measures of MM rest (m->hasMMRest() == false).
//
// As mainElement() must find the first element that
// is going to be written to a file, MM rest writing
// order should also be considered.
if (m1->isMMRest() == m2->isMMRest()) {
// no difference if both are MM rests or both are usual measures
return false;
}
// MM rests may be generated but not written (e.g. if
// saving a file right after disabling MM rests)
const bool mmRestsWritten = e1->score()->styleB(Sid::createMultiMeasureRests);
if (m1->isMMRest()) {
// m1 is earlier if m2 is *not* the first MM rest measure
return mmRestsWritten && !m2->hasMMRest();
}
if (m2->isMMRest()) {
// m1 is earlier if it *is* the first MM rest measure
return !mmRestsWritten || m1->hasMMRest();
}
return false;
}
return tr1 < tr2;
return tick1 < tick2;
}
return false;
});
return tr1 < tr2;
}
return false;
});
}
//---------------------------------------------------------

View file

@ -1344,8 +1344,8 @@ Element* Segment::nextAnnotation(Element* e)
}
// TODO: firstVisibleStaff() for system elements? see Spanner::nextSpanner()
auto resIt = std::find_if(ei + 1, _annotations.end(), [e](Element* nextElem) {
return nextElem && nextElem->staffIdx() == e->staffIdx();
});
return nextElem && nextElem->staffIdx() == e->staffIdx();
});
return _annotations.end() == resIt ? nullptr : *resIt;
}
@ -1366,8 +1366,8 @@ Element* Segment::prevAnnotation(Element* e)
}
// TODO: firstVisibleStaff() for system elements? see Spanner::nextSpanner()
auto resIt = std::find_if(reverseIt + 1, _annotations.rend(), [e](Element* prevElem) {
return prevElem && prevElem->staffIdx() == e->staffIdx();
});
return prevElem && prevElem->staffIdx() == e->staffIdx();
});
return _annotations.rend() == resIt ? nullptr : *resIt;
}

View file

@ -1024,8 +1024,8 @@ SpannerSegment* Slur::layoutSystem(System* system)
Fraction etick = system->lastMeasure()->endTick();
SlurSegment* slurSegment = toSlurSegment(getNextLayoutSystemSegment(system, [this]() {
return new SlurSegment(score());
}));
return new SlurSegment(score());
}));
SpannerSegmentType sst;
if (tick() >= stick) {

View file

@ -28,5 +28,5 @@ static mu::testing::SuiteEnvironment libmscore_se(
},
[]() {
LOGI() << "libmscore tests suite post init";
}
}
);

View file

@ -100,6 +100,7 @@ ModulesSetup::ModulesSetup()
#ifdef BUILD_VST
<< new mu::vst::VSTModule()
#endif
//<< new mu::importexport::ImportExportModule()
<< new mu::inspector::InspectorModule()
<< new mu::palette::PaletteModule()

View file

@ -252,7 +252,7 @@ mu::Ret MasterNotation::createNew(const ScoreCreateOptions& scoreOptions)
score->sigmap()->add(0, timesig);
Ms::Fraction firstMeasureTicks = pickupMeasure ? Ms::Fraction(scoreOptions.measureTimesigNumerator,
scoreOptions.measureTimesigDenominator) : timesig;
scoreOptions.measureTimesigDenominator) : timesig;
for (int i = 0; i < measures; ++i) {
Ms::Fraction tick = firstMeasureTicks + timesig * (i - 1);
@ -270,7 +270,7 @@ mu::Ret MasterNotation::createNew(const ScoreCreateOptions& scoreOptions)
if (pickupMeasure && tick.isZero()) {
measure->setIrregular(true); // dont count pickup measure
measure->setTicks(Ms::Fraction(scoreOptions.measureTimesigNumerator,
scoreOptions.measureTimesigDenominator));
scoreOptions.measureTimesigDenominator));
}
_score->measures()->add(measure);

View file

@ -246,8 +246,8 @@ INotationNoteInputPtr NotationActionController::currentNotationNoteInput() const
void NotationActionController::resetState()
{
auto isAudioPlaying = [this]() {
return audioPlayer()->status() == audio::PlayStatus::PLAYING;
};
return audioPlayer()->status() == audio::PlayStatus::PLAYING;
};
if (isAudioPlaying()) {
audioPlayer()->stop();

View file

@ -935,10 +935,10 @@ bool NotationInteraction::applyPaletteElement(Ms::Element* element, Qt::Keyboard
}
auto isEntryDrumStaff = [score]() {
const Ms::InputState& is = score->inputState();
Ms::Staff* staff = score->staff(is.track() / VOICES);
return staff->staffType(is.tick())->group() == Ms::StaffGroup::PERCUSSION;
};
const Ms::InputState& is = score->inputState();
Ms::Staff* staff = score->staff(is.track() / VOICES);
return staff->staffType(is.tick())->group() == Ms::StaffGroup::PERCUSSION;
};
if (isEntryDrumStaff() && element->isChord()) {
Ms::InputState& is = score->inputState();
@ -1593,15 +1593,15 @@ void NotationInteraction::moveSelection(MoveDirection d, MoveSelectionType type)
//! and interpretation of actions is the responsibility of `NotationActionController`
auto typeToString = [](MoveSelectionType type) {
switch (type) {
case MoveSelectionType::Undefined: return QString();
case MoveSelectionType::Element: return QString();
case MoveSelectionType::Chord: return QString("chord");
case MoveSelectionType::Measure: return QString("measure");
case MoveSelectionType::Track: return QString("track");
}
return QString();
};
switch (type) {
case MoveSelectionType::Undefined: return QString();
case MoveSelectionType::Element: return QString();
case MoveSelectionType::Chord: return QString("chord");
case MoveSelectionType::Measure: return QString("measure");
case MoveSelectionType::Track: return QString("track");
}
return QString();
};
QString cmd;
if (MoveDirection::Left == d) {
@ -1850,16 +1850,16 @@ void NotationInteraction::joinSelectedMeasures()
void NotationInteraction::addBoxes(BoxType boxType, int count, int beforeBoxIndex)
{
auto boxTypeToElementType = [](BoxType boxType) {
switch (boxType) {
case BoxType::Horizontal: return Ms::ElementType::HBOX;
case BoxType::Vertical: return Ms::ElementType::VBOX;
case BoxType::Text: return Ms::ElementType::TBOX;
case BoxType::Measure: return Ms::ElementType::MEASURE;
case BoxType::Unknown: return Ms::ElementType::INVALID;
}
switch (boxType) {
case BoxType::Horizontal: return Ms::ElementType::HBOX;
case BoxType::Vertical: return Ms::ElementType::VBOX;
case BoxType::Text: return Ms::ElementType::TBOX;
case BoxType::Measure: return Ms::ElementType::MEASURE;
case BoxType::Unknown: return Ms::ElementType::INVALID;
}
return ElementType::INVALID;
};
return ElementType::INVALID;
};
Ms::ElementType elementType = boxTypeToElementType(boxType);
Ms::MeasureBase* beforeBox = beforeBoxIndex >= 0 ? score()->measure(beforeBoxIndex) : nullptr;

View file

@ -1216,16 +1216,16 @@ void NotationParts::appendPart(Part* part)
int NotationParts::resolvePartIndex(Part* part) const
{
auto findMasterPartIndex = [this](const ID& partId) -> int {
QList<Part*> masterParts = masterScore()->parts();
QList<Part*> masterParts = masterScore()->parts();
for (int masterPartIndex = 0; masterPartIndex < masterParts.size(); ++masterPartIndex) {
if (masterParts[masterPartIndex]->id() == partId) {
return masterPartIndex;
}
}
for (int masterPartIndex = 0; masterPartIndex < masterParts.size(); ++masterPartIndex) {
if (masterParts[masterPartIndex]->id() == partId) {
return masterPartIndex;
}
}
return -1;
};
return -1;
};
const QList<Part*>& scoreParts = score()->parts();
@ -1331,8 +1331,8 @@ void NotationParts::sortParts(const InstrumentList& instruments)
Q_ASSERT(score()->parts().size() == static_cast<int>(instruments.size()));
auto mainInstrumentId = [](const Part* part) {
return part->instrument()->instrumentId();
};
return part->instrument()->instrumentId();
};
for (int i = 0; i < instruments.size(); ++i) {
const Part* currentPart = score()->parts().at(i);

View file

@ -270,8 +270,8 @@ void NotationViewInputController::startDragElements(ElementType etype, const QPo
const bool isFilterType = m_view->notationInteraction()->selection()->isRange();
const auto isDraggable = [isFilterType, etype](const Element* e) {
return e && e->selected() && (!isFilterType || etype == e->type());
};
return e && e->selected() && (!isFilterType || etype == e->type());
};
m_view->notationInteraction()->startDrag(els, eoffset, isDraggable);
}

View file

@ -492,36 +492,36 @@ ActionNameList NoteInputBarCustomiseModel::defaultActions() const
ActionNameList result;
auto canAppendAction = [&](const ActionName& actionName) {
if (actionFromNoteInputModes(actionName)) {
if (noteInputModeActionExists) {
return false;
}
if (actionFromNoteInputModes(actionName)) {
if (noteInputModeActionExists) {
return false;
}
noteInputModeActionExists = true;
}
noteInputModeActionExists = true;
}
return true;
};
return true;
};
auto appendRelatedActions = [&](size_t startActionIndex) {
ActionNameList actions;
for (size_t i = startActionIndex; i < allNoteInputActions.size(); ++i) {
ActionName actionName = allNoteInputActions[i].name;
if (containsAction(currentWorkspaceNoteInputActions, actionName)) {
break;
}
ActionNameList actions;
for (size_t i = startActionIndex; i < allNoteInputActions.size(); ++i) {
ActionName actionName = allNoteInputActions[i].name;
if (containsAction(currentWorkspaceNoteInputActions, actionName)) {
break;
}
if (!canAppendAction(actionName)) {
continue;
}
if (!canAppendAction(actionName)) {
continue;
}
actions.push_back(actionName);
}
actions.push_back(actionName);
}
if (!actions.empty()) {
result.insert(result.end(), actions.begin(), actions.end());
}
};
if (!actions.empty()) {
result.insert(result.end(), actions.begin(), actions.end());
}
};
//! NOTE: if there are actions at the beginning of the all note input actions,
//! but not at the beginning of the current workspace

View file

@ -335,9 +335,9 @@ void NoteInputBarModel::updateArticulationsState()
std::set<SymbolId> currentArticulations = resolveCurrentArticulations();
auto isArticulationSelected = [&currentArticulations](SymbolId articulationSymbolId) {
return std::find(currentArticulations.begin(), currentArticulations.end(),
articulationSymbolId) != currentArticulations.end();
};
return std::find(currentArticulations.begin(), currentArticulations.end(),
articulationSymbolId) != currentArticulations.end();
};
for (const actions::ActionName& actionName: articulationActions) {
item(actionName).checked = isArticulationSelected(NotationActions::actionArticulationSymbolId(actionName));
@ -387,14 +387,14 @@ std::set<SymbolId> NoteInputBarModel::resolveCurrentArticulations() const
}
auto chordArticulations = [](const Chord* chord) {
std::set<SymbolId> result;
for (Articulation* articulation: chord->articulations()) {
result.insert(articulation->symId());
}
std::set<SymbolId> result;
for (Articulation* articulation: chord->articulations()) {
result.insert(articulation->symId());
}
result = Ms::flipArticulations(result, Ms::Placement::ABOVE);
return Ms::splitArticulations(result);
};
result = Ms::flipArticulations(result, Ms::Placement::ABOVE);
return Ms::splitArticulations(result);
};
std::set<SymbolId> result;
bool isFirstNote = true;

View file

@ -296,9 +296,9 @@ void ScorePropertiesDialog::accept()
void ScorePropertiesDialog::closeEvent(QCloseEvent* event)
{
auto apply = [this, event]() {
WidgetStateStore::saveGeometry(this);
event->accept();
};
WidgetStateStore::saveGeometry(this);
event->accept();
};
if (!m_dirty) {
apply();

View file

@ -135,8 +135,8 @@ Palette::Palette(PalettePanelPtr pp, QWidget* parent)
if (moreElements()) {
connect(this, &Palette::displayMore, [](const QString& arg) {
adapter()->showMasterPalette(arg);
});
adapter()->showMasterPalette(arg);
});
}
}

View file

@ -113,8 +113,8 @@ PalettePanel* PaletteTreeModel::iptrToPalettePanel(void* iptr, int* idx)
const auto palette = std::find_if(
palettes().begin(), palettes().end(),
[iptr](const PalettePanelPtr& p) {
return iptr == p.get();
});
return iptr == p.get();
});
if (idx) {
(*idx) = palette - palettes().begin();

View file

@ -264,7 +264,6 @@ struct PaletteTree
};
using PaletteTreePtr = std::shared_ptr<PaletteTree>;
} // namespace Ms
Q_DECLARE_METATYPE(const Ms::PaletteCell*)

View file

@ -443,8 +443,8 @@ void UserPaletteController::remove(const QModelIndexList& unsortedRemoveIndices,
QModelIndexList removeIndices = unsortedRemoveIndices;
std::sort(removeIndices.begin(), removeIndices.end(), [](const QModelIndex& a, const QModelIndex& b) {
return a.row() < b.row();
});
return a.row() < b.row();
});
// remove in reversed order to leave the previous model indices in the list valid
for (auto i = removeIndices.rbegin(); i != removeIndices.rend(); ++i) {
@ -535,13 +535,13 @@ void UserPaletteController::editPaletteProperties(const QModelIndex& index)
configuration()->paletteConfig(panel->id()).ch.onReceive(this,
[this, srcIndex, panel](const IPaletteConfiguration::PaletteConfig& config) {
panel->setName(config.name);
panel->setGrid(config.size);
panel->setMag(config.scale);
panel->setYOffset(config.elementOffset);
panel->setDrawGrid(config.showGrid);
_userPalette->itemDataChanged(srcIndex);
});
panel->setName(config.name);
panel->setGrid(config.size);
panel->setMag(config.scale);
panel->setYOffset(config.elementOffset);
panel->setDrawGrid(config.showGrid);
_userPalette->itemDataChanged(srcIndex);
});
QVariantMap properties;
properties["paletteId"] = panel->id();
@ -578,13 +578,13 @@ void UserPaletteController::editCellProperties(const QModelIndex& index)
configuration()->paletteCellConfig(cell->id).ch.onReceive(this,
[this, srcIndex, cell](
const IPaletteConfiguration::PaletteCellConfig& config) {
cell->name = config.name;
cell->mag = config.scale;
cell->drawStaff = config.drawStaff;
cell->xoffset = config.xOffset;
cell->yoffset = config.yOffset;
_userPalette->itemDataChanged(srcIndex);
});
cell->name = config.name;
cell->mag = config.scale;
cell->drawStaff = config.drawStaff;
cell->xoffset = config.xOffset;
cell->yoffset = config.yOffset;
_userPalette->itemDataChanged(srcIndex);
});
QVariantMap properties;
properties["cellId"] = cell->id;

View file

@ -36,30 +36,30 @@ void PaletteWorkspaceSetup::setup()
auto updateWorkspaceConnection = std::make_shared<QMetaObject::Connection>();
auto applyWorkspaceData = [paletteWorkspace, updateWorkspaceConnection](workspace::IWorkspacePtr workspace) {
workspace::AbstractDataPtr data = workspace->data(workspace::WorkspaceTag::Palettes);
PaletteWorkspaceDataPtr palette = std::dynamic_pointer_cast<PaletteWorkspaceData>(data);
workspace::AbstractDataPtr data = workspace->data(workspace::WorkspaceTag::Palettes);
PaletteWorkspaceDataPtr palette = std::dynamic_pointer_cast<PaletteWorkspaceData>(data);
if (!palette) {
LOGW() << "no palette data in workspace: " << workspace->name();
return false;
}
if (!palette) {
LOGW() << "no palette data in workspace: " << workspace->name();
return false;
}
paletteWorkspace->setDefaultPaletteTree(palette->tree);
paletteWorkspace->setUserPaletteTree(palette->tree);
paletteWorkspace->setDefaultPaletteTree(palette->tree);
paletteWorkspace->setUserPaletteTree(palette->tree);
if (updateWorkspaceConnection) {
QObject::disconnect(*updateWorkspaceConnection);
}
if (updateWorkspaceConnection) {
QObject::disconnect(*updateWorkspaceConnection);
}
auto newConnection
= QObject::connect(paletteWorkspace, &PaletteWorkspace::userPaletteChanged, [workspace, palette]() {
auto newConnection
= QObject::connect(paletteWorkspace, &PaletteWorkspace::userPaletteChanged, [workspace, palette]() {
workspace->addData(palette);
});
*updateWorkspaceConnection = newConnection;
*updateWorkspaceConnection = newConnection;
return true;
};
return true;
};
RetValCh<workspace::IWorkspacePtr> workspace = workspaceManager()->currentWorkspace();
if (workspace.val) {

View file

@ -59,10 +59,10 @@ QHash<int,QByteArray> PlaybackToolBarModel::roleNames() const
void PlaybackToolBarModel::load()
{
auto makeItem = [](const Action& action) {
ActionItem item;
item.action = action;
return item;
};
ActionItem item;
item.action = action;
return item;
};
beginResetModel();

View file

@ -1577,6 +1577,21 @@ pp_if_indent_code = false # false/true
# Whether to indent '#define' at the brace level (true) or from column 1 (false)
pp_define_at_level = false # false/true
#
# Use or Do not Use options
#
# The value might be used twice:
# - at the assignment
# - at the opening brace
#
# To prevent the double use of the indentation value, use this option with the
# value 'true'.
#
# true: indentation will be used only once
# false: indentation will be used every time (default)
indent_cpp_lambda_only_once = true # true/false
# You can force a token to be a type with the 'type' option.
# Example:
# type myfoo1 myfoo2