add lyx_gui::exit() so Qt doesn't have to busy loop, which was eating

CPU very badly


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4748 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-07-22 18:56:04 +00:00
parent 33836900dd
commit 459dd32dc3
9 changed files with 41 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: use lyx_gui::exit()
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* LyXAction.C: show the failing pseudo action

View File

@ -1,3 +1,7 @@
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.h: add exit()
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* Toolbar.h:

View File

@ -36,6 +36,11 @@ namespace lyx_gui {
*/
void start(string const & batch, std::vector<std::string> files);
/**
* quit running LyX
*/
void exit();
/** Eg, passing LColor::black returns "000000",
* passing LColor::white returns "ffffff".
*/

View File

@ -1,3 +1,7 @@
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add exit() so we don't busy loop !
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* QCommandEdit.C: complete if right at end of line

View File

@ -50,7 +50,6 @@ using std::vector;
using std::hex;
using std::endl;
extern bool finished;
extern BufferList bufferlist;
// FIXME: wrong place !
@ -111,16 +110,19 @@ void lyx_gui::start(string const & batch, vector<string> files)
view.getLyXFunc()->dispatch(batch);
}
// FIXME: something somewhere is EATING CPU
while (!finished) {
qApp->processEvents();
}
qApp->exec();
// FIXME
// FIXME
delete lyxserver;
}
void lyx_gui::exit()
{
qApp->exit(0);
}
string const lyx_gui::hexname(LColor::color col)
{
QColor color(lcolor.getX11Name(col).c_str());

View File

@ -1,3 +1,7 @@
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add lyx_gui::exit()
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* Toolbar_pimpl.h:

View File

@ -55,7 +55,6 @@ using std::setbase;
using std::setfill;
using std::setw;
extern bool finished;
extern BufferList bufferlist;
// FIXME: wrong place !
@ -63,6 +62,9 @@ LyXServer * lyxserver;
namespace {
/// quit lyx
bool finished = false;
/// set default GUI configuration
void setDefaults()
{
@ -309,6 +311,12 @@ void lyx_gui::start(string const & batch, vector<string> files)
}
void lyx_gui::exit()
{
finished = true;
}
string const lyx_gui::hexname(LColor::color col)
{
string const name = lcolor.getX11Name(col);

View File

@ -17,7 +17,6 @@
#include "bufferview_funcs.h"
#include "debug.h"
#include "lastfiles.h"
#include "frontends/LyXView.h"
#include "lyxrc.h"
#include "lyxtext.h"
#include "gettext.h"
@ -25,6 +24,8 @@
#include "insets/insetlabel.h"
#include "frontends/lyx_gui.h"
#include "frontends/LyXView.h"
#include "frontends/Alert.h"
#include "frontends/FileDialog.h"
@ -52,7 +53,6 @@ using std::make_pair;
extern BufferList bufferlist;
// this should be static, but I need it in buffer.C
bool quitting; // flag, that we are quitting the program
extern bool finished; // all cleanup done just let it run through now.
void ShowMessage(Buffer const * buf,
@ -239,7 +239,7 @@ void QuitLyX()
DestroyLyXTmpDir(system_tempdir);
finished = true;
lyx_gui::exit();
}

View File

@ -68,9 +68,6 @@ boost::scoped_ptr<LastFiles> lastfiles;
// This is the global bufferlist object
BufferList bufferlist;
// this should be static, but I need it in buffer.C
bool finished = false; // flag, that we are quitting the program
// convenient to have it here.
boost::scoped_ptr<kb_keymap> toplevel_keymap;