]> git.lyx.org Git - features.git/commitdiff
add lyx_gui::exit() so Qt doesn't have to busy loop, which was eating
authorJohn Levon <levon@movementarian.org>
Mon, 22 Jul 2002 18:56:04 +0000 (18:56 +0000)
committerJohn Levon <levon@movementarian.org>
Mon, 22 Jul 2002 18:56:04 +0000 (18:56 +0000)
CPU very badly

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4748 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/frontends/ChangeLog
src/frontends/lyx_gui.h
src/frontends/qt2/ChangeLog
src/frontends/qt2/lyx_gui.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/lyx_gui.C
src/lyx_cb.C
src/lyx_main.C

index 608982807a4ab653729ba568850aaf3d56b82e00..62ecb5b95078f7004f46d9b42d17169d3cab0a21 100644 (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
index e2cbb5afbdf84c5f5112e4fa868ea27ccde019dc..333fb7c61d0ff9dd20bce26e1a7821d0d523d57c 100644 (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:
index bcc68c7f94d1a8cb2242e9aa464f6c7ca8c6a4f9..741688a3114ef9808d795e032d1526732d0b169a 100644 (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".
         */
index 3c5db9fb8c375149ac48625b77d7ee3ffb72be18..2227423fddb27291b620f69ec441d83372b730d2 100644 (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
index 0991a98181d57d7020c618a03a1e522c469f779a..952edde40222f306d6984230fd658e751145f6f5 100644 (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());
index 12cab17920d9f3982f3f1a6d4f2f8fd884374bb0..0881b799f4950dcd554ad8048a5369baf383f9e5 100644 (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:
index 7d5139fb9a85671d43797de16e1835a443d2e18a..8bb25f52884f6382aadb4c3bfe89db7acd00d18e 100644 (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);
index 1eb77860eb21c68538381a9fd12425a14f002acb..ba68ea63236e3b4dba45d610ac8aea905921d41d 100644 (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();
 }
 
 
index ddb6e7bddd75aafc7a364f09f71a8455df40bdc1..b5153747686ef350d9a48c6377d4e0d976953444 100644 (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;