Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KInfoCenter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
KInfoCenter
Commits
11b1773e
Commit
11b1773e
authored
Oct 22, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reindent it
parent
891c9788
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
959 additions
and
882 deletions
+959
-882
Modules/devinfo/devicelisting.cpp
Modules/devinfo/devicelisting.cpp
+155
-144
Modules/devinfo/devicelisting.h
Modules/devinfo/devicelisting.h
+25
-22
Modules/devinfo/devinfo.cpp
Modules/devinfo/devinfo.cpp
+66
-66
Modules/devinfo/devinfo.h
Modules/devinfo/devinfo.h
+6
-8
Modules/devinfo/infopanel.cpp
Modules/devinfo/infopanel.cpp
+101
-90
Modules/devinfo/infopanel.h
Modules/devinfo/infopanel.h
+11
-10
Modules/devinfo/nicsignals.cpp
Modules/devinfo/nicsignals.cpp
+17
-13
Modules/devinfo/nicsignals.h
Modules/devinfo/nicsignals.h
+9
-11
Modules/devinfo/qvlistlayout.cpp
Modules/devinfo/qvlistlayout.cpp
+27
-33
Modules/devinfo/qvlistlayout.h
Modules/devinfo/qvlistlayout.h
+1
-4
Modules/devinfo/soldevice.cpp
Modules/devinfo/soldevice.cpp
+84
-77
Modules/devinfo/soldevice.h
Modules/devinfo/soldevice.h
+48
-45
Modules/devinfo/soldevicetypes.cpp
Modules/devinfo/soldevicetypes.cpp
+362
-309
Modules/devinfo/soldevicetypes.h
Modules/devinfo/soldevicetypes.h
+28
-33
Modules/devinfo/solidhelper.cpp
Modules/devinfo/solidhelper.cpp
+15
-14
Modules/devinfo/solidhelper.h
Modules/devinfo/solidhelper.h
+4
-3
No files found.
Modules/devinfo/devicelisting.cpp
View file @
11b1773e
/*
* devicelisting.cpp
*
...
...
@@ -24,189 +23,201 @@
#include <QMenu>
DeviceListing
::
DeviceListing
(
QWidget
*
parent
,
InfoPanel
*
info
,
DevInfoPlugin
*
stat
)
:
QTreeWidget
(
parent
),
iPanel
(
info
),
status
(
stat
)
{
DeviceListing
::
DeviceListing
(
QWidget
*
parent
,
InfoPanel
*
info
,
DevInfoPlugin
*
stat
)
:
QTreeWidget
(
parent
)
,
iPanel
(
info
)
,
status
(
stat
)
{
// // Check nic changes
// nicSig = new NicSignals();
// connect(nicSig,SIGNAL(nicActivatedOrDisconnected()),this,SLOT(networkingChangedSlot()));
//
// Check if clicked
connect
(
this
,
&
DeviceListing
::
itemActivated
,
this
,
&
DeviceListing
::
itemActivatedSlot
);
// Check if item is added
connect
(
Solid
::
DeviceNotifier
::
instance
(),
SIGNAL
(
deviceAdded
(
QString
)),
this
,
SLOT
(
deviceAddedSlot
(
QString
)));
connect
(
Solid
::
DeviceNotifier
::
instance
(),
SIGNAL
(
deviceAdded
(
QString
)),
this
,
SLOT
(
deviceAddedSlot
(
QString
)));
// Check if item is removed
connect
(
Solid
::
DeviceNotifier
::
instance
(),
SIGNAL
(
deviceRemoved
(
QString
)),
this
,
SLOT
(
deviceRemovedSlot
(
QString
)));
setWhatsThis
(
i18nc
(
"Device Listing Whats This"
,
"Shows all the devices that are currently listed."
));
connect
(
Solid
::
DeviceNotifier
::
instance
(),
SIGNAL
(
deviceRemoved
(
QString
)),
this
,
SLOT
(
deviceRemovedSlot
(
QString
)));
setWhatsThis
(
i18nc
(
"Device Listing Whats This"
,
"Shows all the devices that are currently listed."
));
createMenuActions
();
setHeaderLabels
(
QStringList
(
i18n
(
"Devices"
)));
populateListing
();
populateListing
();
}
DeviceListing
::~
DeviceListing
()
{
//delete nicSig;
clear
();
{
//delete nicSig;
clear
();
}
void
DeviceListing
::
createMenuActions
()
{
colAct
=
new
QAction
(
i18n
(
"Collapse All"
),
this
);
connect
(
colAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
collapseAllDevicesSlot
);
expAct
=
new
QAction
(
i18n
(
"Expand All"
),
this
);
connect
(
expAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
expandAllDevicesSlot
);
allAct
=
new
QAction
(
i18n
(
"Show All Devices"
),
this
);
connect
(
allAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
showAllDevicesSlot
);
relAct
=
new
QAction
(
i18n
(
"Show Relevant Devices"
),
this
);
connect
(
relAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
showRelevantDevicesSlot
);
void
DeviceListing
::
createMenuActions
()
{
colAct
=
new
QAction
(
i18n
(
"Collapse All"
),
this
);
connect
(
colAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
collapseAllDevicesSlot
);
expAct
=
new
QAction
(
i18n
(
"Expand All"
),
this
);
connect
(
expAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
expandAllDevicesSlot
);
allAct
=
new
QAction
(
i18n
(
"Show All Devices"
),
this
);
connect
(
allAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
showAllDevicesSlot
);
relAct
=
new
QAction
(
i18n
(
"Show Relevant Devices"
),
this
);
connect
(
relAct
,
&
QAction
::
triggered
,
this
,
&
DeviceListing
::
showRelevantDevicesSlot
);
}
void
DeviceListing
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
QMenu
menu
(
this
);
menu
.
addAction
(
colAct
);
menu
.
addAction
(
expAct
);
menu
.
addAction
(
allAct
);
menu
.
addAction
(
relAct
);
menu
.
exec
(
event
->
globalPos
());
void
DeviceListing
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
QMenu
menu
(
this
);
menu
.
addAction
(
colAct
);
menu
.
addAction
(
expAct
);
menu
.
addAction
(
allAct
);
menu
.
addAction
(
relAct
);
menu
.
exec
(
event
->
globalPos
());
}
QTreeWidgetItem
*
DeviceListing
::
createListItems
(
const
Solid
::
DeviceInterface
::
Type
&
type
)
QTreeWidgetItem
*
DeviceListing
::
createListItems
(
const
Solid
::
DeviceInterface
::
Type
&
type
)
{
switch
(
type
)
{
case
Solid
::
DeviceInterface
::
Processor
:
return
new
SolProcessorDevice
(
type
);
case
Solid
::
DeviceInterface
::
StorageDrive
:
return
new
SolStorageDevice
(
type
);
case
Solid
::
DeviceInterface
::
Camera
:
return
new
SolCameraDevice
(
type
);
case
Solid
::
DeviceInterface
::
PortableMediaPlayer
:
return
new
SolMediaPlayerDevice
(
type
);
case
Solid
::
DeviceInterface
::
Battery
:
return
new
SolBatteryDevice
(
type
);
default:
return
new
SolDevice
(
type
,
i18nc
(
"unknown device type"
,
"Unknown"
));
}
switch
(
type
)
{
case
Solid
::
DeviceInterface
::
Processor
:
return
new
SolProcessorDevice
(
type
);
case
Solid
::
DeviceInterface
::
StorageDrive
:
return
new
SolStorageDevice
(
type
);
case
Solid
::
DeviceInterface
::
Camera
:
return
new
SolCameraDevice
(
type
);
case
Solid
::
DeviceInterface
::
PortableMediaPlayer
:
return
new
SolMediaPlayerDevice
(
type
);
case
Solid
::
DeviceInterface
::
Battery
:
return
new
SolBatteryDevice
(
type
);
default:
return
new
SolDevice
(
type
,
i18nc
(
"unknown device type"
,
"Unknown"
));
}
}
void
DeviceListing
::
populateListing
(
const
show
showStatus
)
{
const
Solid
::
DeviceInterface
::
Type
needHardware
[]
=
{
Solid
::
DeviceInterface
::
Processor
,
Solid
::
DeviceInterface
::
StorageDrive
,
Solid
::
DeviceInterface
::
Battery
,
Solid
::
DeviceInterface
::
PortableMediaPlayer
,
Solid
::
DeviceInterface
::
Camera
};
clear
();
for
(
unsigned
int
i
=
0
;
i
<
(
sizeof
(
needHardware
)
/
sizeof
(
Solid
::
DeviceInterface
::
Type
));
i
++
)
{
QTreeWidgetItem
*
tmpDevice
=
createListItems
(
needHardware
[
i
]);
deviceMap
[
needHardware
[
i
]]
=
static_cast
<
SolDevice
*>
(
tmpDevice
);
if
((
tmpDevice
->
childCount
()
>
0
)
||
(
showStatus
==
ALL
))
{
addTopLevelItem
(
tmpDevice
);
}
}
{
const
Solid
::
DeviceInterface
::
Type
needHardware
[]
=
{
Solid
::
DeviceInterface
::
Processor
,
Solid
::
DeviceInterface
::
StorageDrive
,
Solid
::
DeviceInterface
::
Battery
,
Solid
::
DeviceInterface
::
PortableMediaPlayer
,
Solid
::
DeviceInterface
::
Camera
};
clear
();
for
(
unsigned
int
i
=
0
;
i
<
(
sizeof
(
needHardware
)
/
sizeof
(
Solid
::
DeviceInterface
::
Type
));
i
++
)
{
QTreeWidgetItem
*
tmpDevice
=
createListItems
(
needHardware
[
i
]);
deviceMap
[
needHardware
[
i
]]
=
static_cast
<
SolDevice
*>
(
tmpDevice
);
if
((
tmpDevice
->
childCount
()
>
0
)
||
(
showStatus
==
ALL
))
{
addTopLevelItem
(
tmpDevice
);
}
}
}
void
DeviceListing
::
itemActivatedSlot
(
QTreeWidgetItem
*
listItemIn
,
const
int
columnIn
)
void
DeviceListing
::
itemActivatedSlot
(
QTreeWidgetItem
*
listItemIn
,
const
int
columnIn
)
{
Q_UNUSED
(
columnIn
);
SolDevice
*
listItem
=
static_cast
<
SolDevice
*>
(
listItemIn
);
if
(
listItem
->
isDeviceSet
())
{
iPanel
->
setTopInfo
(
listItem
->
deviceIcon
(),
listItem
->
device
());
QVListLayout
*
bottomLay
=
listItem
->
infoPanelLayout
();
if
(
!
bottomLay
)
return
;
iPanel
->
setBottomInfo
(
bottomLay
);
}
else
{
status
->
updateStatus
(
i18nc
(
"no device UDI"
,
"None"
));
}
Q_UNUSED
(
columnIn
);
SolDevice
*
listItem
=
static_cast
<
SolDevice
*>
(
listItemIn
);
if
(
listItem
->
isDeviceSet
())
{
iPanel
->
setTopInfo
(
listItem
->
deviceIcon
(),
listItem
->
device
());
QVListLayout
*
bottomLay
=
listItem
->
infoPanelLayout
();
if
(
!
bottomLay
)
{
return
;
}
iPanel
->
setBottomInfo
(
bottomLay
);
}
else
{
status
->
updateStatus
(
i18nc
(
"no device UDI"
,
"None"
));
}
}
void
DeviceListing
::
deviceAddedSlot
(
const
QString
&
udi
)
{
SolidHelper
*
solhelp
=
new
SolidHelper
();
const
QList
<
Solid
::
Device
>
list
=
Solid
::
Device
::
allDevices
();
foreach
(
const
Solid
::
Device
&
dev
,
list
)
{
if
(
dev
.
udi
()
==
udi
)
{
Solid
::
DeviceInterface
::
Type
deviceType
=
solhelp
->
deviceType
(
&
dev
);
QTreeWidgetItem
*
parent
=
getTreeWidgetItemFromUdi
(
this
,
dev
.
parentUdi
());
// Incase of bad index
if
(
deviceMap
[
deviceType
]
==
NULL
)
{
QTreeWidgetItem
*
topItem
=
topLevelItem
(
0
);
if
(
topItem
==
0
)
{
delete
solhelp
;
return
;
}
deviceMap
[
deviceType
]
=
static_cast
<
SolDevice
*>
(
topItem
);
}
switch
(
deviceType
)
{
case
Solid
::
DeviceInterface
::
Processor
:
new
SolProcessorDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
Camera
:
new
SolCameraDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
PortableMediaPlayer
:
new
SolMediaPlayerDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
Battery
:
new
SolBatteryDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
StorageDrive
:
new
SolStorageDevice
(
deviceMap
[
deviceType
],
dev
,
SolStorageDevice
::
NOCHILDREN
);
break
;
case
Solid
::
DeviceInterface
::
StorageVolume
:
if
(
parent
==
NULL
)
break
;
new
SolVolumeDevice
(
parent
,
dev
);
break
;
default:
break
;
}
{
SolidHelper
*
solhelp
=
new
SolidHelper
();
const
QList
<
Solid
::
Device
>
list
=
Solid
::
Device
::
allDevices
();
foreach
(
const
Solid
::
Device
&
dev
,
list
)
{
if
(
dev
.
udi
()
==
udi
)
{
Solid
::
DeviceInterface
::
Type
deviceType
=
solhelp
->
deviceType
(
&
dev
);
QTreeWidgetItem
*
parent
=
getTreeWidgetItemFromUdi
(
this
,
dev
.
parentUdi
());
// Incase of bad index
if
(
deviceMap
[
deviceType
]
==
NULL
)
{
QTreeWidgetItem
*
topItem
=
topLevelItem
(
0
);
if
(
topItem
==
0
)
{
delete
solhelp
;
return
;
}
deviceMap
[
deviceType
]
=
static_cast
<
SolDevice
*>
(
topItem
);
}
switch
(
deviceType
)
{
case
Solid
::
DeviceInterface
::
Processor
:
new
SolProcessorDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
Camera
:
new
SolCameraDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
PortableMediaPlayer
:
new
SolMediaPlayerDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
Battery
:
new
SolBatteryDevice
(
deviceMap
[
deviceType
],
dev
);
break
;
case
Solid
::
DeviceInterface
::
StorageDrive
:
new
SolStorageDevice
(
deviceMap
[
deviceType
],
dev
,
SolStorageDevice
::
NOCHILDREN
);
break
;
case
Solid
::
DeviceInterface
::
StorageVolume
:
if
(
parent
==
NULL
)
{
break
;
}
new
SolVolumeDevice
(
parent
,
dev
);
break
;
default:
break
;
}
}
}
}
delete
solhelp
;
delete
solhelp
;
}
void
DeviceListing
::
deviceRemovedSlot
(
const
QString
&
udi
)
{
const
QTreeWidgetItem
*
item
=
getTreeWidgetItemFromUdi
(
this
,
udi
);
if
(
item
==
nullptr
)
return
;
delete
item
;
const
QTreeWidgetItem
*
item
=
getTreeWidgetItemFromUdi
(
this
,
udi
);
if
(
item
==
nullptr
)
{
return
;
}
delete
item
;
}
void
DeviceListing
::
collapseAllDevicesSlot
()
{
collapseAll
();
void
DeviceListing
::
collapseAllDevicesSlot
()
{
collapseAll
();
}
void
DeviceListing
::
expandAllDevicesSlot
()
{
expandAll
();
void
DeviceListing
::
expandAllDevicesSlot
()
{
expandAll
();
}
void
DeviceListing
::
showAllDevicesSlot
()
{
populateListing
(
ALL
);
void
DeviceListing
::
showAllDevicesSlot
()
{
populateListing
(
ALL
);
}
void
DeviceListing
::
showRelevantDevicesSlot
()
{
populateListing
(
RELEVANT
);
void
DeviceListing
::
showRelevantDevicesSlot
()
{
populateListing
(
RELEVANT
);
}
Modules/devinfo/devicelisting.h
View file @
11b1773e
/*
* devicelisting.h
*
...
...
@@ -29,7 +28,7 @@
#include <solid/processor.h>
#include <solid/devicenotifier.h>
//QT
//QT
#include <QMap>
#include <QTreeWidget>
#include <QAction>
...
...
@@ -51,42 +50,46 @@ class DevInfoPlugin;
//class NicSignals;
class
DeviceListing
:
public
QTreeWidget
{
Q_OBJECT
{
Q_OBJECT
private:
enum
show
{
ALL
=
0
,
RELEVANT
};
private:
enum
show
{
ALL
=
0
,
RELEVANT
};
public:
public:
DeviceListing
(
QWidget
*
,
InfoPanel
*
,
DevInfoPlugin
*
);
~
DeviceListing
();
~
DeviceListing
();
static
QTreeWidgetItem
*
getTreeWidgetItemFromUdi
(
QTreeWidget
*
widget
,
const
QString
&
udi
)
{
QTreeWidgetItemIterator
treeWidget
(
widget
);
while
(
*
treeWidget
)
{
SolDevice
*
item
=
static_cast
<
SolDevice
*>
(
*
treeWidget
);
if
(
item
->
udi
()
==
udi
)
return
*
treeWidget
;
++
treeWidget
;
}
return
NULL
;
while
(
*
treeWidget
)
{
SolDevice
*
item
=
static_cast
<
SolDevice
*>
(
*
treeWidget
);
if
(
item
->
udi
()
==
udi
)
{
return
*
treeWidget
;
}
++
treeWidget
;
}
return
NULL
;
}
private:
void
populateListing
(
const
show
=
RELEVANT
);
private:
void
populateListing
(
const
show
=
RELEVANT
);
QTreeWidgetItem
*
createListItems
(
const
Solid
::
DeviceInterface
::
Type
&
);
void
contextMenuEvent
(
QContextMenuEvent
*
)
Q_DECL_OVERRIDE
;
void
createMenuActions
();
QMap
<
Solid
::
DeviceInterface
::
Type
,
SolDevice
*>
deviceMap
;
InfoPanel
*
iPanel
;
QAction
*
colAct
,
*
expAct
,
*
allAct
,
*
relAct
;
DevInfoPlugin
*
status
;
//NicSignals *nicSig;
public
Q_SLOTS
:
void
itemActivatedSlot
(
QTreeWidgetItem
*
,
const
int
);
public
Q_SLOTS
:
void
itemActivatedSlot
(
QTreeWidgetItem
*
,
const
int
);
void
deviceAddedSlot
(
const
QString
&
);
void
deviceRemovedSlot
(
const
QString
&
);
void
collapseAllDevicesSlot
();
...
...
Modules/devinfo/devinfo.cpp
View file @
11b1773e
/*
* devinfo.cpp
*
...
...
@@ -24,77 +23,78 @@
#include <QSplitter>
#include <KLocalizedString>
K_PLUGIN_FACTORY
(
devInfoModuleFactory
,
registerPlugin
<
DevInfoPlugin
>
();)
K_PLUGIN_FACTORY
(
devInfoModuleFactory
,
registerPlugin
<
DevInfoPlugin
>
();
)
DevInfoPlugin
::
DevInfoPlugin
(
QWidget
*
parent
,
const
QVariantList
&
)
:
KCModule
(
parent
)
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"
));
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
;
DevInfoPlugin
::~
DevInfoPlugin
()
{
delete
layout
;
}
void
DevInfoPlugin
::
updateStatus
(
const
QString
&
message
)
{
udiStatus
->
setText
(
message
);
{
udiStatus
->
setText
(
message
);
}
#include "devinfo.moc"
Modules/devinfo/devinfo.h
View file @
11b1773e
/*
* devinfo.h
*
...
...
@@ -37,18 +36,17 @@
#include "devicelisting.h"
#include "infopanel.h"
class
DevInfoPlugin
:
public
KCModule
{
Q_OBJECT
public:
Q_OBJECT
public:
DevInfoPlugin
(
QWidget
*
parent
,
const
QVariantList
&
);
~
DevInfoPlugin
();
void
updateStatus
(
const
QString
&
uid
);
private:
private:
QGridLayout
*
layout
;
QLabel
*
udiStatus
;
};
...
...
Modules/devinfo/infopanel.cpp
View file @
11b1773e
/*
* infopanel.cpp
*
...
...
@@ -22,122 +21,134 @@
#include "infopanel.h"