logic: used wstring in FilePath constructor
* used wstring in FilePath constructor where easily possible * added FilePath concatenate method that accepts string parameter * implemented using only wstring in MessageStatus * used wstring in config
This commit is contained in:
@@ -285,5 +285,7 @@ add_files(
|
||||
utility/utilityApp.h
|
||||
utility/utilityPathDetection.cpp
|
||||
utility/utilityPathDetection.h
|
||||
utility/utilityQString.cpp
|
||||
utility/utilityQString.h
|
||||
)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void setupApp(int argc, char *argv[])
|
||||
{
|
||||
if (AppPath::getAppPath().empty())
|
||||
{
|
||||
AppPath::setAppPath(QCoreApplication::applicationDirPath().toStdString() + "/");
|
||||
AppPath::setAppPath(FilePath(QCoreApplication::applicationDirPath().toStdWString() + L"/"));
|
||||
}
|
||||
|
||||
std::string userdir(std::getenv("HOME"));
|
||||
@@ -67,8 +67,8 @@ void setupApp(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdString(ResourcePaths::getFallbackPath().str()), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdString(AppPath::getAppPath() + "/user/" ), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdWString(ResourcePaths::getFallbackPath().wstr()), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdWString(AppPath::getAppPath().concatenate(L"user/").wstr()), userDataPath);
|
||||
}
|
||||
|
||||
#endif // INCLUDES_DEFAULT_H
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
void setupPlatform(int argc, char *argv[])
|
||||
{
|
||||
UserPaths::setUserDataPath(FilePath("./user/"));
|
||||
UserPaths::setUserDataPath(FilePath(L"./user/"));
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
|
||||
@@ -58,7 +58,7 @@ void setupPlatform(int argc, char *argv[])
|
||||
// ----------------------------------------------------------------------------
|
||||
// Makes the mac bundle copy the user files to the Application Support folder
|
||||
QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
QString oldDataPath = QString::fromStdString(ResourcePaths::getFallbackPath().str());
|
||||
QString oldDataPath = QString::fromStdWString(ResourcePaths::getFallbackPath().wstr());
|
||||
|
||||
QDir dataDir(dataPath);
|
||||
if (!dataDir.exists())
|
||||
@@ -81,13 +81,13 @@ void setupPlatform(int argc, char *argv[])
|
||||
utility::copyNewFilesFromDirectory(oldDataPath, dataPath);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
UserPaths::setUserDataPath(FilePath(dataPath.toStdString() + "/"));
|
||||
UserPaths::setUserDataPath(FilePath(dataPath.toStdWString() + L"/"));
|
||||
}
|
||||
|
||||
void setupApp(int argc, char *argv[])
|
||||
{
|
||||
FilePath path(QDir::currentPath().toStdString());
|
||||
AppPath::setAppPath(path.getAbsolute().str() + "/");
|
||||
const FilePath path(QDir::currentPath().toStdWString() + L"/");
|
||||
AppPath::setAppPath(path.getAbsolute());
|
||||
}
|
||||
|
||||
#endif // INCLUDES_MAC_H
|
||||
|
||||
@@ -36,21 +36,20 @@ void setupApp(int argc, char *argv[])
|
||||
{
|
||||
appPath = appPath.substr(0, pos + 1);
|
||||
}
|
||||
AppPath::setAppPath(FilePath(appPath).str());
|
||||
}
|
||||
|
||||
{
|
||||
FilePath userDataPath(AppPath::getAppPath() + "user/");
|
||||
FilePath userDataPath = AppPath::getAppPath().concatenate(L"user/");
|
||||
if (!userDataPath.exists())
|
||||
{
|
||||
userDataPath = FilePath(std::string(std::getenv("APPDATA")) + "/../local/Coati Software/");
|
||||
if (utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64)
|
||||
{
|
||||
userDataPath.concatenate(FilePath("Sourcetrail 64-bit/"));
|
||||
userDataPath.concatenate(L"Sourcetrail 64-bit/");
|
||||
}
|
||||
else
|
||||
{
|
||||
userDataPath.concatenate(FilePath("Sourcetrail/"));
|
||||
userDataPath.concatenate(L"Sourcetrail/");
|
||||
}
|
||||
userDataPath.makeCanonical();
|
||||
}
|
||||
@@ -58,8 +57,8 @@ void setupApp(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// This "copyFile" method does nothing if the copy destination already exist
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(L"ApplicationSettings.xml"), UserPaths::getAppSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(L"window_settings.ini"), UserPaths::getWindowSettingsPath());
|
||||
}
|
||||
|
||||
#endif // INCLUDES_WINDOWS_H
|
||||
|
||||
@@ -26,7 +26,7 @@ bool QtApplication::event(QEvent *event)
|
||||
{
|
||||
QFileOpenEvent* fileEvent = dynamic_cast<QFileOpenEvent*>(event);
|
||||
|
||||
FilePath path(fileEvent->file().toStdString());
|
||||
FilePath path(fileEvent->file().toStdWString());
|
||||
|
||||
if (path.exists() && (path.extension() == ".srctrlprj" || path.extension() == ".coatiproject"))
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ void QtCoreApplication::handleMessage(MessageQuitApplication* message)
|
||||
|
||||
void QtCoreApplication::handleMessage(MessageStatus* message)
|
||||
{
|
||||
for (const std::string& status : message->stati())
|
||||
for (const std::wstring& status : message->stati())
|
||||
{
|
||||
std::cout << status << std::endl;
|
||||
std::wcout << status << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ void QtCodeArea::setIDECursorPosition()
|
||||
{
|
||||
std::pair<int, int> lineColumn = toLineColumn(this->cursorForPosition(m_eventPosition).position());
|
||||
|
||||
MessageMoveIDECursor(getSourceLocationFile()->getFilePath().str(), lineColumn.first, lineColumn.second).dispatch();
|
||||
MessageMoveIDECursor(getSourceLocationFile()->getFilePath(), lineColumn.first, lineColumn.second).dispatch();
|
||||
}
|
||||
|
||||
void QtCodeArea::activateErrors(const std::vector<const Annotation*>& annotations)
|
||||
|
||||
@@ -60,11 +60,6 @@ const FilePath& QtCodeFile::getFilePath() const
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
std::string QtCodeFile::getFileName() const
|
||||
{
|
||||
return m_filePath.fileName();
|
||||
}
|
||||
|
||||
const QtCodeFileTitleBar* QtCodeFile::getTitleBar() const
|
||||
{
|
||||
return m_titleBar;
|
||||
|
||||
@@ -30,7 +30,6 @@ public:
|
||||
void setModificationTime(const TimeStamp modificationTime);
|
||||
|
||||
const FilePath& getFilePath() const;
|
||||
std::string getFileName() const;
|
||||
|
||||
const QtCodeFileTitleBar* getTitleBar() const;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/utilityQString.h"
|
||||
|
||||
QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
@@ -67,8 +68,8 @@ void QtCodeFileTitleButton::setIsComplete(bool isComplete)
|
||||
|
||||
if (!isComplete)
|
||||
{
|
||||
FilePath hatchingFilePath(ResourcePaths::getGuiPath().str() + "code_view/images/pattern_" +
|
||||
ColorScheme::getInstance()->getColor("code/file/title/hatching") + ".png"
|
||||
FilePath hatchingFilePath = ResourcePaths::getGuiPath().concatenate(L"code_view/images/pattern_" +
|
||||
utility::decodeFromUtf8(ColorScheme::getInstance()->getColor("code/file/title/hatching")) + L".png"
|
||||
);
|
||||
|
||||
setStyleSheet((
|
||||
@@ -103,23 +104,23 @@ void QtCodeFileTitleButton::updateTexts()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string title = m_filePath.fileName();
|
||||
std::string toolTip = "file: " + m_filePath.str();
|
||||
std::wstring title = m_filePath.wFileName();
|
||||
std::wstring toolTip = L"file: " + m_filePath.wstr();
|
||||
|
||||
if ((!m_filePath.recheckExists()) ||
|
||||
(FileSystem::getLastWriteTime(m_filePath) > m_modificationTime))
|
||||
{
|
||||
title += "*";
|
||||
toolTip = "out of date " + toolTip;
|
||||
title += L"*";
|
||||
toolTip = L"out of date " + toolTip;
|
||||
}
|
||||
|
||||
if (!m_isComplete)
|
||||
{
|
||||
toolTip = "incomplete " + toolTip;
|
||||
toolTip = L"incomplete " + toolTip;
|
||||
}
|
||||
|
||||
setText(title.c_str());
|
||||
setToolTip(toolTip.c_str());
|
||||
setText(QString::fromStdWString(title));
|
||||
setToolTip(QString::fromStdWString(toolTip));
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::updateFromOther(const QtCodeFileTitleButton* other)
|
||||
|
||||
@@ -569,22 +569,22 @@ void QtCodeNavigator::refreshStyle()
|
||||
m_fileButton->setFixedHeight(height);
|
||||
|
||||
m_prevButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "code_view/images/arrow_left.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_left.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_nextButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "code_view/images/arrow_right.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_right.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_listButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "code_view/images/list.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/list.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_fileButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "code_view/images/file.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/file.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n
|
||||
m_title = createScopeLine(layout);
|
||||
if (m_titleId == 0) // title is a file path
|
||||
{
|
||||
m_title->setText(FilePath(m_titleString).fileName().c_str());
|
||||
m_title->setText(QString::fromStdWString(FilePath(m_titleString).wFileName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,7 +100,7 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n
|
||||
m_footer = createScopeLine(layout);
|
||||
if (m_footerId == 0) // footer is a file path
|
||||
{
|
||||
m_footer->setText(FilePath(m_footerString).fileName().c_str());
|
||||
m_footer->setText(QString::fromStdWString(FilePath(m_footerString).wFileName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ void QtListItemWidget::setText(QString text)
|
||||
FilePath relativeRoot = m_list->getRelativeRootDirectory();
|
||||
if (!relativeRoot.empty())
|
||||
{
|
||||
const FilePath path(text.toStdString());
|
||||
const FilePath path(text.toStdWString());
|
||||
const FilePath relPath = path.getRelativeTo(relativeRoot);
|
||||
if (relPath.str().size() < path.str().size())
|
||||
{
|
||||
@@ -100,7 +100,7 @@ void QtListItemWidget::setFocus()
|
||||
|
||||
void QtListItemWidget::handleButtonPress()
|
||||
{
|
||||
FilePath path(m_data->text().toStdString());
|
||||
FilePath path(m_data->text().toStdWString());
|
||||
const FilePath relativeRoot = m_list->getRelativeRootDirectory();
|
||||
if (!path.empty() && !path.isAbsolute() && !relativeRoot.empty())
|
||||
{
|
||||
@@ -141,7 +141,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
|
||||
m_list->setObjectName("list");
|
||||
m_list->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/listbox.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/listbox.css")).c_str());
|
||||
layout->addWidget(m_list, 5);
|
||||
|
||||
QWidget* buttonContainer = new QWidget(this);
|
||||
|
||||
@@ -131,7 +131,7 @@ QtHistoryList::QtHistoryList(const std::vector<SearchMatch>& history, size_t cur
|
||||
}
|
||||
|
||||
setStyleSheet(utility::getStyleSheet(
|
||||
ResourcePaths::getGuiPath().concatenate(FilePath("history_list/history_list.css"))).c_str());
|
||||
ResourcePaths::getGuiPath().concatenate(L"history_list/history_list.css")).c_str());
|
||||
|
||||
connect(m_list, &QListWidget::itemClicked, this, &QtHistoryList::onItemClicked);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void QtLocationPicker::changeEvent(QEvent *event)
|
||||
|
||||
void QtLocationPicker::handleButtonPress()
|
||||
{
|
||||
FilePath path(m_data->text().toStdString());
|
||||
FilePath path(m_data->text().toStdWString());
|
||||
if (!path.empty() && !path.isAbsolute() && !m_relativeRootDirectory.empty())
|
||||
{
|
||||
path = m_relativeRootDirectory.getConcatenated(path);
|
||||
|
||||
@@ -46,7 +46,7 @@ void QtRefreshBar::refreshStyle()
|
||||
m_refreshButton->setFixedHeight(height);
|
||||
|
||||
m_refreshButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "refresh_view/images/refresh.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"refresh_view/images/refresh.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
|
||||
@@ -123,22 +123,22 @@ QtScreenSearchBox::~QtScreenSearchBox()
|
||||
void QtScreenSearchBox::refreshStyle()
|
||||
{
|
||||
m_searchButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "search_view/images/search.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"search_view/images/search.png"),
|
||||
"screen_search/button"
|
||||
));
|
||||
|
||||
m_prevButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "code_view/images/arrow_left.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_left.png"),
|
||||
"screen_search/button"
|
||||
));
|
||||
|
||||
m_nextButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "code_view/images/arrow_right.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_right.png"),
|
||||
"screen_search/button"
|
||||
));
|
||||
|
||||
m_closeButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "screen_search_view/images/close.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"screen_search_view/images/close.png"),
|
||||
"screen_search/button"
|
||||
));
|
||||
|
||||
|
||||
@@ -102,12 +102,12 @@ void QtSearchBar::refreshStyle()
|
||||
m_homeButton->setFixedHeight(m_searchBox->height() + 5);
|
||||
|
||||
m_searchButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "search_view/images/search.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"search_view/images/search.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_homeButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "search_view/images/home.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"search_view/images/home.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ QtStatusBar::QtStatusBar()
|
||||
m_text.setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_text.setSizePolicy(QSizePolicy::Ignored, m_text.sizePolicy().verticalPolicy());
|
||||
addWidget(&m_text, 1);
|
||||
setText("", false, false);
|
||||
setText(L"", false, false);
|
||||
|
||||
connect(&m_text, &QPushButton::clicked, this, &QtStatusBar::showStatus);
|
||||
|
||||
@@ -49,7 +49,7 @@ QtStatusBar::QtStatusBar()
|
||||
connect(&m_errorButton, &QPushButton::clicked, this, &QtStatusBar::showErrors);
|
||||
}
|
||||
|
||||
void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader)
|
||||
void QtStatusBar::setText(const std::wstring& text, bool isError, bool showLoader)
|
||||
{
|
||||
if (isError)
|
||||
{
|
||||
@@ -69,10 +69,10 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
|
||||
m_loader.hide();
|
||||
}
|
||||
|
||||
if (text.size())
|
||||
if (!text.empty())
|
||||
{
|
||||
m_textString = text;
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdWString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ void QtStatusBar::setIdeStatus(const std::string& text)
|
||||
|
||||
void QtStatusBar::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdWString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
}
|
||||
|
||||
void QtStatusBar::showStatus()
|
||||
|
||||
@@ -18,7 +18,7 @@ class QtStatusBar
|
||||
public:
|
||||
QtStatusBar();
|
||||
|
||||
void setText(const std::string& text, bool isError, bool showLoader);
|
||||
void setText(const std::wstring& text, bool isError, bool showLoader);
|
||||
void setErrorCount(ErrorCountInfo errorCount);
|
||||
|
||||
void setIdeStatus(const std::string& text);
|
||||
@@ -33,7 +33,7 @@ private slots:
|
||||
private:
|
||||
std::shared_ptr<QMovie> m_movie;
|
||||
|
||||
std::string m_textString;
|
||||
std::wstring m_textString;
|
||||
|
||||
QPushButton m_text;
|
||||
QLabel m_loader;
|
||||
|
||||
@@ -161,17 +161,17 @@ void QtUndoRedo::refreshStyle()
|
||||
m_historyButton->setFixedHeight(height);
|
||||
|
||||
m_undoButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "undoredo_view/images/arrow_left.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"undoredo_view/images/arrow_left.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_redoButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "undoredo_view/images/arrow_right.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"undoredo_view/images/arrow_right.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_historyButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "undoredo_view/images/history.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"undoredo_view/images/history.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
|
||||
@@ -190,12 +190,12 @@ void QtGraphicsView::updateZoom(float delta)
|
||||
void QtGraphicsView::refreshStyle()
|
||||
{
|
||||
m_zoomInButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/zoom_in.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/zoom_in.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_zoomOutButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/zoom_out.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/zoom_out.png"),
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
|
||||
@@ -212,9 +212,9 @@ namespace utility
|
||||
return QPixmap::fromImage(image);
|
||||
}
|
||||
|
||||
QIcon createButtonIcon(const std::string& iconPath, const std::string& colorId)
|
||||
QIcon createButtonIcon(const FilePath& iconPath, const std::string& colorId)
|
||||
{
|
||||
QPixmap pixmap(iconPath.c_str());
|
||||
QPixmap pixmap(QString::fromStdWString(iconPath.wstr()));
|
||||
|
||||
QIcon icon(utility::colorizePixmap(pixmap, ColorScheme::getInstance()->getColor(colorId + "/icon").c_str()));
|
||||
icon.addPixmap(
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace utility
|
||||
std::string getStyleSheet(const FilePath& path);
|
||||
|
||||
QPixmap colorizePixmap(const QPixmap& pixmap, QColor color);
|
||||
QIcon createButtonIcon(const std::string& iconPath, const std::string& colorId);
|
||||
QIcon createButtonIcon(const FilePath& iconPath, const std::string& colorId);
|
||||
|
||||
void copyNewFilesFromDirectory(QString src, QString dst);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void QtBookmarkView::setCreateButtonState(const CreateButtonState& state)
|
||||
m_createButtonState = state;
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "bookmark_view/images/edit_bookmark_icon.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/edit_bookmark_icon.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
@@ -100,7 +100,7 @@ void QtBookmarkView::setCreateButtonState(const CreateButtonState& state)
|
||||
m_createBookmarkButton->setEnabled(true);
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "bookmark_view/images/bookmark_active.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/bookmark_active.png"),
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
@@ -250,7 +250,7 @@ void QtBookmarkView::showBookmarksClicked()
|
||||
void QtBookmarkView::setStyleSheet()
|
||||
{
|
||||
m_widget->setStyleSheet(utility::getStyleSheet(
|
||||
ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css"))
|
||||
ResourcePaths::getGuiPath().concatenate(L"bookmark_view/bookmark_view.css")
|
||||
).c_str());
|
||||
}
|
||||
|
||||
@@ -262,12 +262,12 @@ void QtBookmarkView::refreshStyle()
|
||||
m_showBookmarksButton->setFixedHeight(height);
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "bookmark_view/images/edit_bookmark_icon.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/edit_bookmark_icon.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_showBookmarksButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "bookmark_view/images/bookmark_list_icon.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/bookmark_list_icon.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ void QtCodeView::setStyleSheet() const
|
||||
{
|
||||
utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("code/background"));
|
||||
|
||||
std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("code_view/code_view.css")));
|
||||
std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"code_view/code_view.css"));
|
||||
|
||||
m_widget->setStyleSheet(styleSheet.c_str());
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void QtDialogView::showUnknownProgressDialog(const std::string& title, const std
|
||||
|
||||
void QtDialogView::hideUnknownProgressDialog()
|
||||
{
|
||||
MessageStatus("", false, false).dispatch();
|
||||
MessageStatus(L"", false, false).dispatch();
|
||||
|
||||
m_onQtThread2(
|
||||
[=]()
|
||||
@@ -104,7 +104,7 @@ void QtDialogView::hideProgressDialog()
|
||||
m_windowStack.popWindow();
|
||||
}
|
||||
|
||||
MessageStatus("", false, false).dispatch();
|
||||
MessageStatus(L"", false, false).dispatch();
|
||||
|
||||
setUIBlocked(false);
|
||||
}
|
||||
@@ -113,7 +113,6 @@ void QtDialogView::hideProgressDialog()
|
||||
setParentWindow(nullptr);
|
||||
}
|
||||
|
||||
|
||||
void QtDialogView::startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info)
|
||||
{
|
||||
@@ -268,11 +267,51 @@ int QtDialogView::confirm(const std::string& message, const std::vector<std::str
|
||||
[=, &result]()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message.c_str());
|
||||
msgBox.setText(QString::fromStdString(message));
|
||||
|
||||
for (const std::string& option : options)
|
||||
{
|
||||
msgBox.addButton(option.c_str(), QMessageBox::AcceptRole);
|
||||
msgBox.addButton(QString::fromStdString(option), QMessageBox::AcceptRole);
|
||||
}
|
||||
|
||||
msgBox.exec();
|
||||
|
||||
for (int i = 0; i < msgBox.buttons().size(); i++)
|
||||
{
|
||||
if (msgBox.clickedButton() == msgBox.buttons().at(i))
|
||||
{
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_resultReady = true;
|
||||
}
|
||||
);
|
||||
|
||||
while (!m_resultReady)
|
||||
{
|
||||
const int SLEEP_TIME_MS = 25;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int QtDialogView::confirm(const std::wstring& message, const std::vector<std::wstring>& options)
|
||||
{
|
||||
int result = -1;
|
||||
m_resultReady = false;
|
||||
|
||||
m_onQtThread2(
|
||||
[=, &result]()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromStdWString(message));
|
||||
|
||||
for (const std::wstring& option : options)
|
||||
{
|
||||
msgBox.addButton(QString::fromStdWString(option), QMessageBox::AcceptRole);
|
||||
}
|
||||
|
||||
msgBox.exec();
|
||||
|
||||
@@ -45,7 +45,8 @@ public:
|
||||
|
||||
virtual void hideDialogs(bool unblockUI = true) override;
|
||||
|
||||
int confirm(const std::string& message, const std::vector<std::string>& options) override;
|
||||
virtual int confirm(const std::string& message, const std::vector<std::string>& options) override;
|
||||
virtual int confirm(const std::wstring& message, const std::vector<std::wstring>& options) override;
|
||||
|
||||
void setParentWindow(QtWindow* window);
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ void QtGraphView::refreshView()
|
||||
|
||||
QtGraphicsView* view = getView();
|
||||
|
||||
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/graph_view.css")));
|
||||
const std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"graph_view/graph_view.css"));
|
||||
view->setStyleSheet(css.c_str());
|
||||
view->setAppZoomFactor(GraphViewStyle::getZoomFactor());
|
||||
view->refreshStyle();
|
||||
@@ -168,12 +168,12 @@ void QtGraphView::refreshView()
|
||||
m_trailWidget->setStyleSheet(css.c_str());
|
||||
|
||||
m_expandButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/graph.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/graph.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_collapseButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/graph_arrow.png",
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/graph_arrow.png"),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
@@ -729,49 +729,49 @@ void QtGraphView::updateTrailButtons()
|
||||
m_trailDepthLabel->setEnabled(message.trailType);
|
||||
m_trailDepthSlider->setEnabled(message.trailType);
|
||||
|
||||
std::string backwardImagePath;
|
||||
std::string forwardImagePath;
|
||||
std::wstring backwardImagePath;
|
||||
std::wstring forwardImagePath;
|
||||
|
||||
if (message.trailType & Edge::EDGE_CALL)
|
||||
{
|
||||
m_backwardTrailButton->setToolTip("show caller graph");
|
||||
m_forwardTrailButton->setToolTip("show callee graph");
|
||||
|
||||
backwardImagePath = "graph_left.png";
|
||||
forwardImagePath = "graph_right.png";
|
||||
backwardImagePath = L"graph_left.png";
|
||||
forwardImagePath = L"graph_right.png";
|
||||
}
|
||||
else if (message.trailType & Edge::EDGE_INHERITANCE)
|
||||
{
|
||||
m_backwardTrailButton->setToolTip("show base hierarchy");
|
||||
m_forwardTrailButton->setToolTip("show derived hierarchy");
|
||||
|
||||
backwardImagePath = "graph_up.png";
|
||||
forwardImagePath = "graph_down.png";
|
||||
backwardImagePath = L"graph_up.png";
|
||||
forwardImagePath = L"graph_down.png";
|
||||
}
|
||||
else if (message.trailType & Edge::EDGE_INCLUDE)
|
||||
{
|
||||
m_backwardTrailButton->setToolTip("show including files hierarchy");
|
||||
m_forwardTrailButton->setToolTip("show included files hierarchy");
|
||||
|
||||
backwardImagePath = "graph_left.png";
|
||||
forwardImagePath = "graph_right.png";
|
||||
backwardImagePath = L"graph_left.png";
|
||||
forwardImagePath = L"graph_right.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_backwardTrailButton->setToolTip("no depth graph available for active symbol");
|
||||
m_forwardTrailButton->setToolTip("no depth graph available for active symbol");
|
||||
|
||||
backwardImagePath = "graph_left.png";
|
||||
forwardImagePath = "graph_right.png";
|
||||
backwardImagePath = L"graph_left.png";
|
||||
forwardImagePath = L"graph_right.png";
|
||||
}
|
||||
|
||||
m_backwardTrailButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/" + backwardImagePath,
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/" + backwardImagePath),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_forwardTrailButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/" + forwardImagePath,
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/" + forwardImagePath),
|
||||
"search/button"
|
||||
));
|
||||
|
||||
@@ -842,7 +842,7 @@ void QtGraphView::switchToNewGraphData()
|
||||
|
||||
if (m_oldGraph && m_oldGraph->getTrailMode() != Graph::TRAIL_NONE)
|
||||
{
|
||||
MessageStatus("Finished graph display").dispatch();
|
||||
MessageStatus(L"Finished graph display").dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,12 +100,12 @@ void QtMainView::hideStartScreen()
|
||||
);
|
||||
}
|
||||
|
||||
void QtMainView::setTitle(const std::string& title)
|
||||
void QtMainView::setTitle(const std::wstring& title)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_window->setWindowTitle(QString::fromStdString(title));
|
||||
m_window->setWindowTitle(QString::fromStdWString(title));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
virtual void refreshView();
|
||||
|
||||
virtual void hideStartScreen();
|
||||
virtual void setTitle(const std::string& title);
|
||||
virtual void setTitle(const std::wstring& title);
|
||||
virtual void activateWindow();
|
||||
|
||||
virtual void updateRecentProjectMenu();
|
||||
|
||||
@@ -36,5 +36,5 @@ void QtRefreshView::refreshView()
|
||||
void QtRefreshView::setStyleSheet()
|
||||
{
|
||||
m_widget->setStyleSheet(utility::getStyleSheet(
|
||||
ResourcePaths::getGuiPath().concatenate(FilePath("refresh_view/refresh_view.css"))).c_str());
|
||||
ResourcePaths::getGuiPath().concatenate(L"refresh_view/refresh_view.css")).c_str());
|
||||
}
|
||||
|
||||
@@ -45,8 +45,11 @@ void QtScreenSearchView::refreshView()
|
||||
m_onQtThread([=]()
|
||||
{
|
||||
m_bar->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(
|
||||
FilePath("screen_search_view/screen_search_view.css"))).c_str()
|
||||
utility::getStyleSheet(
|
||||
ResourcePaths::getGuiPath().concatenate(
|
||||
L"screen_search_view/screen_search_view.css"
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
m_widget->refreshStyle();
|
||||
|
||||
@@ -77,7 +77,7 @@ void QtSearchView::setAutocompletionList(const std::vector<SearchMatch>& autocom
|
||||
|
||||
void QtSearchView::setStyleSheet()
|
||||
{
|
||||
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("search_view/search_view.css")));
|
||||
const std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"search_view/search_view.css"));
|
||||
|
||||
m_widget->setStyleSheet(css.c_str());
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void QtStatusBarView::refreshView()
|
||||
{
|
||||
}
|
||||
|
||||
void QtStatusBarView::showMessage(const std::string& message, bool isError, bool showLoader)
|
||||
void QtStatusBarView::showMessage(const std::wstring& message, bool isError, bool showLoader)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
virtual void refreshView();
|
||||
|
||||
// StatusBar view implementation
|
||||
virtual void showMessage(const std::string& message, bool isError, bool showLoader);
|
||||
virtual void showMessage(const std::wstring& message, bool isError, bool showLoader);
|
||||
virtual void setErrorCount(ErrorCountInfo errorCount);
|
||||
|
||||
virtual void showIdeStatus(const std::string& message);
|
||||
|
||||
@@ -122,7 +122,7 @@ void QtStatusView::addStatus(const std::vector<Status>& status)
|
||||
|
||||
QString statusType = (s.type == StatusType::STATUS_ERROR ? "ERROR" : "INFO");
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::TYPE, new QStandardItem(statusType));
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::STATUS, new QStandardItem(s.message.c_str()));
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::STATUS, new QStandardItem(QString::fromStdWString(s.message)));
|
||||
}
|
||||
|
||||
m_table->updateRows();
|
||||
|
||||
@@ -65,6 +65,6 @@ void QtTabbedView::setStyleSheet()
|
||||
QtViewWidgetWrapper::getWidgetOfView(this), ColorScheme::getInstance()->getColor("tab/background"));
|
||||
|
||||
m_widget->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("tabbed_view/tabbed_view.css"))).c_str()
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"tabbed_view/tabbed_view.css")).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void QtTooltipView::refreshView()
|
||||
m_onQtThread([=]()
|
||||
{
|
||||
m_widget->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("tooltip_view/tooltip_view.css"))).c_str()
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"tooltip_view/tooltip_view.css")).c_str()
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -68,5 +68,6 @@ void QtUndoRedoView::updateHistory(const std::vector<SearchMatch>& searchMatches
|
||||
void QtUndoRedoView::setStyleSheet()
|
||||
{
|
||||
m_widget->setStyleSheet(utility::getStyleSheet(
|
||||
ResourcePaths::getGuiPath().concatenate(FilePath("undoredo_view/undoredo_view.css"))).c_str());
|
||||
ResourcePaths::getGuiPath().concatenate(L"undoredo_view/undoredo_view.css")
|
||||
).c_str());
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ QSize QtAbout::sizeHint() const
|
||||
|
||||
void QtAbout::setupAbout()
|
||||
{
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("about/about.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"about/about.css")).c_str());
|
||||
|
||||
QVBoxLayout* windowLayout = new QVBoxLayout();
|
||||
windowLayout->setContentsMargins(10, 10, 10, 0);
|
||||
@@ -34,7 +34,7 @@ void QtAbout::setupAbout()
|
||||
QHBoxLayout* row = new QHBoxLayout();
|
||||
windowLayout->addLayout(row);
|
||||
{
|
||||
QtDeviceScaledPixmap sourcetrailLogo((ResourcePaths::getGuiPath().str() + "about/logo_sourcetrail.png").c_str());
|
||||
QtDeviceScaledPixmap sourcetrailLogo(QString::fromStdWString(ResourcePaths::getGuiPath().wstr() + L"about/logo_sourcetrail.png"));
|
||||
sourcetrailLogo.scaleToHeight(150);
|
||||
|
||||
QLabel* sourcetrailLogoLabel = new QLabel(this);
|
||||
|
||||
@@ -24,8 +24,8 @@ QtBookmarkBrowser::~QtBookmarkBrowser()
|
||||
void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
{
|
||||
setStyleSheet((
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css")))
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/window.css")) +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"bookmark_view/bookmark_view.css"))
|
||||
).c_str());
|
||||
|
||||
m_headerBackground = new QWidget(m_window);
|
||||
|
||||
@@ -106,8 +106,8 @@ void QtBookmarkCreator::setupBookmarkCreator()
|
||||
void QtBookmarkCreator::refreshStyle()
|
||||
{
|
||||
setStyleSheet((
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css")))
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/window.css")) +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"bookmark_view/bookmark_view.css"))
|
||||
).c_str());
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void QtBookmarkCreator::handleNext()
|
||||
m_controllerProxy->executeAsTaskWithArgs(
|
||||
&BookmarkController::createBookmark, name, comment, category, m_nodeId);
|
||||
|
||||
MessageStatus("Creating Bookmark for active Token").dispatch();
|
||||
MessageStatus(L"Creating Bookmark for active Token").dispatch();
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
@@ -35,7 +35,7 @@ void QtEulaWindow::populateWindow(QWidget* widget)
|
||||
}
|
||||
|
||||
std::shared_ptr<TextAccess> text =
|
||||
TextAccess::createFromFile(FilePath(ResourcePaths::getGuiPath().str() + "installer/EULA.txt"));
|
||||
TextAccess::createFromFile(ResourcePaths::getGuiPath().concatenate(L"installer/EULA.txt"));
|
||||
|
||||
QTextEdit* licenseText = new QTextEdit();
|
||||
licenseText->setObjectName("textField");
|
||||
|
||||
@@ -392,8 +392,8 @@ QBoxLayout* QtIndexingDialog::createLayout()
|
||||
);
|
||||
|
||||
setStyleSheet((
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("indexing_dialog/indexing_dialog.css")))
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/window.css")) +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/indexing_dialog.css"))
|
||||
).c_str());
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
@@ -70,7 +70,7 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget)
|
||||
|
||||
widget->setLayout(layout);
|
||||
|
||||
widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("keyboard_shortcuts/keyboard_shortcuts.css"))).c_str());
|
||||
widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"keyboard_shortcuts/keyboard_shortcuts.css")).c_str());
|
||||
}
|
||||
|
||||
void QtKeyboardShortcuts::windowReady()
|
||||
|
||||
@@ -134,7 +134,7 @@ void QtLicenseWindow::populateWindow(QWidget* widget)
|
||||
void QtLicenseWindow::windowReady()
|
||||
{
|
||||
m_content->setStyleSheet(m_content->styleSheet() +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("license/license.css"))).c_str());
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"license/license.css")).c_str());
|
||||
|
||||
addLogo();
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ QtMainWindow::QtMainWindow()
|
||||
{
|
||||
// can only be done once, because resetting the style on the QCoreApplication causes crash
|
||||
app->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("main/scrollbar.css"))).c_str());
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"main/scrollbar.css")).c_str());
|
||||
}
|
||||
|
||||
m_recentProjectAction = new QAction*[ApplicationSettings::getInstance()->getMaxRecentProjectsCount()];
|
||||
@@ -371,7 +371,7 @@ void QtMainWindow::setContentEnabled(bool enabled)
|
||||
|
||||
void QtMainWindow::refreshStyle()
|
||||
{
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("main/main.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"main/main.css")).c_str());
|
||||
}
|
||||
|
||||
void QtMainWindow::setWindowsTaskbarProgress(float progress)
|
||||
@@ -589,7 +589,7 @@ void QtMainWindow::openProject()
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
MessageLoadProject(FilePath(fileName.toStdString())).dispatch();
|
||||
MessageLoadProject(FilePath(fileName.toStdWString())).dispatch();
|
||||
m_windowStack.clearWindows();
|
||||
}
|
||||
}
|
||||
@@ -692,7 +692,7 @@ void QtMainWindow::resetWindowLayout()
|
||||
{
|
||||
FileSystem::remove(UserPaths::getWindowSettingsPath());
|
||||
FileSystem::copyFile(
|
||||
ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")),
|
||||
ResourcePaths::getFallbackPath().concatenate(L"window_settings.ini"),
|
||||
UserPaths::getWindowSettingsPath()
|
||||
);
|
||||
loadDockWidgetLayout();
|
||||
@@ -703,7 +703,7 @@ void QtMainWindow::openRecentProject()
|
||||
QAction *action = qobject_cast<QAction*>(sender());
|
||||
if (action)
|
||||
{
|
||||
MessageLoadProject(FilePath(action->data().toString().toStdString())).dispatch();
|
||||
MessageLoadProject(FilePath(action->data().toString().toStdWString())).dispatch();
|
||||
m_windowStack.clearWindows();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ std::vector<FilePath> QtSelectPathsDialog::getPathsList() const
|
||||
{
|
||||
if (m_list->item(i)->checkState() == Qt::Checked)
|
||||
{
|
||||
checkedPaths.push_back(FilePath(m_list->item(i)->text().toStdString()));
|
||||
checkedPaths.push_back(FilePath(m_list->item(i)->text().toStdWString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ void QtRecentProjectButton::setProjectPath(const FilePath& projectFilePath)
|
||||
{
|
||||
m_projectFilePath = projectFilePath;
|
||||
m_projectExists = projectFilePath.exists();
|
||||
this->setText(m_projectFilePath.withoutExtension().fileName().c_str());
|
||||
this->setText(QString::fromStdWString(m_projectFilePath.withoutExtension().wFileName()));
|
||||
if (m_projectExists)
|
||||
{
|
||||
this->setToolTip(m_projectFilePath.str().c_str());
|
||||
@@ -82,13 +82,12 @@ void QtRecentProjectButton::handleButtonClick()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QtStartScreen::QtStartScreen(QWidget *parent)
|
||||
: QtWindow(true, parent)
|
||||
, m_cppIcon((ResourcePaths::getGuiPath().str() + "icon/cpp_icon.png").c_str())
|
||||
, m_cIcon((ResourcePaths::getGuiPath().str() + "icon/c_icon.png").c_str())
|
||||
, m_javaIcon((ResourcePaths::getGuiPath().str() + "icon/java_icon.png").c_str())
|
||||
, m_projectIcon((ResourcePaths::getGuiPath().str() + "icon/empty_icon.png").c_str())
|
||||
, m_cppIcon(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"icon/cpp_icon.png").wstr()))
|
||||
, m_cIcon(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"icon/c_icon.png").wstr()))
|
||||
, m_javaIcon(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"icon/java_icon.png").wstr()))
|
||||
, m_projectIcon(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"icon/empty_icon.png").wstr()))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -142,15 +141,15 @@ void QtStartScreen::updateButtons()
|
||||
}
|
||||
i++;
|
||||
}
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("startscreen/startscreen.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"startscreen/startscreen.css")).c_str());
|
||||
}
|
||||
|
||||
void QtStartScreen::setupStartScreen()
|
||||
{
|
||||
License license;
|
||||
license.loadFromEncodedString(ApplicationSettings::getInstance()->getLicenseString(), AppPath::getAppPath());
|
||||
license.loadFromEncodedString(ApplicationSettings::getInstance()->getLicenseString(), AppPath::getAppPath().str());
|
||||
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("startscreen/startscreen.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"startscreen/startscreen.css")).c_str());
|
||||
addLogo();
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
|
||||
@@ -88,7 +88,7 @@ QSize QtWindow::sizeHint() const
|
||||
|
||||
void QtWindow::setup()
|
||||
{
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/window.css")).c_str());
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(10, 10, 10, 10);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityApp.h"
|
||||
#include "utility/utilityPathDetection.h"
|
||||
#include "utility/utilityQString.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/utilityUuid.h"
|
||||
|
||||
@@ -74,7 +75,7 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::ve
|
||||
|
||||
if (m_projectSettings->getProjectFilePath().empty())
|
||||
{
|
||||
m_projectSettings->setProjectFilePath(filePath.withoutExtension().fileName(), filePath.getParentDirectory());
|
||||
m_projectSettings->setProjectFilePath(filePath.withoutExtension().wFileName(), filePath.getParentDirectory());
|
||||
}
|
||||
|
||||
if (!m_contentWidget)
|
||||
@@ -841,7 +842,12 @@ void QtProjectWizzard::dependenciesJava()
|
||||
void QtProjectWizzard::sourcePathsJavaMaven()
|
||||
{
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_newSourceGroupSettings)->setMavenDependenciesDirectory(
|
||||
FilePath("./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/" + m_newSourceGroupSettings->getId() + "/maven")
|
||||
FilePath(
|
||||
L"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), L" ", L"_") +
|
||||
L"/" +
|
||||
utility::decodeFromUtf8(m_newSourceGroupSettings->getId()) +
|
||||
L"/maven"
|
||||
)
|
||||
);
|
||||
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
@@ -860,7 +866,12 @@ void QtProjectWizzard::sourcePathsJavaMaven()
|
||||
void QtProjectWizzard::sourcePathsJavaGradle()
|
||||
{
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_newSourceGroupSettings)->setGradleDependenciesDirectory(
|
||||
FilePath("./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/" + m_newSourceGroupSettings->getId() + "/gradle")
|
||||
FilePath(
|
||||
L"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), L" ", L"_") +
|
||||
L"/" +
|
||||
utility::decodeFromUtf8(m_newSourceGroupSettings->getId()) +
|
||||
L"/gradle"
|
||||
)
|
||||
);
|
||||
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
@@ -938,7 +949,7 @@ void QtProjectWizzard::createProject()
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageStatus("Created project: " + path.str()).dispatch();
|
||||
MessageStatus(L"Created project: " + path.wstr()).dispatch();
|
||||
}
|
||||
|
||||
MessageLoadProject(path, settingsChanged).dispatch();
|
||||
|
||||
@@ -60,7 +60,7 @@ bool QtProjectWizzardContentPath::check()
|
||||
break;
|
||||
}
|
||||
|
||||
FilePath path = m_settings->makePathExpandedAndAbsolute(FilePath(m_picker->getText().toStdString()));
|
||||
FilePath path = m_settings->makePathExpandedAndAbsolute(FilePath(m_picker->getText().toStdWString()));
|
||||
|
||||
if (m_picker->pickDirectory())
|
||||
{
|
||||
@@ -157,7 +157,7 @@ void QtProjectWizzardContentPathCDB::save()
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdWString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void QtProjectWizzardContentPathSourceMaven::save()
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdWString()));
|
||||
settings->setShouldIndexMavenTests(m_shouldIndexTests->isChecked());
|
||||
}
|
||||
}
|
||||
@@ -240,8 +240,8 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
|
||||
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
|
||||
if (!success)
|
||||
{
|
||||
const std::string dialogMessage =
|
||||
"Sourcetrail was unable to locate Maven on this machine.\n"
|
||||
const std::wstring dialogMessage =
|
||||
L"Sourcetrail was unable to locate Maven on this machine.\n"
|
||||
"Please make sure to provide the correct Maven Path in the preferences.";
|
||||
|
||||
MessageStatus(dialogMessage, true, false).dispatch();
|
||||
@@ -308,7 +308,7 @@ void QtProjectWizzardContentPathDependenciesMaven::save()
|
||||
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdWString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ void QtProjectWizzardContentPathSourceGradle::save()
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setGradleProjectFilePath(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setGradleProjectFilePath(FilePath(m_picker->getText().toStdWString()));
|
||||
settings->setShouldIndexGradleTests(m_shouldIndexTests->isChecked());
|
||||
}
|
||||
}
|
||||
@@ -439,6 +439,6 @@ void QtProjectWizzardContentPathDependenciesGradle::save()
|
||||
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setGradleDependenciesDirectory(FilePath(m_picker->getText().toStdString()));
|
||||
settings->setGradleDependenciesDirectory(FilePath(m_picker->getText().toStdWString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
|
||||
m_colorSchemes = addComboBox("Color Scheme", "", layout, row);
|
||||
for (size_t i = 0; i < m_colorSchemePaths.size(); i++)
|
||||
{
|
||||
m_colorSchemes->insertItem(i, m_colorSchemePaths[i].withoutExtension().fileName().c_str());
|
||||
m_colorSchemes->insertItem(i, QString::fromStdWString(m_colorSchemePaths[i].withoutExtension().wFileName()));
|
||||
}
|
||||
connect(m_colorSchemes, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
||||
this, &QtProjectWizzardContentPreferences::colorSchemeChanged);
|
||||
@@ -411,7 +411,7 @@ void QtProjectWizzardContentPreferences::load()
|
||||
|
||||
if (m_javaPath)
|
||||
{
|
||||
m_javaPath->setText(QString::fromStdString(appSettings->getJavaPath()));
|
||||
m_javaPath->setText(QString::fromStdWString(appSettings->getJavaPath().wstr()));
|
||||
}
|
||||
|
||||
m_jvmMaximumMemory->setText(QString::number(appSettings->getJavaMaximumMemory()));
|
||||
@@ -472,7 +472,7 @@ void QtProjectWizzardContentPreferences::save()
|
||||
|
||||
if (m_javaPath)
|
||||
{
|
||||
appSettings->setJavaPath(FilePath(m_javaPath->getText().toStdString()));
|
||||
appSettings->setJavaPath(FilePath(m_javaPath->getText().toStdWString()));
|
||||
}
|
||||
|
||||
appSettings->setJreSystemLibraryPaths(m_jreSystemLibraryPaths->getList());
|
||||
@@ -482,7 +482,7 @@ void QtProjectWizzardContentPreferences::save()
|
||||
|
||||
if (m_mavenPath)
|
||||
{
|
||||
appSettings->setMavenPath(FilePath(m_mavenPath->getText().toStdString()));
|
||||
appSettings->setMavenPath(FilePath(m_mavenPath->getText().toStdWString()));
|
||||
}
|
||||
|
||||
appSettings->save();
|
||||
|
||||
@@ -56,15 +56,15 @@ void QtProjectWizzardContentProjectData::populate(QGridLayout* layout, int& row)
|
||||
|
||||
void QtProjectWizzardContentProjectData::load()
|
||||
{
|
||||
m_projectName->setText(QString::fromStdString(m_projectSettings->getProjectName()));
|
||||
m_projectFileLocation->setText(QString::fromStdString(m_projectSettings->getProjectDirectoryPath().str()));
|
||||
m_projectName->setText(QString::fromStdWString(m_projectSettings->getProjectName()));
|
||||
m_projectFileLocation->setText(QString::fromStdWString(m_projectSettings->getProjectDirectoryPath().wstr()));
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentProjectData::save()
|
||||
{
|
||||
m_projectSettings->setProjectFilePath(
|
||||
m_projectName->text().toStdString(),
|
||||
FilePath(m_projectFileLocation->getText().toStdString())
|
||||
m_projectName->text().toStdWString(),
|
||||
FilePath(m_projectFileLocation->getText().toStdWString())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ bool QtProjectWizzardContentProjectData::check()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<FilePath> paths = FilePath(m_projectFileLocation->getText().toStdString()).expandEnvironmentVariables();
|
||||
std::vector<FilePath> paths = FilePath(m_projectFileLocation->getText().toStdWString()).expandEnvironmentVariables();
|
||||
if (paths.size() != 1 || !paths[0].exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
|
||||
@@ -29,13 +29,9 @@ std::vector<FilePath> CxxVs10To14HeaderPathDetector::getPaths() const
|
||||
std::vector<FilePath> headerSearchPaths;
|
||||
if (vsInstallPath.exists())
|
||||
{
|
||||
std::vector<std::string> subdirectories;
|
||||
subdirectories.push_back("vc/include");
|
||||
subdirectories.push_back("vc/atlmfc/include");
|
||||
|
||||
for (size_t i = 0; i < subdirectories.size(); i++)
|
||||
for (const std::wstring& subdirectory : { L"vc/include" , L"vc/atlmfc/include" })
|
||||
{
|
||||
FilePath headerSearchPath = vsInstallPath.getConcatenated(FilePath(subdirectories[i]));
|
||||
FilePath headerSearchPath = vsInstallPath.getConcatenated(subdirectory);
|
||||
if (headerSearchPath.exists())
|
||||
{
|
||||
headerSearchPaths.push_back(headerSearchPath.makeCanonical());
|
||||
@@ -98,7 +94,7 @@ FilePath CxxVs10To14HeaderPathDetector::getVsInstallPathUsingRegistry() const
|
||||
QSettings expressKey(key, QSettings::NativeFormat); // NativeFormat means from Registry on Windows.
|
||||
QString value = expressKey.value("InstallDir").toString() + "../../";
|
||||
|
||||
FilePath path(value.toStdString());
|
||||
FilePath path(value.toStdWString());
|
||||
if (path.exists())
|
||||
{
|
||||
return path;
|
||||
|
||||
@@ -22,7 +22,7 @@ std::vector<FilePath> CxxVs15HeaderPathDetector::getPaths() const
|
||||
std::vector<FilePath> headerSearchPaths;
|
||||
|
||||
{
|
||||
const std::vector<FilePath> expandedPaths = FilePath("%ProgramFiles(x86)%/Microsoft Visual Studio/Installer/vswhere.exe").expandEnvironmentVariables();
|
||||
const std::vector<FilePath> expandedPaths = FilePath(L"%ProgramFiles(x86)%/Microsoft Visual Studio/Installer/vswhere.exe").expandEnvironmentVariables();
|
||||
if (!expandedPaths.empty())
|
||||
{
|
||||
const std::string command = "\"" + expandedPaths[0].str() + "\" -latest -property installationPath";
|
||||
@@ -32,16 +32,16 @@ std::vector<FilePath> CxxVs15HeaderPathDetector::getPaths() const
|
||||
const FilePath vsInstallPath(output);
|
||||
if (vsInstallPath.exists())
|
||||
{
|
||||
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(vsInstallPath.getConcatenated(FilePath("VC/Tools/MSVC"))))
|
||||
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(vsInstallPath.getConcatenated(L"VC/Tools/MSVC")))
|
||||
{
|
||||
if (versionPath.exists())
|
||||
{
|
||||
headerSearchPaths.push_back(versionPath.getConcatenated(FilePath("include")));
|
||||
headerSearchPaths.push_back(versionPath.getConcatenated(FilePath("atlmfc/include")));
|
||||
headerSearchPaths.push_back(versionPath.getConcatenated(L"include"));
|
||||
headerSearchPaths.push_back(versionPath.getConcatenated(L"atlmfc/include"));
|
||||
}
|
||||
}
|
||||
headerSearchPaths.push_back(vsInstallPath.getConcatenated(FilePath("VC/Auxiliary/VS/include")));
|
||||
headerSearchPaths.push_back(vsInstallPath.getConcatenated(FilePath("VC/Auxiliary/VS/UnitTest/include")));
|
||||
headerSearchPaths.push_back(vsInstallPath.getConcatenated(L"VC/Auxiliary/VS/include"));
|
||||
headerSearchPaths.push_back(vsInstallPath.getConcatenated(L"VC/Auxiliary/VS/UnitTest/include"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,18 +44,13 @@ namespace utility
|
||||
const FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, windowsSdkVersions[i]);
|
||||
if (sdkPath.exists())
|
||||
{
|
||||
const FilePath sdkIncludePath = sdkPath.getConcatenated(FilePath("include/"));
|
||||
const FilePath sdkIncludePath = sdkPath.getConcatenated(L"include/");
|
||||
if (sdkIncludePath.exists())
|
||||
{
|
||||
std::vector<std::string> subdirectories;
|
||||
subdirectories.push_back("shared");
|
||||
subdirectories.push_back("um");
|
||||
subdirectories.push_back("winrt");
|
||||
|
||||
bool usingSubdirectories = false;
|
||||
for (size_t j = 0; j < subdirectories.size(); j++)
|
||||
for (const std::wstring subDirectory : { L"shared", L"um", L"winrt" })
|
||||
{
|
||||
const FilePath sdkSubdirectory = sdkIncludePath.getConcatenated(FilePath(subdirectories[j]));
|
||||
const FilePath sdkSubdirectory = sdkIncludePath.getConcatenated(subDirectory);
|
||||
if (sdkSubdirectory.exists())
|
||||
{
|
||||
headerSearchPaths.push_back(sdkSubdirectory);
|
||||
@@ -75,9 +70,9 @@ namespace utility
|
||||
const FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, "v10.0");
|
||||
if (sdkPath.exists())
|
||||
{
|
||||
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(sdkPath.getConcatenated(FilePath("include/"))))
|
||||
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(sdkPath.getConcatenated(L"include/")))
|
||||
{
|
||||
const FilePath ucrtPath = versionPath.getConcatenated(FilePath("ucrt"));
|
||||
const FilePath ucrtPath = versionPath.getConcatenated(L"ucrt");
|
||||
if (ucrtPath.exists())
|
||||
{
|
||||
headerSearchPaths.push_back(ucrtPath);
|
||||
@@ -102,7 +97,7 @@ namespace utility
|
||||
QSettings expressKey(key, QSettings::NativeFormat); // NativeFormat means from Registry on Windows.
|
||||
QString value = expressKey.value("InstallationFolder").toString();
|
||||
|
||||
FilePath path(value.toStdString());
|
||||
FilePath path(value.toStdWString());
|
||||
if (path.exists())
|
||||
{
|
||||
return path;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
const char jvmLibPathRelativeToJavaExecutable[] = "/../lib/amd64/server/libjvm.so";
|
||||
const wchar_t jvmLibPathRelativeToJavaExecutable[] = L"/../lib/amd64/server/libjvm.so";
|
||||
#else
|
||||
const char jvmLibPathRelativeToJavaExecutable[] = "/../lib/i386/server/libjvm.so";
|
||||
const wchar_t jvmLibPathRelativeToJavaExecutable[] = L"/../lib/i386/server/libjvm.so";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ FilePath JavaPathDetectorLinux::getJavaInPath() const
|
||||
std::string command = "which java";
|
||||
std::string output = utility::executeProcess(command.c_str());
|
||||
|
||||
if (output.size())
|
||||
if (!output.empty())
|
||||
{
|
||||
output = utility::trim(output);
|
||||
|
||||
@@ -52,7 +52,7 @@ FilePath JavaPathDetectorLinux::readLink(const FilePath& path) const
|
||||
|
||||
FilePath JavaPathDetectorLinux::getFilePathRelativeToJavaExecutable(FilePath& javaExecutablePath) const
|
||||
{
|
||||
FilePath p(javaExecutablePath.getParentDirectory().str() + jvmLibPathRelativeToJavaExecutable);
|
||||
FilePath p = javaExecutablePath.getParentDirectory().concatenate(jvmLibPathRelativeToJavaExecutable);
|
||||
if (p.exists())
|
||||
{
|
||||
return p.makeCanonical();
|
||||
@@ -90,20 +90,20 @@ std::vector<FilePath> JavaPathDetectorLinux::getPaths() const
|
||||
{
|
||||
std::vector<FilePath> paths;
|
||||
FilePath p = getJavaInPath();
|
||||
if( !p.empty() )
|
||||
if(!p.empty())
|
||||
{
|
||||
paths.push_back(p);
|
||||
}
|
||||
p = getJavaInJavaHome();
|
||||
if( !p.empty() )
|
||||
if(!p.empty())
|
||||
{
|
||||
paths.push_back(p);
|
||||
}
|
||||
|
||||
// some default paths for java
|
||||
paths.push_back(FilePath("/etc/alternatives/java"));
|
||||
paths.push_back(FilePath("/usr/lib/jvm/default/bin/java"));
|
||||
paths.push_back(FilePath("/usr/lib/jvm/java-openjdk/bin/java"));
|
||||
paths.push_back(FilePath(L"/etc/alternatives/java"));
|
||||
paths.push_back(FilePath(L"/usr/lib/jvm/default/bin/java"));
|
||||
paths.push_back(FilePath(L"/usr/lib/jvm/java-openjdk/bin/java"));
|
||||
|
||||
for (const FilePath& path : paths )
|
||||
{
|
||||
|
||||
@@ -21,14 +21,14 @@ std::vector<FilePath> JavaPathDetectorMac::getPaths() const
|
||||
std::string command = "/usr/libexec/java_home";
|
||||
std::string output = utility::executeProcess(command.c_str());
|
||||
|
||||
if (output.size())
|
||||
if (!output.empty())
|
||||
{
|
||||
javaPath = FilePath(utility::trim(output) + "/jre/lib/jli/libjli.dylib");
|
||||
}
|
||||
|
||||
if (!javaPath.exists())
|
||||
{
|
||||
javaPath = FilePath("/usr/lib/libjli.dylib");
|
||||
javaPath = FilePath(L"/usr/lib/libjli.dylib");
|
||||
}
|
||||
|
||||
if (!javaPath.exists() && output.size())
|
||||
@@ -38,7 +38,7 @@ std::vector<FilePath> JavaPathDetectorMac::getPaths() const
|
||||
|
||||
if (!javaPath.exists())
|
||||
{
|
||||
javaPath = FilePath("/usr/lib/libjvm.dylib");
|
||||
javaPath = FilePath(L"/usr/lib/libjvm.dylib");
|
||||
}
|
||||
|
||||
if (javaPath.exists())
|
||||
|
||||
@@ -29,7 +29,7 @@ std::vector<FilePath> JavaPathDetectorWindows::getPaths() const
|
||||
QSettings expressKey(key, QSettings::NativeFormat); // NativeFormat means from Registry on Windows.
|
||||
QString value = expressKey.value("RuntimeLib").toString();
|
||||
|
||||
FilePath path(value.toStdString());
|
||||
FilePath path(value.toStdWString());
|
||||
|
||||
std::vector<FilePath> paths;
|
||||
if (path.exists())
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ std::vector<FilePath> JreSystemLibraryPathDetector::getPaths() const
|
||||
for (const FilePath& jrePath: m_javaPathDetector->getPaths())
|
||||
{
|
||||
const FilePath javaRoot = jrePath.getParentDirectory().getParentDirectory().getParentDirectory();
|
||||
for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.getConcatenated(FilePath("lib")), {".jar"}))
|
||||
for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.getConcatenated(L"lib"), {".jar"}))
|
||||
{
|
||||
paths.push_back(jarPath);
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ bool utility::saveLicense(const License* license)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string appLocation = AppPath::getAppPath();
|
||||
appSettings->setLicenseString(license->getLicenseEncodedString(appLocation));
|
||||
appSettings->setLicenseCheck(license->hashLocation(FilePath(appLocation).makeAbsolute().str()));
|
||||
const FilePath appLocation = AppPath::getAppPath();
|
||||
appSettings->setLicenseString(license->getLicenseEncodedString(appLocation.str()));
|
||||
appSettings->setLicenseCheck(license->hashLocation(appLocation.getAbsolute().str()));
|
||||
appSettings->save();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "utility/utilityQString.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
std::wstring utility::decodeFromUtf8(std::string s)
|
||||
{
|
||||
QString qs = QString::fromUtf8(s.c_str());
|
||||
return qs.toStdWString();
|
||||
}
|
||||
|
||||
std::string utility::encodeToUtf8(std::wstring s)
|
||||
{
|
||||
QString qs = QString::fromStdWString(s);
|
||||
return qs.toUtf8().toStdString();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef UTILITY_Q_STRING_H
|
||||
#define UTILITY_Q_STRING_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace utility
|
||||
{
|
||||
std::wstring decodeFromUtf8(std::string s);
|
||||
std::string encodeToUtf8(std::wstring s);
|
||||
}
|
||||
|
||||
#endif // UTILITY_Q_STRING_H
|
||||
|
||||
Reference in New Issue
Block a user