forked from qt-creator/qt-creator
Display progress indicator on navigation view...
...if parsing takes longer. Change-Id: Ib311c031ae0af72b2f923d93578099687d9af91a Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -620,6 +620,8 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
|
|||||||
Autotest::Constants::TASK_PARSE);
|
Autotest::Constants::TASK_PARSE);
|
||||||
connect(progress, &Core::FutureProgress::finished,
|
connect(progress, &Core::FutureProgress::finished,
|
||||||
this, &TestCodeParser::onFinished);
|
this, &TestCodeParser::onFinished);
|
||||||
|
|
||||||
|
emit parsingStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCodeParser::clearCache()
|
void TestCodeParser::clearCache()
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ signals:
|
|||||||
void unnamedQuickTestsUpdated(const QString &filePath, const QString &mainFile,
|
void unnamedQuickTestsUpdated(const QString &filePath, const QString &mainFile,
|
||||||
const QMap<QString, TestCodeLocationAndType> &functions);
|
const QMap<QString, TestCodeLocationAndType> &functions);
|
||||||
void unnamedQuickTestsRemoved(const QString &filePath);
|
void unnamedQuickTestsRemoved(const QString &filePath);
|
||||||
|
void parsingStarted();
|
||||||
void parsingFinished();
|
void parsingFinished();
|
||||||
void partialParsingFinished();
|
void partialParsingFinished();
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,9 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
#include <utils/progressindicator.h>
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
@@ -55,6 +57,21 @@ TestNavigationWidget::TestNavigationWidget(QWidget *parent) :
|
|||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
connect(m_view, &TestTreeView::activated, this, &TestNavigationWidget::onItemActivated);
|
connect(m_view, &TestTreeView::activated, this, &TestNavigationWidget::onItemActivated);
|
||||||
|
|
||||||
|
m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicator::Medium, this);
|
||||||
|
m_progressIndicator->attachToWidget(m_view);
|
||||||
|
m_progressIndicator->hide();
|
||||||
|
|
||||||
|
m_progressTimer = new QTimer(this);
|
||||||
|
m_progressTimer->setSingleShot(true);
|
||||||
|
m_progressTimer->setInterval(100); // don't display indicator if progress takes less than 100ms
|
||||||
|
|
||||||
|
connect(m_model->parser(), &TestCodeParser::parsingStarted,
|
||||||
|
this, &TestNavigationWidget::onParsingStarted);
|
||||||
|
connect(m_model->parser(), &TestCodeParser::parsingFinished,
|
||||||
|
this, &TestNavigationWidget::onParsingFinished);
|
||||||
|
connect(m_progressTimer, &QTimer::timeout,
|
||||||
|
m_progressIndicator, &Utils::ProgresssIndicator::show);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestNavigationWidget::~TestNavigationWidget()
|
TestNavigationWidget::~TestNavigationWidget()
|
||||||
@@ -178,6 +195,17 @@ void TestNavigationWidget::onFilterMenuTriggered(QAction *action)
|
|||||||
TestTreeSortFilterModel::toFilterMode(action->data().value<int>()));
|
TestTreeSortFilterModel::toFilterMode(action->data().value<int>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestNavigationWidget::onParsingStarted()
|
||||||
|
{
|
||||||
|
m_progressTimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestNavigationWidget::onParsingFinished()
|
||||||
|
{
|
||||||
|
m_progressTimer->stop();
|
||||||
|
m_progressIndicator->hide();
|
||||||
|
}
|
||||||
|
|
||||||
void TestNavigationWidget::initializeFilterMenu()
|
void TestNavigationWidget::initializeFilterMenu()
|
||||||
{
|
{
|
||||||
QAction *action = new QAction(m_filterMenu);
|
QAction *action = new QAction(m_filterMenu);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QAction;
|
class QAction;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QTimer;
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@@ -33,6 +34,10 @@ namespace Core {
|
|||||||
class IContext;
|
class IContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
class ProgressIndicator;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -60,6 +65,8 @@ private slots:
|
|||||||
void onRunSelectedTriggered();
|
void onRunSelectedTriggered();
|
||||||
void onSortClicked();
|
void onSortClicked();
|
||||||
void onFilterMenuTriggered(QAction *action);
|
void onFilterMenuTriggered(QAction *action);
|
||||||
|
void onParsingStarted();
|
||||||
|
void onParsingFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initializeFilterMenu();
|
void initializeFilterMenu();
|
||||||
@@ -71,7 +78,8 @@ private:
|
|||||||
QToolButton *m_filterButton;
|
QToolButton *m_filterButton;
|
||||||
QMenu *m_filterMenu;
|
QMenu *m_filterMenu;
|
||||||
bool m_sortAlphabetically;
|
bool m_sortAlphabetically;
|
||||||
|
Utils::ProgressIndicator *m_progressIndicator;
|
||||||
|
QTimer *m_progressTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TestNavigationWidgetFactory : public Core::INavigationWidgetFactory
|
class TestNavigationWidgetFactory : public Core::INavigationWidgetFactory
|
||||||
|
|||||||
Reference in New Issue
Block a user