ui: use wstring in gui relates places
* loading icons * loading fonts * context menu action for copy path to clipboard * context menu action for open containing folder
This commit is contained in:
@@ -113,8 +113,8 @@ void QtContextMenu::redoActionTriggered()
|
||||
|
||||
void QtContextMenu::copyFullPathActionTriggered()
|
||||
{
|
||||
const std::string pathString = (QSysInfo::windowsVersion() != QSysInfo::WV_None) ? s_filePath.getBackslashedString() : s_filePath.str();
|
||||
QApplication::clipboard()->setText(pathString.c_str());
|
||||
const std::wstring pathString = (QSysInfo::windowsVersion() != QSysInfo::WV_None) ? s_filePath.getBackslashedWString() : s_filePath.wstr();
|
||||
QApplication::clipboard()->setText(QString::fromStdWString(pathString));
|
||||
}
|
||||
|
||||
void QtContextMenu::openContainingFolderActionTriggered()
|
||||
@@ -122,11 +122,11 @@ void QtContextMenu::openContainingFolderActionTriggered()
|
||||
FilePath dir = s_filePath.getParentDirectory();
|
||||
if (dir.exists())
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(("file:///" + dir.str()).c_str(), QUrl::TolerantMode));
|
||||
QDesktopServices::openUrl(QUrl(QString::fromStdWString(L"file:///" + dir.wstr()), QUrl::TolerantMode));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to open directory: " + dir.str());
|
||||
LOG_ERROR(L"Unable to open directory: " + dir.wstr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
QStringList QtFileDialog::getFileNamesAndDirectories(QWidget* parent, const FilePath& path)
|
||||
{
|
||||
const QString dir = getDir(QString::fromStdString((path.isDirectory() ? path : path.getParentDirectory()).str()));
|
||||
const QString dir = getDir(QString::fromStdWString((path.isDirectory() ? path : path.getParentDirectory()).wstr()));
|
||||
|
||||
QFileDialog* dialog = (utility::getOsType() == OS_MAC ? new QFileDialog(parent) : new QtFilesAndDirectoriesDialog(parent));
|
||||
|
||||
@@ -43,12 +43,12 @@ QStringList QtFileDialog::getFileNamesAndDirectories(QWidget* parent, const File
|
||||
|
||||
QString QtFileDialog::getExistingDirectory(QWidget* parent, const QString& caption, const FilePath& dir)
|
||||
{
|
||||
return QFileDialog::getExistingDirectory(parent, caption, getDir(QString::fromStdString(dir.str())));
|
||||
return QFileDialog::getExistingDirectory(parent, caption, getDir(QString::fromStdWString(dir.wstr())));
|
||||
}
|
||||
|
||||
QString QtFileDialog::getOpenFileName(QWidget* parent, const QString& caption, const FilePath& dir, const QString& filter)
|
||||
{
|
||||
return QFileDialog::getOpenFileName(parent, caption, getDir(QString::fromStdString(dir.str())), filter);
|
||||
return QFileDialog::getOpenFileName(parent, caption, getDir(QString::fromStdWString(dir.wstr())), filter);
|
||||
}
|
||||
|
||||
QString QtFileDialog::showSaveFileDialog(
|
||||
@@ -56,10 +56,10 @@ QString QtFileDialog::showSaveFileDialog(
|
||||
{
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
|
||||
return QFileDialog::getSaveFileName(parent, title, getDir(QString::fromStdString(directory.str())), filter);
|
||||
return QFileDialog::getSaveFileName(parent, title, getDir(QString::fromStdWString(directory.wstr())), filter);
|
||||
|
||||
#else
|
||||
QFileDialog dialog(parent, title, getDir(QString::fromStdString(directory.str())), filter);
|
||||
QFileDialog dialog(parent, title, getDir(QString::fromStdWString(directory.wstr())), filter);
|
||||
|
||||
if (parent)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace utility
|
||||
|
||||
for (const FilePath& fontFilePath: fontFilePaths)
|
||||
{
|
||||
QFile file(fontFilePath.str().c_str());
|
||||
QFile file(QString::fromStdWString(fontFilePath.wstr()));
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
int id = QFontDatabase::addApplicationFontFromData(file.readAll());
|
||||
@@ -62,7 +62,7 @@ namespace utility
|
||||
{
|
||||
for (QString& family: QFontDatabase::applicationFontFamilies(loadedFontId))
|
||||
{
|
||||
LOG_INFO("Loaded FontFamily: " + family.toStdString());
|
||||
LOG_INFO(L"Loaded FontFamily: " + family.toStdWString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace utility
|
||||
std::deque<std::string> seq = utility::split(css.substr(posA + 1, posB - posA - 1), ':');
|
||||
if (seq.size() != 2)
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path.str());
|
||||
LOG_ERROR(L"Syntax error in file: " + path.wstr());
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace utility
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path.str());
|
||||
LOG_ERROR(L"Syntax error in file: " + path.wstr());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace utility
|
||||
std::vector<std::string> values = utility::splitToVector(val, '|');
|
||||
if (values.size() != 3)
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path.str());
|
||||
LOG_ERROR(L"Syntax error in file: " + path.wstr());
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace utility
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path.str());
|
||||
LOG_ERROR(L"Syntax error in file: " + path.wstr());
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user