src: switched to using only wstring for status message

This commit is contained in:
mlangkabel
2018-02-12 10:39:28 +01:00
parent 72c2596251
commit e3322adf2e
20 changed files with 69 additions and 65 deletions
+11 -11
View File
@@ -30,9 +30,9 @@ QtDialogView::~QtDialogView()
m_resultReady = true;
}
void QtDialogView::showUnknownProgressDialog(const std::string& title, const std::string& message)
void QtDialogView::showUnknownProgressDialog(const std::wstring& title, const std::wstring& message)
{
MessageStatus(title + ": " + message, false, true).dispatch();
MessageStatus(title + L": " + message, false, true).dispatch();
m_onQtThread2(
[=]()
@@ -56,7 +56,7 @@ void QtDialogView::hideUnknownProgressDialog()
setParentWindow(nullptr);
}
void QtDialogView::showProgressDialog(const std::string& title, const std::string& message, size_t progress)
void QtDialogView::showProgressDialog(const std::wstring& title, const std::wstring& message, size_t progress)
{
m_onQtThread(
[=]()
@@ -81,11 +81,11 @@ void QtDialogView::showProgressDialog(const std::string& title, const std::strin
if (sendStatusMessage)
{
MessageStatus(title + ": " + message + " [" + std::to_string(progress) + "%]", false, true).dispatch();
MessageStatus(title + L": " + message + L" [" + std::to_wstring(progress) + L"%]", false, true).dispatch();
}
window->updateTitle(title.c_str());
window->updateMessage(message.c_str());
window->updateTitle(QString::fromStdWString(title));
window->updateMessage(QString::fromStdWString(message));
window->updateProgress(progress);
setUIBlocked(true);
@@ -143,7 +143,7 @@ void QtDialogView::startIndexingDialog(
connect(timer.get(), &QTimer::timeout,
[=]()
{
showUnknownProgress("Preparing Indexing", "Processing Files", true);
showUnknownProgress(L"Preparing Indexing", L"Processing Files", true);
}
);
timer->start(200);
@@ -348,7 +348,7 @@ void QtDialogView::setParentWindow(QtWindow* window)
);
}
void QtDialogView::showUnknownProgress(const std::string& title, const std::string& message, bool stacked)
void QtDialogView::showUnknownProgress(const std::wstring& title, const std::wstring& message, bool stacked)
{
QtIndexingDialog* window = nullptr;
@@ -369,8 +369,8 @@ void QtDialogView::showUnknownProgress(const std::string& title, const std::stri
window->setupUnknownProgress();
}
window->updateTitle(title.c_str());
window->updateMessage(message.c_str());
window->updateTitle(QString::fromStdWString(title));
window->updateMessage(QString::fromStdWString(message));
setUIBlocked(true);
}
@@ -418,7 +418,7 @@ void QtDialogView::handleMessage(MessageInterruptTasks* message)
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
if (window && window->getType() == QtIndexingDialog::DIALOG_INDEXING)
{
showUnknownProgressDialog("Interrupting Indexing", "Waiting for indexer\nthreads to finish");
showUnknownProgressDialog(L"Interrupting Indexing", L"Waiting for indexer\nthreads to finish");
}
}
);
+3 -3
View File
@@ -29,10 +29,10 @@ public:
QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess);
virtual ~QtDialogView();
virtual void showUnknownProgressDialog(const std::string& title, const std::string& message) override;
virtual void showUnknownProgressDialog(const std::wstring& title, const std::wstring& message) override;
virtual void hideUnknownProgressDialog() override;
virtual void showProgressDialog(const std::string& title, const std::string& message, size_t progress) override;
virtual void showProgressDialog(const std::wstring& title, const std::wstring& message, size_t progress) override;
virtual void hideProgressDialog() override;
virtual void startIndexingDialog(
@@ -51,7 +51,7 @@ public:
void setParentWindow(QtWindow* window);
private slots:
void showUnknownProgress(const std::string& title, const std::string& message, bool stacked);
void showUnknownProgress(const std::wstring& title, const std::wstring& message, bool stacked);
void hideUnknownProgress();
void setUIBlocked(bool blocked);
+4 -4
View File
@@ -265,7 +265,7 @@ void QtIndexingDialog::setupProgress()
finishSetup();
}
void QtIndexingDialog::updateMessage(QString message)
void QtIndexingDialog::updateMessage(const QString& message)
{
if (m_messageLabel)
{
@@ -273,13 +273,13 @@ void QtIndexingDialog::updateMessage(QString message)
}
}
std::string QtIndexingDialog::getMessage() const
std::wstring QtIndexingDialog::getMessage() const
{
if (m_messageLabel)
{
return m_messageLabel->text().toStdString();
return m_messageLabel->text().toStdWString();
}
return "";
return L"";
}
void QtIndexingDialog::updateProgress(size_t progress)
+2 -2
View File
@@ -47,8 +47,8 @@ public:
void setupUnknownProgress();
void setupProgress();
void updateMessage(QString message);
std::string getMessage() const;
void updateMessage(const QString& message);
std::wstring getMessage() const;
void updateProgress(size_t progress);
size_t getProgress() const;
void updateIndexingProgress(size_t fileCount, size_t totalFileCount, const FilePath& sourcePath);
+4 -4
View File
@@ -205,7 +205,7 @@ void QtWindow::moveToCenter()
}
}
void QtWindow::updateTitle(QString title)
void QtWindow::updateTitle(const QString& title)
{
if (m_title)
{
@@ -213,13 +213,13 @@ void QtWindow::updateTitle(QString title)
}
}
std::string QtWindow::getTitle() const
std::wstring QtWindow::getTitle() const
{
if (m_title)
{
return m_title->text().toStdString();
return m_title->text().toStdWString();
}
return "";
return L"";
}
void QtWindow::updateSubTitle(QString subTitle)
+2 -2
View File
@@ -34,8 +34,8 @@ public:
void moveToCenter();
void updateTitle(QString title);
std::string getTitle() const;
void updateTitle(const QString& title);
std::wstring getTitle() const;
void updateSubTitle(QString subTitle);
void updateNextButton(QString text);
@@ -236,7 +236,7 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() con
});
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nGenerating Source Files");
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nGenerating Source Files");
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
if (!success)
{
@@ -250,7 +250,7 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() con
}
else
{
dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nFetching Source Directories");
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nFetching Source Directories");
const std::vector<FilePath> sourceDirectories = utility::mavenGetAllDirectoriesFromEffectivePom(
mavenPath,
mavenProjectRoot,
@@ -382,7 +382,7 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceGradle::getFilePaths() co
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
{
dialogView->showUnknownProgressDialog("Preparing Project", "Gradle\nFetching Source Directories");
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Gradle\nFetching Source Directories");
const std::vector<FilePath> sourceDirectories = utility::gradleGetAllSourceDirectories(
gradleProjectRoot,
settings->getShouldIndexGradleTests()
@@ -212,7 +212,7 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
});
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog("Processing", "Gathering Source Files");
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
FileManager fileManager;
fileManager.update(
@@ -534,7 +534,7 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
{
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog("Processing", "Gathering Source Files");
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
ScopedFunctor dialogHider([&dialogView](){
dialogView->hideUnknownProgressDialog();
});
@@ -570,7 +570,7 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
[&](const float progress)
{
Application::getInstance()->getDialogView()->showProgressDialog(
"Processing", std::to_string(int(progress * sourceFilePaths.size())) + " Files", int(progress * 100.0f)
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
);
}
);
@@ -597,7 +597,7 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
std::vector<FilePath> headerSearchPaths;
{
dialogView->setParentWindow(m_window);
dialogView->showUnknownProgressDialog("Processing", "Gathering Source Files");
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
ScopedFunctor dialogHider([&dialogView]() {
dialogView->hideUnknownProgressDialog();
});
@@ -631,7 +631,7 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
[&](const float progress)
{
Application::getInstance()->getDialogView()->showProgressDialog(
"Processing", std::to_string(int(progress * sourceFilePaths.size())) + " Files", int(progress * 100.0f)
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
);
}
);