2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2017 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
21 #include "../util/fmtwidgetitem.h"
24 void SDStatus::doUpdate()
29 status.pushButton->setEnabled(false);
30 connect(t, SIGNAL(done(task *)), this, SLOT(taskDone(task *)), Qt::QueuedConnection);
31 t->init(res, TASK_STATUS);
33 status.statusBar->setText(QString("Trying to connect to Storage..."));
34 Dmsg1(50, "doUpdate(%p)\n", res);
38 void SDStatus::taskDone(task *t)
42 status.statusBar->setText(QString(t->errmsg));
45 status.statusBar->clear();
46 if (t->type == TASK_STATUS) {
48 struct s_last_job *ljob;
49 struct s_running_job *rjob;
51 status.labelName->setText(QString(res->name));
52 status.labelVersion->setText(QString(res->version));
53 status.labelStarted->setText(QString(res->started));
54 status.labelPlugins->setText(QString(res->plugins));
55 /* Clear the table first */
56 Freeze(*status.tableRunning);
57 Freeze(*status.tableTerminated);
58 QStringList headerlistR = (QStringList() << tr("JobId")
59 << tr("Job") << tr("Level") << tr("Client")
61 << tr("Files") << tr("Bytes") << tr("Errors"));
62 status.tableRunning->clear();
63 status.tableRunning->setRowCount(0);
64 status.tableRunning->setColumnCount(headerlistR.count());
65 status.tableRunning->setHorizontalHeaderLabels(headerlistR);
66 status.tableRunning->setEditTriggers(QAbstractItemView::NoEditTriggers);
67 status.tableRunning->verticalHeader()->hide();
68 status.tableRunning->setSortingEnabled(true);
70 if (res->running_jobs) {
71 status.tableRunning->setRowCount(res->running_jobs->size());
73 foreach_alist(rjob, res->running_jobs) {
75 TableItemFormatter item(*status.tableRunning, row++);
76 item.setNumericFld(col++, QString(edit_uint64(rjob->JobId, ed1)));
77 item.setTextFld(col++, QString(rjob->Job));
78 item.setJobLevelFld(col++, QString(rjob->JobLevel));
79 item.setTextFld(col++, QString(rjob->Client));
80 item.setTextFld(col++, QString(rjob->Storage));
81 item.setNumericFld(col++, QString(edit_uint64(rjob->JobFiles, ed1)));
82 item.setBytesFld(col++, QString(edit_uint64(rjob->JobBytes, ed1)));
83 item.setNumericFld(col++, QString(edit_uint64(rjob->Errors, ed1)));
86 Dmsg0(0, "Strange, the list is NULL\n");
89 QStringList headerlistT = (QStringList() << tr("JobId")
90 << tr("Job") << tr("Level")
91 << tr("Status") << tr("Files") << tr("Bytes")
94 status.tableTerminated->clear();
95 status.tableTerminated->setRowCount(0);
96 status.tableTerminated->setColumnCount(headerlistT.count());
97 status.tableTerminated->setHorizontalHeaderLabels(headerlistT);
98 status.tableTerminated->setEditTriggers(QAbstractItemView::NoEditTriggers);
99 status.tableTerminated->verticalHeader()->hide();
100 status.tableTerminated->setSortingEnabled(true);
102 if (res->terminated_jobs) {
103 status.tableTerminated->setRowCount(res->terminated_jobs->size());
105 foreach_dlist(ljob, res->terminated_jobs) {
107 TableItemFormatter item(*status.tableTerminated, row++);
108 item.setNumericFld(col++, QString(edit_uint64(ljob->JobId, ed1)));
109 item.setTextFld(col++, QString(ljob->Job));
110 item.setJobLevelFld(col++, QString(ljob->JobLevel));
111 item.setJobStatusFld(col++, QString(ljob->JobStatus));
112 item.setNumericFld(col++, QString(edit_uint64(ljob->JobFiles, ed1)));
113 item.setBytesFld(col++, QString(edit_uint64(ljob->JobBytes, ed1)));
114 item.setNumericFld(col++, QString(edit_uint64(ljob->Errors, ed1)));
117 Dmsg0(0, "Strange, the list is NULL\n");
119 res->mutex->unlock();
121 Dmsg1(50, " Task %p OK\n", t);
124 status.pushButton->setEnabled(true);