]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
Merge branch 'master' into biblatex2
[lyx.git] / src / frontends / qt4 / GuiWorkArea.cpp
index 31df06b8a9efd2084224eab8fe1ebe444e7c8ef2..aa5e285da733a6e6bdb76727f5a08368e6b44d57 100644 (file)
@@ -47,7 +47,6 @@
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
-#include "support/FileName.h"
 #include "support/lassert.h"
 #include "support/TempFile.h"
 
@@ -247,11 +246,12 @@ SyntheticMouseEvent::SyntheticMouseEvent()
 
 
 GuiWorkArea::Private::Private(GuiWorkArea * parent)
-: p(parent), screen_(0), buffer_view_(0), read_only_(false), lyx_view_(0),
-cursor_visible_(false), cursor_(0),
-need_resize_(false), schedule_redraw_(false), preedit_lines_(1),
-pixel_ratio_(1.0),
-completer_(new GuiCompleter(p, p)), dialog_mode_(false)
+: p(parent), screen_(0), buffer_view_(0), lyx_view_(0),
+  cursor_visible_(false), cursor_(0),
+  need_resize_(false), schedule_redraw_(false), preedit_lines_(1),
+  pixel_ratio_(1.0),
+  completer_(new GuiCompleter(p, p)), dialog_mode_(false),
+  read_only_(false), clean_(true)
 {
 }
 
@@ -1264,6 +1264,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
        GuiPainter pain(d->screen_, pixelRatio());
        d->buffer_view_->updateMetrics();
        d->buffer_view_->draw(pain);
+       // FIXME: shall we use real_current_font here? (see #10478)
        FontInfo font = d->buffer_view_->cursor().getFont().fontInfo();
        FontMetrics const & fm = theFontMetrics(font);
        int height = fm.maxHeight();
@@ -1388,8 +1389,15 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
 
 void GuiWorkArea::updateWindowTitle()
 {
-       d->lyx_view_->updateWindowTitle(this);
-       titleChanged(this);
+       Buffer const & buf = bufferView().buffer();
+       if (buf.fileName() != d->file_name_ || buf.isReadonly() != d->read_only_
+           || buf.lyxvc().vcstatus() != d->vc_status_ || buf.isClean() != d->clean_) {
+               d->file_name_ = buf.fileName();
+               d->read_only_ = buf.isReadonly();
+               d->vc_status_ = buf.lyxvc().vcstatus();
+               d->clean_ = buf.isClean();
+               Q_EMIT titleChanged(this);
+       }
 }