]> git.lyx.org Git - features.git/commitdiff
Transfer forked process checking from GuiWorkArea to GuiApplication. I got rid of...
authorAbdelrazak Younes <younes@lyx.org>
Tue, 5 Feb 2008 13:10:42 +0000 (13:10 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 5 Feb 2008 13:10:42 +0000 (13:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22785 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/GuiWorkArea.h

index 76e82b3e1294c437f484693588181afbf516a62b..932e52b1aa192bc41bec3151a3b1c522a7b509b9 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "support/ExceptionMessage.h"
 #include "support/FileName.h"
+#include "support/ForkedCalls.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 #include "support/Package.h"
@@ -201,6 +202,11 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 
        if (lyxrc.typewriter_font_name.empty())
                lyxrc.typewriter_font_name = fromqstr(typewriterFontName());
+
+       general_timer_.setInterval(500);
+       connect(&general_timer_, SIGNAL(timeout()),
+               this, SLOT(handleRegularEvents()));
+       general_timer_.start();
 }
 
 
@@ -405,6 +411,12 @@ QString const GuiApplication::typewriterFontName()
 }
 
 
+void GuiApplication::handleRegularEvents()
+{
+       ForkedCallsController::handleCompletedProcesses();
+}
+
+
 bool GuiApplication::event(QEvent * e)
 {
        switch(e->type()) {
index fb8be4a75e06c992e8414b809115a5cdef8a9b04..060cf69b074489d8330a6393e99ff73a1a7a40f8 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <QObject>
 #include <QApplication>
+#include <QTimer>
 #include <QTranslator>
 
 #include <map>
@@ -124,6 +125,8 @@ private Q_SLOTS:
        void execBatchCommands();
        ///
        void socketDataReceived(int fd);
+       /// events to be triggered by general_timer_ should go here
+       void handleRegularEvents();
 
 private:
        ///
@@ -142,6 +145,10 @@ private:
        std::map<int, SocketNotifier *> socket_notifiers_;
        ///
        Menus menus_;
+       /// this timer is used for any regular events one wants to
+       /// perform. at present it is used to check if forked processes
+       /// are done.
+       QTimer general_timer_;
 
 #ifdef Q_WS_X11
 public:
index 0f2c0114db68a80b17ac5d9f52c9fc73ef4525b8..5b7dfb0857376ca52e411faf05758ff1f7ed88a9 100644 (file)
@@ -39,7 +39,6 @@
 #include "support/debug.h"
 #include "support/gettext.h"
 #include "support/FileName.h"
-#include "support/ForkedCalls.h"
 
 #include "frontends/Application.h"
 #include "frontends/FontMetrics.h"
@@ -208,11 +207,6 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
                // let's initialize this just to be safe
                cursor_timeout_.setInterval(500);
 
-       general_timer_.setInterval(500);
-       connect(&general_timer_, SIGNAL(timeout()),
-               this, SLOT(handleRegularEvents()));
-       startGeneralTimer();
-
        screen_ = QPixmap(viewport()->width(), viewport()->height());
        cursor_ = new frontend::CursorWidget();
        cursor_->hide();
@@ -334,15 +328,12 @@ void GuiWorkArea::processKeySym(KeySymbol const & key, KeyModifier mod)
 {
        // In order to avoid bad surprise in the middle of an operation,
        // we better stop the blinking cursor...
+       // the cursor gets restarted in GuiView::restartCursor()
        stopBlinkingCursor();
-       // ...and the general timer.
-       stopGeneralTimer();
 
        theLyXFunc().setLyXView(lyx_view_);
        theLyXFunc().processKeySym(key, mod);
        
-       // the cursor gets restarted in GuiView::restartCursor()
-       startGeneralTimer();
 }
 
 
@@ -373,11 +364,9 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
                cmd.action != LFUN_MOUSE_MOTION || cmd.button() != mouse_button::none;
        
        // In order to avoid bad surprise in the middle of an operation, we better stop
-       // the blinking cursor and the general timer
-       if (notJustMovingTheMouse) {
+       // the blinking cursor.
+       if (notJustMovingTheMouse)
                stopBlinkingCursor();
-               stopGeneralTimer();
-       }
 
        buffer_view_->mouseEventDispatch(cmd);
 
@@ -396,7 +385,6 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
 
                // Show the cursor immediately after any operation
                startBlinkingCursor();
-               startGeneralTimer();
        }
 }
 
@@ -473,12 +461,6 @@ void GuiWorkArea::toggleCursor()
 }
 
 
-void GuiWorkArea::handleRegularEvents()
-{
-       ForkedCallsController::handleCompletedProcesses();
-}
-
-
 void GuiWorkArea::updateScrollbar()
 {
        ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
index d1a65e3f061b9e8440d33d5a5b3a0c27727e1331..af067d69209326744ed55fcaa892449a24ce5069 100644 (file)
@@ -121,10 +121,6 @@ public:
        void stopBlinkingCursor();
        ///
        void startBlinkingCursor();
-       /// 
-       void startGeneralTimer() { general_timer_.start(); }
-       ///
-       void stopGeneralTimer() { general_timer_.stop(); }
        /// Process Key pressed event.
        /// This needs to be public because it is accessed externally by GuiView.
        void processKeySym(KeySymbol const & key, KeyModifier mod);
@@ -146,8 +142,6 @@ private Q_SLOTS:
        void doubleClickTimeout();
        /// toggle the cursor's visibility
        void toggleCursor();
-       /// events to be triggered by general_timer_ should go here
-       void handleRegularEvents();
        /// close this work area.
        /// Slot for Buffer::closing signal.
        void close();
@@ -218,10 +212,6 @@ private:
 
        ///
        QTimer cursor_timeout_;
-       /// this timer is used for any regular events one wants to
-       /// perform. at present it is used to check if forked processes
-       /// are done.
-       QTimer general_timer_;
        ///
        SyntheticMouseEvent synthetic_mouse_event_;
        ///