mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
This commit is contained in:
parent
8dbdd24c8e
commit
b29bd9e070
272 changed files with 13378 additions and 9535 deletions
|
|
@ -1,24 +1,19 @@
|
|||
#include <QFont>
|
||||
#include "filtertreemodel.h"
|
||||
#include "filtertree.h"
|
||||
#include "cardfilter.h"
|
||||
#include "filtertree.h"
|
||||
#include <QFont>
|
||||
|
||||
FilterTreeModel::FilterTreeModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent)
|
||||
{
|
||||
fTree = new FilterTree;
|
||||
connect(fTree,
|
||||
SIGNAL(preInsertRow(const FilterTreeNode *, int)),
|
||||
this, SLOT(proxyBeginInsertRow(const FilterTreeNode *, int)));
|
||||
connect(fTree,
|
||||
SIGNAL(postInsertRow(const FilterTreeNode *, int)),
|
||||
this, SLOT(proxyEndInsertRow(const FilterTreeNode *, int)));
|
||||
connect(fTree,
|
||||
SIGNAL(preRemoveRow(const FilterTreeNode *, int)),
|
||||
this, SLOT(proxyBeginRemoveRow(const FilterTreeNode *, int)));
|
||||
connect(fTree,
|
||||
SIGNAL(postRemoveRow(const FilterTreeNode *, int)),
|
||||
this, SLOT(proxyEndRemoveRow(const FilterTreeNode *, int)));
|
||||
connect(fTree, SIGNAL(preInsertRow(const FilterTreeNode *, int)), this,
|
||||
SLOT(proxyBeginInsertRow(const FilterTreeNode *, int)));
|
||||
connect(fTree, SIGNAL(postInsertRow(const FilterTreeNode *, int)), this,
|
||||
SLOT(proxyEndInsertRow(const FilterTreeNode *, int)));
|
||||
connect(fTree, SIGNAL(preRemoveRow(const FilterTreeNode *, int)), this,
|
||||
SLOT(proxyBeginRemoveRow(const FilterTreeNode *, int)));
|
||||
connect(fTree, SIGNAL(postRemoveRow(const FilterTreeNode *, int)), this,
|
||||
SLOT(proxyEndRemoveRow(const FilterTreeNode *, int)));
|
||||
}
|
||||
|
||||
FilterTreeModel::~FilterTreeModel()
|
||||
|
|
@ -26,13 +21,13 @@ FilterTreeModel::~FilterTreeModel()
|
|||
delete fTree;
|
||||
}
|
||||
|
||||
void FilterTreeModel::proxyBeginInsertRow(const FilterTreeNode *node, int i)
|
||||
void FilterTreeModel::proxyBeginInsertRow(const FilterTreeNode *node, int i)
|
||||
{
|
||||
int idx;
|
||||
|
||||
idx = node->index();
|
||||
if (idx >= 0)
|
||||
beginInsertRows(createIndex(idx, 0, (void *) node), i, i);
|
||||
beginInsertRows(createIndex(idx, 0, (void *)node), i, i);
|
||||
}
|
||||
|
||||
void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
|
||||
|
|
@ -44,13 +39,13 @@ void FilterTreeModel::proxyEndInsertRow(const FilterTreeNode *node, int)
|
|||
endInsertRows();
|
||||
}
|
||||
|
||||
void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
|
||||
void FilterTreeModel::proxyBeginRemoveRow(const FilterTreeNode *node, int i)
|
||||
{
|
||||
int idx;
|
||||
|
||||
idx = node->index();
|
||||
if (idx >= 0)
|
||||
beginRemoveRows(createIndex(idx, 0, (void *) node), i, i);
|
||||
beginRemoveRows(createIndex(idx, 0, (void *)node), i, i);
|
||||
}
|
||||
|
||||
void FilterTreeModel::proxyEndRemoveRow(const FilterTreeNode *node, int)
|
||||
|
|
@ -102,7 +97,7 @@ int FilterTreeModel::rowCount(const QModelIndex &parent) const
|
|||
return result;
|
||||
}
|
||||
|
||||
int FilterTreeModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
int FilterTreeModel::columnCount(const QModelIndex & /*parent*/) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -133,7 +128,7 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::ToolTipRole:
|
||||
case Qt::StatusTipRole:
|
||||
case Qt::WhatsThisRole:
|
||||
if(!node->isLeaf())
|
||||
if (!node->isLeaf())
|
||||
return tr(node->textCStr());
|
||||
else
|
||||
return node->text();
|
||||
|
|
@ -149,8 +144,7 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
bool FilterTreeModel::setData(const QModelIndex &index,
|
||||
const QVariant &value, int role)
|
||||
bool FilterTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
FilterTreeNode *node;
|
||||
|
||||
|
|
@ -158,7 +152,7 @@ bool FilterTreeModel::setData(const QModelIndex &index,
|
|||
return false;
|
||||
if (index.column() >= columnCount())
|
||||
return false;
|
||||
if (role != Qt::CheckStateRole )
|
||||
if (role != Qt::CheckStateRole)
|
||||
return false;
|
||||
|
||||
node = indexToNode(index);
|
||||
|
|
@ -208,8 +202,7 @@ QModelIndex FilterTreeModel::nodeIndex(const FilterTreeNode *node, int row, int
|
|||
return createIndex(row, column, child);
|
||||
}
|
||||
|
||||
QModelIndex FilterTreeModel::index(int row, int column,
|
||||
const QModelIndex &parent) const
|
||||
QModelIndex FilterTreeModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
const FilterTreeNode *node;
|
||||
|
||||
|
|
@ -249,12 +242,12 @@ QModelIndex FilterTreeModel::parent(const QModelIndex &ind) const
|
|||
return QModelIndex();
|
||||
}
|
||||
|
||||
bool FilterTreeModel::removeRows(int row, int count, const QModelIndex & parent)
|
||||
bool FilterTreeModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
FilterTreeNode *node;
|
||||
int i, last;
|
||||
|
||||
last = row+count-1;
|
||||
last = row + count - 1;
|
||||
if (!parent.isValid() || count < 1 || row < 0)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue