mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-08 13:15:01 +00:00
Editor: Disable implicit Qt string conversions
Requires that our format conversions be explicit.
This commit is contained in:
@@ -52,7 +52,7 @@ void CExportGameDialog::InitUI(QString ExportDir)
|
||||
CGameInfo GameInfo;
|
||||
GameInfo.LoadGameInfo(mGame);
|
||||
|
||||
ExportDir.replace('\\', '/');
|
||||
ExportDir.replace(QLatin1Char{'\\'}, QLatin1Char{'/'});
|
||||
|
||||
TString DefaultNameMapPath = CAssetNameMap::DefaultNameMapPath(mGame);
|
||||
if (!FileUtil::Exists(DefaultNameMapPath)) DefaultNameMapPath = "";
|
||||
@@ -68,7 +68,7 @@ void CExportGameDialog::InitUI(QString ExportDir)
|
||||
mpUI->GameTitleLineEdit->setText( TO_QSTRING(mGameTitle) );
|
||||
mpUI->GameIdLineEdit->setText( TO_QSTRING(mGameID) );
|
||||
mpUI->BuildVersionLineEdit->setText(tr("%1 (%2)").arg(mBuildVer).arg(TO_QSTRING(GameInfo.GetBuildName(mBuildVer, mRegion))));
|
||||
mpUI->RegionLineEdit->setText(TEnumReflection<ERegion>::ConvertValueToString(mRegion));
|
||||
mpUI->RegionLineEdit->setText(QString::fromUtf8(TEnumReflection<ERegion>::ConvertValueToString(mRegion)));
|
||||
|
||||
// Disc tree widget
|
||||
nod::IPartition *pPartition = mpDisc->getDataPartition();
|
||||
|
||||
@@ -219,7 +219,7 @@ void CGeneratePropertyNamesDialog::OnTreeItemDoubleClicked(QTreeWidgetItem* pIte
|
||||
|
||||
const QString Text = pItem->text(0);
|
||||
|
||||
if (!Text.endsWith(".xml"))
|
||||
if (!Text.endsWith(QStringLiteral(".xml")))
|
||||
return;
|
||||
|
||||
const TString TStrText = TO_TSTRING(Text);
|
||||
|
||||
@@ -121,6 +121,14 @@ target_compile_definitions(
|
||||
"APP_VERSION=\"${PROJECT_VERSION}\""
|
||||
"APP_FULL_NAME=\"${PWE_APP_NAME} ${PWE_WC_DESCRIBE}\""
|
||||
UNICODE
|
||||
|
||||
# Ensures conversions to internal strings and Qt strings are explicit
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
QT_NO_CAST_FROM_BYTEARRAY
|
||||
QT_NO_CAST_TO_ASCII
|
||||
|
||||
# Disable deprecated Qt snprintf functions
|
||||
QT_NO_QSNPRINTF
|
||||
)
|
||||
|
||||
gather_include_directories(pwe_editor_include_directories pwe_editor)
|
||||
|
||||
@@ -105,7 +105,7 @@ void CProjectSettingsDialog::SetupPackagesList()
|
||||
|
||||
QString PackageName = TO_QSTRING(pPackage->Name());
|
||||
if (pPackage->NeedsRecook())
|
||||
PackageName += '*';
|
||||
PackageName += QLatin1Char{'*'};
|
||||
mpUI->PackagesList->addItem(PackageName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "ui_CTweakEditor.h"
|
||||
#include "Editor/Undo/IUndoCommand.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
/** Internal undo command for changing tabs */
|
||||
class CSetTweakIndexCommand : public IUndoCommand
|
||||
{
|
||||
@@ -10,7 +12,7 @@ class CSetTweakIndexCommand : public IUndoCommand
|
||||
|
||||
public:
|
||||
CSetTweakIndexCommand(CTweakEditor* pEditor, int OldIndex, int NewIndex)
|
||||
: IUndoCommand("Change Tab")
|
||||
: IUndoCommand(QCoreApplication::translate("CSetTweakIndexCommand", "Change Tab"))
|
||||
, mpEditor(pEditor)
|
||||
, mOldIndex(OldIndex)
|
||||
, mNewIndex(NewIndex)
|
||||
|
||||
@@ -20,7 +20,7 @@ QString MacOSPathToDolphinBinary()
|
||||
/* Filter to accumulate relative coordinates of middle and right mouse drags for camera control. */
|
||||
bool MouseDragCocoaEventFilter::nativeEventFilter(const QByteArray& eventType, void* message, long*)
|
||||
{
|
||||
if (eventType == "mac_generic_NSEvent")
|
||||
if (eventType == QByteArrayLiteral("mac_generic_NSEvent"))
|
||||
{
|
||||
NSEvent* event = static_cast<NSEvent*>(message);
|
||||
NSEventType evType = event.type;
|
||||
|
||||
@@ -754,7 +754,7 @@ void CModelEditorWindow::Import()
|
||||
|
||||
SetActiveModel(pModel);
|
||||
SET_WINDOWTITLE_APPVARS(tr("%APP_FULL_NAME% - Model Editor: Untitled"));
|
||||
mOutputFilename = "";
|
||||
mOutputFilename.clear();
|
||||
gpResourceStore->DestroyUnreferencedResources();
|
||||
}
|
||||
|
||||
@@ -785,7 +785,7 @@ void CModelEditorWindow::ConvertToDDS()
|
||||
|
||||
void CModelEditorWindow::ConvertToTXTR()
|
||||
{
|
||||
QString Input = QFileDialog::getOpenFileName(this, "DirectDraw Surface (*.dds)", "", "*.dds");
|
||||
QString Input = QFileDialog::getOpenFileName(this, tr("DirectDraw Surface (*.dds)"), QString(), QStringLiteral("*.dds"));
|
||||
if (Input.isEmpty()) return;
|
||||
|
||||
TString TexFilename = TO_TSTRING(Input);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Editor/UICommon.h"
|
||||
#include "Editor/SDolHeader.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include <QOverload>
|
||||
@@ -109,8 +110,8 @@ EQuickplayLaunchResult LaunchQuickplay(QWidget* pParentWidget,
|
||||
// Check if quickplay is already running
|
||||
if (gpDolphinProcess && gpDolphinProcess->state() != QProcess::NotRunning)
|
||||
{
|
||||
if (UICommon::YesNoQuestion(pParentWidget, "Quickplay",
|
||||
"Quickplay is already running. Close the existing session and relaunch?"))
|
||||
if (UICommon::YesNoQuestion(pParentWidget, QCoreApplication::translate("LaunchQuickplay", "Quickplay"),
|
||||
QCoreApplication::translate("LaunchQuickplay", "Quickplay is already running. Close the existing session and relaunch?")))
|
||||
{
|
||||
KillQuickplay();
|
||||
}
|
||||
@@ -146,8 +147,8 @@ EQuickplayLaunchResult LaunchQuickplay(QWidget* pParentWidget,
|
||||
// Check if the user has any dirty packages
|
||||
if (gpEdApp->HasAnyDirtyPackages())
|
||||
{
|
||||
if (UICommon::YesNoQuestion(pParentWidget, "Uncooked Changes",
|
||||
"You have uncooked changes. Cook before starting quickplay?"))
|
||||
if (UICommon::YesNoQuestion(pParentWidget, QCoreApplication::translate("LaunchQuickplay", "Uncooked Changes"),
|
||||
QCoreApplication::translate("LaunchQuickplay", "You have uncooked changes. Cook before starting quickplay?")))
|
||||
{
|
||||
gpEdApp->CookAllDirtyPackages();
|
||||
}
|
||||
@@ -299,23 +300,23 @@ bool SetDolphinPath(QWidget* pParentWidget, const QString& kDolphinPath, bool bS
|
||||
{
|
||||
if (!bSilent)
|
||||
{
|
||||
UICommon::ErrorMsg(pParentWidget, "The selected file is not a Dolphin executable!");
|
||||
UICommon::ErrorMsg(pParentWidget, QCoreApplication::translate("SetDolphinPath", "The selected file is not a Dolphin executable!"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try to obtain the version from Dolphin
|
||||
QProcess DolphinProcess;
|
||||
DolphinProcess.start(kDolphinPath, QStringList() << "--version");
|
||||
DolphinProcess.start(kDolphinPath, QStringList() << QStringLiteral("--version"));
|
||||
DolphinProcess.waitForFinished();
|
||||
QString VersionString = DolphinProcess.readLine().trimmed();
|
||||
QString VersionString = QString::fromUtf8(DolphinProcess.readLine().trimmed());
|
||||
|
||||
// Make sure we have a valid string
|
||||
if (VersionString.isNull())
|
||||
{
|
||||
if (!bSilent)
|
||||
{
|
||||
UICommon::ErrorMsg(pParentWidget, "Unable to validate version string, the selected file is likely not a Dolphin executable");
|
||||
UICommon::ErrorMsg(pParentWidget, QCoreApplication::translate("SetDolphinPath", "Unable to validate version string, the selected file is likely not a Dolphin executable"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -323,12 +324,12 @@ bool SetDolphinPath(QWidget* pParentWidget, const QString& kDolphinPath, bool bS
|
||||
// Dolphin's version string is broken into two parts, the first part is the name the second is the version
|
||||
// Dolphin unfortunately collide's with KDE Plasma's file manager which also happens to be named "Dolphin"
|
||||
// Fortunately the latter uses a lowercase name so we can differentiate.
|
||||
QStringList VersionParts = VersionString.split(' ');
|
||||
if (VersionParts.count() < 2 || (VersionParts[0] != "Dolphin" && VersionParts[0] != "PrimeHack"))
|
||||
QStringList VersionParts = VersionString.split(QLatin1Char{' '});
|
||||
if (VersionParts.count() < 2 || (VersionParts[0] != QStringLiteral("Dolphin") && VersionParts[0] != QStringLiteral("PrimeHack")))
|
||||
{
|
||||
if (!bSilent)
|
||||
{
|
||||
UICommon::ErrorMsg(pParentWidget, "The selected file is not a Dolphin executable!");
|
||||
UICommon::ErrorMsg(pParentWidget, QCoreApplication::translate("SetDolphinPath", "The selected file is not a Dolphin executable!"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -374,13 +375,13 @@ QString GetDolphinPath()
|
||||
|
||||
QString AskForDolphinPath(QWidget* pParentWidget) {
|
||||
#if defined(Q_OS_WIN)
|
||||
QString Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "*.exe");
|
||||
QString Path = UICommon::OpenFileDialog(pParentWidget, QCoreApplication::translate("AskForDolphinPath", "Open Dolphin"), QStringLiteral("*.exe"));
|
||||
#elif defined(Q_OS_MACOS)
|
||||
QString Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "*.app");
|
||||
if (Path.endsWith(".app"))
|
||||
Path += "/Contents/MacOS/Dolphin";
|
||||
QString Path = UICommon::OpenFileDialog(pParentWidget, QCoreApplication::translate("AskForDolphinPath", "Open Dolphin"), QStringLiteral("*.app"));
|
||||
if (Path.endsWith(QStringLiteral(".app")))
|
||||
Path += QStringLiteral("/Contents/MacOS/Dolphin");
|
||||
#else
|
||||
QString Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", {});
|
||||
QString Path = UICommon::OpenFileDialog(pParentWidget, QCoreApplication::translate("AskForDolphinPath", "Open Dolphin"), {});
|
||||
#endif
|
||||
return Path;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ QVariant CPropertyModel::data(const QModelIndex& rkIndex, int Role) const
|
||||
// Add name
|
||||
IProperty *pProp = PropertyForIndex(rkIndex, false);
|
||||
const QString DisplayText = data(rkIndex, Qt::DisplayRole).toString();
|
||||
const QString TypeName = pProp->HashableTypeName();
|
||||
const QString TypeName = QString::fromUtf8(pProp->HashableTypeName());
|
||||
QString Text = tr("<b>%1</b> <i>(%2)</i>").arg(DisplayText).arg(TypeName);
|
||||
|
||||
// Add uncooked notification
|
||||
|
||||
@@ -96,7 +96,7 @@ CResourceBrowser::CResourceBrowser(QWidget *pParent)
|
||||
mpFilterAllBox = new QCheckBox(this);
|
||||
mpFilterAllBox->setChecked(true);
|
||||
mpFilterAllBox->setFont(AllBoxFont);
|
||||
mpFilterAllBox->setText("All");
|
||||
mpFilterAllBox->setText(tr("All"));
|
||||
mpFilterBoxesLayout->addWidget(mpFilterAllBox);
|
||||
|
||||
CreateFilterCheckboxes();
|
||||
@@ -675,7 +675,7 @@ bool CResourceBrowser::Delete(QList<CResourceEntry*> Resources, QList<CVirtualDi
|
||||
{
|
||||
if (!Directories[DirIdx]->IsSafeToDelete())
|
||||
{
|
||||
ErrorPaths += TO_QSTRING(Directories[DirIdx]->FullPath()) + '\n';
|
||||
ErrorPaths += TO_QSTRING(Directories[DirIdx]->FullPath()) + QLatin1Char{'\n'};
|
||||
Directories.removeAt(DirIdx);
|
||||
DirIdx--;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ bool CResourceBrowser::Delete(QList<CResourceEntry*> Resources, QList<CVirtualDi
|
||||
{
|
||||
if (Resources[ResIdx]->IsLoaded() && Resources[ResIdx]->Resource()->IsReferenced())
|
||||
{
|
||||
ErrorPaths += TO_QSTRING(Resources[ResIdx]->CookedAssetPath(true)) + '\n';
|
||||
ErrorPaths += TO_QSTRING(Resources[ResIdx]->CookedAssetPath(true)) + QLatin1Char{'\n'};
|
||||
Resources.removeAt(ResIdx);
|
||||
ResIdx--;
|
||||
}
|
||||
@@ -986,7 +986,7 @@ void CResourceBrowser::ImportAssetNameMap()
|
||||
void CResourceBrowser::ExportAssetNames()
|
||||
{
|
||||
const QString OutFile = UICommon::SaveFileDialog(this, tr("Export asset name map"), QStringLiteral("*.xml"),
|
||||
gResourcesWritable ? *(gDataDir + "resources/gameinfo/") : "");
|
||||
gResourcesWritable ? TO_QSTRING(gDataDir + "resources/gameinfo/") : QString());
|
||||
if (OutFile.isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ void CResourceBrowserDelegate::paint(QPainter *pPainter, const QStyleOptionViewI
|
||||
// Draw resource info string
|
||||
if (pEntry)
|
||||
{
|
||||
QString ResInfo = TO_QSTRING( pEntry->TypeInfo()->TypeName() );
|
||||
QString ResInfo = TO_QSTRING(pEntry->TypeInfo()->TypeName());
|
||||
|
||||
if (mDisplayAssetIDs)
|
||||
ResInfo.prepend( TO_QSTRING(pEntry->ID().ToString()) + " | " );
|
||||
ResInfo.prepend(TO_QSTRING(pEntry->ID().ToString()) + QStringLiteral(" | "));
|
||||
|
||||
QString ElidedResInfo = FontInfo.InfoFontMetrics.elidedText(ResInfo, Qt::ElideRight, GeomInfo.InfoStringRect.width());
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Editor/UICommon.h"
|
||||
#include "Editor/Undo/TSerializeUndoCommand.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QSettings>
|
||||
#include <QShortcut>
|
||||
|
||||
@@ -18,7 +19,8 @@ class CSetStringIndexCommand : public IUndoCommand
|
||||
int mOldIndex, mNewIndex;
|
||||
public:
|
||||
CSetStringIndexCommand(CStringEditor* pEditor, int OldIndex, int NewIndex)
|
||||
: IUndoCommand("Select String"), mpEditor(pEditor), mOldIndex(OldIndex), mNewIndex(NewIndex)
|
||||
: IUndoCommand(QCoreApplication::translate("CSetStringIndexCommand", "Select String"))
|
||||
, mpEditor(pEditor), mOldIndex(OldIndex), mNewIndex(NewIndex)
|
||||
{}
|
||||
|
||||
void undo() override { mpEditor->SetActiveString(mOldIndex); }
|
||||
@@ -32,7 +34,8 @@ class CSetLanguageCommand : public IUndoCommand
|
||||
ELanguage mOldLanguage, mNewLanguage;
|
||||
public:
|
||||
CSetLanguageCommand(CStringEditor* pEditor, ELanguage OldLanguage, ELanguage NewLanguage)
|
||||
: IUndoCommand("Select Language"), mpEditor(pEditor), mOldLanguage(OldLanguage), mNewLanguage(NewLanguage)
|
||||
: IUndoCommand(QCoreApplication::translate("CSetLanguageCommand", "Select Language"))
|
||||
, mpEditor(pEditor), mOldLanguage(OldLanguage), mNewLanguage(NewLanguage)
|
||||
{}
|
||||
|
||||
void undo() override { mpEditor->SetActiveLanguage(mOldLanguage); }
|
||||
@@ -111,7 +114,7 @@ void CStringEditor::InitUI()
|
||||
{
|
||||
const ELanguage Language = mpStringTable->LanguageByIndex(LanguageIdx);
|
||||
const char* pkLanguageName = TEnumReflection<ELanguage>::ConvertValueToString(Language);
|
||||
mpUI->EditLanguageTabBar->addTab(pkLanguageName);
|
||||
mpUI->EditLanguageTabBar->addTab(QString::fromUtf8(pkLanguageName));
|
||||
}
|
||||
|
||||
// Connect signals & slots
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "UICommon.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QProcess>
|
||||
|
||||
@@ -31,8 +32,8 @@ void OpenContainingFolder(QWidget* parent, const QString& pathIn)
|
||||
}
|
||||
if (explorer.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(parent, "Launching Windows Explorer Failed",
|
||||
"Could not find explorer.exe in path to launch Windows Explorer.");
|
||||
QMessageBox::warning(parent, QCoreApplication::translate("OpenContainingFoleder", "Launching Windows Explorer Failed"),
|
||||
QCoreApplication::translate("OpenContainingFolder", "Could not find explorer.exe in path to launch Windows Explorer."));
|
||||
return;
|
||||
}
|
||||
QStringList param;
|
||||
@@ -60,7 +61,7 @@ void OpenContainingFolder(QWidget* parent, const QString& pathIn)
|
||||
|
||||
bool OpenInExternalApplication(const QString& rkPath)
|
||||
{
|
||||
return QDesktopServices::openUrl( QString("file:///") + QDir::toNativeSeparators(rkPath) );
|
||||
return QDesktopServices::openUrl(QStringLiteral("file:///") + QDir::toNativeSeparators(rkPath));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "CEditorApplication.h"
|
||||
#include <Common/TString.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileDialog>
|
||||
#include <QMap>
|
||||
@@ -15,9 +16,9 @@
|
||||
#define UI_APPVAR_VERSION "%APP_VERSION%"
|
||||
|
||||
#define REPLACE_APPVARS(InQString) \
|
||||
InQString.replace(UI_APPVAR_NAME, APP_NAME); \
|
||||
InQString.replace(UI_APPVAR_FULLNAME, APP_FULL_NAME); \
|
||||
InQString.replace(UI_APPVAR_VERSION, APP_VERSION);
|
||||
InQString.replace(QStringLiteral(UI_APPVAR_NAME), QStringLiteral(APP_NAME)); \
|
||||
InQString.replace(QStringLiteral(UI_APPVAR_FULLNAME), QStringLiteral(APP_FULL_NAME)); \
|
||||
InQString.replace(QStringLiteral(UI_APPVAR_VERSION), QStringLiteral(APP_VERSION));
|
||||
|
||||
#define SET_WINDOWTITLE_APPVARS(InString) \
|
||||
{ \
|
||||
@@ -100,7 +101,7 @@ inline T16String ToT16String(const QString& rkStr)
|
||||
#define POP_TICKS_ENABLED \
|
||||
gpEdApp->SetEditorTicksEnabled(TicksEnabled);
|
||||
|
||||
inline QString OpenFileDialog(QWidget *pParent, const QString& rkCaption, const QString& rkFilter, const QString& rkStartingDir = "")
|
||||
inline QString OpenFileDialog(QWidget* pParent, const QString& rkCaption, const QString& rkFilter, const QString& rkStartingDir = {})
|
||||
{
|
||||
PUSH_TICKS_ENABLED;
|
||||
QString Result = QFileDialog::getOpenFileName(pParent, rkCaption, rkStartingDir, rkFilter);
|
||||
@@ -108,7 +109,7 @@ inline QString OpenFileDialog(QWidget *pParent, const QString& rkCaption, const
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline QStringList OpenFilesDialog(QWidget *pParent, const QString& rkCaption, const QString& rkFilter, const QString& rkStartingDir = "")
|
||||
inline QStringList OpenFilesDialog(QWidget* pParent, const QString& rkCaption, const QString& rkFilter, const QString& rkStartingDir = {})
|
||||
{
|
||||
PUSH_TICKS_ENABLED;
|
||||
QStringList Result = QFileDialog::getOpenFileNames(pParent, rkCaption, rkStartingDir, rkFilter);
|
||||
@@ -116,7 +117,7 @@ inline QStringList OpenFilesDialog(QWidget *pParent, const QString& rkCaption, c
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline QString SaveFileDialog(QWidget *pParent, const QString& rkCaption, const QString& rkFilter, const QString& rkStartingDir = "")
|
||||
inline QString SaveFileDialog(QWidget* pParent, const QString& rkCaption, const QString& rkFilter, const QString& rkStartingDir = {})
|
||||
{
|
||||
PUSH_TICKS_ENABLED;
|
||||
QString Result = QFileDialog::getSaveFileName(pParent, rkCaption, rkStartingDir, rkFilter);
|
||||
@@ -124,7 +125,7 @@ inline QString SaveFileDialog(QWidget *pParent, const QString& rkCaption, const
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline QString OpenDirDialog(QWidget *pParent, const QString& rkCaption, const QString& rkStartingDir = "")
|
||||
inline QString OpenDirDialog(QWidget* pParent, const QString& rkCaption, const QString& rkStartingDir = {})
|
||||
{
|
||||
PUSH_TICKS_ENABLED;
|
||||
QString Result = QFileDialog::getExistingDirectory(pParent, rkCaption, rkStartingDir);
|
||||
@@ -133,17 +134,17 @@ inline QString OpenDirDialog(QWidget *pParent, const QString& rkCaption, const Q
|
||||
}
|
||||
|
||||
// QMessageBox wrappers
|
||||
inline void InfoMsg(QWidget *pParent, QString InfoBoxTitle, QString InfoText)
|
||||
inline void InfoMsg(QWidget *pParent, const QString& InfoBoxTitle, const QString& InfoText)
|
||||
{
|
||||
QMessageBox::information(pParent, InfoBoxTitle, InfoText);
|
||||
}
|
||||
|
||||
inline void ErrorMsg(QWidget *pParent, QString ErrorText)
|
||||
inline void ErrorMsg(QWidget *pParent, const QString& ErrorText)
|
||||
{
|
||||
QMessageBox::warning(pParent, "Error", ErrorText);
|
||||
QMessageBox::warning(pParent, QCoreApplication::translate("ErrorMsg", "Error"), ErrorText);
|
||||
}
|
||||
|
||||
inline bool YesNoQuestion(QWidget *pParent, QString InfoBoxTitle, QString Question)
|
||||
inline bool YesNoQuestion(QWidget *pParent, const QString& InfoBoxTitle, const QString& Question)
|
||||
{
|
||||
QMessageBox::StandardButton Button = QMessageBox::question(pParent, InfoBoxTitle, Question, QMessageBox::Yes | QMessageBox::No);
|
||||
return Button == QMessageBox::Yes;
|
||||
@@ -152,7 +153,7 @@ inline bool YesNoQuestion(QWidget *pParent, QString InfoBoxTitle, QString Questi
|
||||
inline bool OpenProject()
|
||||
{
|
||||
QWidget* pMainWindow = (QWidget*) gpEdApp->WorldEditor();
|
||||
QString ProjPath = UICommon::OpenFileDialog(pMainWindow, "Open Project", "Game Project (*.prj)");
|
||||
QString ProjPath = UICommon::OpenFileDialog(pMainWindow, QCoreApplication::translate("OpenProject", "Open Project"), QStringLiteral("Game Project (*.prj)"));
|
||||
return ProjPath.isEmpty() ? false : gpEdApp->OpenProject(ProjPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ void CResourceSelector::UpdateUI()
|
||||
bool HasResource = mpResEntry != nullptr;
|
||||
|
||||
// Update main UI
|
||||
mpResNameButton->setText(HasResource ? TO_QSTRING(mpResEntry->Name()) + "." + TO_QSTRING(mpResEntry->CookedExtension().ToString()) : "");
|
||||
mpResNameButton->setToolTip(HasResource ? TO_QSTRING(mpResEntry->CookedAssetPath(true)) : "");
|
||||
mpResNameButton->setText(HasResource ? TO_QSTRING(mpResEntry->Name()) + QLatin1Char{'.'} + TO_QSTRING(mpResEntry->CookedExtension().ToString()) : QString());
|
||||
mpResNameButton->setToolTip(HasResource ? TO_QSTRING(mpResEntry->CookedAssetPath(true)) : QString());
|
||||
mpClearButton->setEnabled(HasResource);
|
||||
|
||||
// Update context menu
|
||||
@@ -259,7 +259,7 @@ void CResourceSelector::CopyName()
|
||||
|
||||
void CResourceSelector::CopyPath()
|
||||
{
|
||||
QString Text = (mpResEntry ? TO_QSTRING(mpResEntry->CookedAssetPath(true)) : "");
|
||||
QString Text = (mpResEntry ? TO_QSTRING(mpResEntry->CookedAssetPath(true)) : QString());
|
||||
gpEdApp->clipboard()->setText(Text);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,18 +40,18 @@ protected slots:
|
||||
if ( mpSoftValidator->validate(Text, DummyPos) == QValidator::Acceptable )
|
||||
{
|
||||
NewValidity = true;
|
||||
setStyleSheet("border: 1px solid green");
|
||||
setStyleSheet(QStringLiteral("border: 1px solid green"));
|
||||
}
|
||||
else
|
||||
{
|
||||
NewValidity = false;
|
||||
setStyleSheet("border: 1px solid red");
|
||||
setStyleSheet(QStringLiteral("border: 1px solid red"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NewValidity = true;
|
||||
setStyleSheet("");
|
||||
setStyleSheet(QString());
|
||||
}
|
||||
|
||||
if (NewValidity != mInputIsValid)
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
if (It.Value() != TEnumReflection<EnumT>::ErrorValue())
|
||||
{
|
||||
addItem(It.Name());
|
||||
addItem(QString::fromUtf8(It.Name()));
|
||||
mValueList.push_back(It.Value());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ bool WDraggableSpinBox::eventFilter(QObject *, QEvent *pEvent)
|
||||
QString WDraggableSpinBox::textFromValue(double Val) const
|
||||
{
|
||||
QString Str = QString::number(Val, 'f', decimals());
|
||||
int DecIndex = Str.indexOf('.');
|
||||
int DecIndex = Str.indexOf(QLatin1Char{'.'});
|
||||
int NumDecs;
|
||||
|
||||
if (DecIndex == -1)
|
||||
@@ -111,23 +111,23 @@ QString WDraggableSpinBox::textFromValue(double Val) const
|
||||
int Size = Str.size() + mMinDecimals + 1;
|
||||
Str.reserve(Size);
|
||||
|
||||
Str += '.';
|
||||
Str += QLatin1Char{'.'};
|
||||
|
||||
for (int iDec = 0; iDec < mMinDecimals; iDec++)
|
||||
Str += '0';
|
||||
Str += QLatin1Char{'0'};
|
||||
}
|
||||
|
||||
else if ((NumDecs > mMinDecimals) && mTrimTrailingZeroes)
|
||||
{
|
||||
while (NumDecs > mMinDecimals)
|
||||
{
|
||||
if (Str.endsWith('0'))
|
||||
if (Str.endsWith(QLatin1Char{'0'}))
|
||||
{
|
||||
Str.chop(1);
|
||||
NumDecs--;
|
||||
}
|
||||
|
||||
else if (Str.endsWith('.'))
|
||||
else if (Str.endsWith(QLatin1Char{'.'}))
|
||||
{
|
||||
Str.chop(1);
|
||||
break;
|
||||
|
||||
@@ -35,8 +35,8 @@ void CCollisionRenderSettingsDialog::SetupWidgets()
|
||||
EGame Game = mpEditor->CurrentGame();
|
||||
|
||||
// Set widgets to match current render setting values
|
||||
mpUi->HideMaskLineEdit->setText( "0x" + QString::number(rSettings.HideMask, 16).toUpper() );
|
||||
mpUi->HighlightMaskLineEdit->setText( "0x" + QString::number(rSettings.HighlightMask, 16).toUpper() );
|
||||
mpUi->HideMaskLineEdit->setText(QStringLiteral("0x") + QString::number(rSettings.HideMask, 16).toUpper());
|
||||
mpUi->HighlightMaskLineEdit->setText(QStringLiteral("0x") + QString::number(rSettings.HighlightMask, 16).toUpper());
|
||||
mpUi->WireframeCheckBox->setChecked(rSettings.DrawWireframe);
|
||||
mpUi->SurfaceTypeCheckBox->setChecked(rSettings.TintWithSurfaceColor);
|
||||
mpUi->StandableTrisCheckBox->setChecked(rSettings.TintUnwalkableTris);
|
||||
|
||||
@@ -174,7 +174,7 @@ void CTemplateEditDialog::RefreshTypeNameOverride()
|
||||
}
|
||||
else
|
||||
{
|
||||
mpValidator->SetTypeNameOverride("");
|
||||
mpValidator->SetTypeNameOverride(QString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -741,7 +741,7 @@ void CWorldEditor::UpdateOpenRecentActions()
|
||||
// Remove projects that don't exist anymore
|
||||
for (const QString& rkProj : RecentProjectsList)
|
||||
{
|
||||
if (!FileUtil::Exists( TO_TSTRING(rkProj) ) || rkProj.contains('\\') )
|
||||
if (!FileUtil::Exists(TO_TSTRING(rkProj)) || rkProj.contains(QLatin1Char{'\\'}))
|
||||
RecentProjectsList.removeAll(rkProj);
|
||||
}
|
||||
|
||||
@@ -771,14 +771,14 @@ void CWorldEditor::UpdateWindowTitle()
|
||||
|
||||
if (pProj)
|
||||
{
|
||||
WindowTitle += " - " + TO_QSTRING( pProj->Name() );
|
||||
WindowTitle += QStringLiteral(" - ") + TO_QSTRING(pProj->Name());
|
||||
|
||||
if (mpWorld)
|
||||
{
|
||||
WindowTitle += " - " + TO_QSTRING(mpWorld->InGameName());
|
||||
WindowTitle += QStringLiteral(" - ") + TO_QSTRING(mpWorld->InGameName());
|
||||
|
||||
if (mpArea && CurrentGame() < EGame::DKCReturns)
|
||||
WindowTitle += " - " + TO_QSTRING( mpWorld->AreaInGameName(mpArea->WorldIndex()) );
|
||||
WindowTitle += QStringLiteral(" - ") + TO_QSTRING(mpWorld->AreaInGameName(mpArea->WorldIndex()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ void CWorldTreeModel::OnProjectChanged(CGameProject *pProj)
|
||||
// Add remaining worlds to FrontEnd world
|
||||
mWorldList.prepend(SWorldInfo());
|
||||
pInfo = &mWorldList.front();
|
||||
pInfo->WorldName = "FrontEnd";
|
||||
pInfo->WorldName = QStringLiteral("FrontEnd");
|
||||
|
||||
for (TResourceIterator<EResourceType::World> It; It; ++It)
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ void WEditorProperties::OnSelectionModified()
|
||||
}
|
||||
else
|
||||
{
|
||||
mpInstanceInfoLabel->setText(QString("<i>[%1 objects selected]</i>").arg(pSelection->Size()));
|
||||
mpInstanceInfoLabel->setText(tr("<i>[%1 objects selected]</i>").arg(pSelection->Size()));
|
||||
mpInstanceNameLineEdit->clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <Core/Resource/Script/NGameList.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QIcon>
|
||||
#include <QStyleFactory>
|
||||
#include <QtGlobal>
|
||||
@@ -95,7 +96,7 @@ public:
|
||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
CEditorApplication App(argc, argv);
|
||||
App.setApplicationName(QStringLiteral("PrimeWorldEditor"));
|
||||
App.setApplicationVersion( APP_VERSION );
|
||||
App.setApplicationVersion(QStringLiteral(APP_VERSION));
|
||||
App.setOrganizationName(QStringLiteral("AxioDL"));
|
||||
App.setWindowIcon(QIcon(QStringLiteral(":/icons/win/AppIcon.ico")));
|
||||
|
||||
@@ -116,7 +117,7 @@ public:
|
||||
// Init log
|
||||
bool Initialized = NLog::InitLog(LocateLogPath());
|
||||
if (!Initialized)
|
||||
UICommon::ErrorMsg(nullptr, "Couldn't open log file. Logging will not work for this session.");
|
||||
UICommon::ErrorMsg(nullptr, QCoreApplication::translate("Main", "Couldn't open log file. Logging will not work for this session."));
|
||||
qInstallMessageHandler(QtLogRedirect);
|
||||
|
||||
// Locate data directory and check write permissions
|
||||
@@ -129,8 +130,8 @@ public:
|
||||
|
||||
if (!gpEditorStore->DatabasePathExists())
|
||||
{
|
||||
UICommon::ErrorMsg(nullptr, "Unable to locate PWE resources directory; "
|
||||
"PWE's executable must remain as deployed.");
|
||||
UICommon::ErrorMsg(nullptr, QCoreApplication::translate("Main", "Unable to locate PWE resources directory; "
|
||||
"PWE's executable must remain as deployed."));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user