diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-01-16 16:06:16 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-01-19 10:45:35 +0100 |
commit | 4c63deae5cd42b72abe0422bab54a80888167bf1 (patch) | |
tree | 3e1dc06bffc86ea4efa792ace71cb86e0f2a91c7 /src/plugins/vcsbase/vcsbaseeditor.cpp | |
parent | 8c3e68832ef93f9a4cce894a195e1e4f797187ad (diff) | |
download | qt-creator-4c63deae5cd42b72abe0422bab54a80888167bf1.tar.gz |
Git/VCS: Use spinning progress indicator for log view
Show a spinning progress indicator instead of the "Waiting for data"
text for e.g. the git log view and other commands that use
VcsBaseEditor.
Change-Id: Ie4c73f85397f8809bda6bb276140eb695d96174f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/vcsbase/vcsbaseeditor.cpp')
-rw-r--r-- | src/plugins/vcsbase/vcsbaseeditor.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 8755a4c091..09dce77020 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -46,6 +46,7 @@ #include <projectexplorer/session.h> #include <texteditor/textdocument.h> #include <texteditor/textdocumentlayout.h> +#include <utils/progressindicator.h> #include <utils/qtcassert.h> #include <QDebug> @@ -573,6 +574,7 @@ public: QPointer<VcsCommand> m_command; QObject *m_describeReceiver; const char *m_describeSlot; + Utils::ProgressIndicator *m_progressIndicator; private: QComboBox *m_entriesComboBox; @@ -589,6 +591,7 @@ VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *edit m_mouseDragging(false), m_describeReceiver(0), m_describeSlot(0), + m_progressIndicator(0), m_entriesComboBox(0) { m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget)); @@ -1352,9 +1355,18 @@ VcsBaseEditorParameterWidget *VcsBaseEditorWidget::configurationWidget() const void VcsBaseEditorWidget::setCommand(VcsCommand *command) { - if (d->m_command) + if (d->m_command) { d->m_command->abort(); + hideProgressIndicator(); + } d->m_command = command; + if (d->m_command) { + d->m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicator::Large); + d->m_progressIndicator->attachToWidget(this); + connect(d->m_command, &VcsCommand::finished, + this, &VcsBaseEditorWidget::hideProgressIndicator); + QTimer::singleShot(100, this, SLOT(showProgressIndicator())); + } } // Find the complete file from a diff relative specification. @@ -1439,6 +1451,19 @@ void VcsBaseEditorWidget::slotPaste() } } +void VcsBaseEditorWidget::showProgressIndicator() +{ + if (!d->m_progressIndicator) // already stopped and deleted + return; + d->m_progressIndicator->show(); +} + +void VcsBaseEditorWidget::hideProgressIndicator() +{ + delete d->m_progressIndicator; + d->m_progressIndicator = 0; +} + bool VcsBaseEditorWidget::canApplyDiffChunk(const DiffChunk &dc) const { if (!dc.isValid()) |