Add disk info page to device manager

pull/2/head
Timothy Pearson 12 years ago
parent 5f27e3ead5
commit 18d991680d

@ -44,6 +44,11 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge
if (m_device) {
base = new DevicePropertiesDialogBase(plainPage());
// Remove all non-applicable tabs
if (m_device->type() != TDEGenericDeviceType::Disk) {
base->tabBarWidget->removePage(base->tabDisk);
}
TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint());
mainGrid->setRowStretch(1, 1);
mainGrid->setRowStretch(1, 1);
@ -64,6 +69,41 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge
base->labelBusID->hide();
base->stocklabelBusID->hide();
}
if (m_device->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(m_device);
base->tabDisk->show();
base->labelDiskMountpoint->setText(sdevice->mountPath());
// Show status
TQString status_text = "<qt>";
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Mountable)) {
status_text += "Mountable<br>";
}
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) {
status_text += "Removable<br>";
}
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Inserted)) {
status_text += "Inserted<br>";
}
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsedByDevice)) {
status_text += "In use<br>";
}
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsesDevice)) {
status_text += "Uses other device<br>";
}
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::ContainsFilesystem)) {
status_text += "Contains a filesystem<br>";
}
if (status_text == "<qt>") {
status_text += "<i>Unavailable</i>";
}
status_text += "</qt>";
base->labelDiskStatus->setText(status_text);
// TODO
// Add mount/unmount buttons
}
}
}

@ -18,14 +18,14 @@
</property>
<widget class="TQTabWidget" row="0" column="0">
<property name="name">
<cstring>TabWidget2</cstring>
<cstring>tabBarWidget</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>tab</cstring>
<cstring>tabGeneral</cstring>
</property>
<attribute name="title">
<string>General</string>
@ -192,6 +192,78 @@
</spacer>
</grid>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>tabDisk</cstring>
</property>
<attribute name="title">
<string>Disk</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupProps</cstring>
</property>
<property name="title">
<string>Volume Information</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Mountpoint:</string>
</property>
</widget>
<widget class="TQLabel" row="0" column="1" colspan="1">
<property name="name">
<cstring>labelDiskMountpoint</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0" colspan="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Status:</string>
</property>
<property name="alignment">
<set>AlignTop|AlignLeft</set>
</property>
</widget>
<widget class="TQLabel" row="1" column="1" colspan="1">
<property name="name">
<cstring>labelDiskStatus</cstring>
</property>
</widget>
</grid>
</widget>
<spacer row="8" column="0">
<property name="name" stdset="0">
<cstring>Spacer4</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</grid>
</widget>
</widget>
</grid>
</widget>

Loading…
Cancel
Save