Salome HOME
Updated copyright comment
[modules/gui.git] / src / CAM / CAM_Application.cxx
index d524028f4828139ae872d6d3ae761dabeafc39eb..e6b0d5f3a8f2f501356ae44df237e9ad52d26902 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -38,6 +38,7 @@
 #include <QApplication>
 #include <QDir>
 #include <QFileInfo>
+#include <QLockFile>
 #include <QMutex>
 #include <QMutexLocker>
 #include <QRegExp>
@@ -1038,11 +1039,19 @@ void CAM_Application::logUserEvent( const QString& eventDescription )
     QFile file ( guiLogFile );
     if ( file.open( QFile::Append ) ) // append to log file
     {
+      // lock for multiple processes, if more than one salome instance
+      // is running on the same computer.
+      QString lockFilename = file.fileName() + ".lock";
+      QLockFile fLock( lockFilename );
+      fLock.lock();
+
       QDateTime current = QDateTime::currentDateTime();
       QTextStream stream( &file );
       stream << current.toString("yyyyMMdd-hhmmss")
              << "," << eventDescription
              << endl;
+
+      fLock.unlock();
       file.close();
     }
   }
@@ -1082,15 +1091,15 @@ void CAM_Application::logAction( QAction* action, const QString& moduleName )
     {
       logStructuredUserEvent ( moduleName,
                                "",
-                               tr( "ACTION_TOGGLED" ),
-                               action->isChecked() ? tr( "ACTION_ON" ) : tr( "ACTION_OFF" ),
+                               "toggled",
+                               action->isChecked() ? "on" : "off",
                                text );
     }
     else
     {
       logStructuredUserEvent ( moduleName,
                                "",
-                               tr( "ACTION_TRIGGERED" ),
+                               "triggered",
                                "",
                                text );
     }