VCS(Buffer * b) : vcstatus(NOLOCKING), owner_(b) {}
virtual ~VCS() {}
+ /// the name of the vc backend
+ virtual std::string vcname() const = 0;
/// register a file for version control
virtual void registrer(std::string const & msg) = 0;
/// can this operation be processed in the current VCS?
/// get file from repo, the caller must ensure that it does not exist locally
static bool retrieve(support::FileName const & file);
+ virtual std::string vcname() const { return "RCS"; };
+
virtual void registrer(std::string const & msg);
virtual bool renameEnabled();
/// get file from repo, the caller must ensure that it does not exist locally
static bool retrieve(support::FileName const & file);
+ virtual std::string vcname() const { return "CVS"; };
+
virtual void registrer(std::string const & msg);
virtual bool renameEnabled();
/// get file from repo, the caller must ensure that it does not exist locally
static bool retrieve(support::FileName const & file);
+ virtual std::string vcname() const { return "SVN"; };
+
virtual void registrer(std::string const & msg);
virtual bool renameEnabled();
/// get file from repo, the caller must ensure that it does not exist locally
static bool retrieve(support::FileName const & file);
+ virtual std::string vcname() const { return "GIT"; };
+
virtual void registrer(std::string const & msg);
virtual bool renameEnabled();
#include <QSplitter>
#include <QStackedWidget>
#include <QStatusBar>
-#if QT_VERSION >= 0x050000
#include <QSvgRenderer>
-#endif
#include <QtConcurrentRun>
#include <QTime>
#include <QTimer>
#endif
#endif
- resetWindowTitleAndIconText();
+ resetWindowTitle();
// use tabbed dock area for multiple docks
// (such as "source" and "messages")
connect(&d.processing_thread_watcher_, SIGNAL(finished()),
busylabel, SLOT(hide()));
+ QFontMetrics const fm(statusBar()->fontMetrics());
+ int const roheight = max(int(d.normalIconSize), fm.height());
+ QSize const rosize(roheight, roheight);
+ QPixmap readonly = QPixmap(rosize);
+ QString imagedir = "images/";
+ FileName fname = imageLibFileSearch(imagedir, "emblem-readonly", "svgz");
+ QSvgRenderer renderer(toqstr(fname.absFileName()));
+ if (renderer.isValid()) {
+ readonly.fill(statusBar()->palette().color(QWidget::backgroundRole()));
+ QPainter painter(&readonly);
+ renderer.render(&painter);
+ } else {
+ readonly = getPixmap("images/", "emblem-readonly", "png").scaled(rosize, Qt::KeepAspectRatio);
+ }
+ read_only_ = new QLabel(statusBar());
+ read_only_->setPixmap(readonly);
+ read_only_->setScaledContents(true);
+ read_only_->setAlignment(Qt::AlignCenter);
+ read_only_->hide();
+ statusBar()->addPermanentWidget(read_only_);
+
+ version_control_ = new QLabel(statusBar());
+ version_control_->setAlignment(Qt::AlignCenter);
+ version_control_->setFrameStyle(QFrame::StyledPanel);
+ version_control_->hide();
+ statusBar()->addPermanentWidget(version_control_);
+
statusBar()->setSizeGripEnabled(true);
updateStatusBar();
if (wa != d.current_work_area_
|| wa->bufferView().buffer().isInternal())
return;
- setWindowTitle(qt_("LyX: ") + wa->windowTitle());
- setWindowIconText(wa->windowIconText());
-#if (QT_VERSION >= 0x040400)
- // Sets the path for the window: this is used by OSX to
+ Buffer const & buf = wa->bufferView().buffer();
+ // Sets the path for the window: this is used by OSX to
// allow a context click on the title bar showing a menu
// with the path up to the file
- setWindowFilePath(toqstr(wa->bufferView().buffer().absFileName()));
+ setWindowFilePath(toqstr(buf.absFileName()));
+ // Tell Qt whether the current document is changed
+ setWindowModified(!buf.isClean());
+ // Set the windows title
+ docstring title = buf.fileName().displayName(130) + from_ascii("[*]");
+#ifndef Q_WS_MAC
+ // — U+2014 EM DASH
+ title += from_ascii(" ") + char_type(0x2014) + from_ascii(" LyX");
#endif
+ setWindowTitle(toqstr(title));
+
+ if (buf.isReadonly())
+ read_only_->show();
+ else
+ read_only_->hide();
+
+ if (buf.lyxvc().inUse()) {
+ version_control_->show();
+ if (buf.lyxvc().locking())
+ version_control_->setText(
+ toqstr(bformat(_("%1$s lock"),
+ from_ascii(buf.lyxvc().vcname()))));
+ else
+ version_control_->setText(toqstr(buf.lyxvc().vcname()));
+ } else
+ version_control_->hide();
}
updateDialog("document", "");
updateDialogs();
- resetWindowTitleAndIconText();
+ resetWindowTitle();
updateStatusBar();
if (lyxrc.open_buffers_in_tabs)
updateDialog("document", "");
updateDialogs();
} else {
- resetWindowTitleAndIconText();
+ resetWindowTitle();
}
setFocus();
return QMainWindow::event(e);
}
}
-void GuiView::resetWindowTitleAndIconText()
+void GuiView::resetWindowTitle()
{
setWindowTitle(qt_("LyX"));
- setWindowIconText(qt_("LyX"));
}
bool GuiView::focusNextPrevChild(bool /*next*/)
void GuiWorkArea::updateWindowTitle()
{
- docstring maximize_title;
- docstring minimize_title;
-
- Buffer const & buf = d->buffer_view_->buffer();
- FileName const file_name = buf.fileName();
- if (!file_name.empty()) {
- maximize_title = file_name.displayName(130);
- minimize_title = from_utf8(file_name.onlyFileName());
- if (buf.lyxvc().inUse()) {
- if (buf.lyxvc().locking())
- maximize_title += _(" (version control, locking)");
- else
- maximize_title += _(" (version control)");
- }
- if (!buf.isClean()) {
- maximize_title += _(" (changed)");
- minimize_title += char_type('*');
- }
- if (buf.isReadonly())
- maximize_title += _(" (read only)");
- }
-
- QString const new_title = toqstr(maximize_title);
- if (new_title != windowTitle()) {
- QWidget::setWindowTitle(new_title);
- QWidget::setWindowIconText(toqstr(minimize_title));
- titleChanged(this);
- }
+ d->lyx_view_->updateWindowTitle(this);
+ titleChanged(this);
}