if (!isClean()) {
docstring msg = _("LyX attempted to close a document that had unsaved changes!\n");
msg += emergencyWrite();
- frontend::Alert::warning(_("Attempting to close changed document!"), msg);
+ Alert::warning(_("Attempting to close changed document!"), msg);
}
// clear references to children in macro tables
stack_widget_->addWidget(bg_widget_);
stack_widget_->addWidget(splitter_);
setBackground();
- progress = new GuiProgress(gv);
+ progress_ = new GuiProgress(gv);
}
~GuiViewPrivate()
delete splitter_;
delete bg_widget_;
delete stack_widget_;
- delete progress;
+ delete progress_;
}
QMenu * toolBarPopup(GuiView * parent)
BackgroundWidget * bg_widget_;
/// view's toolbars
ToolbarMap toolbars_;
- GuiProgress* progress;
+ ProgressInterface* progress_;
/// The main layout box.
/**
* \warning Don't Delete! The layout box is actually owned by
connect(&d.autosave_watcher_, SIGNAL(finished()), this,
SLOT(threadFinished()));
#endif
+
+ connect(this, SIGNAL(triggerShowDialog(QString const &, QString const &, Inset *)),
+ SLOT(doShowDialog(QString const &, QString const &, Inset *)));
}
{
if (ForkedProcess::iAmAChild())
return;
+
+ // call is moved to GUI-thread by GuiProgress
+ d.progress_->appendMessage(toqstr(str));
+}
- statusBar()->showMessage(toqstr(str));
+
+void GuiView::updateMessage(QString const & str)
+{
+ statusBar()->showMessage(str);
d.statusbar_timer_.stop();
d.statusbar_timer_.start(3000);
}
void GuiView::showDialog(string const & name, string const & data,
Inset * inset)
+{
+ triggerShowDialog(toqstr(name), toqstr(data), inset);
+}
+
+
+void GuiView::doShowDialog(QString const & qname, QString const & qdata,
+ Inset * inset)
{
if (d.in_show_)
return;
+ const string name = fromqstr(qname);
+ const string data = fromqstr(qdata);
+
d.in_show_ = true;
try {
Dialog * dialog = findOrBuild(name, false);
BufferView const * documentBufferView() const;
void newDocument(std::string const & filename,
bool fromTemplate);
+
+ /// could be called from any thread
void message(docstring const &);
+ /// must be called from GUI thread
+ void updateMessage(QString const & str);
+
bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
bool dispatch(FuncRequest const & cmd);
void restartCursor();
Q_SIGNALS:
void closing(int);
+ void triggerShowDialog(QString const & qname, QString const & qdata, Inset * inset);
public Q_SLOTS:
/// idle timeout.
/// For completion of autosave or exporrt threads.
void threadFinished();
+ /// must be called in GUI thread
+ void doShowDialog(QString const & qname, QString const & qdata,
+ Inset * inset);
+
private:
/// Open given child document in current buffer directory.
void openChildDocument(std::string const & filename);
*/
void updateDialogs();
- /** \param name == "bibtex", "citation" etc; an identifier used to
+ /** Show dialog could be called from arbitrary threads.
+ \param name == "bibtex", "citation" etc; an identifier used to
launch a particular dialog.
\param data is a string representation of the Inset contents.
It is often little more than the output from Inset::write.