~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kinfocenter/Modules/infosummary/progressboxwidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 *  progressboxwidget.cpp
 
4
 *
 
5
 *  Copyright (C) 2010 David Hubner <hubnerd@ntlworld.com>
 
6
 *
 
7
 *  This program is free software; you can redistribute it and/or modify
 
8
 *  it under the terms of the GNU General Public License as published by
 
9
 *  the Free Software Foundation; either version 2 of the License, or
 
10
 *  (at your option) any later version.
 
11
 *
 
12
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
20
 *
 
21
 */
 
22
 
 
23
#include "progressboxwidget.h"
 
24
 
 
25
ProgressBoxWidget::ProgressBoxWidget()
 
26
{
 
27
  setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
 
28
  setObjectName( QLatin1String("OuterFrame" ));
 
29
  
 
30
  m_layout = new QGridLayout(this);
 
31
  m_layout->setAlignment(Qt::AlignTop|Qt::AlignLeft);
 
32
  m_layout->setSpacing(10);
 
33
  
 
34
  setStyleSheet("QFrame#OuterFrame { border: 2px solid grey; border-radius: 10px; };");
 
35
  
 
36
  createDisplay();
 
37
}
 
38
 
 
39
void ProgressBoxWidget::createDisplay() 
 
40
{
 
41
  m_iconLabel = new QLabel();
 
42
  m_iconLabel->setAlignment(Qt::AlignCenter);
 
43
  m_iconLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
44
  
 
45
  QFont bFont;
 
46
  bFont.setBold(true);
 
47
  
 
48
  m_info0Label = new QLabel();
 
49
  m_info0Label->setFont(bFont);
 
50
  m_info0NameLabel = new QLabel();
 
51
  
 
52
  m_info1Label = new QLabel();
 
53
  m_info1Label->setFont(bFont);
 
54
  m_progressBar = new QProgressBar();
 
55
  
 
56
  m_layout->addWidget(m_iconLabel,1,1,2,1,Qt::AlignCenter);
 
57
  
 
58
  m_layout->addWidget(m_info0Label,1,2,1,1);
 
59
  m_layout->addWidget(m_info0NameLabel,1,3,1,1);
 
60
  
 
61
  m_layout->addWidget(m_info1Label,2,2,1,1);
 
62
  m_layout->addWidget(m_progressBar,2,3,1,1);
 
63
}
 
64
 
 
65
void ProgressBoxWidget::setLabelTitles(const QString &first, const QString &second)
 
66
{
 
67
  m_info0Label->setText(first);
 
68
  m_info1Label->setText(second);
 
69
}
 
70
 
 
71
void ProgressBoxWidget::setIcon(const KIcon &icon) 
 
72
{
 
73
  m_iconLabel->setPixmap(icon.pixmap(64));
 
74
}
 
75
 
 
76
void ProgressBoxWidget::setLabelOne(const QString &info) 
 
77
{
 
78
  m_info0NameLabel->setText(info);
 
79
}
 
80
 
 
81
void ProgressBoxWidget::setRange(int s, int e) const
 
82
{
 
83
  m_progressBar->setRange(s,e);
 
84
}
 
85
 
 
86
void ProgressBoxWidget::setValue(int s) const
 
87
{
 
88
  m_progressBar->setValue(s);
 
89
}