mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
simplify exit code, old code doesn't work on the Mac
* 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
This commit is contained in:
parent
34a0fbe897
commit
07fa2456f9
@ -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_;
|
||||
|
@ -83,10 +83,6 @@ public:
|
||||
///
|
||||
GuiFontLoader & guiFontLoader() { return font_loader_; }
|
||||
|
||||
private Q_SLOTS:
|
||||
/// request an LFUN_LYX_QUIT
|
||||
void quitLyX();
|
||||
|
||||
private:
|
||||
///
|
||||
GuiImplementation gui_;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user