mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
(qt) copyediting: modify more files to the new indentation/whitespace formatting
This commit is contained in:
parent
4356ade034
commit
5af4abfc82
1 changed files with 47 additions and 42 deletions
|
@ -42,7 +42,7 @@ enum
|
||||||
****/
|
****/
|
||||||
|
|
||||||
QHash<QString,int>&
|
QHash<QString,int>&
|
||||||
FileTreeItem :: getMyChildRows()
|
FileTreeItem :: getMyChildRows ()
|
||||||
{
|
{
|
||||||
const size_t n = childCount();
|
const size_t n = childCount();
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ FileTreeItem :: getMyChildRows()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FileTreeItem :: ~FileTreeItem()
|
FileTreeItem :: ~FileTreeItem ()
|
||||||
{
|
{
|
||||||
assert(myChildren.isEmpty());
|
assert(myChildren.isEmpty());
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ FileTreeItem :: child (const QString& filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
FileTreeItem :: row() const
|
FileTreeItem :: row () const
|
||||||
{
|
{
|
||||||
int i(-1);
|
int i(-1);
|
||||||
|
|
||||||
|
@ -235,7 +235,9 @@ FileTreeItem :: priority () const
|
||||||
{
|
{
|
||||||
int i(0);
|
int i(0);
|
||||||
|
|
||||||
if(myChildren.isEmpty()) switch(myPriority)
|
if (myChildren.isEmpty())
|
||||||
|
{
|
||||||
|
switch (myPriority)
|
||||||
{
|
{
|
||||||
case TR_PRI_LOW:
|
case TR_PRI_LOW:
|
||||||
i |= LOW;
|
i |= LOW;
|
||||||
|
@ -249,8 +251,9 @@ FileTreeItem :: priority () const
|
||||||
i |= NORMAL;
|
i |= NORMAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(const FileTreeItem * child, myChildren)
|
foreach (const FileTreeItem * child, myChildren)
|
||||||
i |= child->priority();
|
i |= child->priority();
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
@ -297,13 +300,13 @@ FileTreeItem :: isSubtreeWanted () const
|
||||||
{
|
{
|
||||||
const int childWanted = child->isSubtreeWanted();
|
const int childWanted = child->isSubtreeWanted();
|
||||||
|
|
||||||
if(wanted == -1)
|
if (wanted == -1)
|
||||||
wanted = childWanted;
|
wanted = childWanted;
|
||||||
|
|
||||||
if(wanted != childWanted)
|
if (wanted != childWanted)
|
||||||
wanted = Qt::PartiallyChecked;
|
wanted = Qt::PartiallyChecked;
|
||||||
|
|
||||||
if(wanted == Qt::PartiallyChecked)
|
if (wanted == Qt::PartiallyChecked)
|
||||||
return wanted;
|
return wanted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,11 +406,11 @@ FileTreeModel :: setData (const QModelIndex& index, const QVariant& newname, int
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
FileTreeModel :: headerData(int column, Qt::Orientation orientation, int role) const
|
FileTreeModel :: headerData (int column, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
QVariant data;
|
QVariant data;
|
||||||
|
|
||||||
if(orientation==Qt::Horizontal && role==Qt::DisplayRole)
|
if (orientation==Qt::Horizontal && role==Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
switch (column)
|
switch (column)
|
||||||
{
|
{
|
||||||
|
@ -538,9 +541,9 @@ FileTreeModel :: addFile (int index,
|
||||||
QList<QModelIndex> & rowsAdded,
|
QList<QModelIndex> & rowsAdded,
|
||||||
bool torrentChanged)
|
bool torrentChanged)
|
||||||
{
|
{
|
||||||
FileTreeItem * i(rootItem);
|
FileTreeItem * i (rootItem);
|
||||||
|
|
||||||
foreach (QString token, filename.split(QChar::fromAscii('/')))
|
foreach (QString token, filename.split (QChar::fromAscii('/')))
|
||||||
{
|
{
|
||||||
FileTreeItem * child(i->child(token));
|
FileTreeItem * child(i->child(token));
|
||||||
if (!child)
|
if (!child)
|
||||||
|
@ -680,18 +683,18 @@ FileTreeDelegate :: paint (QPainter * painter,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStyle * style(QApplication :: style());
|
QStyle * style (QApplication :: style());
|
||||||
if (option.state & QStyle::State_Selected)
|
if (option.state & QStyle::State_Selected)
|
||||||
painter->fillRect(option.rect, option.palette.highlight());
|
painter->fillRect (option.rect, option.palette.highlight());
|
||||||
painter->save();
|
painter->save();
|
||||||
if (option.state & QStyle::State_Selected)
|
if (option.state & QStyle::State_Selected)
|
||||||
painter->setBrush(option.palette.highlightedText());
|
painter->setBrush (option.palette.highlightedText());
|
||||||
|
|
||||||
if (column == COL_NAME)
|
if (column == COL_NAME)
|
||||||
{
|
{
|
||||||
// draw the file icon
|
// draw the file icon
|
||||||
static const int iconSize(style->pixelMetric(QStyle :: PM_SmallIconSize));
|
static const int iconSize (style->pixelMetric(QStyle :: PM_SmallIconSize));
|
||||||
const QRect iconArea(option.rect.x(),
|
const QRect iconArea (option.rect.x(),
|
||||||
option.rect.y() + (option.rect.height()-iconSize)/2,
|
option.rect.y() + (option.rect.height()-iconSize)/2,
|
||||||
iconSize, iconSize);
|
iconSize, iconSize);
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
@ -704,13 +707,13 @@ FileTreeDelegate :: paint (QPainter * painter,
|
||||||
QString name = index.data().toString();
|
QString name = index.data().toString();
|
||||||
icon = Utils :: guessMimeIcon (name.left(name.lastIndexOf(" (")));
|
icon = Utils :: guessMimeIcon (name.left(name.lastIndexOf(" (")));
|
||||||
}
|
}
|
||||||
icon.paint(painter, iconArea, Qt::AlignCenter, QIcon::Normal, QIcon::On);
|
icon.paint (painter, iconArea, Qt::AlignCenter, QIcon::Normal, QIcon::On);
|
||||||
|
|
||||||
// draw the name
|
// draw the name
|
||||||
QStyleOptionViewItem tmp(option);
|
QStyleOptionViewItem tmp (option);
|
||||||
tmp.rect.setWidth(option.rect.width() - iconArea.width() - HIG::PAD_SMALL);
|
tmp.rect.setWidth (option.rect.width() - iconArea.width() - HIG::PAD_SMALL);
|
||||||
tmp.rect.moveRight(option.rect.right());
|
tmp.rect.moveRight (option.rect.right());
|
||||||
QItemDelegate::paint(painter, tmp, index);
|
QItemDelegate::paint (painter, tmp, index);
|
||||||
}
|
}
|
||||||
else if(column == COL_PROGRESS)
|
else if(column == COL_PROGRESS)
|
||||||
{
|
{
|
||||||
|
@ -718,8 +721,8 @@ FileTreeDelegate :: paint (QPainter * painter,
|
||||||
p.state = option.state | QStyle::State_Small;
|
p.state = option.state | QStyle::State_Small;
|
||||||
p.direction = QApplication::layoutDirection();
|
p.direction = QApplication::layoutDirection();
|
||||||
p.rect = option.rect;
|
p.rect = option.rect;
|
||||||
p.rect.setSize(QSize(option.rect.width()-2, option.rect.height()-8));
|
p.rect.setSize (QSize(option.rect.width()-2, option.rect.height()-8));
|
||||||
p.rect.moveCenter(option.rect.center());
|
p.rect.moveCenter (option.rect.center());
|
||||||
p.fontMetrics = QApplication::fontMetrics();
|
p.fontMetrics = QApplication::fontMetrics();
|
||||||
p.minimum = 0;
|
p.minimum = 0;
|
||||||
p.maximum = 100;
|
p.maximum = 100;
|
||||||
|
@ -734,16 +737,16 @@ FileTreeDelegate :: paint (QPainter * painter,
|
||||||
QStyleOptionButton o;
|
QStyleOptionButton o;
|
||||||
o.state = option.state;
|
o.state = option.state;
|
||||||
o.direction = QApplication::layoutDirection();
|
o.direction = QApplication::layoutDirection();
|
||||||
o.rect.setSize(QSize(20, option.rect.height()));
|
o.rect.setSize (QSize(20, option.rect.height()));
|
||||||
o.rect.moveCenter(option.rect.center());
|
o.rect.moveCenter (option.rect.center());
|
||||||
o.fontMetrics = QApplication::fontMetrics();
|
o.fontMetrics = QApplication::fontMetrics();
|
||||||
switch(index.data().toInt())
|
switch (index.data().toInt())
|
||||||
{
|
{
|
||||||
case Qt::Unchecked: o.state |= QStyle::State_Off; break;
|
case Qt::Unchecked: o.state |= QStyle::State_Off; break;
|
||||||
case Qt::Checked: o.state |= QStyle::State_On; break;
|
case Qt::Checked: o.state |= QStyle::State_On; break;
|
||||||
default: o.state |= QStyle::State_NoChange;break;
|
default: o.state |= QStyle::State_NoChange;break;
|
||||||
}
|
}
|
||||||
style->drawControl(QStyle::CE_CheckBox, &o, painter);
|
style->drawControl (QStyle::CE_CheckBox, &o, painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@ -818,8 +821,10 @@ FileTreeView :: eventFilter (QObject * o, QEvent * event)
|
||||||
{
|
{
|
||||||
if (column == COL_NAME)
|
if (column == COL_NAME)
|
||||||
continue;
|
continue;
|
||||||
if (isColumnHidden(column))
|
|
||||||
|
if (isColumnHidden (column))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const QString header = myModel.headerData (column, Qt::Horizontal).toString() + " ";
|
const QString header = myModel.headerData (column, Qt::Horizontal).toString() + " ";
|
||||||
const int width = fontMetrics.size (0, header).width();
|
const int width = fontMetrics.size (0, header).width();
|
||||||
setColumnWidth (column, width);
|
setColumnWidth (column, width);
|
||||||
|
@ -855,7 +860,7 @@ FileTreeView :: eventFilter (QObject * o, QEvent * event)
|
||||||
void
|
void
|
||||||
FileTreeView :: update (const FileList& files)
|
FileTreeView :: update (const FileList& files)
|
||||||
{
|
{
|
||||||
update(files, true);
|
update (files, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -866,7 +871,7 @@ FileTreeView :: update (const FileList& files, bool torrentChanged)
|
||||||
QList<QModelIndex> added;
|
QList<QModelIndex> added;
|
||||||
myModel.addFile (file.index, file.filename, file.wanted, file.priority, file.size, file.have, added, torrentChanged);
|
myModel.addFile (file.index, file.filename, file.wanted, file.priority, file.size, file.have, added, torrentChanged);
|
||||||
foreach (QModelIndex i, added)
|
foreach (QModelIndex i, added)
|
||||||
expand(myProxy->mapFromSource(i));
|
expand (myProxy->mapFromSource(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue