From 457833fb2a0a967890a341dbf3f97b2a8062ce75 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Wed, 30 Nov 2016 16:32:34 +0100 Subject: [PATCH] logic: Added full refresh checkbox to indexing start dialog * Checkbox allows for switching between refresh and full refresh * Renamed menu option Force Refresh to Full Refresh * Checkbox is not visible when project needs to be fully refreshed --- .../gui/indexing_dialog/indexing_dialog.css | 2 +- src/lib/CMakeLists.txt | 3 +- src/lib/Project.cpp | 154 ++++++++++-------- src/lib/Project.h | 4 +- src/lib/component/view/DialogView.cpp | 7 +- src/lib/component/view/DialogView.h | 10 +- src/lib/utility/file/FileManager.cpp | 37 ++--- src/lib/utility/file/FileManager.h | 18 +- .../scheduling/TaskReturnSuccessWhile.cpp | 0 src/lib_gui/qt/view/QtDialogView.cpp | 14 +- src/lib_gui/qt/view/QtDialogView.h | 3 +- src/lib_gui/qt/window/QtIndexingDialog.cpp | 72 ++++++-- src/lib_gui/qt/window/QtIndexingDialog.h | 8 +- src/lib_gui/qt/window/QtMainWindow.cpp | 4 +- src/lib_java/JavaProject.cpp | 4 +- src/test/FileManagerTestSuite.h | 13 +- 16 files changed, 203 insertions(+), 150 deletions(-) delete mode 100644 src/lib/utility/scheduling/TaskReturnSuccessWhile.cpp diff --git a/bin/app/data/gui/indexing_dialog/indexing_dialog.css b/bin/app/data/gui/indexing_dialog/indexing_dialog.css index 95f2cf22..1f7abc92 100644 --- a/bin/app/data/gui/indexing_dialog/indexing_dialog.css +++ b/bin/app/data/gui/indexing_dialog/indexing_dialog.css @@ -1,4 +1,4 @@ -QLabel { +QLabel, QCheckBox { color: white; } diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 4a13bf16..848e42d4 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -298,7 +298,7 @@ add_files( utility/messaging/type/MessageWindowClosed.h utility/messaging/type/MessageWindowFocus.h utility/messaging/type/MessageZoom.h - + utility/messaging/Message.h utility/messaging/MessageBase.h utility/messaging/MessageInterruptTasksCounter.cpp @@ -327,7 +327,6 @@ add_files( utility/scheduling/TaskGroupSequence.h utility/scheduling/TaskLambda.cpp utility/scheduling/TaskLambda.h - utility/scheduling/TaskReturnSuccessWhile.cpp utility/scheduling/TaskReturnSuccessWhile.h utility/scheduling/TaskRunner.cpp utility/scheduling/TaskRunner.h diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp index aadda426..aff3c7a2 100644 --- a/src/lib/Project.cpp +++ b/src/lib/Project.cpp @@ -43,52 +43,50 @@ bool Project::refresh(bool forceRefresh) return false; } + bool needsFullRefresh = false; std::string question; - if (!forceRefresh) + switch (m_state) { - switch (m_state) - { - case PROJECT_STATE_EMPTY: - forceRefresh = true; - break; + case PROJECT_STATE_EMPTY: + needsFullRefresh = true; + break; - case PROJECT_STATE_LOADED: - break; + case PROJECT_STATE_LOADED: + break; - case PROJECT_STATE_OUTDATED: - question = - "The project file was changed after the last indexing. The project needs to get fully reindexed to " - "reflect the current project state. Do you want to reindex the project?"; - forceRefresh = true; - break; + case PROJECT_STATE_OUTDATED: + question = + "The project file was changed after the last indexing. The project needs to get fully reindexed to " + "reflect the current project state. Do you want to reindex the project?"; + needsFullRefresh = true; + break; - case PROJECT_STATE_OUTVERSIONED: - question = - "This project was indexed with a different version of Coati. It needs to be fully reindexed to be used " - "with this version of Coati. Do you want to reindex the project?"; - forceRefresh = true; - break; + case PROJECT_STATE_OUTVERSIONED: + question = + "This project was indexed with a different version of Coati. It needs to be fully reindexed to be used " + "with this version of Coati. Do you want to reindex the project?"; + needsFullRefresh = true; + break; - case PROJECT_STATE_SETTINGS_UPDATED: - question = - "Some settings were changed, the project needs to be fully reindexed. " - "Do you want to reindex the project?"; - forceRefresh = true; - break; + case PROJECT_STATE_SETTINGS_UPDATED: + question = + "Some settings were changed, the project needs to be fully reindexed. " + "Do you want to reindex the project?"; + needsFullRefresh = true; + break; - case PROJECT_STATE_NEEDS_MIGRATION: - question = - "This project was created with a different version of Coati. The project file needs to get updated and " - "the project fully reindexed. Do you want to update the project file and reindex the project?"; - forceRefresh = true; + case PROJECT_STATE_NEEDS_MIGRATION: + question = + "This project was created with a different version of Coati. The project file needs to get updated and " + "the project fully reindexed. Do you want to update the project file and reindex the project?"; + needsFullRefresh = true; - default: - break; - } + default: + break; } - if (forceRefresh && question.size() && Application::getInstance()->hasGUI()) + if (!forceRefresh && needsFullRefresh && question.size() && Application::getInstance()->hasGUI()) { std::vector options; options.push_back("Yes"); @@ -115,7 +113,7 @@ bool Project::refresh(bool forceRefresh) updateFileManager(m_fileManager); - if (buildIndex(forceRefresh)) + if (requestIndex(forceRefresh, needsFullRefresh)) { m_storageAccessProxy->setSubject(m_storage.get()); @@ -242,66 +240,84 @@ void Project::load() } } -bool Project::buildIndex(bool forceRefresh) +bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh) { if (!prepareIndexing()) { return false; } - std::vector fileInfos = m_storage->getInfoOnAllFiles(); - - m_fileManager.fetchFilePaths(forceRefresh ? std::vector() : fileInfos); - - std::set addedFilePaths = m_fileManager.getAddedFilePaths(); - std::set updatedFilePaths = m_fileManager.getUpdatedFilePaths(); - std::set removedFilePaths = m_fileManager.getRemovedFilePaths(); + FileManager::FileSets fileSets = m_fileManager.fetchFilePaths(m_storage->getInfoOnAllFiles()); std::set filesToClean; - std::set filesToParse; + std::set filesToIndex; - if (!forceRefresh) + if (!needsFullRefresh) { std::set dependingFilePaths; - utility::append(dependingFilePaths, m_storage->getDependingFilePaths(updatedFilePaths)); - utility::append(dependingFilePaths, m_storage->getDependingFilePaths(removedFilePaths)); + utility::append(dependingFilePaths, m_storage->getDependingFilePaths(fileSets.updatedFiles)); + utility::append(dependingFilePaths, m_storage->getDependingFilePaths(fileSets.removedFiles)); for (const FilePath& path : dependingFilePaths) { - if (removedFilePaths.find(path) == removedFilePaths.end()) + if (fileSets.removedFiles.find(path) == fileSets.removedFiles.end()) { - updatedFilePaths.insert(path); + fileSets.updatedFiles.insert(path); } } + utility::append(filesToClean, fileSets.removedFiles); + utility::append(filesToClean, fileSets.updatedFiles); utility::append(filesToClean, dependingFilePaths); + + utility::append(filesToIndex, fileSets.addedFiles); + utility::append(filesToIndex, fileSets.updatedFiles); } - utility::append(filesToClean, removedFilePaths); - utility::append(filesToClean, updatedFilePaths); + bool fullRefresh = forceRefresh | needsFullRefresh; - utility::append(filesToParse, addedFilePaths); - utility::append(filesToParse, updatedFilePaths); + if (Application::getInstance()->hasGUI()) + { + DialogView::IndexMode mode = m_dialogView->startIndexingDialog( + filesToClean.size(), filesToIndex.size(), fileSets.allFiles.size(), + forceRefresh, needsFullRefresh + ); - if (!filesToClean.size() && !filesToParse.size() && (!forceRefresh || !fileInfos.size())) + switch (mode) + { + case DialogView::INDEX_ABORT: + return false; + case DialogView::INDEX_REFRESH: + fullRefresh = false; + break; + case DialogView::INDEX_FULL: + fullRefresh = true; + break; + } + } + + if (fullRefresh) + { + filesToClean.clear(); + filesToIndex = fileSets.allFiles; + } + + if (!filesToClean.size() && !filesToIndex.size()) { MessageStatus("Nothing to refresh, all files are up-to-date.").dispatch(); return false; } - if (Application::getInstance()->hasGUI()) - { - bool doIndex = m_dialogView->startIndexingDialog(filesToClean.size(), filesToParse.size()); + buildIndex(filesToClean, filesToIndex, fullRefresh); - if (!doIndex) - { - return false; - } - } + return true; +} +void Project::buildIndex(const std::set& filesToClean, const std::set& filesToIndex, bool fullRefresh) +{ MessageClearErrorCount().dispatch(); - if (forceRefresh) + if (fullRefresh) { m_storage->clear(); } @@ -323,9 +339,9 @@ bool Project::buildIndex(bool forceRefresh) std::shared_ptr fileRegister = std::make_shared(&m_fileManager, indexerThreadCount > 1); - if (!filesToParse.empty()) + if (!filesToIndex.empty()) { - fileRegister->setFilePaths(utility::toVector(filesToParse)); + fileRegister->setFilePaths(utility::toVector(filesToIndex)); std::shared_ptr taskParserWrapper = std::make_shared( m_storage.get(), @@ -339,7 +355,7 @@ bool Project::buildIndex(bool forceRefresh) std::shared_ptr storageProvider = std::make_shared(); - for (size_t i = 0; i < indexerThreadCount && i < filesToParse.size(); i++) + for (size_t i = 0; i < indexerThreadCount && i < filesToIndex.size(); i++) { taskParallelIndexing->addChildTasks( std::make_shared(TaskDecoratorRepeat::CONDITION_WHILE_SUCCESS, Task::STATE_SUCCESS)->addChildTask( @@ -378,13 +394,9 @@ bool Project::buildIndex(bool forceRefresh) ); } - - taskSequential->addTask(std::make_shared(m_storage.get(), m_storageAccessProxy, fileRegister, m_dialogView)); Task::dispatch(taskSequential); - - return true; } bool Project::prepareIndexing() diff --git a/src/lib/Project.h b/src/lib/Project.h index d21b7c8b..af4a1b82 100644 --- a/src/lib/Project.h +++ b/src/lib/Project.h @@ -3,6 +3,7 @@ #include #include +#include #include "utility/file/FileManager.h" @@ -57,7 +58,8 @@ public: // todo: make private again void load(); private: - bool buildIndex(bool forceRefresh); + bool requestIndex(bool forceRefresh, bool needsFullRefresh); + void buildIndex(const std::set& filesToClean, const std::set& filesToIndex, bool fullRefresh); virtual bool prepareIndexing(); virtual bool prepareRefresh(); diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index 40c66b1b..70db6f3c 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -17,9 +17,10 @@ void DialogView::hideProgressDialog() { } -bool DialogView::startIndexingDialog(size_t cleanFileCount, size_t indexFileCount) -{ - return false; +DialogView::IndexMode DialogView::startIndexingDialog( + size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, bool forceRefresh, bool needsFullRefresh +){ + return INDEX_ABORT; } void DialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath) diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index e5107f78..f998cc63 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -11,13 +11,21 @@ class StorageAccess; class DialogView { public: + enum IndexMode + { + INDEX_ABORT, + INDEX_REFRESH, + INDEX_FULL + }; + DialogView(StorageAccess* storageAccess); virtual ~DialogView(); virtual void showProgressDialog(const std::string& title, const std::string& message); virtual void hideProgressDialog(); - virtual bool startIndexingDialog(size_t cleanFileCount, size_t indexFileCount); + virtual IndexMode startIndexingDialog( + size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, bool forceRefresh, bool needsFullRefresh); virtual void updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath); virtual void finishedIndexingDialog(size_t fileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo); diff --git a/src/lib/utility/file/FileManager.cpp b/src/lib/utility/file/FileManager.cpp index c9d17759..1b65a8fe 100644 --- a/src/lib/utility/file/FileManager.cpp +++ b/src/lib/utility/file/FileManager.cpp @@ -32,7 +32,7 @@ void FileManager::setPaths( m_sourceExtensions = sourceExtensions; } -void FileManager::fetchFilePaths(const std::vector& oldFileInfos) +FileManager::FileSets FileManager::fetchFilePaths(const std::vector& oldFileInfos) { m_files.clear(); for (FileInfo oldFileInfo: oldFileInfos) @@ -40,9 +40,7 @@ void FileManager::fetchFilePaths(const std::vector& oldFileInfos) m_files.emplace(oldFileInfo.path, oldFileInfo); } - m_addedFiles.clear(); - m_updatedFiles.clear(); - m_removedFiles.clear(); + FileSets fileSets; for (std::map::iterator it = m_files.begin(); it != m_files.end(); it++) { @@ -54,17 +52,15 @@ void FileManager::fetchFilePaths(const std::vector& oldFileInfos) if (fileInfo.lastWriteTime > it->second.lastWriteTime) { it->second.lastWriteTime = fileInfo.lastWriteTime; - m_updatedFiles.insert(filePath); + fileSets.updatedFiles.insert(filePath); } } else { - m_removedFiles.insert(filePath); + fileSets.removedFiles.insert(filePath); } } - m_sourceFiles.clear(); - std::vector fileInfos = FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions); for (FileInfo fileInfo: fileInfos) { @@ -74,44 +70,33 @@ void FileManager::fetchFilePaths(const std::vector& oldFileInfos) continue; } - m_sourceFiles.insert(filePath); + fileSets.allFiles.insert(filePath); std::map::iterator it = m_files.find(filePath); if (it != m_files.end()) { - m_removedFiles.erase(filePath); + fileSets.removedFiles.erase(filePath); if (fileInfo.lastWriteTime > it->second.lastWriteTime) { it->second.lastWriteTime = fileInfo.lastWriteTime; - m_updatedFiles.insert(filePath); + fileSets.updatedFiles.insert(filePath); } } else { m_files.insert(std::pair(filePath, fileInfo)); - m_addedFiles.insert(filePath); + fileSets.addedFiles.insert(filePath); } } - for (const FilePath& filePath : m_removedFiles) + for (const FilePath& filePath : fileSets.removedFiles) { m_files.erase(filePath); } -} -std::set FileManager::getAddedFilePaths() const -{ - return m_addedFiles; -} + m_sourceFiles = fileSets.allFiles; -std::set FileManager::getUpdatedFilePaths() const -{ - return m_updatedFiles; -} - -std::set FileManager::getRemovedFilePaths() const -{ - return m_removedFiles; + return fileSets; } bool FileManager::hasFilePath(const FilePath& filePath) const diff --git a/src/lib/utility/file/FileManager.h b/src/lib/utility/file/FileManager.h index 143d24f3..c7008d27 100644 --- a/src/lib/utility/file/FileManager.h +++ b/src/lib/utility/file/FileManager.h @@ -10,6 +10,14 @@ class FileManager { public: + struct FileSets + { + std::set allFiles; + std::set addedFiles; + std::set updatedFiles; + std::set removedFiles; + }; + FileManager(); virtual ~FileManager(); @@ -22,11 +30,7 @@ public: std::vector sourceExtensions ); - void fetchFilePaths(const std::vector& oldFileInfos); - - std::set getAddedFilePaths() const; - std::set getUpdatedFilePaths() const; - std::set getRemovedFilePaths() const; + FileSets fetchFilePaths(const std::vector& oldFileInfos); virtual bool hasFilePath(const FilePath& filePath) const; virtual bool hasSourceFilePath(const FilePath& filePath) const; @@ -45,10 +49,6 @@ private: std::vector m_sourceExtensions; - std::set m_addedFiles; - std::set m_updatedFiles; - std::set m_removedFiles; - std::set m_sourceFiles; }; diff --git a/src/lib/utility/scheduling/TaskReturnSuccessWhile.cpp b/src/lib/utility/scheduling/TaskReturnSuccessWhile.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 38574813..8c5c810a 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -67,19 +67,23 @@ void QtDialogView::hideProgressDialog() ); } -bool QtDialogView::startIndexingDialog(size_t cleanFileCount, size_t indexFileCount) +DialogView::IndexMode QtDialogView::startIndexingDialog( + size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, bool forceRefresh, bool needsFullRefresh) { - bool result = false; + IndexMode result = INDEX_ABORT; m_resultReady = false; m_onQtThread( [=, &result]() { QtIndexingDialog* window = createWindow(); - window->setupStart(cleanFileCount, indexFileCount, - [&](bool start) + window->setupStart(cleanFileCount, indexFileCount, totalFileCount, forceRefresh, needsFullRefresh, + [&](bool start, bool fullRefresh) { - result = start; + if (start) + { + result = (!fullRefresh && !needsFullRefresh ? INDEX_REFRESH : INDEX_FULL); + } m_resultReady = true; setUIBlocked(false); diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index a727cb27..6a5d927d 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -31,7 +31,8 @@ public: void showProgressDialog(const std::string& title, const std::string& message) override; void hideProgressDialog() override; - bool startIndexingDialog(size_t cleanFileCount, size_t indexFileCount) override; + DialogView::IndexMode startIndexingDialog(size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, + bool forceRefresh, bool needsFullRefresh) override; void updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath) override; void finishedIndexingDialog(size_t fileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo) override; diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 02a9038c..4665280d 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -1,5 +1,6 @@ #include "qt/window/QtIndexingDialog.h" +#include #include #include #include @@ -21,8 +22,9 @@ QtIndexingDialog::QtIndexingDialog(QWidget* parent) , m_messageLabel(nullptr) , m_filePathLabel(nullptr) , m_errorLabel(nullptr) + , m_checkBox(nullptr) , m_sizeHint(QSize(450, 450)) - , m_callback([](bool){}) + , m_callback([](bool, bool){}) { // setWindowFlags(Qt::WindowStaysOnTopHint); setSizeGripStyle(false); @@ -38,26 +40,60 @@ QtIndexingDialog::DialogType QtIndexingDialog::getType() const return m_type; } -void QtIndexingDialog::setupStart(size_t cleanFileCount, size_t indexFileCount, std::function callback) +void QtIndexingDialog::setupStart( + size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, + bool forceRefresh, bool needsFullRefresh, std::function callback) { QBoxLayout* layout = createLayout(); addTitle("Start Indexing", layout); layout->addSpacing(5); - if (cleanFileCount) - { - QLabel* cleanLabel = new QLabel("Clear: " + QString::number(cleanFileCount) + " File" + (cleanFileCount > 1 ? "s" : "")); - cleanLabel->setObjectName("message"); - cleanLabel->setAlignment(Qt::AlignRight); - layout->addWidget(cleanLabel, 0, Qt::AlignRight); - } + QLabel* clearLabel = createMessageLabel(layout); + QLabel* indexLabel = createMessageLabel(layout); + QLabel* fullLabel = createMessageLabel(layout); - addMessageLabel(layout); - updateMessage("Index: " + QString::number(indexFileCount) + " File" + (indexFileCount > 1 ? "s" : "")); + clearLabel->setText("Clear: " + QString::number(cleanFileCount) + " File" + (cleanFileCount != 1 ? "s" : "")); + indexLabel->setText("Index: " + QString::number(indexFileCount) + " File" + (indexFileCount != 1 ? "s" : "")); + fullLabel->setText("Index: " + QString::number(totalFileCount) + " File" + (totalFileCount != 1 ? "s" : "")); layout->addStretch(); + if (needsFullRefresh) + { + clearLabel->hide(); + indexLabel->hide(); + } + else + { + m_checkBox = new QCheckBox("full refresh", this); + m_checkBox->setObjectName("message"); + + connect(m_checkBox, static_cast(&QCheckBox::toggled), + [=](bool checked = false) + { + if (checked) + { + clearLabel->hide(); + indexLabel->hide(); + fullLabel->show(); + } + else + { + clearLabel->show(); + indexLabel->show(); + fullLabel->hide(); + } + } + ); + + m_checkBox->setChecked(!forceRefresh); + m_checkBox->setChecked(forceRefresh); + + layout->addWidget(m_checkBox, 0, Qt::AlignRight); + layout->addSpacing(30); + } + addButtons(layout); updateNextButton("Start"); updateCloseButton("Cancel"); @@ -211,7 +247,7 @@ void QtIndexingDialog::handleNext() { if (m_type == DIALOG_MESSAGE) { - m_callback(true); + m_callback(true, !m_checkBox || m_checkBox->isChecked()); } QtWindow::handleNext(); @@ -221,7 +257,7 @@ void QtIndexingDialog::handleClose() { if (m_type == DIALOG_MESSAGE) { - m_callback(false); + m_callback(false, false); } if (m_type == DIALOG_INDEXING) @@ -308,6 +344,16 @@ void QtIndexingDialog::addMessageLabel(QBoxLayout* layout) layout->addWidget(m_messageLabel, 0, Qt::AlignRight); } +QLabel* QtIndexingDialog::createMessageLabel(QBoxLayout* layout) +{ + QLabel* label = new QLabel(); + label->setObjectName("message"); + label->setAlignment(Qt::AlignRight); + label->setWordWrap(true); + layout->addWidget(label, 0, Qt::AlignRight); + return label; +} + void QtIndexingDialog::addFilePathLabel(QBoxLayout* layout) { m_filePathLabel = new QLabel(); diff --git a/src/lib_gui/qt/window/QtIndexingDialog.h b/src/lib_gui/qt/window/QtIndexingDialog.h index 124c6129..139a6d03 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.h +++ b/src/lib_gui/qt/window/QtIndexingDialog.h @@ -5,6 +5,7 @@ #include "qt/window/QtWindow.h" +class QCheckBox; class QLabel; class QtProgressBar; @@ -26,7 +27,8 @@ public: DialogType getType() const; - void setupStart(size_t cleanFileCount, size_t indexFileCount, std::function callback); + void setupStart(size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, + bool forceRefresh, bool needsFullRefresh, std::function callback); void setupProgress(); void setupIndexing(); void setupReport(size_t fileCount, size_t totalFileCount, float time); @@ -50,6 +52,7 @@ private: void addPercentLabel(QBoxLayout* layout); void addMessageLabel(QBoxLayout* layout); + QLabel* createMessageLabel(QBoxLayout* layout); void addFilePathLabel(QBoxLayout* layout); void addErrorLabel(QBoxLayout* layout); @@ -69,10 +72,11 @@ private: QLabel* m_messageLabel; QLabel* m_filePathLabel; QPushButton* m_errorLabel; + QCheckBox* m_checkBox; QSize m_sizeHint; - std::function m_callback; + std::function m_callback; QString m_sourcePath; }; diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 3953dd40..1814e75d 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -593,13 +593,13 @@ void QtMainWindow::setupEditMenu() if (QSysInfo::windowsVersion() != QSysInfo::WV_None) { m_trialDisabledActions.push_back( - menu->addAction(tr("&Force Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::Key_F5)) + menu->addAction(tr("&Full Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::Key_F5)) ); } else { m_trialDisabledActions.push_back(menu->addAction( - tr("&Force Refresh"), + tr("&Full Refresh"), this, SLOT(forceRefresh()), QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R) diff --git a/src/lib_java/JavaProject.cpp b/src/lib_java/JavaProject.cpp index 993fe007..8358a475 100644 --- a/src/lib_java/JavaProject.cpp +++ b/src/lib_java/JavaProject.cpp @@ -139,9 +139,9 @@ void JavaProject::fetchRootDirectories() m_projectSettings->getAbsoluteExcludePaths(), m_projectSettings->getSourceExtensions() ); - fileManager.fetchFilePaths(std::vector()); + FileManager::FileSets fileSets = fileManager.fetchFilePaths(std::vector()); std::shared_ptr javaEnvironment = JavaEnvironmentFactory::getInstance()->createEnvironment(); - for (FilePath filePath: fileManager.getAddedFilePaths()) + for (FilePath filePath: fileSets.addedFiles) { std::shared_ptr textAccess = TextAccess::createFromFile(filePath.str()); diff --git a/src/test/FileManagerTestSuite.h b/src/test/FileManagerTestSuite.h index 653c3324..a0821f08 100644 --- a/src/test/FileManagerTestSuite.h +++ b/src/test/FileManagerTestSuite.h @@ -5,15 +5,6 @@ class FileManagerTestSuite : public CxxTest::TestSuite { public: - void test_file_manager_is_created_empty() - { - FileManager fm = FileManager(); - - TS_ASSERT_EQUALS(fm.getAddedFilePaths().size(), 0); - TS_ASSERT_EQUALS(fm.getUpdatedFilePaths().size(), 0); - TS_ASSERT_EQUALS(fm.getRemovedFilePaths().size(), 0); - } - void test_file_manager_has_added_file_paths_after_first_fetch() { std::vector sourcePaths; @@ -27,8 +18,8 @@ public: FileManager fm; fm.setPaths(sourcePaths, headerPaths, excludePaths, sourceExtensions); - fm.fetchFilePaths(std::vector()); + FileManager::FileSets fileSets = fm.fetchFilePaths(std::vector()); - TS_ASSERT_EQUALS(fm.getAddedFilePaths().size(), 2); + TS_ASSERT_EQUALS(fileSets.addedFiles.size(), 2); } };