1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
/*
* devinfo.cpp
*
* Copyright (C) 2009 David Hubner <hubnerd@ntlworld.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "devinfo.h"
#include <QGridLayout>
#include <QLabel>
#include <QSplitter>
#include <KLocalizedString>
#include <KAboutData>
//Plugin
#include <KPluginFactory>
#include <KPluginLoader>
#include "devicelisting.h"
#include "infopanel.h"
K_PLUGIN_FACTORY(devInfoModuleFactory, registerPlugin<DevInfoPlugin>();
)
DevInfoPlugin::DevInfoPlugin(QWidget *parent, const QVariantList &)
: KCModule(parent)
{
const KAboutData *about
= new KAboutData(i18n("kcmdevinfo"), i18n("Device Viewer"),
QStringLiteral("0.70"), QString(), KAboutLicense::GPL,
i18n("(c) 2010 David Hubner"));
setAboutData(about);
//Layout
layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
//top
QSplitter *split = new QSplitter(Qt::Horizontal, this);
split->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
split->setChildrenCollapsible(false);
InfoPanel *info = new InfoPanel(split, this);
DeviceListing *devList = new DeviceListing(split, info, this);
split->setStretchFactor(1, 1);
//bottom
QWidget *bottom = new QWidget(this);
bottom->setContentsMargins(0, 0, 0, 0);
bottom->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
QHBoxLayout *bottomLayout = new QHBoxLayout(bottom);
bottomLayout->setContentsMargins(0, 0, 0, 0);
QFont boldFont;
boldFont.setBold(true);
QLabel *udiLabel = new QLabel(i18n("UDI: "));
udiLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
udiLabel->setFont(boldFont);
udiLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
udiStatus = new QLabel(this);
udiStatus->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
udiStatus->setTextInteractionFlags(Qt::TextSelectableByMouse);
udiStatus->setWhatsThis(i18nc("Udi Whats This",
"Shows the current device's UDI (Unique Device Identifier)"));
//Adding
split->addWidget(devList);
split->addWidget(info);
layout->addWidget(split, 0, 0);
bottomLayout->addWidget(udiLabel);
bottomLayout->addWidget(udiStatus);
layout->addWidget(bottom, 1, 0, 1, 0);
//Misc
setButtons(Help);
updateStatus(i18nc("no device UDI", "None"));
}
DevInfoPlugin::~DevInfoPlugin()
{
delete layout;
}
void DevInfoPlugin::updateStatus(const QString &message)
{
udiStatus->setText(message);
}
#include "devinfo.moc"
|