logic: more wstring usages

* removed header paths from VS Project setup message since VS doesn't send these anymore
* implemented using wstring in IDE communication
* fixed retrieving filepaths from QtDirectoryListbox that contain special characters
* use wstring for source extensions
* added special character as file extension to FileManagerTestSuite
This commit is contained in:
mlangkabel
2018-01-30 17:07:51 +01:00
parent 471b1757df
commit c99e79364f
46 changed files with 319 additions and 337 deletions
+2 -8
View File
@@ -565,7 +565,7 @@ void QtMainWindow::newProject()
wizzard->newProject();
}
void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
void QtMainWindow::newProjectFromCDB(const FilePath& filePath)
{
QtProjectWizzard* wizzard = dynamic_cast<QtProjectWizzard*>(m_windowStack.getTopWindow());
if (!wizzard)
@@ -573,13 +573,7 @@ void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vec
wizzard = createWindow<QtProjectWizzard>();
}
std::vector<FilePath> headerFilePaths;
for (const std::string& s: headerPaths)
{
headerFilePaths.push_back(FilePath(s));
}
wizzard->newProjectFromCDB(FilePath(filePath), headerFilePaths);
wizzard->newProjectFromCDB(filePath);
}
void QtMainWindow::openProject()
+1 -1
View File
@@ -115,7 +115,7 @@ public slots:
void hideStartScreen();
void newProject();
void newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths);
void newProjectFromCDB(const FilePath& filePath);
void openProject();
void editProject();
@@ -25,6 +25,16 @@ std::string QtTextEditDialog::getText()
return m_text->toPlainText().toStdString();
}
void QtTextEditDialog::setWText(const std::wstring& text)
{
m_text->setPlainText(QString::fromStdWString(text));
}
std::wstring QtTextEditDialog::getWText()
{
return m_text->toPlainText().toStdWString();
}
void QtTextEditDialog::setReadOnly(bool readOnly)
{
m_text->setReadOnly(readOnly);
+3
View File
@@ -18,6 +18,9 @@ public:
void setText(const std::string& text);
std::string getText();
void setWText(const std::wstring& text);
std::wstring getWText();
void setReadOnly(bool readOnly);
protected:
@@ -65,7 +65,7 @@ void QtProjectWizzard::newProject()
setup();
}
void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::vector<FilePath>& headerPaths)
void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath)
{
if (!m_projectSettings)
{
@@ -91,16 +91,11 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::ve
std::shared_ptr<SourceGroupSettingsCxxCdb> sourceGroupSettings =
std::make_shared<SourceGroupSettingsCxxCdb>(utility::getUuidString(), m_projectSettings.get());
sourceGroupSettings->setCompilationDatabasePath(filePath);
sourceGroupSettings->setSourcePaths(headerPaths);
m_newSourceGroupSettings = sourceGroupSettings;
emptySourceGroupCDBVS();
}
void QtProjectWizzard::refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
{
}
void QtProjectWizzard::editProject(const FilePath& settingsPath)
{
std::shared_ptr<ProjectSettings> settings = std::make_shared<ProjectSettings>(settingsPath);
@@ -29,8 +29,7 @@ public:
public slots:
void newProject();
void newProjectFromCDB(const FilePath& filePath, const std::vector<FilePath>& headerPaths);
void refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
void newProjectFromCDB(const FilePath& filePath);
void editProject(const FilePath& settingsPath);
void editProject(std::shared_ptr<ProjectSettings> settings);
@@ -27,10 +27,10 @@ void QtProjectWizzardContentExtensions::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentExtensions::load()
{
m_sourceList->setStringList(m_settings->getSourceExtensions());
m_sourceList->setWStringList(m_settings->getSourceExtensions());
}
void QtProjectWizzardContentExtensions::save()
{
m_settings->setSourceExtensions(m_sourceList->getStringList());
m_settings->setSourceExtensions(m_sourceList->getWStringList());
}
@@ -86,7 +86,7 @@ bool QtProjectWizzardContentPaths::check()
{
if (!expandedPath.exists())
{
missingPaths.append((expandedPath.str() + "\n").c_str());
missingPaths.append(QString::fromStdWString(expandedPath.wstr() + L"\n"));
}
else
{
@@ -94,7 +94,7 @@ bool QtProjectWizzardContentPaths::check()
}
}
if (expandedPaths.size() && expandedPaths.size() == existingCount)
if (!expandedPaths.empty() && expandedPaths.size() == existingCount)
{
existingPaths.push_back(path);
}
@@ -648,13 +648,13 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePathsDialog()
{
const std::vector<std::string> detectedPaths = utility::splitToVector(m_filesDialog->getText(), "\n");
const std::vector<std::wstring> detectedPaths = utility::split<std::vector<std::wstring>>(m_filesDialog->getWText(), L"\n");
closedFilesDialog();
std::vector<std::string> headerSearchPaths = m_list->getStringList();
std::vector<std::wstring> headerSearchPaths = m_list->getWStringList();
headerSearchPaths.reserve(headerSearchPaths.size() + detectedPaths.size());
for (const std::string& detectedPath : detectedPaths)
for (const std::wstring& detectedPath : detectedPaths)
{
if (!detectedPath.empty())
{
@@ -662,7 +662,7 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePath
}
}
m_list->setStringList(headerSearchPaths);
m_list->setWStringList(headerSearchPaths);
}
void QtProjectWizzardContentPathsHeaderSearch::closedPathsDialog()