SVN: PLDLiveInstaller/trunk/DiskListWidget.cpp

shadzik shadzik at pld-linux.org
Thu Jan 13 14:42:46 CET 2011


Author: shadzik
Date: Thu Jan 13 14:42:46 2011
New Revision: 12035

Modified:
   PLDLiveInstaller/trunk/DiskListWidget.cpp
Log:
- show only devices (disks) that are bigger than 6GB
- code indention


Modified: PLDLiveInstaller/trunk/DiskListWidget.cpp
==============================================================================
--- PLDLiveInstaller/trunk/DiskListWidget.cpp	(original)
+++ PLDLiveInstaller/trunk/DiskListWidget.cpp	Thu Jan 13 14:42:46 2011
@@ -37,40 +37,46 @@
     {
       if(device.is<Solid::StorageDrive>())
       {
-	QString dev = device.as<Solid::Block>()->device();
-	
-	if (solidDevice.contains(dev))
+	// show only devices bigger than 6GB
+	if(device.as<Solid::StorageDrive>()->size()/1024/1024 >= 6144)
 	{
-	  solidDevice.removeOne(dev);
-	} else {
+	  QString dev = device.as<Solid::Block>()->device();
 	
-	Solid::StorageDrive *harddisk = device.as<Solid::StorageDrive>();
-	if(((harddisk->driveType()==Solid::StorageDrive::HardDisk) || (harddisk->driveType()==Solid::StorageDrive::MemoryStick)))
-	{
-	  QString text = device.product() + " (" + dev + ")"; 
-	  QListWidgetItem *listitem = new QListWidgetItem;
-	  if ((harddisk->driveType()==Solid::StorageDrive::MemoryStick) || harddisk->bus()==Solid::StorageDrive::Usb)
-	    listitem->setIcon(KIcon("drive-removable-media-usb").pixmap(64));
-	  else
-	    listitem->setIcon(KIcon("drive-harddisk").pixmap(64));
-	  listitem->setText(text);
-	  listitem->setToolTip(dev);
-	  addItem(listitem);
-	  devhash->insert(text,device);
-	  diskListAlreadyOnList.append(dev);
-	  qDebug() << "Product: " << device.product() << "Vendor: " << device.vendor() 
-	  << "Description: " << device.description() << "Dev: " << dev
-	  << "Type: " << harddisk->driveType();
+	  if (solidDevice.contains(dev))
+	  {
+	    solidDevice.removeOne(dev);
+	  } 
+	  else 
+	  {
+	
+	    Solid::StorageDrive *harddisk = device.as<Solid::StorageDrive>();
+	    if(((harddisk->driveType()==Solid::StorageDrive::HardDisk) || (harddisk->driveType()==Solid::StorageDrive::MemoryStick)))
+	    {
+	      QString text = device.product() + " (" + dev + ")"; 
+	      QListWidgetItem *listitem = new QListWidgetItem;
+	      if ((harddisk->driveType()==Solid::StorageDrive::MemoryStick) || harddisk->bus()==Solid::StorageDrive::Usb)
+		listitem->setIcon(KIcon("drive-removable-media-usb").pixmap(64));
+	      else
+		listitem->setIcon(KIcon("drive-harddisk").pixmap(64));
+	      listitem->setText(text);
+	      listitem->setToolTip(dev);
+	      addItem(listitem);
+	      devhash->insert(text,device);
+	      diskListAlreadyOnList.append(dev);
+	      qDebug() << "Product: " << device.product() << "Vendor: " << device.vendor() 
+		<< "Description: " << device.description() << "Dev: " << dev
+		<< "Type: " << harddisk->driveType();
 	  
-	   foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, device.udi() ))
-	   {
-	    QString part = partDev.as<Solid::Block>()->device();
-	    parthash->insert(part, partDev);
-	    //qDebug() << "has partition: " << part;
-	  }
+	      foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, device.udi() ))
+	      {
+		QString part = partDev.as<Solid::Block>()->device();
+		parthash->insert(part, partDev);
+		//qDebug() << "has partition: " << part;
+	      }
 	  
-	}
-	}
+	    }
+	  }
+	} // devices bigger than 6GB
       }
     }
     foreach(QString soldev, solidDevice) {


More information about the pld-cvs-commit mailing list