Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add some words on installation.
[graphlib.git] / DrawingWindow.cpp
index d1ef81b..3234441 100644 (file)
@@ -665,11 +665,11 @@ bool DrawingWindow::waitMousePress(int &x, int &y, int &button,
                                    unsigned long time)
 {
     bool pressed;
                                    unsigned long time)
 {
     bool pressed;
-    safeLock(mouseMutex);
+    safeLock(inputMutex);
     if (terminateThread) {
         pressed = false;
     } else {
     if (terminateThread) {
         pressed = false;
     } else {
-        pressed = mouseCondition.wait(&mouseMutex, time) && !terminateThread;
+        pressed = inputCondition.wait(&inputMutex, time) && !terminateThread;
         if (pressed) {
             x = mousePos.x();
             y = mousePos.y();
         if (pressed) {
             x = mousePos.x();
             y = mousePos.y();
@@ -683,7 +683,7 @@ bool DrawingWindow::waitMousePress(int &x, int &y, int &button,
                 button = 0;
         }
     }
                 button = 0;
         }
     }
-    safeUnlock(mouseMutex);
+    safeUnlock(inputMutex);
     return pressed;
 }
 
     return pressed;
 }
 
@@ -745,6 +745,9 @@ void DrawingWindow::usleep(unsigned long usecs)
     DrawingThread::usleep(usecs);
 }
 
     DrawingThread::usleep(usecs);
 }
 
+//--- DrawingWindow (protected methods) --------------------------------
+//! \cond show_protected
+
 /*!
  * \see QWidget
  */
 /*!
  * \see QWidget
  */
@@ -753,7 +756,7 @@ void DrawingWindow::closeEvent(QCloseEvent *ev)
     timer.stop();
     thread->exit();
     syncMutex.lock();
     timer.stop();
     thread->exit();
     syncMutex.lock();
-    mouseMutex.lock();
+    inputMutex.lock();
     terminateThread = true;     // this flag is needed for the case
                                 // where the following wakeAll() call
                                 // occurs between the
     terminateThread = true;     // this flag is needed for the case
                                 // where the following wakeAll() call
                                 // occurs between the
@@ -761,8 +764,8 @@ void DrawingWindow::closeEvent(QCloseEvent *ev)
                                 // mutex lock in safeLock() called
                                 // from sync()
     syncCondition.wakeAll();
                                 // mutex lock in safeLock() called
                                 // from sync()
     syncCondition.wakeAll();
-    mouseCondition.wakeAll();
-    mouseMutex.unlock();
+    inputCondition.wakeAll();
+    inputMutex.unlock();
     syncMutex.unlock();
     QWidget::closeEvent(ev);
     if (!thread->wait(250)) {
     syncMutex.unlock();
     QWidget::closeEvent(ev);
     if (!thread->wait(250)) {
@@ -797,12 +800,12 @@ void DrawingWindow::customEvent(QEvent *ev)
  */
 void DrawingWindow::mousePressEvent(QMouseEvent *ev)
 {
  */
 void DrawingWindow::mousePressEvent(QMouseEvent *ev)
 {
-    mouseMutex.lock();
+    inputMutex.lock();
     mousePos = ev->pos();
     mouseButton = ev->button();
     ev->accept();
     mousePos = ev->pos();
     mouseButton = ev->button();
     ev->accept();
-    mouseCondition.wakeAll();
-    mouseMutex.unlock();
+    inputCondition.wakeAll();
+    inputMutex.unlock();
 }
 
 /*!
 }
 
 /*!
@@ -810,17 +813,10 @@ void DrawingWindow::mousePressEvent(QMouseEvent *ev)
  */
 void DrawingWindow::keyPressEvent(QKeyEvent *ev)
 {
  */
 void DrawingWindow::keyPressEvent(QKeyEvent *ev)
 {
-    bool accept = true;
-    switch (ev->key()) {
-    case Qt::Key_Escape:
+    if (ev->key() == Qt::Key_Escape) {
+        ev->accept();
         close();
         close();
-        break;
-    default:
-        accept = false;
-        break;
     }
     }
-    if (accept)
-        ev->accept();
 }
 
 /*!
 }
 
 /*!
@@ -861,6 +857,8 @@ void DrawingWindow::timerEvent(QTimerEvent *ev)
     }
 }
 
     }
 }
 
+// \endcond
+
 //--- DrawingWindow (private methods) ----------------------------------
 
 //! Fonction d'initialisation.
 //--- DrawingWindow (private methods) ----------------------------------
 
 //! Fonction d'initialisation.