mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 10:45:39 +03:00
Format
This commit is contained in:
parent
3a91d245cf
commit
1323ddfdf0
@ -626,14 +626,13 @@ public:
|
||||
->value(Setting::Id::ShowCommitsInCompactMode)
|
||||
.toBool();
|
||||
bool showAuthor = Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsAuthor, true)
|
||||
.toBool();
|
||||
->value(Setting::Id::ShowCommitsAuthor, true)
|
||||
.toBool();
|
||||
bool showDate = Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsDate, true)
|
||||
.toBool();
|
||||
bool showId = Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsId, true)
|
||||
.toBool();
|
||||
->value(Setting::Id::ShowCommitsDate, true)
|
||||
.toBool();
|
||||
bool showId =
|
||||
Settings::instance()->value(Setting::Id::ShowCommitsId, true).toBool();
|
||||
LayoutConstants constants = layoutConstants(compact);
|
||||
|
||||
// Draw background.
|
||||
@ -858,7 +857,8 @@ public:
|
||||
painter->drawText(rect, Qt::AlignLeft, name);
|
||||
painter->restore();
|
||||
const QFontMetrics boldFm(bold);
|
||||
rect.setX(rect.x() + boldFm.horizontalAdvance(name) + constants.hMargin);
|
||||
rect.setX(rect.x() + boldFm.horizontalAdvance(name) +
|
||||
constants.hMargin);
|
||||
}
|
||||
|
||||
// Draw message.
|
||||
@ -884,13 +884,13 @@ public:
|
||||
}
|
||||
|
||||
// Draw date.
|
||||
if (showDate && rect.width() > fm.horizontalAdvance(name) + timestampWidth + 8) {
|
||||
if (showDate &&
|
||||
rect.width() > fm.horizontalAdvance(name) + timestampWidth + 8) {
|
||||
painter->save();
|
||||
painter->setPen(bright);
|
||||
if (showAuthor) {
|
||||
painter->drawText(rect, Qt::AlignRight, timestamp);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
painter->drawText(rect, Qt::AlignLeft, timestamp);
|
||||
}
|
||||
painter->restore();
|
||||
@ -916,18 +916,17 @@ public:
|
||||
QString leftText = "";
|
||||
|
||||
if (showDate && showAuthor) {
|
||||
refsRect.setY(refsRect.y() + constants.lineSpacing + constants.vMargin);
|
||||
refsRect.setY(refsRect.y() + constants.lineSpacing +
|
||||
constants.vMargin);
|
||||
if (showId) {
|
||||
leftText = id;
|
||||
}
|
||||
} else {
|
||||
if (showDate) {
|
||||
leftText = timestamp;
|
||||
}
|
||||
else if (showAuthor) {
|
||||
} else if (showAuthor) {
|
||||
leftText = name;
|
||||
}
|
||||
else if (showId) {
|
||||
} else if (showId) {
|
||||
leftText = id;
|
||||
}
|
||||
}
|
||||
@ -936,9 +935,12 @@ public:
|
||||
}
|
||||
|
||||
int numOptional = 0;
|
||||
if (showId) ++numOptional;
|
||||
if (showAuthor) ++numOptional;
|
||||
if (showDate) ++numOptional;
|
||||
if (showId)
|
||||
++numOptional;
|
||||
if (showAuthor)
|
||||
++numOptional;
|
||||
if (showDate)
|
||||
++numOptional;
|
||||
if (numOptional > 1) {
|
||||
rect.setY(rect.y() + constants.lineSpacing + constants.vMargin);
|
||||
}
|
||||
|
@ -180,33 +180,28 @@ CommitToolBar::CommitToolBar(QWidget *parent) : QToolBar(parent) {
|
||||
QAction *author = menu->addAction(tr("Show Author"));
|
||||
author->setCheckable(true);
|
||||
author->setChecked(Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsAuthor, true)
|
||||
.toBool());
|
||||
->value(Setting::Id::ShowCommitsAuthor, true)
|
||||
.toBool());
|
||||
connect(author, &QAction::triggered, [this](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsAuthor,
|
||||
checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsAuthor, checked);
|
||||
emit settingsChanged();
|
||||
});
|
||||
|
||||
QAction *date = menu->addAction(tr("Show Date"));
|
||||
date->setCheckable(true);
|
||||
date->setChecked(Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsDate, true)
|
||||
.toBool());
|
||||
date->setChecked(
|
||||
Settings::instance()->value(Setting::Id::ShowCommitsDate, true).toBool());
|
||||
connect(date, &QAction::triggered, [this](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsDate,
|
||||
checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsDate, checked);
|
||||
emit settingsChanged();
|
||||
});
|
||||
|
||||
QAction *id = menu->addAction(tr("Show Id"));
|
||||
id->setCheckable(true);
|
||||
id->setChecked(Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsId, true)
|
||||
.toBool());
|
||||
id->setChecked(
|
||||
Settings::instance()->value(Setting::Id::ShowCommitsId, true).toBool());
|
||||
connect(id, &QAction::triggered, [this](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsId,
|
||||
checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsId, checked);
|
||||
emit settingsChanged();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user