From: Pavel Sanda Date: Tue, 7 Sep 2010 11:29:02 +0000 (+0000) Subject: Finish VC_COMPARE, connect to compare dialog and run it automatically. X-Git-Tag: 2.0.0~2671 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c14dad8d2b276d9baf4a28386a24397ed1f6ad39;p=features.git Finish VC_COMPARE, connect to compare dialog and run it automatically. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35307 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiCompare.cpp b/src/frontends/qt4/GuiCompare.cpp index 79a6832f0d..e19f41b78c 100644 --- a/src/frontends/qt4/GuiCompare.cpp +++ b/src/frontends/qt4/GuiCompare.cpp @@ -116,10 +116,10 @@ void GuiCompare::updateContents() newFileCB->addItem(filename); oldFileCB->addItem(filename); } - if (lyxview().documentBufferView()) - newFileCB->setEditText(toqstr(buffer().absFileName())); - else + if (!restore_filename1.isEmpty()) newFileCB->setEditText(restore_filename1); + else if (lyxview().documentBufferView()) + newFileCB->setEditText(toqstr(buffer().absFileName())); if (!restore_filename2.isEmpty()) oldFileCB->setEditText(restore_filename2); @@ -318,6 +318,17 @@ int GuiCompare::run() return 1; } +bool GuiCompare::initialiseParams(std::string const &par) +{ + //just for the sake of parsing arguments + FuncRequest cmd(LFUN_UNKNOWN_ACTION, par); + if (cmd.getArg(0) == "run") { + oldFileCB->setEditText(toqstr(cmd.getArg(1))); + newFileCB->setEditText(toqstr(cmd.getArg(2))); + slotOK(); + } + return true; +} Dialog * createGuiCompare(GuiView & lv) { return new GuiCompare(lv); } diff --git a/src/frontends/qt4/GuiCompare.h b/src/frontends/qt4/GuiCompare.h index 47f70a12ab..aa5f701ebb 100644 --- a/src/frontends/qt4/GuiCompare.h +++ b/src/frontends/qt4/GuiCompare.h @@ -62,7 +62,7 @@ private: /// bool isValid(); /// - bool initialiseParams(std::string const &) { return true; } + bool initialiseParams(std::string const &); /// bool isBufferDependent() const { return false; } /// diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 1e04338002..860717bc39 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2686,20 +2686,8 @@ void GuiView::dispatchVC(FuncRequest const & cmd) if (!buffer->lyxvc().prepareFileRevision(rev2, f2)) break; } - // FIXME We need to call comparison feature here. - // This is quick and dirty code for testing VC. - // We need that comparison feature has some LFUN_COMPARE file1 file1 - // where specifies whether we want GUI dialog or just launch - // running with defaults. - /* - FileName initpath(lyxrc.document_path); - Buffer * dest = newUnnamedFile(initpath, to_utf8(_("differences"))); - CompareOptions options; - Compare * compare = new Compare(loadIfNeeded(FileName(f1)), loadIfNeeded(FileName(f2)), dest, options); - compare->start(QThread::LowPriority); - Sleep::millisec(200); - lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest->absFileName())); - */ + string par = "compare run " + f1 + " " + f2; + lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, par)); break; }