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

« back to all changes in this revision

Viewing changes to kinfocenter/Modules/devinfo/devinfo.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
 *  devinfo.cpp
 
4
 *
 
5
 *  Copyright (C) 2009 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 "devinfo.h"
 
24
#include <QSplitter>
 
25
 
 
26
K_PLUGIN_FACTORY(devInfoModuleFactory, registerPlugin<DevInfoPlugin>();)
 
27
K_EXPORT_PLUGIN(devInfoModuleFactory("kcmdevinfo"))
 
28
 
 
29
DevInfoPlugin::DevInfoPlugin(QWidget *parent, const QVariantList &)  : 
 
30
  KCModule(devInfoModuleFactory::componentData(), parent)
 
31
{
 
32
  
 
33
  const KAboutData *about =
 
34
  new KAboutData(I18N_NOOP("kcmdevinfo"), 0, ki18n("KDE Solid Based Device Viewer"),
 
35
                  "0.70", KLocalizedString(), KAboutData::License_GPL,
 
36
                  ki18n("(c) 2010 David Hubner"));
 
37
                  
 
38
  setAboutData(about);
 
39
  
 
40
  //Layout
 
41
  layout = new QGridLayout(this);
 
42
  layout->setContentsMargins(0,0,0,0);
 
43
  
 
44
  //top 
 
45
  QSplitter *split = new QSplitter(Qt::Horizontal, this);
 
46
  split->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
47
  
 
48
  split->setChildrenCollapsible(false);
 
49
  
 
50
  InfoPanel *info = new InfoPanel(split, this);
 
51
  DeviceListing *devList = new DeviceListing(split, info, this);
 
52
  
 
53
  split->setStretchFactor(1,1);
 
54
 
 
55
  //bottom
 
56
  QWidget *bottom = new QWidget(this); 
 
57
  bottom->setContentsMargins(0,0,0,0);
 
58
  bottom->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
 
59
  
 
60
  QHBoxLayout *bottomLayout = new QHBoxLayout(bottom);
 
61
  bottomLayout->setContentsMargins(0,0,0,0);
 
62
  
 
63
  QFont boldFont;
 
64
  boldFont.setBold(true);
 
65
  
 
66
  QLabel *udiLabel = new QLabel(i18n("UDI: "));
 
67
  udiLabel->setFont(boldFont);
 
68
  udiLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
69
   
 
70
  udiStatus = new QLabel(this);
 
71
  udiStatus->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
 
72
  udiStatus->setTextInteractionFlags(Qt::TextSelectableByMouse);
 
73
  udiStatus->setWhatsThis(i18nc("Udi Whats This","Shows the current device's UDI (Unique Device Identifier)"));
 
74
 
 
75
  //Adding
 
76
  split->addWidget(devList);  
 
77
  split->addWidget(info);
 
78
  layout->addWidget(split,0,0);
 
79
  
 
80
  bottomLayout->addWidget(udiLabel);
 
81
  bottomLayout->addWidget(udiStatus);
 
82
  layout->addWidget(bottom,1,0,1,0);
 
83
  
 
84
  //Misc
 
85
  setButtons(Help);
 
86
  updateStatus(i18n("None"));
 
87
}
 
88
 
 
89
DevInfoPlugin::~DevInfoPlugin() 
 
90
{  
 
91
  delete layout; 
 
92
}
 
93
  
 
94
void DevInfoPlugin::updateStatus(const QString message) 
 
95
{  
 
96
  udiStatus->setText(message);
 
97
}