Bläddra i källkod

Fix some indentation issues

CTK convention is to follow the superclass style unless there
is a CTK convention that overrides it.  In most cases we follow Qt,
but we use a vtk/itk style indent (two spaces, brackets indented).

http://www.commontk.org/index.php/Contributing_to_CTK#CTK_Coding_Style
Steve Pieper 11 år sedan
förälder
incheckning
df3bb14c29

+ 64 - 61
Libs/DICOM/Core/ctkDICOMObjectModel.cpp

@@ -51,8 +51,9 @@ public:
   void itemInsert( DcmItem *dataset, QStandardItem *parent);
   void seqInsert( DcmSequenceOfItems *dataset, QStandardItem *parent);
   QString getTagValue( DcmElement *dcmElem);
-  QStandardItem* populateModelRow(const QString& tagName,const QString& tagHexName,const QString& tagValue,
-    const QString& VRName, const QString& elementLengthQString, QStandardItem *parent);
+  QStandardItem* populateModelRow(const QString& tagName,const QString& tagHexName,
+    const QString& tagValue, const QString& VRName,
+    const QString& elementLengthQString, QStandardItem *parent);
 
   DcmFileFormat fileFormat;
   QStandardItem *rootItem;
@@ -66,6 +67,7 @@ ctkDICOMObjectModelPrivate::ctkDICOMObjectModelPrivate(ctkDICOMObjectModel& o):q
 ctkDICOMObjectModelPrivate::~ctkDICOMObjectModelPrivate()
 {
 }
+
 //------------------------------------------------------------------------------
 void ctkDICOMObjectModelPrivate::init()
 {
@@ -93,12 +95,12 @@ void ctkDICOMObjectModelPrivate::itemInsert( DcmItem *dataset, QStandardItem *pa
     QString tagName = tag.getTagName();
     //
     DcmTagKey tagX = tag.getXTag();
-    QString tagHexName = tagX.toString().c_str();    
+    QString tagHexName = tagX.toString().c_str();
     //
     DcmVR VR = dO->getVR();
     QString VRName = VR.getVRName();
     //
-        // Getting length
+    // Getting length
     int elementLength;
     elementLength = dO->getLength();
     QString elementLengthQString = QString::number(elementLength);
@@ -106,24 +108,24 @@ void ctkDICOMObjectModelPrivate::itemInsert( DcmItem *dataset, QStandardItem *pa
     DcmTag tagKey = tag.getXTag();
 	  // std::cout<< tagName.toUtf8().constData()<<std::endl;
     if( tagKey == DCM_SequenceDelimitationItem
-    || tagKey == DCM_ItemDelimitationItem
-    || "Item" == tagName)
+        || tagKey == DCM_ItemDelimitationItem
+        || "Item" == tagName)
       {
 	    return;
 	    }
-  
+
     DcmElement *dcmElem = dynamic_cast<DcmElement *> (dO);
     tagValue = getTagValue(dcmElem);
-  
+
     // Populate QStandardModel with current DICOM element tag name and value
     QStandardItem *tagItem = populateModelRow(tagName,tagHexName,tagValue,VRName,elementLengthQString,parent);
-    
+
     // check if the DICOM object is a SQ Data element and extract the nested DICOM objects
     if( dcmElem && !dcmElem->isLeaf())
-     {
-     // now dcmElem  points to a sequenceOfItems
-     ctkDICOMObjectModelPrivate::seqInsert( dynamic_cast<DcmSequenceOfItems*> (dcmElem), tagItem);   
-     }
+      {
+      // now dcmElem  points to a sequenceOfItems
+      ctkDICOMObjectModelPrivate::seqInsert( dynamic_cast<DcmSequenceOfItems*> (dcmElem), tagItem);
+      }
   }
 }
 
@@ -131,47 +133,47 @@ void ctkDICOMObjectModelPrivate::itemInsert( DcmItem *dataset, QStandardItem *pa
 //------------------------------------------------------------------------------
 void ctkDICOMObjectModelPrivate::seqInsert( DcmSequenceOfItems *dataset, QStandardItem *parent)
 {
-  DcmObject *dO = dataset->nextInContainer( NULL);
+  DcmObject *dO = dataset->nextInContainer(NULL);
 
- for( ; dO; dO = dataset->nextInContainer(dO))
-   {
+  for( ; dO; dO = dataset->nextInContainer(dO))
+    {
     DcmElement *dcmElem = dynamic_cast<DcmElement *> (dO);
     QString tagValue = "";
     DcmTag tag = dO->getTag();
     DcmTag tagKey = tag.getXTag();
     if( tagKey == DCM_SequenceDelimitationItem
-    || tagKey == DCM_ItemDelimitationItem)
-    {
+        || tagKey == DCM_ItemDelimitationItem)
+      {
       return;
-    }
-   
-   QString tagName = tag.getTagName();
-   //
-   DcmTagKey tagX = tag.getXTag();
-   QString tagHexName = tagX.toString().c_str();
-   //
-   DcmVR VR = dO->getVR();
-   QString VRName = VR.getVRName();
-   // Getting length
-   int elementLength;
-   elementLength = dO->getLength();
-   QString elementLengthQString = QString::number(elementLength);
-   //
-  if( dcmElem)
-   {
-     tagValue = getTagValue(dcmElem);
-   }
-  QStandardItem *tagItem = populateModelRow(tagName,tagHexName,tagValue,VRName,elementLengthQString,parent);
- 
-  if( dcmElem && !dcmElem->isLeaf())
-   {
-     ctkDICOMObjectModelPrivate::seqInsert( dynamic_cast<DcmSequenceOfItems*> (dcmElem), tagItem);   
-   }
-  else if( tag.getXTag() == DCM_Item)
-   {
-     itemInsert( dynamic_cast<DcmItem*> (dO), tagItem);   
+      }
+
+    QString tagName = tag.getTagName();
+    //
+    DcmTagKey tagX = tag.getXTag();
+    QString tagHexName = tagX.toString().c_str();
+    //
+    DcmVR VR = dO->getVR();
+    QString VRName = VR.getVRName();
+    // Getting length
+    int elementLength;
+    elementLength = dO->getLength();
+    QString elementLengthQString = QString::number(elementLength);
+    //
+    if( dcmElem)
+      {
+      tagValue = getTagValue(dcmElem);
+      }
+    QStandardItem *tagItem = populateModelRow(tagName,tagHexName,tagValue,VRName,elementLengthQString,parent);
+
+    if( dcmElem && !dcmElem->isLeaf())
+      {
+      ctkDICOMObjectModelPrivate::seqInsert( dynamic_cast<DcmSequenceOfItems*> (dcmElem), tagItem);
+      }
+    else if( tag.getXTag() == DCM_Item)
+      {
+      itemInsert( dynamic_cast<DcmItem*> (dO), tagItem);
+      }
    }
-  }
 }
 
 //------------------------------------------------------------------------------
@@ -183,14 +185,14 @@ QString ctkDICOMObjectModelPrivate::getTagValue( DcmElement *dcmElem)
   std::string sep;
   int mult = dcmElem->getVM();
   int pos;
-  
+
   if( mult>1)
     {
     value << "[" << mult << "] ";
     }
- 
+
   // TODO define max elem per line
-  
+
   for( pos=0; pos < mult; pos++)
     {
     value << sep;
@@ -203,17 +205,18 @@ QString ctkDICOMObjectModelPrivate::getTagValue( DcmElement *dcmElem)
     }
     if( pos < mult-1)
       {
-       value << " ...";
+      value << " ...";
       }
   tagValue = value.str().c_str();
-  
+
   return tagValue;
 }
 
 //------------------------------------------------------------------------------
- QStandardItem* ctkDICOMObjectModelPrivate::populateModelRow(const QString& tagName, const QString& tagHexName,
-   const QString& tagValue,const QString& VRName, const QString& elementLengthQString, QStandardItem *parent)
- {
+QStandardItem* ctkDICOMObjectModelPrivate::populateModelRow(const QString& tagName,
+   const QString& tagHexName, const QString& tagValue,const QString& VRName,
+   const QString& elementLengthQString, QStandardItem *parent)
+{
   // Create items
   QStandardItem *VRItem = new QStandardItem( VRName);
   QStandardItem *tagItem = new QStandardItem( tagName);
@@ -228,7 +231,7 @@ QString ctkDICOMObjectModelPrivate::getTagValue( DcmElement *dcmElem)
   valItem->setFlags(valItem->flags() & ~Qt::ItemIsEditable);
   // Insert items
   QList<QStandardItem *> modelRow;
-  
+
   modelRow.append( tagItem);
   modelRow.append( tagHexItem);
   modelRow.append( VRItem);
@@ -236,7 +239,7 @@ QString ctkDICOMObjectModelPrivate::getTagValue( DcmElement *dcmElem)
   modelRow.append( valItem);
   parent->appendRow( modelRow);
   return tagItem;
- }
+}
 
 //------------------------------------------------------------------------------
 ctkDICOMObjectModel::ctkDICOMObjectModel(QObject* parentObject)
@@ -245,7 +248,7 @@ ctkDICOMObjectModel::ctkDICOMObjectModel(QObject* parentObject)
 {
   Q_D(ctkDICOMObjectModel);
   d->init();
- }
+}
 
 //------------------------------------------------------------------------------
 ctkDICOMObjectModel::ctkDICOMObjectModel(const ctkDICOMObjectModel& other)
@@ -261,13 +264,13 @@ ctkDICOMObjectModel::~ctkDICOMObjectModel()
 void ctkDICOMObjectModel::setFile(const QString &fileName)
 {
   Q_D(ctkDICOMObjectModel);
- 
- OFCondition status = d->fileFormat.loadFile( fileName.toLatin1().data());
-  if( !status.good())
+
+  OFCondition status = d->fileFormat.loadFile( fileName.toLatin1().data());
+  if( !status.good() )
     {
 		// TODO: Add through error
     }
-  
+
   DcmDataset *dataset = d->fileFormat.getDataset();
   d->rootItem = ctkDICOMObjectModel::invisibleRootItem();
   d->itemInsert( dataset, d->rootItem);

+ 1 - 1
Libs/DICOM/Core/ctkDICOMObjectModel.h

@@ -35,7 +35,7 @@
 class ctkDICOMObjectModelPrivate;
 /// \ingroup DICOM_Core
 ///
-/// \brief .
+/// \brief Provides a Qt MVC-compatible wrapper around a ctkDICOMItem.
 ///
 class CTK_DICOM_CORE_EXPORT ctkDICOMObjectModel
 	: public QStandardItemModel

+ 4 - 4
Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp

@@ -44,8 +44,8 @@ public:
   ~ctkDICOMObjectListWidgetPrivate();
   void populateDICOMObjectTreeView(const QString& fileName);
 
-QString currentFile;
-QStringList fileList;
+  QString currentFile;
+  QStringList fileList;
 
 };
 
@@ -108,13 +108,13 @@ void ctkDICOMObjectListWidget::setFileList(const QStringList& fileList)
   }
 }
 // --------------------------------------------------------------------------
-QString ctkDICOMObjectListWidget::currentFile()const
+QString ctkDICOMObjectListWidget::currentFile()
 {
   Q_D(const ctkDICOMObjectListWidget);
   return d->currentFile;
 }
 // --------------------------------------------------------------------------
-QStringList ctkDICOMObjectListWidget::fileList()const
+QStringList ctkDICOMObjectListWidget::fileList()
 {
   Q_D(const ctkDICOMObjectListWidget);
   return d->fileList;

+ 5 - 5
Libs/DICOM/Widgets/ctkDICOMObjectListWidget.h

@@ -31,9 +31,9 @@ class ctkDICOMObjectListWidgetPrivate;
 /// \ingroup DICOM_Widgets
 class CTK_DICOM_WIDGETS_EXPORT ctkDICOMObjectListWidget : public QWidget
 {
-    Q_OBJECT
-    Q_PROPERTY(QString currentFile READ currentFile WRITE setCurrentFile)
-    Q_PROPERTY(QStringList fileList READ fileList WRITE setFileList)
+  Q_OBJECT
+  Q_PROPERTY(QString currentFile READ currentFile WRITE setCurrentFile)
+  Q_PROPERTY(QStringList fileList READ fileList WRITE setFileList)
 
 public:
   typedef QWidget Superclass;
@@ -42,8 +42,8 @@ public:
   
   /// 
 
-  QString ctkDICOMObjectListWidget::currentFile()const;
-  QStringList ctkDICOMObjectListWidget::fileList()const;
+  QString currentFile();
+  QStringList fileList();
 
 protected:
   QScopedPointer<ctkDICOMObjectListWidgetPrivate> d_ptr;