コード例 #1
0
/** Shows information about a Partition in the InfoPane
	@param area the current area the widget's dock is in
	@param p the Partition to show information about
*/
void InfoPane::showPartition(Qt::DockWidgetArea area, const Partition& p)
{
	clear();
	parentWidget()->parentWidget()->setWindowTitle(i18nc("@title:window", "Partition Information"));

	int x = 0;
	int y = createHeader(p.deviceNode(), cols(area));
	if (p.fileSystem().type() == FileSystem::Luks)
	{
		QString deviceNode = p.partitionPath();
		createLabels(i18nc("@label partition", "File system:"), p.fileSystem().name(), cols(area), x, y);
		createLabels(i18nc("@label partition", "Capacity:"), Capacity::formatByteSize(p.capacity()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Cipher name:"), FS::luks::getCipherName(deviceNode), cols(area), x, y);
		createLabels(i18nc("@label partition", "Cipher mode:"), FS::luks::getCipherMode(deviceNode), cols(area), x, y);
		createLabels(i18nc("@label partition", "Hash:"), FS::luks::getHashName(deviceNode), cols(area), x, y);
		createLabels(i18nc("@label partition", "Key size:"), FS::luks::getKeySize(deviceNode), cols(area), x, y);
		createLabels(i18nc("@label partition", "Payload offset:"), FS::luks::getPayloadOffset(deviceNode), cols(area), x, y);
		createLabels(i18nc("@label partition", "First sector:"), QLocale().toString(p.firstSector()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Last sector:"), QLocale().toString(p.lastSector()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Number of sectors:"), QLocale().toString(p.length()), cols(area), x, y);
	}
	else
	{
		createLabels(i18nc("@label partition", "File system:"), p.fileSystem().name(), cols(area), x, y);
		createLabels(i18nc("@label partition", "Capacity:"), Capacity::formatByteSize(p.capacity()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Available:"), Capacity::formatByteSize(p.available()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Used:"), Capacity::formatByteSize(p.used()), cols(area), x, y);
		createLabels(i18nc("@label partition", "First sector:"), QLocale().toString(p.firstSector()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Last sector:"), QLocale().toString(p.lastSector()), cols(area), x, y);
		createLabels(i18nc("@label partition", "Number of sectors:"), QLocale().toString(p.length()), cols(area), x, y);
	}
}
コード例 #2
0
/** Creates a new Capacity instance.
	@param p the Partition
	@param t type of Capacity
*/
Capacity::Capacity(const Partition& p, Type t) :
	m_Size(-1)
{
	switch(t)
	{
		case Used: m_Size = p.used(); break;
		case Available: m_Size = p.available(); break;
		case Total: m_Size = p.capacity(); break;
		default: break;
	}
}