From 3941b00ec7d6d52c5e169e09408f0b5a7c97e5c1 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 5 Feb 2008 13:10:42 +0000 Subject: [PATCH] Transfer forked process checking from GuiWorkArea to GuiApplication. I got rid of the general timer starting/stopping too. Looking a bit deeper I don't think it was necessary. We'll put them again in case it is needed. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22785 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiApplication.cpp | 12 ++++++++++++ src/frontends/qt4/GuiApplication.h | 7 +++++++ src/frontends/qt4/GuiWorkArea.cpp | 24 +++--------------------- src/frontends/qt4/GuiWorkArea.h | 10 ---------- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 76e82b3e12..932e52b1aa 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -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()) { diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index fb8be4a75e..060cf69b07 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -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 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: diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 0f2c0114db..5b7dfb0857 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -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(); diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index d1a65e3f06..af067d6920 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -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_; ///