]> git.lyx.org Git - lyx.git/commitdiff
simplify exit code, old code doesn't work on the Mac
authorPeter Kümmel <syntheticpp@gmx.net>
Sat, 25 Nov 2006 21:24:04 +0000 (21:24 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sat, 25 Nov 2006 21:24:04 +0000 (21:24 +0000)
* lyxfunc.C                         : rename unused LFUN_LYX_QUIT parameter
* frontends/qt4/GuiImplementation.C : call LFUN_LYX_QUIT when last window closed
* frontends/qt4/GuiWorkArea.C       : check theApp, add debug case
* frontends/qt4/GuiApplication.C    : remove quitLyX()
* frontends/qt4/GuiApplication.h    : remove quitLyX()
* frontends/qt4/GuiView.C           : hide() widow fore exiting to prevent crash

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

src/frontends/qt4/GuiApplication.C
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiImplementation.C
src/frontends/qt4/GuiView.C
src/frontends/qt4/GuiWorkArea.C
src/lyxfunc.C

index a6aad8219f4e8274e0dd2d725e17c87770969a46..006b5b76b239cfff885c82a4847fb8c4f8c15fa1 100644 (file)
@@ -152,32 +152,9 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 
        LoaderQueue::setPriority(10,100);
 
-       /* Qt Docs:
-       void QApplication::lastWindowClosed ()   [signal]
-       This signal is emitted from QApplication::exec() when the last visible 
-       primary window ... is closed.
-       This feature be turned off by setting quitOnLastWindowClosed to false.
-       */
-       setQuitOnLastWindowClosed(false);
-       // this connect should not be necessary: 
-       // we rely on a Qt bug on Windows and maybe Linux
-       QObject::connect(this, SIGNAL(lastWindowClosed()),
-               this, SLOT(quitLyX()));
-
        guiApp = this;
 }
 
-
-void GuiApplication::quitLyX()
-{
-       theLyXFunc().setLyXView(0);
-
-       // trigger LFUN_LYX_QUIT instead of QApplication::quit() directly
-       // since LFUN_LYX_QUIT may have more cleanup stuff
-       dispatch(FuncRequest(LFUN_LYX_QUIT, "force"));
-}
-
-
 Clipboard& GuiApplication::clipboard()
 {
        return clipboard_;
index d09b157ca3f348e838ee794764efd68ad5587699..851557d4114ff0c2bdfde48938a0bc2ac0e40157 100644 (file)
@@ -83,10 +83,6 @@ public:
        ///
        GuiFontLoader & guiFontLoader() { return font_loader_; }
 
-private Q_SLOTS:
-       /// request an LFUN_LYX_QUIT
-       void quitLyX();
-
 private:
        ///
        GuiImplementation gui_;
index 52eccf5ca8c1bdbb342d98ce45b710311ed6ec06..a4ea5833b0925cafcdac45be0df45b2c871b648e 100644 (file)
@@ -57,6 +57,7 @@ LyXView& GuiImplementation::view(int id)
 
 bool GuiImplementation::closeAll()
 {
+       // ATM never used
        if (!theBufferList().quitWriteAll())
                return false;
 
@@ -105,7 +106,7 @@ void GuiImplementation::unregisterView(GuiView * view)
 
        if (views_.empty()) {
                theLyXFunc().setLyXView(0);
-//             dispatch(FuncRequest(LFUN_LYX_QUIT));
+               dispatch(FuncRequest(LFUN_LYX_QUIT));
                return;
        }
 
index 54520561b6907f6fa17f5467659419f5786eb829..9364d6a443302dae989e44fb1d4aafeeda2420af 100644 (file)
@@ -110,9 +110,6 @@ struct GuiView::GuiViewPrivate
 GuiView::GuiView(int id)
        : QMainWindow(), LyXView(id), commandbuffer_(0), d(*new GuiViewPrivate)
 {
-       setAttribute(Qt::WA_DeleteOnClose, true);
-       setAttribute(Qt::WA_QuitOnClose, true);
-
 //     setToolButtonStyle(Qt::ToolButtonIconOnly);
 //     setIconSize(QSize(12,12));
 
@@ -476,7 +473,8 @@ void GuiView::closeEvent(QCloseEvent * close_event)
        }
 
        saveGeometry();
-       gui.unregisterView(this);
+       hide(); // don't remove this hide, it prevents a crash on exit
+       gui.unregisterView(this);       
 }
 
 
index 9b4f2f2f1d0d027fb525a208b669466c2527a12f..7c9bca4d800d0988e16bcb8319c138c6d3f6fdda 100644 (file)
@@ -271,7 +271,7 @@ void GuiWorkArea::dropEvent(QDropEvent* event)
 void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/)
 {
        // No need to do anything if we didn't change views...
-       if (&lyx_view_ == &theApp->currentView())
+       if (theApp == 0 || &lyx_view_ == &theApp->currentView())
                return;
 
        theApp->setCurrentView(lyx_view_);
@@ -528,7 +528,7 @@ void GuiWorkArea::doGreyOut(QLPainter & pain)
 
        //if (!lyxrc.show_banner)
        //      return;
-       lyxerr << "show banner: " << lyxrc.show_banner << endl;
+       lyxerr[Debug::GUI] << "show banner: " << lyxrc.show_banner << endl;
        /// The text to be written on top of the pixmap
        QString const text = lyx_version ? QString(lyx_version) : qt_("unknown version");
        string const file = support::libFileSearch("images", "banner", "ppm");
@@ -583,7 +583,7 @@ void GuiWorkArea::expose(int x, int y, int w, int h)
        QLPainter pain(&screen_);
 
        if (greyed_out_) {
-               lyxerr << "splash screen requested" << endl;
+               lyxerr[Debug::GUI] << "splash screen requested" << endl;
                doGreyOut(pain);
                verticalScrollBar()->hide();
                update(0, 0, width(), height());
index 582806ea8bac5b943f73a3fd39018c70c3ad1dcc..45c3ae2e092b99a39612603aa3b4452cde1b33e6 100644 (file)
@@ -1035,7 +1035,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
 
                case LFUN_LYX_QUIT:
-                       if (argument != "force") {
+                       if (argument == "closeOnly") {
                                if (!theApp->gui().closeAll())
                                        break;
                                lyx_view_ = 0;