]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Show free RAM while computing the mesh
authoreap <eap@opencascade.com>
Thu, 20 Jun 2013 14:29:16 +0000 (14:29 +0000)
committereap <eap@opencascade.com>
Thu, 20 Jun 2013 14:29:16 +0000 (14:29 +0000)
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h
src/SMESHGUI/SMESH_msg_en.ts

index be3fc2f18660e1633254a0ad6d7af06d359f2b1b..1bd4d86f11f5367418fe60534afa0448718192b5 100644 (file)
 #include <vector>
 #include <set>
 
+#ifndef WIN32
+#include <sys/sysinfo.h>
+#endif
+
 #define SPACING 6
 #define MARGIN  11
 
@@ -748,17 +752,24 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
 
   QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
   QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this );
+  QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this );
   nbNodesLabel = new QLabel("0", this );
   nbElemsLabel = new QLabel("0", this );
+  freeRAMLabel = new QLabel("", this );
 
   QGridLayout* layout = new QGridLayout(this);
   layout->setMargin( MARGIN );
   layout->setSpacing( SPACING );
-  layout->addWidget(nbNodesName,  0, 0);
-  layout->addWidget(nbNodesLabel, 0, 1);
-  layout->addWidget(nbElemsName,  1, 0);
-  layout->addWidget(nbElemsLabel, 1, 1);
-  layout->addWidget(cancelButton, 2, 0, 1, 2);
+  int row = 0;
+  layout->addWidget(nbNodesName,  row,   0);
+  layout->addWidget(nbNodesLabel, row++, 1);
+  layout->addWidget(nbElemsName,  row,   0);
+  layout->addWidget(nbElemsLabel, row++, 1);
+#ifndef WNT
+  layout->addWidget(freeRAMName,  row,   0);
+  layout->addWidget(freeRAMLabel, row++, 1);
+#endif
+  layout->addWidget(cancelButton, row,   0, 1, 2);
   adjustSize();
   update();
 
@@ -781,18 +792,30 @@ void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel()
 void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
 {
   if(qthread.isFinished())
-    {
-      close();
-    }
-  nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() ));
-  nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() ));
+  {
+    close();
+  }
+  else
+  {
+    nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() ));
+    nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() ));
+#ifndef WNT
+    struct sysinfo si;
+    const int err = sysinfo( &si );
+    if ( err )
+      freeRAMLabel->setText("");
+    else
+      freeRAMLabel->setText( tr("SMESH_GIGABYTE").arg
+                             ( si.freeram * si.mem_unit /1024./1024./1024., 0, 'f', 2 ));
+#endif
+  }
   event->accept();
 }
 
 void SMESHGUI_ComputeDlg_QThreadQDialog::closeEvent(QCloseEvent *event)
 {
   if(qthread.isRunning())
-    {
+  {
       event->ignore();
       return;
     }
index 81a09f85760563b424a8353e8bb0f5aeffd1894a..e8101a311d5913cb3b27dfd352b1e78d0f03100e 100644 (file)
@@ -317,6 +317,7 @@ private:
   QPushButton *               cancelButton;
   QLabel *                    nbNodesLabel;
   QLabel *                    nbElemsLabel;
+  QLabel *                    freeRAMLabel;
 };
 
 #endif // SMESHGUI_COMPUTEDLG_H
index 3f4d8e5d128247017e8e304829c1e611f3651d29..5369148587b9ec4601dea3c55b962e91e7dcdbab 100644 (file)
@@ -4100,6 +4100,14 @@ Input value precision can be adjusted using
         <translation>Selected object has been used to create another one.
 It can&apos;t be deleted </translation>
     </message>
+    <message>
+        <source>SMESH_FREERAM</source>
+        <translation>Free RAM</translation>
+    </message>
+    <message>
+        <source>SMESH_GIGABYTE</source>
+        <translation>%1 G</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_Dialog</name>