mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:46:41 +00:00
UI: SchedulePage: Open ZonesWindow on TaskZoneDownloader double click.
This commit is contained in:
parent
a261ade018
commit
cda9c34bb9
@ -9,6 +9,7 @@
|
||||
#include <QTableView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "../../../fortmanager.h"
|
||||
#include "../../../task/taskinfo.h"
|
||||
#include "../../../task/tasklistmodel.h"
|
||||
#include "../../../task/taskmanager.h"
|
||||
@ -115,6 +116,13 @@ void SchedulePage::setupTableTasks()
|
||||
m_tableTasks->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||
|
||||
m_tableTasks->setModel(taskListModel());
|
||||
|
||||
connect(m_tableTasks, &TableView::doubleClicked, [&](const QModelIndex &index) {
|
||||
const auto taskInfo = taskListModel()->taskInfoAt(index.row());
|
||||
if (taskInfo->type() == TaskInfo::ZoneDownloader) {
|
||||
fortManager()->showZonesWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SchedulePage::setupTableTasksHeader()
|
||||
|
@ -221,26 +221,26 @@ void TaskListModel::setTaskIntervalHours(const QModelIndex &index, int v)
|
||||
emit dataEdited();
|
||||
}
|
||||
|
||||
TaskRow *TaskListModel::addTaskRow(int index)
|
||||
TaskRow *TaskListModel::addTaskRow(int row)
|
||||
{
|
||||
auto taskRow = new TaskRow();
|
||||
m_taskRows.replace(index, taskRow);
|
||||
m_taskRows.replace(row, taskRow);
|
||||
|
||||
auto taskInfo = taskInfoAt(index);
|
||||
auto taskInfo = taskInfoAt(row);
|
||||
taskRow->enabled = taskInfo->enabled();
|
||||
taskRow->intervalHours = taskInfo->intervalHours();
|
||||
|
||||
return taskRow;
|
||||
}
|
||||
|
||||
TaskInfo *TaskListModel::taskInfoAt(int index) const
|
||||
TaskInfo *TaskListModel::taskInfoAt(int row) const
|
||||
{
|
||||
return taskInfosList().at(index);
|
||||
return taskInfosList().at(row);
|
||||
}
|
||||
|
||||
TaskRow *TaskListModel::taskRowAt(int index) const
|
||||
TaskRow *TaskListModel::taskRowAt(int row) const
|
||||
{
|
||||
return m_taskRows.at(index);
|
||||
return m_taskRows.at(row);
|
||||
}
|
||||
|
||||
QString TaskListModel::formatDateTime(const QDateTime &dateTime)
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
TaskManager *taskManager() const { return m_taskManager; }
|
||||
|
||||
const QList<TaskInfo *> &taskInfosList() const;
|
||||
TaskInfo *taskInfoAt(int index) const;
|
||||
TaskInfo *taskInfoAt(int row) const;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
@ -62,9 +62,9 @@ private:
|
||||
int taskIntervalHours(int index) const;
|
||||
void setTaskIntervalHours(const QModelIndex &index, int v);
|
||||
|
||||
TaskRow *addTaskRow(int index);
|
||||
TaskRow *addTaskRow(int row);
|
||||
|
||||
TaskRow *taskRowAt(int index) const;
|
||||
TaskRow *taskRowAt(int row) const;
|
||||
|
||||
static QString formatDateTime(const QDateTime &dateTime);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user