Skip to content

Commit

Permalink
Run clang-format on the whole repo
Browse files Browse the repository at this point in the history
3rd-party libs, e.g. lib/libjpeg* are excluded.

GIT_SILENT
  • Loading branch information
ahmadsamir committed Jul 10, 2021
1 parent 57006d5 commit 23b740f
Show file tree
Hide file tree
Showing 373 changed files with 5,560 additions and 6,549 deletions.
20 changes: 9 additions & 11 deletions app/abstractcontextmanageritem.cpp
Expand Up @@ -24,16 +24,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

namespace Gwenview
{

struct AbstractContextManagerItemPrivate
{
ContextManager* mContextManager = nullptr;
QWidget* mWidget = nullptr;
struct AbstractContextManagerItemPrivate {
ContextManager *mContextManager = nullptr;
QWidget *mWidget = nullptr;
};

AbstractContextManagerItem::AbstractContextManagerItem(ContextManager* manager)
: QObject(manager)
, d(new AbstractContextManagerItemPrivate)
AbstractContextManagerItem::AbstractContextManagerItem(ContextManager *manager)
: QObject(manager)
, d(new AbstractContextManagerItemPrivate)
{
d->mContextManager = manager;
d->mWidget = nullptr;
Expand All @@ -44,17 +42,17 @@ AbstractContextManagerItem::~AbstractContextManagerItem()
delete d;
}

ContextManager* AbstractContextManagerItem::contextManager() const
ContextManager *AbstractContextManagerItem::contextManager() const
{
return d->mContextManager;
}

QWidget* AbstractContextManagerItem::widget() const
QWidget *AbstractContextManagerItem::widget() const
{
return d->mWidget;
}

void AbstractContextManagerItem::setWidget(QWidget* widget)
void AbstractContextManagerItem::setWidget(QWidget *widget)
{
d->mWidget = widget;
}
Expand Down
11 changes: 5 additions & 6 deletions app/abstractcontextmanageritem.h
Expand Up @@ -26,26 +26,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

namespace Gwenview
{

class ContextManager;

struct AbstractContextManagerItemPrivate;
class AbstractContextManagerItem : public QObject
{
Q_OBJECT
public:
AbstractContextManagerItem(ContextManager*);
AbstractContextManagerItem(ContextManager *);
~AbstractContextManagerItem() override;

QWidget* widget() const;
QWidget *widget() const;

ContextManager* contextManager() const;
ContextManager *contextManager() const;

protected:
void setWidget(QWidget* widget);
void setWidget(QWidget *widget);

private:
AbstractContextManagerItemPrivate * const d;
AbstractContextManagerItemPrivate *const d;
};

} // namespace
Expand Down
19 changes: 7 additions & 12 deletions app/alignwithsidebarwidgetaction.cpp
Expand Up @@ -20,8 +20,7 @@
AlignWithSideBarWidgetAction::AlignWithSideBarWidgetAction(QObject *parent)
: QWidgetAction(parent)
{
setText(i18nc("@action:inmenu a spacer that aligns toolbar buttons with the sidebar",
"Sidebar Alignment Spacer"));
setText(i18nc("@action:inmenu a spacer that aligns toolbar buttons with the sidebar", "Sidebar Alignment Spacer"));
}

void AlignWithSideBarWidgetAction::setSideBar(QWidget *sideBar)
Expand All @@ -44,8 +43,7 @@ AligningSpacer::AligningSpacer(QWidget *parent)
: QWidget{parent}
{
if ((mToolbar = qobject_cast<QToolBar *>(parent))) {
connect (mToolbar, &QToolBar::orientationChanged,
this, &AligningSpacer::update);
connect(mToolbar, &QToolBar::orientationChanged, this, &AligningSpacer::update);
}
}

Expand Down Expand Up @@ -127,15 +125,12 @@ void AligningSpacer::update()

int AligningSpacer::updateWidth()
{
if (!mSideBar
|| (mToolbar && mToolbar->orientation() == Qt::Vertical)
) {
if (!mSideBar || (mToolbar && mToolbar->orientation() == Qt::Vertical)) {
setFixedWidth(0);
return 0;
}

const auto separatorWidth = static_cast<float>(
style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, nullptr, this));
const auto separatorWidth = static_cast<float>(style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, nullptr, this));
int sideBarWidth = mSideBar->geometry().width();
if (sideBarWidth <= 0) {
if (!Gwenview::GwenviewConfig::sideBarSplitterSizes().isEmpty()) {
Expand All @@ -147,7 +142,7 @@ int AligningSpacer::updateWidth()
// a nice default appearance on the first run.
if (QApplication::layoutDirection() != Qt::RightToLeft) {
sideBarWidth = x() + separatorWidth * 2; // Leads to a nice default spacing.
} else {
} else {
sideBarWidth = mToolbar->width() - x() + separatorWidth * 2;
}
mSideBar->resize(sideBarWidth, mSideBar->height()); // Make sure it aligns.
Expand All @@ -156,12 +151,12 @@ int AligningSpacer::updateWidth()

int newWidth;
if (QApplication::layoutDirection() != Qt::RightToLeft) {
newWidth = sideBarWidth - mapTo(window(), QPoint(0,0)).x();
newWidth = sideBarWidth - mapTo(window(), QPoint(0, 0)).x();
} else {
newWidth = sideBarWidth - window()->width() + mapTo(window(), QPoint(width(), 0)).x();
}
if (!mWasSeparatorRemoved) {
// Make it so a potentially following separator looks aligned with the sidebar.
// Make it so a potentially following separator looks aligned with the sidebar.
newWidth -= std::ceil(separatorWidth * 0.3);
} else {
// Make it so removing the separator doesn't change the toolbutton positions.
Expand Down

0 comments on commit 23b740f

Please sign in to comment.