UI: Programs: Reorganize columns

This commit is contained in:
Nodir Temirkhodjaev 2024-02-02 12:46:18 +03:00
parent dc6df25dc1
commit cf071416cb
2 changed files with 27 additions and 27 deletions

View File

@ -31,7 +31,7 @@
namespace {
constexpr int APPS_HEADER_VERSION = 8;
constexpr int APPS_HEADER_VERSION = 9;
}
@ -331,18 +331,18 @@ void ProgramsWindow::setupTableAppsHeader()
auto header = m_appListView->horizontalHeader();
header->setSectionResizeMode(0, QHeaderView::Interactive);
header->setSectionResizeMode(1, QHeaderView::Interactive);
header->setSectionResizeMode(2, QHeaderView::Interactive);
header->setSectionResizeMode(3, QHeaderView::Fixed);
header->setSectionResizeMode(4, QHeaderView::Fixed);
header->setSectionResizeMode(1, QHeaderView::Fixed);
header->setSectionResizeMode(2, QHeaderView::Fixed);
header->setSectionResizeMode(3, QHeaderView::Interactive);
header->setSectionResizeMode(4, QHeaderView::Interactive);
header->setSectionResizeMode(5, QHeaderView::Interactive);
header->setSectionResizeMode(6, QHeaderView::Stretch);
header->resizeSection(0, 320);
header->resizeSection(1, 100);
header->resizeSection(2, 100);
header->resizeSection(3, 30);
header->resizeSection(4, 30);
header->resizeSection(1, 30);
header->resizeSection(2, 30);
header->resizeSection(3, 100);
header->resizeSection(4, 100);
header->resizeSection(5, 280);
header->setSectionsClickable(true);

View File

@ -171,9 +171,9 @@ inline QVariant headerDataDisplay(int column, int role)
inline QVariant headerDataDecoration(int section)
{
switch (section) {
case 3:
case 1:
return IconCache::icon(":/icons/parking.png");
case 4:
case 2:
return IconCache::icon(":/icons/time.png");
default:
return QVariant();
@ -234,10 +234,10 @@ using dataDisplay_func = QVariant (*)(const AppRow &appRow, int role);
static dataDisplay_func dataDisplay_funcList[] = {
&dataDisplayName,
&dataDisplayAction,
&dataDisplayGroup,
&dataDisplayParked,
&dataDisplayScheduled,
&dataDisplayAction,
&dataDisplayGroup,
&dataDisplayFilePath,
&dataDisplayCreationTime,
};
@ -373,11 +373,11 @@ QVariant AppListModel::dataDecoration(const QModelIndex &index) const
case 0:
return appIcon(appRow);
case 1:
return appStateIcon(appRow);
case 3:
return appParkedIcon(appRow);
case 4:
case 2:
return appScheduledIcon(appRow);
case 3:
return appStateIcon(appRow);
}
return QVariant();
@ -391,9 +391,9 @@ QVariant AppListModel::dataForeground(const QModelIndex &index) const
const auto appRow = appRowAt(row);
switch (column) {
case 1:
case 3:
return appStateColor(appRow);
case 2:
case 4:
return appGroupColor(appRow);
}
@ -404,7 +404,7 @@ QVariant AppListModel::dataTextAlignment(const QModelIndex &index) const
{
const int column = index.column();
if (column == 2) {
if (column == 4) {
return int(Qt::AlignHCenter | Qt::AlignVCenter);
}
@ -542,18 +542,18 @@ QString AppListModel::sqlOrderColumn() const
switch (sortColumn()) {
case 0: // Name
return "t.name" + sqlOrderAsc() + ", t.path";
case 1: // Action
columnsStr = "alerted DESC, t.kill_process, t.blocked";
break;
case 2: // Group
columnsStr = "group_index";
break;
case 3: // Parked
case 1: // Parked
columnsStr = "t.parked";
break;
case 4: // Scheduled
case 2: // Scheduled
columnsStr = "t.end_time";
break;
case 3: // Action
columnsStr = "alerted DESC, t.kill_process, t.blocked";
break;
case 4: // Group
columnsStr = "group_index";
break;
case 5: // File Path
columnsStr = "t.path";
break;