forked from qt-creator/qt-creator
Make Translation Tests ignore imported files
Change-Id: I4abd222bd15da79a1fe14d01b8a4a1f25d935b3b Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Łukasz Ornatek
parent
b74ec903a7
commit
0831c07cb3
@@ -125,8 +125,11 @@ ProjectFileSelectionsWidget::ProjectFileSelectionsWidget(const QString &projectS
|
||||
const auto settingsDisabledFiles = project->namedSettings(m_projectSettingsKey).toStringList();
|
||||
|
||||
if (auto rootProjectNode = project->rootProjectNode()) {
|
||||
rootProjectNode->forEachNode([this, settingsDisabledFiles, model](ProjectExplorer::FileNode *fileNode) {
|
||||
if (fileNode->fileType() == m_fileType) {
|
||||
auto rootPath = rootProjectNode->filePath();
|
||||
|
||||
rootProjectNode->forEachNode([this, settingsDisabledFiles, model, rootPath](ProjectExplorer::FileNode *fileNode) {
|
||||
if (fileNode->fileType() == m_fileType
|
||||
&& !fileNode->filePath().relativeChildPath(rootPath).startsWith("imports/")) {
|
||||
bool isDisabled = settingsDisabledFiles.contains(fileNode->filePath().toString());
|
||||
model->rootItem()->appendChild(new ProjectFileItem(fileNode->filePath(), isDisabled));
|
||||
}
|
||||
|
@@ -104,21 +104,17 @@ QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent)
|
||||
|
||||
const QString projectSettingsKey = "QmlPreview.DisabledDebugTranslationFiles";
|
||||
const ProjectExplorer::FileType filterFileType = ProjectExplorer::FileType::QML;
|
||||
auto checkableProjectFileView = new ProjectFileSelectionsWidget(projectSettingsKey, filterFileType);
|
||||
checkableProjectFileView->setVisible(false);
|
||||
connect(checkableProjectFileView, &ProjectFileSelectionsWidget::selectionChanged, this, &QmlDebugTranslationWidget::setFiles);
|
||||
m_checkableProjectFileView = new ProjectFileSelectionsWidget(projectSettingsKey, filterFileType);
|
||||
m_checkableProjectFileView->setVisible(false);
|
||||
connect(m_checkableProjectFileView, &ProjectFileSelectionsWidget::selectionChanged, this, &QmlDebugTranslationWidget::setFiles);
|
||||
m_multipleFileButton = new QRadioButton(tr("multiple files"));
|
||||
// TODO: fix multiple files issues, because it have some issues disable it for now
|
||||
m_multipleFileButton->setDisabled(true);
|
||||
buttonGroup->addButton(m_multipleFileButton);
|
||||
connect(m_multipleFileButton, &QAbstractButton::toggled, [checkableProjectFileView, this](bool checked) {
|
||||
checkableProjectFileView->setVisible(checked);
|
||||
setFiles(checkableProjectFileView->checkedFiles());
|
||||
});
|
||||
connect(m_multipleFileButton, &QAbstractButton::toggled, m_checkableProjectFileView, &QWidget::setVisible);
|
||||
connect(m_multipleFileButton, &QAbstractButton::toggled, this, &QmlDebugTranslationWidget::updateFiles);
|
||||
|
||||
mainLayout->addWidget(m_singleFileButton);
|
||||
mainLayout->addWidget(m_multipleFileButton);
|
||||
mainLayout->addWidget(checkableProjectFileView);
|
||||
mainLayout->addWidget(m_checkableProjectFileView);
|
||||
|
||||
// language checkboxes are add in updateAvailableTranslations method
|
||||
m_selectLanguageLayout = new QHBoxLayout;
|
||||
@@ -226,7 +222,7 @@ void QmlDebugTranslationWidget::updateCurrentEditor(const Core::IEditor *editor)
|
||||
else
|
||||
m_currentFilePath.clear();
|
||||
m_singleFileButton->setText(singleFileButtonText(m_currentFilePath.toString()));
|
||||
|
||||
updateFiles();
|
||||
}
|
||||
|
||||
void QmlDebugTranslationWidget::updateStartupProjectTranslations()
|
||||
@@ -253,6 +249,7 @@ void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Proje
|
||||
tr("Current language is \'<b>%1</b>\' can be changed in the 'Translation' tab.")
|
||||
.arg(multiLanguageAspect->currentLocale())));
|
||||
m_testLanguages.clear();
|
||||
m_testLanguages.append(multiLanguageAspect->currentLocale());
|
||||
} else {
|
||||
m_selectLanguageLayout->addWidget(new QLabel(tr("Select which language should be tested:")));
|
||||
QString errorMessage;
|
||||
@@ -272,6 +269,14 @@ void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Proje
|
||||
}
|
||||
}
|
||||
|
||||
void QmlDebugTranslationWidget::updateFiles()
|
||||
{
|
||||
if (m_multipleFileButton->isChecked())
|
||||
setFiles(m_checkableProjectFileView->checkedFiles());
|
||||
else
|
||||
setFiles({m_currentFilePath});
|
||||
}
|
||||
|
||||
void QmlDebugTranslationWidget::setFiles(const Utils::FilePaths &filePathes)
|
||||
{
|
||||
m_selectedFilePaths = filePathes;
|
||||
@@ -305,14 +310,9 @@ void QmlDebugTranslationWidget::runTest()
|
||||
});
|
||||
}
|
||||
};
|
||||
if (m_multipleFileButton->isChecked()) {
|
||||
for (auto filePath : m_selectedFilePaths) {
|
||||
testLanguages(timerCounter++, filePath.toString());
|
||||
}
|
||||
} else {
|
||||
testLanguages(timerCounter, QString());
|
||||
for (auto filePath : m_selectedFilePaths) {
|
||||
testLanguages(timerCounter++, filePath.toString());
|
||||
}
|
||||
|
||||
});
|
||||
connect(runControl, &ProjectExplorer::RunControl::stopped, [this]() {
|
||||
m_runTestButton->setChecked(false);
|
||||
|
@@ -49,6 +49,8 @@ class RunControl;
|
||||
|
||||
namespace QmlPreview {
|
||||
|
||||
class ProjectFileSelectionsWidget;
|
||||
|
||||
class QMLPREVIEW_EXPORT QmlDebugTranslationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -62,6 +64,7 @@ public:
|
||||
private:
|
||||
void updateCurrentEditor(const Core::IEditor *editor);
|
||||
void updateCurrentTranslations(ProjectExplorer::Project *project);
|
||||
void updateFiles();
|
||||
void runTest();
|
||||
void appendMessage(const QString &message, Utils::OutputFormat format);
|
||||
void clear();
|
||||
@@ -81,6 +84,7 @@ private:
|
||||
|
||||
QRadioButton *m_singleFileButton = nullptr;
|
||||
QRadioButton *m_multipleFileButton = nullptr;
|
||||
ProjectFileSelectionsWidget *m_checkableProjectFileView = nullptr;
|
||||
QPushButton *m_runTestButton = nullptr;
|
||||
|
||||
Utils::FilePath m_currentFilePath;
|
||||
|
Reference in New Issue
Block a user