Commit 90dd2442 authored by Kurt Hindenburg's avatar Kurt Hindenburg

uncrustify using kf5 config

parent a1aec1f3
......@@ -30,21 +30,22 @@
using Konsole::ViewSplitter;
using Konsole::ViewContainer;
ViewSplitter::ViewSplitter(QWidget* parent)
: QSplitter(parent)
, _recursiveSplitting(true)
ViewSplitter::ViewSplitter(QWidget *parent) :
QSplitter(parent),
_recursiveSplitting(true)
{
}
void ViewSplitter::childEmpty(ViewSplitter* splitter)
void ViewSplitter::childEmpty(ViewSplitter *splitter)
{
delete splitter;
if (count() == 0)
if (count() == 0) {
emit empty(this);
}
}
void ViewSplitter::adjustContainerSize(ViewContainer* container , int percentage)
void ViewSplitter::adjustContainerSize(ViewContainer *container, int percentage)
{
int containerIndex = indexOf(container->containerWidget());
......@@ -57,24 +58,25 @@ void ViewSplitter::adjustContainerSize(ViewContainer* container , int percentage
const int perContainerDelta = (count() == 1) ? 0 : ((newSize - oldSize) / (count() - 1)) * (-1);
for (int i = 0 ; i < containerSizes.count() ; i++) {
if (i == containerIndex)
for (int i = 0; i < containerSizes.count(); i++) {
if (i == containerIndex) {
containerSizes[i] = newSize;
else
} else {
containerSizes[i] = containerSizes[i] + perContainerDelta;
}
}
setSizes(containerSizes);
}
ViewSplitter* ViewSplitter::activeSplitter()
ViewSplitter *ViewSplitter::activeSplitter()
{
QWidget* widget = focusWidget() != nullptr ? focusWidget() : this;
QWidget *widget = focusWidget() != nullptr ? focusWidget() : this;
ViewSplitter* splitter = 0;
ViewSplitter *splitter = 0;
while ((splitter == nullptr) && (widget != nullptr)) {
splitter = qobject_cast<ViewSplitter*>(widget);
splitter = qobject_cast<ViewSplitter *>(widget);
widget = widget->parentWidget();
}
......@@ -82,7 +84,7 @@ ViewSplitter* ViewSplitter::activeSplitter()
return splitter;
}
void ViewSplitter::registerContainer(ViewContainer* container)
void ViewSplitter::registerContainer(ViewContainer *container)
{
_containers << container;
// Connecting to container::destroyed() using the new-style connection
......@@ -90,14 +92,15 @@ void ViewSplitter::registerContainer(ViewContainer* container)
// syntax works.
//connect(container , static_cast<void(ViewContainer::*)(ViewContainer*)>(&Konsole::ViewContainer::destroyed) , this , &Konsole::ViewSplitter::containerDestroyed);
//connect(container , &Konsole::ViewContainer::empty , this , &Konsole::ViewSplitter::containerEmpty);
connect(container , SIGNAL(destroyed(ViewContainer*)) , this , SLOT(containerDestroyed(ViewContainer*)));
connect(container , SIGNAL(empty(ViewContainer*)) , this , SLOT(containerEmpty(ViewContainer*)));
connect(container, SIGNAL(destroyed(ViewContainer *)), this,
SLOT(containerDestroyed(ViewContainer *)));
connect(container, SIGNAL(empty(ViewContainer *)), this, SLOT(containerEmpty(ViewContainer *)));
}
void ViewSplitter::unregisterContainer(ViewContainer* container)
void ViewSplitter::unregisterContainer(ViewContainer *container)
{
_containers.removeAll(container);
disconnect(container , 0 , this , 0);
disconnect(container, 0, this, 0);
}
void ViewSplitter::updateSizes()
......@@ -111,8 +114,9 @@ void ViewSplitter::updateSizes()
}
QList<int> widgetSizes;
for (int i = 0; i < count(); i++)
for (int i = 0; i < count(); i++) {
widgetSizes << space;
}
setSizes(widgetSizes);
}
......@@ -121,38 +125,40 @@ void ViewSplitter::setRecursiveSplitting(bool recursive)
{
_recursiveSplitting = recursive;
}
bool ViewSplitter::recursiveSplitting() const
{
return _recursiveSplitting;
}
void ViewSplitter::removeContainer(ViewContainer* container)
void ViewSplitter::removeContainer(ViewContainer *container)
{
Q_ASSERT(containers().contains(container));
unregisterContainer(container);
}
void ViewSplitter::addContainer(ViewContainer* container ,
Qt::Orientation containerOrientation)
void ViewSplitter::addContainer(ViewContainer *container, Qt::Orientation containerOrientation)
{
ViewSplitter* splitter = activeSplitter();
ViewSplitter *splitter = activeSplitter();
if (splitter->count() < 2 ||
containerOrientation == splitter->orientation() ||
!_recursiveSplitting) {
if (splitter->count() < 2
|| containerOrientation == splitter->orientation()
|| !_recursiveSplitting) {
splitter->registerContainer(container);
splitter->addWidget(container->containerWidget());
if (splitter->orientation() != containerOrientation)
if (splitter->orientation() != containerOrientation) {
splitter->setOrientation(containerOrientation);
}
splitter->updateSizes();
} else {
auto newSplitter = new ViewSplitter(this);
connect(newSplitter , &Konsole::ViewSplitter::empty , splitter , &Konsole::ViewSplitter::childEmpty);
connect(newSplitter, &Konsole::ViewSplitter::empty, splitter,
&Konsole::ViewSplitter::childEmpty);
ViewContainer* oldContainer = splitter->activeContainer();
ViewContainer *oldContainer = splitter->activeContainer();
const int oldContainerIndex = splitter->indexOf(oldContainer->containerWidget());
splitter->unregisterContainer(oldContainer);
......@@ -170,18 +176,19 @@ void ViewSplitter::addContainer(ViewContainer* container ,
}
}
void ViewSplitter::containerEmpty(ViewContainer* /*container*/)
void ViewSplitter::containerEmpty(ViewContainer * /*container*/)
{
int children = 0;
foreach(ViewContainer* container, _containers) {
foreach (ViewContainer *container, _containers) {
children += container->views().count();
}
if (children == 0)
if (children == 0) {
emit allContainersEmpty();
}
}
void ViewSplitter::containerDestroyed(ViewContainer* container)
void ViewSplitter::containerDestroyed(ViewContainer *container)
{
Q_ASSERT(_containers.contains(container));
......@@ -194,50 +201,54 @@ void ViewSplitter::containerDestroyed(ViewContainer* container)
void ViewSplitter::activateNextContainer()
{
ViewContainer* active = activeContainer();
ViewContainer *active = activeContainer();
int index = _containers.indexOf(active);
if (index == -1)
if (index == -1) {
return;
}
if (index == _containers.count() - 1)
if (index == _containers.count() - 1) {
index = 0;
else
} else {
index++;
}
setActiveContainer(_containers.at(index));
}
void ViewSplitter::activatePreviousContainer()
{
ViewContainer* active = activeContainer();
ViewContainer *active = activeContainer();
int index = _containers.indexOf(active);
if (index == 0)
if (index == 0) {
index = _containers.count() - 1;
else
} else {
index--;
}
setActiveContainer(_containers.at(index));
}
void ViewSplitter::setActiveContainer(ViewContainer* container)
void ViewSplitter::setActiveContainer(ViewContainer *container)
{
QWidget* activeView = container->activeView();
QWidget *activeView = container->activeView();
if (activeView != nullptr)
if (activeView != nullptr) {
activeView->setFocus(Qt::OtherFocusReason);
}
}
ViewContainer* ViewSplitter::activeContainer() const
ViewContainer *ViewSplitter::activeContainer() const
{
if (QWidget* focusW = focusWidget()) {
ViewContainer* focusContainer = 0;
if (QWidget *focusW = focusWidget()) {
ViewContainer *focusContainer = 0;
while (focusW != 0) {
foreach(ViewContainer* container, _containers) {
foreach (ViewContainer *container, _containers) {
if (container->containerWidget() == focusW) {
focusContainer = container;
break;
......@@ -246,19 +257,20 @@ ViewContainer* ViewSplitter::activeContainer() const
focusW = focusW->parentWidget();
}
if (focusContainer != nullptr)
if (focusContainer != nullptr) {
return focusContainer;
}
}
QList<ViewSplitter*> splitters = findChildren<ViewSplitter*>();
QList<ViewSplitter *> splitters = findChildren<ViewSplitter *>();
if (splitters.count() > 0) {
return splitters.last()->activeContainer();
} else {
if (_containers.count() > 0)
if (_containers.count() > 0) {
return _containers.last();
else
} else {
return 0;
}
}
}
......@@ -24,4 +24,3 @@
using Konsole::WindowSystemInfo;
bool WindowSystemInfo::HAVE_TRANSPARENCY = false;
......@@ -29,8 +29,8 @@
using Konsole::ZModemDialog;
ZModemDialog::ZModemDialog(QWidget* aParent, bool modal, const QString& caption)
: QDialog(aParent)
ZModemDialog::ZModemDialog(QWidget *aParent, bool modal, const QString &caption) :
QDialog(aParent)
{
setObjectName(QStringLiteral("zmodem_progress"));
setModal(modal);
......@@ -54,11 +54,14 @@ ZModemDialog::ZModemDialog(QWidget* aParent, bool modal, const QString& caption)
_textEdit->setReadOnly(true);
mainLayout->addWidget(_textEdit);
connect(this, &Konsole::ZModemDialog::user1Clicked, this, &Konsole::ZModemDialog::slotUser1Clicked);
connect(mButtonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &Konsole::ZModemDialog::slotClose);
connect(this, &Konsole::ZModemDialog::user1Clicked, this,
&Konsole::ZModemDialog::slotUser1Clicked);
connect(mButtonBox->button(QDialogButtonBox::Close),
&QPushButton::clicked, this,
&Konsole::ZModemDialog::slotClose);
}
void ZModemDialog::addProgressText(const QString& text)
void ZModemDialog::addProgressText(const QString &text)
{
QTextCursor currentCursor = _textEdit->textCursor();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment