Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
Changes after running tools/codestyle/uncrustify_run.sh script.
  • Loading branch information
shoogle committed Jul 22, 2020
1 parent dc7451b commit 9114d60
Show file tree
Hide file tree
Showing 38 changed files with 420 additions and 408 deletions.
7 changes: 4 additions & 3 deletions global/context/scorestateobserver.cpp
@@ -1,8 +1,8 @@
#include "scorestateobserver.h"

ScoreStateObserver::ScoreStateObserver(QObject* parent) : QObject(parent)
ScoreStateObserver::ScoreStateObserver(QObject* parent)
: QObject(parent)
{

}

Ms::ScoreState ScoreStateObserver::currentState() const
Expand All @@ -12,8 +12,9 @@ Ms::ScoreState ScoreStateObserver::currentState() const

void ScoreStateObserver::setCurrentState(Ms::ScoreState currentState)
{
if (m_currentState == currentState)
if (m_currentState == currentState) {
return;
}

m_currentState = currentState;
emit currentStateChanged(m_currentState);
Expand Down
3 changes: 2 additions & 1 deletion global/context/scorestateobserver.h
Expand Up @@ -10,7 +10,8 @@ class ScoreStateObserver : public QObject
Q_OBJECT

public:
static ScoreStateObserver* instance() {
static ScoreStateObserver* instance()
{
static ScoreStateObserver obs;
return &obs;
}
Expand Down
40 changes: 20 additions & 20 deletions global/gui/miconengine.h
Expand Up @@ -33,25 +33,25 @@ class MIconEnginePrivate;
//---------------------------------------------------------

class MIconEngine : public QIconEngine
{
public:
static QString iconDirPath;

MIconEngine();
MIconEngine(const MIconEngine &other);
~MIconEngine();
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);

void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state);
void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state);

QString key() const;
QIconEngine *clone() const;

private:
QSharedDataPointer<MIconEnginePrivate> d;
};
{
public:
static QString iconDirPath;

MIconEngine();
MIconEngine(const MIconEngine& other);
~MIconEngine();
void paint(QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state);
QSize actualSize(const QSize& size, QIcon::Mode mode, QIcon::State state);
QPixmap pixmap(const QSize& size, QIcon::Mode mode, QIcon::State state);

void addPixmap(const QPixmap& pixmap, QIcon::Mode mode, QIcon::State state);
void addFile(const QString& fileName, const QSize& size, QIcon::Mode mode, QIcon::State state);

QString key() const;
QIconEngine* clone() const;

private:
QSharedDataPointer<MIconEnginePrivate> d;
};

#endif
78 changes: 39 additions & 39 deletions libmscore/ambitus.cpp
Expand Up @@ -38,8 +38,8 @@ static const qreal LINEOFFSET_DEFAULT = 0.8; // the distance
// Ambitus
//---------------------------------------------------------

Ambitus::Ambitus(Score* s) :
Element(s, ElementFlag::ON_STAFF), _topAccid(s), _bottomAccid(s)
Ambitus::Ambitus(Score* s)
: Element(s, ElementFlag::ON_STAFF), _topAccid(s), _bottomAccid(s)
{
_noteHeadGroup = NOTEHEADGROUP_DEFAULT;
_noteHeadType = NOTEHEADTYPE_DEFAULT;
Expand Down Expand Up @@ -601,16 +601,16 @@ Ambitus::Ranges Ambitus::estimateRanges() const
return result;
}
Chord* chord;
int firstTrack = track();
int lastTrack = firstTrack + VOICES-1;
int pitchTop = -1000;
int pitchBottom = 1000;
int tpcTop = 0; // Initialized to prevent warning
int tpcBottom = 0; // Initialized to prevent warning
int trk;
int firstTrack = track();
int lastTrack = firstTrack + VOICES - 1;
int pitchTop = -1000;
int pitchBottom = 1000;
int tpcTop = 0; // Initialized to prevent warning
int tpcBottom = 0; // Initialized to prevent warning
int trk;
Measure* meas = segment()->measure();
Segment* segm = meas->findSegment(SegmentType::ChordRest, segment()->tick());
bool stop = meas->sectionBreak();
bool stop = meas->sectionBreak();
while (segm) {
// moved to another measure?
if (segm->measure() != meas) {
Expand Down Expand Up @@ -744,35 +744,35 @@ bool Ambitus::setProperty(Pid propertyId, const QVariant& v)
//---------------------------------------------------------

QVariant Ambitus::propertyDefault(Pid id) const
{
switch(id) {
case Pid::HEAD_GROUP:
return int(NOTEHEADGROUP_DEFAULT);
case Pid::HEAD_TYPE:
return int(NOTEHEADTYPE_DEFAULT);
case Pid::MIRROR_HEAD:
return int(DIR_DEFAULT);
case Pid::GHOST:
return HASLINE_DEFAULT;
case Pid::LINE_WIDTH:
return Spatium(LINEWIDTH_DEFAULT);
case Pid::TPC1:
return estimateRanges().topTpc;
case Pid::FBPARENTHESIS1:
return estimateRanges().bottomTpc;
case Pid::PITCH:
return estimateRanges().topPitch;
case Pid::FBPARENTHESIS2:
return estimateRanges().bottomPitch;
case Pid::FBPARENTHESIS3:
return int(estimateRanges().topPitch / 12) - 1;
case Pid::FBPARENTHESIS4:
return int(estimateRanges().bottomPitch / 12) - 1;
default:
return Element::propertyDefault(id);
}
//return QVariant();
}
{
switch (id) {
case Pid::HEAD_GROUP:
return int(NOTEHEADGROUP_DEFAULT);
case Pid::HEAD_TYPE:
return int(NOTEHEADTYPE_DEFAULT);
case Pid::MIRROR_HEAD:
return int(DIR_DEFAULT);
case Pid::GHOST:
return HASLINE_DEFAULT;
case Pid::LINE_WIDTH:
return Spatium(LINEWIDTH_DEFAULT);
case Pid::TPC1:
return estimateRanges().topTpc;
case Pid::FBPARENTHESIS1:
return estimateRanges().bottomTpc;
case Pid::PITCH:
return estimateRanges().topPitch;
case Pid::FBPARENTHESIS2:
return estimateRanges().bottomPitch;
case Pid::FBPARENTHESIS3:
return int(estimateRanges().topPitch / 12) - 1;
case Pid::FBPARENTHESIS4:
return int(estimateRanges().bottomPitch / 12) - 1;
default:
return Element::propertyDefault(id);
}
//return QVariant();
}

//---------------------------------------------------------
// nextSegmentElement
Expand Down
26 changes: 14 additions & 12 deletions libmscore/barline.cpp
Expand Up @@ -631,7 +631,7 @@ void BarLine::draw(QPainter* painter) const
break;

case BarLineType::DOUBLE_HEAVY: {
qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
qreal x = lw2 * .5;
painter->drawLine(QLineF(x, y1, x, y2));
Expand Down Expand Up @@ -941,24 +941,26 @@ Element* BarLine::drop(EditData& data)
//---------------------------------------------------------

void BarLine::setShowTips(bool val)
{
if (!score())
return;
{
if (!score()) {
return;
}

score()->undoChangeStyleVal(Sid::repeatBarTips, val);
}
score()->undoChangeStyleVal(Sid::repeatBarTips, val);
}

//---------------------------------------------------------
// showTips
//---------------------------------------------------------

bool BarLine::showTips() const
{
if (!score())
return false;
{
if (!score()) {
return false;
}

return score()->styleB(Sid::repeatBarTips);
}
return score()->styleB(Sid::repeatBarTips);
}

//---------------------------------------------------------
// gripsPositions
Expand Down Expand Up @@ -1297,7 +1299,7 @@ qreal BarLine::layoutWidth(Score* score, BarLineType type)
case BarLineType::DOUBLE:
w = score->styleP(Sid::doubleBarWidth) + score->styleP(Sid::doubleBarDistance);
break;
case BarLineType::DOUBLE_HEAVY:
case BarLineType::DOUBLE_HEAVY:
w = score->styleP(Sid::endBarWidth) * 2 + score->styleP(Sid::endBarDistance);
break;
case BarLineType::END_START_REPEAT:
Expand Down
12 changes: 7 additions & 5 deletions libmscore/beam.cpp
Expand Up @@ -55,7 +55,7 @@ struct BeamFragment {
//---------------------------------------------------------

Beam::Beam(Score* s)
: Element(s)
: Element(s)
{
initElementStyle(&beamStyle);
_direction = Direction::AUTO;
Expand All @@ -78,7 +78,7 @@ Beam::Beam(Score* s)
//---------------------------------------------------------

Beam::Beam(const Beam& b)
: Element(b)
: Element(b)
{
_elements = b._elements;
_id = b._id;
Expand Down Expand Up @@ -2276,7 +2276,7 @@ std::vector<QPointF> Beam::gripsPositions(const EditData& ed) const
break;
}
}
for (int i = n-1; i >= 0; --i) {
for (int i = n - 1; i >= 0; --i) {
if (_elements[i]->isChordRest()) {
c2 = toChordRest(_elements[i]);
break;
Expand Down Expand Up @@ -2500,12 +2500,14 @@ bool Beam::setProperty(Pid propertyId, const QVariant& v)
setUserModified(v.toBool());
break;
case Pid::BEAM_POS:
if (userModified())
if (userModified()) {
setBeamPos(v.toPointF());
}
break;
case Pid::BEAM_NO_SLOPE:
if (v.toBool())
if (v.toBool()) {
alignBeamPosition();
}
break;
default:
if (!Element::setProperty(propertyId, v)) {
Expand Down
2 changes: 1 addition & 1 deletion libmscore/bend.cpp
Expand Up @@ -436,7 +436,7 @@ bool Bend::setProperty(Pid id, const QVariant& v)
updatePointsByBendType(static_cast<BendType>(v.toInt()));
break;
case Pid::BEND_CURVE:
setPoints(v.value<QList<Ms::PitchValue>>());
setPoints(v.value<QList<Ms::PitchValue> >());
break;
default:
return Element::setProperty(id, v);
Expand Down
17 changes: 9 additions & 8 deletions libmscore/chord.cpp
Expand Up @@ -2882,12 +2882,13 @@ Element* Chord::drop(EditData& data)
//---------------------------------------------------------

void Chord::setColor(const QColor& color)
{
ChordRest::setColor(color);
{
ChordRest::setColor(color);

for (Note* note : _notes)
note->undoChangeProperty(Pid::COLOR, color);
}
for (Note* note : _notes) {
note->undoChangeProperty(Pid::COLOR, color);
}
}

//---------------------------------------------------------
// dotPosX
Expand Down Expand Up @@ -3660,9 +3661,9 @@ void Chord::undoChangeProperty(Pid id, const QVariant& newValue)
void Chord::undoChangeProperty(Pid id, const QVariant& newValue, PropertyFlags ps)
{
if (id == Pid::VISIBLE) {
processSiblings([=] (Element* element) {
element->undoChangeProperty(id, newValue, ps);
});
processSiblings([=](Element* element) {
element->undoChangeProperty(id, newValue, ps);
});
}

Element::undoChangeProperty(id, newValue, ps);
Expand Down
2 changes: 1 addition & 1 deletion libmscore/chord.h
Expand Up @@ -240,7 +240,7 @@ class Chord final : public ChordRest

Shape shape() const override;
void undoChangeProperty(Pid id, const QVariant& newValue);
void undoChangeProperty(Pid id, const QVariant &newValue, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const QVariant& newValue, PropertyFlags ps) override;
};
} // namespace Ms
#endif
2 changes: 1 addition & 1 deletion libmscore/dynamic.cpp
Expand Up @@ -586,7 +586,7 @@ bool Dynamic::setProperty(Pid propertyId, const QVariant& v)

QVariant Dynamic::propertyDefault(Pid id) const
{
switch(id) {
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::DYNAMICS);
case Pid::DYNAMIC_RANGE:
Expand Down
5 changes: 3 additions & 2 deletions libmscore/edit.cpp
Expand Up @@ -1568,9 +1568,10 @@ void Score::cmdFlip()
continue;
}
} else {
flipOnce(chord, [this, chord](){
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));
chord->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir),
propertyFlags(Pid::STEM_DIRECTION));
});
}
}
Expand Down
5 changes: 2 additions & 3 deletions libmscore/fret.cpp
Expand Up @@ -1226,10 +1226,9 @@ void FretDiagram::addLoaded(Element* e)
if (e->isHarmony()) {
_harmony = toHarmony(e);
_harmony->setTrack(track());
}
else {
} else {
qWarning("FretDiagram: cannot add <%s>\n", e->name());
}
}
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion libmscore/hook.cpp
Expand Up @@ -33,7 +33,7 @@ Hook::Hook(Score* s)

Element* Hook::elementBase() const
{
return parent();
return parent();
}

//---------------------------------------------------------
Expand Down

0 comments on commit 9114d60

Please sign in to comment.