X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiCompare.cpp;h=09139597469be938ccc75fe36574e6d08d32897f;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=3fd504b90358927b7c3291d627de9806ae2d6b9b;hpb=7227566e8688e9fc0a60b01cbc077a97d1281f7e;p=lyx.git diff --git a/src/frontends/qt4/GuiCompare.cpp b/src/frontends/qt4/GuiCompare.cpp index 3fd504b903..0913959746 100644 --- a/src/frontends/qt4/GuiCompare.cpp +++ b/src/frontends/qt4/GuiCompare.cpp @@ -66,6 +66,8 @@ GuiCompare::GuiCompare(GuiView & lv) progressBar->setValue(0); progressBar->setEnabled(false); + closePB->setCursor(Qt::ArrowCursor); + bc().setPolicy(ButtonPolicy::OkApplyCancelPolicy); bc().setOK(okPB); } @@ -106,6 +108,7 @@ void GuiCompare::updateContents() newFileCB->clear(); oldFileCB->clear(); progressBar->setValue(0); + statusBar->clearMessage(); BufferList::iterator it = theBufferList().begin(); BufferList::iterator const end = theBufferList().end(); for (; it != end; ++it) { @@ -169,8 +172,12 @@ QString GuiCompare::browse(QString const & in_name) const } -void GuiCompare::enableControls(bool enable) const +void GuiCompare::enableControls(bool enable) { + // Set the hourglass cursor for the dialog, but + // never for the cancel button. + setCursor(enable ? Qt::ArrowCursor : Qt::WaitCursor); + newFileLA->setEnabled(enable); newFilePB->setEnabled(enable); newFileCB->setEnabled(enable); @@ -191,18 +198,13 @@ void GuiCompare::enableControls(bool enable) const void GuiCompare::error() { Alert::error(_("Error"), _("Error while comparing documents.")); - window_title_ = windowTitle(); finished(true); } void GuiCompare::finished(bool aborted) { enableControls(true); - if (old_buffer_) - old_buffer_->setReadonly(false); - if (new_buffer_) - new_buffer_->setReadonly(false); - + if (compare_) { delete compare_; compare_ = 0; @@ -213,8 +215,8 @@ void GuiCompare::finished(bool aborted) dest_buffer_->markClean(); theBufferList().release(dest_buffer_); } - setWindowTitle(window_title_); progressBar->setValue(0); + statusBar->showMessage(qt_("Aborted"), 5000); } else { hideView(); bc().ok(); @@ -222,6 +224,7 @@ void GuiCompare::finished(bool aborted) dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest_buffer_->absFileName())); } + statusBar->showMessage(qt_("Finished"), 5000); } } @@ -236,7 +239,13 @@ void GuiCompare::progressMax(int max) const { progressBar->setMaximum(max); } - + + +void GuiCompare::setStatusMessage(QString msg) +{ + statusBar->showMessage(msg); +} + void GuiCompare::slotOK() { @@ -249,12 +258,12 @@ void GuiCompare::slotOK() void GuiCompare::slotCancel() { if (compare_ && compare_->isRunning()) { - window_title_ = windowTitle(); - setWindowTitle(window_title_ + " " + qt_("(cancelling)")); + statusBar->showMessage(qt_("Aborting process...")); compare_->abort(); } else { GuiDialog::slotClose(); progressBar->setValue(0); + statusBar->clearMessage(); } } @@ -290,14 +299,9 @@ int GuiCompare::run() if (!new_buffer_ || !old_buffer_ || !dest_buffer_) return 0; - dest_buffer_->changed(); + dest_buffer_->changed(true); dest_buffer_->markDirty(); - // the comparison is done in a separate thread, so don't let - // the user change the buffers - old_buffer_->setReadonly(true); - new_buffer_->setReadonly(true); - // get the options from the dialog CompareOptions options; options.settings_from_new = newSettingsRB->isChecked(); @@ -308,6 +312,8 @@ int GuiCompare::run() connect(compare_, SIGNAL(finished(bool)), this, SLOT(finished(bool))); connect(compare_, SIGNAL(progress(int)), this, SLOT(progress(int))); connect(compare_, SIGNAL(progressMax(int)), this, SLOT(progressMax(int))); + connect(compare_, SIGNAL(statusMessage(QString)), + this, SLOT(setStatusMessage(QString))); compare_->start(QThread::LowPriority); return 1; }