source: src-qt4/pc-sysmanager/updaterDialog.cpp @ 1620346

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 1620346 was 1620346, checked in by Kris Moore <kris@…>, 17 months ago

Initial import of PC-BSD /current/ SVN repo

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/****************************************************************************
2** ui.h extension file, included from the uic-generated form implementation.
3**
4** If you want to add, delete, or rename functions or slots, use
5** Qt Designer to update this file, preserving your code.
6**
7** You should not define a constructor or destructor in this file.
8** Instead, write your code in functions called init() and destroy().
9** These will automatically be called by the form's constructor and
10** destructor.
11*****************************************************************************/
12#include "updaterDialog.h"
13#include "ui_updaterDialog.h"
14#include <QTreeWidget>
15#include <QtGui>
16
17void updaterStatus::programInit()
18{
19    setWindowTitle(tr("Update Progress"));
20    listInstallView->clear();
21    listInstallView->setColumnHidden(3, true);
22    listInstallView->resizeColumnToContents(0);
23}
24
25
26
27void updaterStatus::closeEvent( QCloseEvent *event )
28{
29    event->ignore();
30}
31
32
33void updaterStatus::insertStatusListBoxItem( QString &itemName, QString itemSize, QString itemStatus, int id )
34{
35    QStringList itemData;
36    QString tmp;
37    itemData << itemName << itemSize << itemStatus << tmp.setNum(id);
38    new QTreeWidgetItem ( listInstallView, itemData ) ;
39}
40
41
42void updaterStatus::updateStatusListBoxItem( QString &itemStatus, int id )
43{
44    QString tmp;
45    tmp.setNum(id);
46
47    QTreeWidgetItemIterator it(listInstallView);
48    while (*it) {
49        if ( (*it)->text(3) == tmp)
50        {
51            (*it)->setText(2, itemStatus);
52        }
53        ++it;
54    }
55}
56
57
58void updaterStatus::setLabelSysUpdateStatus( QString &text )
59{
60   textInstallStatusLabel->setText(text);
61}
62
63
64void updaterStatus::setProgressTotalSteps( int totalSteps )
65{
66  progressInstall->setMaximum(totalSteps);
67}
68
69
70void updaterStatus::setProgressSteps( int currentStep )
71{
72  progressInstall->setValue(currentStep);
73}
74
75
76
77
78void updaterStatus::clearWorkingItems()
79{
80     listInstallView->clear();
81}
82
83
84void updaterStatus::updateSizeListBoxItem( QString &itemSize, int id )
85{
86    QString tmp;
87    tmp.setNum(id);
88
89    QTreeWidgetItemIterator it(listInstallView);
90    while ( *it ) {
91        if ( (*it)->text(3) == tmp)
92        {
93            (*it)->setText(1, itemSize);
94        }
95        ++it;
96    }
97}
98
99
100void updaterStatus::slotJobUpdateProcessedSize( qint64 rec, qint64 total )
101{
102   totalSize = total;
103   processedSize = rec;
104   progressInstall->setMaximum(total);
105   progressInstall->setValue(rec);
106   generateCopyLabel();
107}
108
109
110void updaterStatus::generateCopyLabel()
111{
112   QString totalSize = QString::number(this->totalSize / 1048576) + "MB";
113   QString processedSize = QString::number(this->processedSize / 1048576) + "MB";
114   //QString speed = QString::number(this->speed / 1024) + "KB/s";
115   //textInstallStatusLabel->setText(processedSize + tr(" of ") + totalSize + " (" + speed + ")");
116   textInstallStatusLabel->setText(processedSize + tr(" of ") + totalSize);
117}
Note: See TracBrowser for help on using the repository browser.