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
This commit is contained in:
Abdelrazak Younes 2008-02-05 13:10:42 +00:00
parent 6bb94129d8
commit 3941b00ec7
4 changed files with 22 additions and 31 deletions

View 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()) {

View 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:

View 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();

View 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_;
///