mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:25:40 +00:00
UI: ConnBlockListModel: Simplify headerData()
This commit is contained in:
parent
42f5776ef3
commit
40d5a85985
@ -71,22 +71,7 @@ int ConnBlockListModel::columnCount(const QModelIndex &parent) const
|
||||
QVariant ConnBlockListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && (role == Qt::DisplayRole || role == Qt::ToolTipRole)) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("Program");
|
||||
case 1:
|
||||
return (role == Qt::DisplayRole) ? tr("Proc. ID") : tr("Process ID");
|
||||
case 2:
|
||||
return tr("Protocol");
|
||||
case 3:
|
||||
return tr("Local IP and Port");
|
||||
case 4:
|
||||
return tr("Remote IP and Port");
|
||||
case 5:
|
||||
return (role == Qt::DisplayRole) ? tr("Dir.") : tr("Direction");
|
||||
case 6:
|
||||
return tr("Time");
|
||||
}
|
||||
return headerDataDisplay(section, role);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
@ -110,6 +95,28 @@ QVariant ConnBlockListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant ConnBlockListModel::headerDataDisplay(int section, int role) const
|
||||
{
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("Program");
|
||||
case 1:
|
||||
return (role == Qt::DisplayRole) ? tr("Proc. ID") : tr("Process ID");
|
||||
case 2:
|
||||
return tr("Protocol");
|
||||
case 3:
|
||||
return tr("Local IP and Port");
|
||||
case 4:
|
||||
return tr("Remote IP and Port");
|
||||
case 5:
|
||||
return (role == Qt::DisplayRole) ? tr("Dir.") : tr("Direction");
|
||||
case 6:
|
||||
return tr("Time");
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant ConnBlockListModel::dataDisplay(const QModelIndex &index, int role) const
|
||||
{
|
||||
const int row = index.row();
|
||||
|
@ -79,6 +79,8 @@ protected:
|
||||
QString sqlLimitOffset() const override;
|
||||
|
||||
private:
|
||||
QVariant headerDataDisplay(int section, int role) const;
|
||||
|
||||
QVariant dataDisplay(const QModelIndex &index, int role) const;
|
||||
QVariant dataDisplayDirection(const ConnRow &connRow, int role) const;
|
||||
QVariant dataDecoration(const QModelIndex &index) const;
|
||||
|
Loading…
Reference in New Issue
Block a user