forked from qt-creator/qt-creator
AutoTest: Provide way to remember last chosen run configurations
In some special setups it is almost impossible to get the right executable or run configuration. For bigger projects this can become a pain point when trying to execute tests and always getting asked which one to run. So, allow remembering the choice and use it if appropriate. The cached information is not stored permanently. Resetting of the cached information can also be triggered by switching or closing the current project and inside the settings. Task-number: QTCREATORBUG-20859 Change-Id: If416ea0ae9ad3548daca2ffcf5888fd568fd2622 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -29,6 +29,10 @@
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <QMap>
|
||||
|
||||
namespace ProjectExplorer { class RunConfiguration; }
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -39,6 +43,16 @@ struct TestSettings;
|
||||
class TestSettingsPage;
|
||||
enum class TestRunMode;
|
||||
|
||||
struct ChoicePair
|
||||
{
|
||||
explicit ChoicePair(const QString &name = QString(), const QString &exe = QString())
|
||||
: displayName(name), executable(exe) {}
|
||||
bool matches(const ProjectExplorer::RunConfiguration *rc) const;
|
||||
|
||||
QString displayName;
|
||||
QString executable;
|
||||
};
|
||||
|
||||
class AutotestPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -54,6 +68,9 @@ public:
|
||||
|
||||
static QSharedPointer<TestSettings> settings();
|
||||
static void updateMenuItemsEnabledState();
|
||||
static void cacheRunConfigChoice(const QString &buildTargetKey, const ChoicePair &choice);
|
||||
static ChoicePair cachedChoiceFor(const QString &buildTargetKey);
|
||||
static void clearChoiceCache();
|
||||
|
||||
private:
|
||||
bool checkLicense();
|
||||
@@ -68,6 +85,7 @@ private:
|
||||
TestSettingsPage *m_testSettingPage = nullptr;
|
||||
TestNavigationWidgetFactory *m_navigationWidgetFactory = nullptr;
|
||||
TestResultsPane *m_resultsPane = nullptr;
|
||||
QMap<QString, ChoicePair> m_runconfigCache;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user