summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2018-10-05 15:04:23 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2018-10-10 10:29:26 +0000
commitfe04c1301a1a6865fc96ee3a561696015ba3a1ae (patch)
tree4206bf178c6add95de590a5cd20248ffc58f9c2b /src/Authoring/Studio
parent9b0276d7aba5d93a2619d0f39698c43cdb13c084 (diff)
Change many CStrings to QString
- A lot of CString, CFilePath, and Qt3DSFile occureneces and their relevant code has been removed to save the costy back and forth conversion between CString and QString. - Renovated several classes as part of the process (Preferences classes, recent items, build configuration, probably few more) - Assorted tweaks here and there Task-number: QT3DS-1899 Task-number: QT3DS-2455 Change-Id: Ibbf4c3b7ab0b9fe6e19d8aed822fa29d43b99086 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio')
-rw-r--r--src/Authoring/Studio/Application/AboutDlg.cpp3
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.cpp26
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.h2
-rw-r--r--src/Authoring/Studio/Application/StudioApp.cpp204
-rw-r--r--src/Authoring/Studio/Application/StudioApp.h28
-rw-r--r--src/Authoring/Studio/MainFrm.cpp35
-rw-r--r--src/Authoring/Studio/MainFrm.h6
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/GuideInspectable.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp5
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp6
-rw-r--r--src/Authoring/Studio/Palettes/Progress/ProgressView.cpp8
-rw-r--r--src/Authoring/Studio/Palettes/Progress/ProgressView.h4
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp8
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectView.cpp12
-rw-r--r--src/Authoring/Studio/Palettes/Project/ProjectView.h6
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp8
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp18
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp3
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp5
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp4
-rw-r--r--src/Authoring/Studio/PreviewHelper.cpp96
-rw-r--r--src/Authoring/Studio/PreviewHelper.h7
-rw-r--r--src/Authoring/Studio/Render/StudioRenderer.cpp2
-rw-r--r--src/Authoring/Studio/Render/StudioRendererTranslation.cpp9
-rw-r--r--src/Authoring/Studio/Render/StudioRendererTranslation.h6
-rw-r--r--src/Authoring/Studio/UI/RecentItems.cpp94
-rw-r--r--src/Authoring/Studio/UI/RecentItems.h29
-rw-r--r--src/Authoring/Studio/UI/StartupDlg.cpp13
-rw-r--r--src/Authoring/Studio/UI/StartupDlg.h8
-rw-r--r--src/Authoring/Studio/Workspace/Dialogs.cpp60
-rw-r--r--src/Authoring/Studio/Workspace/Dialogs.h15
32 files changed, 274 insertions, 460 deletions
diff --git a/src/Authoring/Studio/Application/AboutDlg.cpp b/src/Authoring/Studio/Application/AboutDlg.cpp
index 17d1ca63..818c3556 100644
--- a/src/Authoring/Studio/Application/AboutDlg.cpp
+++ b/src/Authoring/Studio/Application/AboutDlg.cpp
@@ -109,8 +109,7 @@ static QString compilerString()
void CAboutDlg::OnInitDialog()
{
// Set the Studio version
- m_ProductVersionStr = QStringLiteral("Qt 3D Studio v")
- + CStudioPreferences::GetVersionString().toQString();
+ m_ProductVersionStr = QStringLiteral("Qt 3D Studio v") + CStudioPreferences::GetVersionString();
// Set the copyright string
m_CopyrightStr = QObject::tr("Copyright (C) %1 The Qt Company. All rights reserved.").arg(
diff --git a/src/Authoring/Studio/Application/ProjectFile.cpp b/src/Authoring/Studio/Application/ProjectFile.cpp
index 9dd51f2a..b4650a03 100644
--- a/src/Authoring/Studio/Application/ProjectFile.cpp
+++ b/src/Authoring/Studio/Application/ProjectFile.cpp
@@ -50,14 +50,14 @@ ProjectFile::ProjectFile()
void ProjectFile::ensureProjectFile()
{
if (!m_fileInfo.exists()) {
- QFileInfo uipFile(g_StudioApp.GetCore()->GetDoc()
- ->GetDocumentPath().GetAbsolutePath().toQString());
- QString uiaPath(PresentationFile::findProjectFile(uipFile.absoluteFilePath()));
+ QFileInfo uipInfo(g_StudioApp.GetCore()->GetDoc()->GetDocumentPath());
+ QString uiaPath(PresentationFile::findProjectFile(uipInfo.absoluteFilePath()));
if (uiaPath.isEmpty()) {
- // .uia not found, create new project .uia file. Creation sets info.
- create(uipFile.completeBaseName(), uipFile.absolutePath());
- addPresentationNode(uipFile.absoluteFilePath());
+ // .uia not found, create a new one in the same uip filder. Creation sets file info.
+ create(uipInfo.absoluteFilePath().replace(QLatin1String(".uip"),
+ QLatin1String(".uia")));
+ addPresentationNode(uipInfo.absoluteFilePath());
updateDocPresentationId();
} else {
// .uia found, set project file info
@@ -350,7 +350,7 @@ QString ProjectFile::getPresentationId(const QString &src) const
}
// create the project .uia file
-void ProjectFile::create(const QString &projectName, const QString &projectPath)
+void ProjectFile::create(const QString &uiaPath)
{
QDomDocument doc;
doc.setContent(QStringLiteral("<?xml version=\"1.0\" encoding=\"utf-8\"?>"
@@ -366,8 +366,6 @@ void ProjectFile::create(const QString &projectName, const QString &projectPath)
"</statemachine>"
"</application>"));
- QString uiaPath = projectPath + QStringLiteral("/") + projectName + QStringLiteral(".uia");
-
QFile file(uiaPath);
file.open(QIODevice::WriteOnly);
file.resize(0);
@@ -387,7 +385,7 @@ void ProjectFile::create(const QString &projectName, const QString &projectPath)
QString ProjectFile::createPreview()
{
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- QString uipPrvPath = doc->GetDocumentPath().GetAbsolutePath().toQString();
+ QString uipPrvPath = doc->GetDocumentPath();
// create a preview uip if doc modified
if (doc->IsModified()) {
uipPrvPath.replace(QLatin1String(".uip"), QLatin1String("_@preview@.uip"));
@@ -567,12 +565,10 @@ QString ProjectFile::ensureUniquePresentationId(const QString &id) const
// Get the path to the project root. If .uia doesn't exist, return path to current presentation.
QString ProjectFile::getProjectPath() const
{
- if (m_fileInfo.exists()) {
+ if (m_fileInfo.exists())
return m_fileInfo.path();
- } else {
- return QFileInfo(g_StudioApp.GetCore()->GetDoc()
- ->GetDocumentPath().GetAbsolutePath().toQString()).absolutePath();
- }
+ else
+ return QFileInfo(g_StudioApp.GetCore()->GetDoc()->GetDocumentPath()).absolutePath();
}
// Get the path to the project's .uia file. If .uia doesn't exist, return empty string.
diff --git a/src/Authoring/Studio/Application/ProjectFile.h b/src/Authoring/Studio/Application/ProjectFile.h
index 8dddd923..34093bb3 100644
--- a/src/Authoring/Studio/Application/ProjectFile.h
+++ b/src/Authoring/Studio/Application/ProjectFile.h
@@ -45,7 +45,7 @@ class ProjectFile : public QObject
public:
ProjectFile();
- void create(const QString &projectName, const QString &projectPath);
+ void create(const QString &uiaPath);
void ensureProjectFile();
void initProjectFile(const QString &presPath);
void loadSubpresentationsAndDatainputs(
diff --git a/src/Authoring/Studio/Application/StudioApp.cpp b/src/Authoring/Studio/Application/StudioApp.cpp
index 1d6c07b1..77b0f271 100644
--- a/src/Authoring/Studio/Application/StudioApp.cpp
+++ b/src/Authoring/Studio/Application/StudioApp.cpp
@@ -196,7 +196,6 @@ int main(int argc, char *argv[])
#include "Qt3DSDMDataCore.h"
#include "IDirectoryWatchingSystem.h"
#include "ITickTock.h"
-#include "Qt3DSFileTools.h"
#include "foundation/Qt3DSLogging.h"
CStudioApp g_StudioApp;
@@ -299,28 +298,23 @@ bool CStudioApp::initInstance(const QCommandLineParser &parser)
QApplication::setOrganizationName("The Qt Company");
QApplication::setOrganizationDomain("qt.io");
QApplication::setApplicationName("Qt 3D Studio");
- QApplication::setApplicationVersion(
- QString::fromWCharArray(CStudioPreferences::GetVersionString().c_str()));
+ QApplication::setApplicationVersion(CStudioPreferences::GetVersionString());
qCInfo(qt3ds::TRACE_INFO) << "Studio: " << QApplication::applicationFilePath();
- qCInfo(qt3ds::TRACE_INFO) << "Version: "
- << CStudioPreferences::GetVersionString().GetCharStar();
+ qCInfo(qt3ds::TRACE_INFO) << "Version: " << CStudioPreferences::GetVersionString();
// Silent is ignored for everything but create
m_isSilent = parser.isSet("silent") && parser.isSet("create");
- CFilePath thePreferencesPath = CFilePath::GetUserApplicationDirectory();
- thePreferencesPath = CFilePath::CombineBaseAndRelative(
- thePreferencesPath, CFilePath(L"Qt3DSComposer\\Preferences.setting"));
- CPreferences::SetPreferencesFile(thePreferencesPath);
-
// Initialize help file paths
- m_helpFilePath = Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../doc/qt3dstudio/qt3dstudio-index.html");
- m_gettingStartedFilePath = Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../doc/qt3dstudio/getting-started.html");
+ m_helpFilePath = Qt3DSFile::GetApplicationDirectory()
+ + QStringLiteral("/../doc/qt3dstudio/qt3dstudio-index.html");
+ m_gettingStartedFilePath = Qt3DSFile::GetApplicationDirectory()
+ + QStringLiteral("/../doc/qt3dstudio/getting-started.html");
- CStudioPreferences::LoadPreferences();
+ QString thePreferencesPath = CFilePath::GetUserApplicationDirectory()
+ + QStringLiteral("/Qt3DSComposer/Preferences.setting");
+ CStudioPreferences::LoadPreferences(thePreferencesPath);
m_dialogs = new CDialogs(!m_isSilent);
@@ -403,8 +397,8 @@ bool CStudioApp::handleWelcomeRes(int res, bool recursive)
switch (res) {
case StudioTutorialWidget::createNewResult: {
if (PerformSavePrompt()) {
- Qt3DSFile theFile(m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir()));
- if (theFile.GetPath() != "") {
+ QString theFile(m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir()));
+ if (!theFile.isEmpty()) {
if (!m_core->OnNewDocument(theFile, true)) {
// Invalid filename, show a message box and the startup dialog
showInvalidFilenameWarning();
@@ -431,19 +425,19 @@ bool CStudioApp::handleWelcomeRes(int res, bool recursive)
QString theFile(QStringLiteral("."));
#ifndef Q_OS_MACOS
- filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../examples/studio3d/SampleProject"));
+ filePath.setFile(Qt3DSFile::GetApplicationDirectory() +
+ QStringLiteral("/../examples/studio3d/SampleProject"));
if (!filePath.exists()) {
- filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../examples/studio3d"));
+ filePath.setFile(Qt3DSFile::GetApplicationDirectory()
+ + QStringLiteral("/../examples/studio3d"));
#else
- filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../../../../examples/studio3d/SampleProject"));
+ filePath.setFile(Qt3DSFile::GetApplicationDirectory()
+ + QStringLiteral("/../../../../examples/studio3d/SampleProject"));
if (!filePath.exists()) {
- filePath.setFile(Qt3DSFile::GetApplicationDirectory().GetPath().toQString() +
- QStringLiteral("/../../../../examples/studio3d"));
+ filePath.setFile(Qt3DSFile::GetApplicationDirectory()
+ + QStringLiteral("/../../../../examples/studio3d"));
#endif
if (!filePath.exists()) {
filePath.setFile(QStandardPaths::writableLocation(
@@ -564,8 +558,8 @@ bool CStudioApp::showStartupDialog()
break;
case CStartupDlg::EStartupChoice_NewDoc: {
- Qt3DSFile theFile = m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir());
- if (theFile.GetPath() != "") {
+ QString theFile = m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir());
+ if (!theFile.isEmpty()) {
if (!m_core->OnNewDocument(theFile, true)) {
// Invalid filename, show a message box and the dialog again
showInvalidFilenameWarning();
@@ -578,8 +572,8 @@ bool CStudioApp::showStartupDialog()
} break;
case CStartupDlg::EStartupChoice_OpenDoc: {
- Qt3DSFile theFile = m_dialogs->GetFileOpenChoice(getMostRecentDirectory());
- if (theFile.GetPath() != "") {
+ QString theFile = m_dialogs->GetFileOpenChoice(getMostRecentDirectory());
+ if (!theFile.isEmpty()) {
OnLoadDocument(theFile);
theReturn = true;
} else {
@@ -589,8 +583,8 @@ bool CStudioApp::showStartupDialog()
} break;
case CStartupDlg::EStartupChoice_OpenRecent: {
- Qt3DSFile theFile = theStartupDlg.GetRecentDoc();
- if (theFile.GetPath() != "") {
+ QString theFile = theStartupDlg.GetRecentDoc();
+ if (!theFile.isEmpty()) {
OnLoadDocument(theFile);
theReturn = true;
} else {
@@ -615,7 +609,7 @@ void CStudioApp::openApplication(const QString &inFilename)
{
m_fileOpenEvent = true;
QString loadFile = resolvePresentationFile(inFilename);
- OnLoadDocument(CString::fromQString(loadFile), true);
+ OnLoadDocument(loadFile, true);
}
#endif
@@ -664,7 +658,7 @@ bool CStudioApp::openAndRunApplication(const QString &inFilename)
bool theSuccess = false;
initCore();
// Load document. Upon failure, don't show startup dialog but exit immediately.
- if (OnLoadDocument(CString::fromQString(loadFile), false))
+ if (OnLoadDocument(loadFile, false))
theSuccess = runApplication();
return theSuccess;
}
@@ -676,13 +670,17 @@ bool CStudioApp::createAndRunApplication(const QString &filename, const QString
initCore();
// Append .uip if it is not included in the filename
QString actualFilename = filename;
- if (!actualFilename.endsWith(QStringLiteral(".uip")))
- actualFilename.append(QStringLiteral(".uip"));
+ if (!actualFilename.endsWith(QLatin1String(".uip")))
+ actualFilename.append(QLatin1String(".uip"));
+
+ QString actualFolder = folder;
+ if (!actualFolder.endsWith(QLatin1String("/")))
+ actualFilename.append(QLatin1String("/"));
+
// Create presentation
- Qt3DSFile theFile = Qt3DSFile(CString::fromQString(folder),
- CString::fromQString(actualFilename));
- if (theFile.GetPath() != "") {
- theSuccess = m_core->OnNewDocument(theFile, isNewProject, m_isSilent);
+ QString filePath = actualFolder + actualFilename;
+ if (!filePath.isEmpty()) {
+ theSuccess = m_core->OnNewDocument(filePath, isNewProject, m_isSilent);
if (!theSuccess)
return false;
@@ -731,8 +729,8 @@ struct SIImportFailedHandler : public Q3DStudio::IImportFailedHandler
: m_Dialogs(dialogs)
{
}
- void DisplayImportFailed(const QString &inDocumentPath,
- const QString &inDescription, bool inWarningsOnly) override
+ void DisplayImportFailed(const QString &inDocumentPath, const QString &inDescription,
+ bool inWarningsOnly) override
{
m_Dialogs.DisplayImportFailed(QUrl(inDocumentPath), inDescription, inWarningsOnly);
}
@@ -747,12 +745,12 @@ struct SIDeletingReferencedObjectHandler : public Q3DStudio::IDeletingReferenced
{
}
- void DisplayMessageBox(const Q3DStudio::CString &inDescription) override
+ void DisplayMessageBox(const QString &inDescription) override
{
QString theTitle = QObject::tr("Warning");
QString theMessage = QObject::tr("The following objects have action(s) that reference this "
"object and/or its descendants:\n%1\nPlease fix the "
- "action(s) accordingly.").arg(inDescription.toQString());
+ "action(s) accordingly.").arg(inDescription);
m_Dialogs.DisplayMessageBox(theTitle, theMessage, Qt3DSMessageBox::ICON_WARNING, false);
}
@@ -767,11 +765,9 @@ struct SIMoveRenameHandler : public Q3DStudio::IMoveRenameHandler
{
}
- void displayMessageBox(const Q3DStudio::CString &origName,
- const Q3DStudio::CString &newName) override
+ void displayMessageBox(const QString &origName, const QString &newName) override
{
- g_StudioApp.GetDialogs()->DisplayObjectRenamed(
- origName.toQString(), newName.toQString());
+ g_StudioApp.GetDialogs()->DisplayObjectRenamed(origName, newName);
}
};
@@ -817,7 +813,7 @@ void CStudioApp::handleMessageReceived(const QString &message, QObject *socket)
QFileInfo checkFile(checkPath);
QString docPath;
if (m_core)
- docPath = m_core->GetDoc()->GetDocumentPath().GetAbsolutePath().toQString();
+ docPath = m_core->GetDoc()->GetDocumentPath();
QFileInfo openFile(docPath);
if (!checkPath.isEmpty() && checkFile == openFile) {
lsocket->write(SharedTools::QtLocalPeer::acceptReply(),
@@ -1230,7 +1226,7 @@ bool CStudioApp::IsPlaying()
void CStudioApp::OnRevert()
{
if (!m_core->GetDoc()->IsModified() || m_dialogs->ConfirmRevert()) {
- Qt3DSFile theCurrentDoc = m_core->GetDoc()->GetDocumentPath();
+ QString theCurrentDoc = m_core->GetDoc()->GetDocumentPath();
OnLoadDocument(theCurrentDoc);
}
}
@@ -1239,16 +1235,16 @@ void CStudioApp::OnRevert()
/**
* Check to see if it is possible to perform a revert.
*/
-bool CStudioApp::CanRevert()
+bool CStudioApp::CanRevert() const
{
- return m_core->GetDoc()->IsModified() && m_core->GetDoc()->GetDocumentPath().GetPath() != "";
+ return m_core->GetDoc()->IsModified() && m_core->GetDoc()->IsValid();
}
//==============================================================================
/**
* Handles the recent list.
*/
-void CStudioApp::OnFileOpenRecent(const Qt3DSFile &inDocument)
+void CStudioApp::OnFileOpenRecent(const QString &inDocument)
{
if (PerformSavePrompt())
OnLoadDocument(inDocument);
@@ -1545,14 +1541,14 @@ bool CStudioApp::OnSave(bool autosave)
} else {
// Compose autosave filename (insert _autosave before extension)
QString autosaveFile = theCurrentDoc.GetPath().toQString();
- int insertionPoint = autosaveFile.lastIndexOf(QStringLiteral(".uip"));
+ int insertionPoint = autosaveFile.lastIndexOf(QLatin1String(".uip"));
autosaveFile.insert(insertionPoint, QStringLiteral("_autosave"));
if (autosave) {
// Set the copy flag to avoid changing actual document name & history
- m_core->OnSaveDocument(Qt3DSFile(CString::fromQString(autosaveFile)), true);
+ m_core->OnSaveDocument(autosaveFile, true);
} else {
- m_core->OnSaveDocument(theCurrentDoc);
+ m_core->OnSaveDocument(theCurrentDoc.GetAbsolutePath().toQString());
// Delete previous autosave file
QFile::remove(autosaveFile);
}
@@ -1570,8 +1566,8 @@ bool CStudioApp::OnSave(bool autosave)
*/
bool CStudioApp::OnSaveAs()
{
- Qt3DSFile theFile = m_dialogs->GetSaveAsChoice();
- if (theFile.GetPath() != "") {
+ QString theFile = m_dialogs->GetSaveAsChoice();
+ if (!theFile.isEmpty()) {
m_core->OnSaveDocument(theFile);
return true;
}
@@ -1587,8 +1583,8 @@ bool CStudioApp::OnSaveAs()
*/
bool CStudioApp::OnSaveCopy()
{
- Qt3DSFile theFile = m_dialogs->GetSaveAsChoice();
- if (theFile.GetPath() != "") {
+ QString theFile = m_dialogs->GetSaveAsChoice();
+ if (!theFile.isEmpty()) {
// Send in a "true" to the save function to indicate this is a copy
m_core->OnSaveDocument(theFile, true);
return true;
@@ -1617,25 +1613,24 @@ void CStudioApp::SetAutosaveInterval(int interval)
* @param inShowStartupDialogOnError true to show startup dialog if loading document is error
* @return true if loading was successful
*/
-bool CStudioApp::OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupDialogOnError)
+bool CStudioApp::OnLoadDocument(const QString &inDocument, bool inShowStartupDialogOnError)
{
bool theLoadResult = false;
QString theLoadErrorParameter;
QString theErrorText;
- QString loadFile = resolvePresentationFile(inDocument.GetPath().toQString());
- Qt3DSFile loadDocument(CString::fromQString(loadFile));
+ QString loadFile = resolvePresentationFile(inDocument);
+ QFileInfo loadFileInfo(loadFile);
- m_core->GetDispatch()->FireOnProgressBegin(CString::fromQString(QObject::tr("Loading ")),
- loadDocument.GetName());
+ m_core->GetDispatch()->FireOnProgressBegin(QObject::tr("Loading "), inDocument);
// Make sure scene is visible
if (m_views)
m_views->getMainFrame()->showScene();
try {
- m_core->getProjectFile().initProjectFile(loadDocument.GetAbsolutePath().toQString());
- OnLoadDocumentCatcher(loadDocument);
- m_core->GetDispatch()->FireOnOpenDocument(loadDocument, true);
+ m_core->getProjectFile().initProjectFile(loadFile);
+ OnLoadDocumentCatcher(loadFile);
+ m_core->GetDispatch()->FireOnOpenDocument(loadFile, true);
// Loading was successful
theLoadResult = true;
} catch (ProjectFileNotFoundException &) {
@@ -1651,16 +1646,14 @@ bool CStudioApp::OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupD
} catch (CLoadReferencedFileException &inError) {
// referenced files (e.g. Data Files) failed to load
theErrorText = tr("%1 failed to load due to invalid referenced file: %2.").arg(
- loadDocument.GetName().toQString(),
- Q3DStudio::CString(inError.GetFilePath()).toQString());
- const wchar_t *theDesc = inError.GetDescription();
- if (theDesc && wcslen(theDesc) > 0) {
+ loadFileInfo.completeBaseName(), inError.GetFilePath());
+ const QString theDesc = inError.GetDescription();
+ if (!theDesc.isEmpty()) {
// append any description is provided
- theErrorText += QStringLiteral("\n")
- + Q3DStudio::CString(inError.GetDescription()).toQString();
+ theErrorText += QStringLiteral("\n") + inError.GetDescription();
}
} catch (CIOException &) { // provide specific error message if possible
- if (loadDocument.Exists() == false)
+ if (!loadFileInfo.exists())
theLoadErrorParameter = tr(" does not exist.");
qCCritical(qt3ds::INTERNAL_ERROR)
<< "Failed to load document, IO error (file may be unreadable or nonexistent)";
@@ -1684,9 +1677,9 @@ bool CStudioApp::OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupD
if (!theErrorText.isEmpty())
m_dialogs->DisplayKnownErrorDialog(theErrorText);
else
- m_dialogs->DisplayLoadingPresentationFailed(loadDocument, theLoadErrorParameter);
+ m_dialogs->DisplayLoadingPresentationFailed(loadFileInfo, theLoadErrorParameter);
- m_core->GetDispatch()->FireOnOpenDocument(loadDocument, false);
+ m_core->GetDispatch()->FireOnOpenDocument(loadFile, false);
// Show startup dialog
if (inShowStartupDialogOnError) {
@@ -1694,7 +1687,7 @@ bool CStudioApp::OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupD
qApp->quit();
}
} else {
- m_dialogs->ResetSettings(loadDocument.GetPath());
+ m_dialogs->ResetSettings(loadFile);
m_core->getProjectFile().updateDocPresentationId();
m_core->getProjectFile().loadSubpresentationsAndDatainputs(m_subpresentations,
m_dataInputDialogItems);
@@ -1775,7 +1768,7 @@ QString CStudioApp::getMostRecentDirectory() const
CRecentItems *recentItems = m_views->getMainFrame()->GetRecentItems();
if (recentItems->GetItemCount() > 0) {
mostRecentDirectory
- = QFileInfo(recentItems->GetItem(0).GetAbsolutePath().toQString()).path();
+ = QFileInfo(recentItems->GetItem(0)).path();
}
}
return mostRecentDirectory.absoluteFilePath();
@@ -1787,7 +1780,7 @@ QString CStudioApp::getMostRecentProjectParentDir() const
if (m_views) {
CRecentItems *recentItems = m_views->getMainFrame()->GetRecentItems();
if (recentItems->GetItemCount() > 0) {
- QString mostRecentPresentation = recentItems->GetItem(0).GetAbsolutePath().toQString();
+ QString mostRecentPresentation = recentItems->GetItem(0);
QFileInfo projectFile(PresentationFile::findProjectFile(mostRecentPresentation));
if (!projectFile.exists())
projectFile.setFile(mostRecentPresentation);
@@ -1830,7 +1823,7 @@ bool CStudioApp::isQmlStream(const QString &fileName)
* Because of the nature of the error reporting, OnLoadDocument has to have
* a certain structure that limits it (C type variables, no object destructors).
*/
-void CStudioApp::OnLoadDocumentCatcher(const Qt3DSFile &inDocument)
+void CStudioApp::OnLoadDocumentCatcher(const QString &inDocument)
{
{
CDispatchDataModelNotificationScope __scope(*m_core->GetDispatch());
@@ -1846,8 +1839,8 @@ void CStudioApp::OnLoadDocumentCatcher(const Qt3DSFile &inDocument)
void CStudioApp::OnFileOpen()
{
if (PerformSavePrompt()) {
- Qt3DSFile theFile = m_dialogs->GetFileOpenChoice(getMostRecentDirectory());
- if (theFile.GetPath() != "")
+ QString theFile = m_dialogs->GetFileOpenChoice(getMostRecentDirectory());
+ if (!theFile.isEmpty())
OnLoadDocument(theFile);
}
}
@@ -1859,15 +1852,13 @@ void CStudioApp::OnFileOpen()
QString CStudioApp::OnProjectNew()
{
if (PerformSavePrompt()) {
- Qt3DSFile theFile = m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir(), true);
- if (theFile.GetPath() != "") {
+ QString theFile = m_dialogs->GetNewDocumentChoice(getMostRecentProjectParentDir(), true);
+ if (!theFile.isEmpty()) {
if (!m_core->OnNewDocument(theFile, true))
showInvalidFilenameWarning();
- } else {
- return theFile.GetName().toQString();
}
}
- return QString();
+ return {};
}
/**
@@ -1877,8 +1868,8 @@ QString CStudioApp::OnProjectNew()
void CStudioApp::OnFileNew()
{
if (PerformSavePrompt()) {
- Qt3DSFile theFile = m_dialogs->GetNewDocumentChoice(getMostRecentDirectory(), false);
- if (!theFile.GetPath().IsEmpty() && !m_core->OnNewDocument(theFile, false))
+ QString theFile = m_dialogs->GetNewDocumentChoice(getMostRecentDirectory(), false);
+ if (!theFile.isEmpty() && !m_core->OnNewDocument(theFile, false))
showInvalidFilenameWarning();
}
}
@@ -1909,13 +1900,13 @@ void CStudioApp::OnAsynchronousCommand(CCmd *inCmd)
CMsgRouter::GetInstance()->SendCommand(inCmd, m_core);
}
-void CStudioApp::OnDisplayAppStatus(Q3DStudio::CString &inStatusMsg)
+void CStudioApp::OnDisplayAppStatus(const QString &inStatusMsg)
{
// Do nothing, it was used to show this in the status bar
}
-void CStudioApp::OnProgressBegin(const Q3DStudio::CString &inActionText,
- const Q3DStudio::CString &inAdditionalText)
+void CStudioApp::OnProgressBegin(const QString &inActionText,
+ const QString &inAdditionalText)
{
m_isOnProgress = true;
m_dialogs->DisplayProgressScreen(inActionText, inAdditionalText);
@@ -1939,9 +1930,9 @@ void CStudioApp::OnPasteFail()
m_dialogs->DisplayPasteFailed();
}
-void CStudioApp::OnBuildconfigurationFileParseFail(const Q3DStudio::CString &inMessage)
+void CStudioApp::OnBuildconfigurationFileParseFail(const QString &inMessage)
{
- m_dialogs->DisplayMessageBox(tr("Build Configurations Error"), inMessage.toQString(),
+ m_dialogs->DisplayMessageBox(tr("Build Configurations Error"), inMessage,
Qt3DSMessageBox::ICON_ERROR, false);
}
@@ -1955,24 +1946,17 @@ void CStudioApp::OnSaveFail(bool inKnownError)
m_dialogs->DisplayKnownErrorDialog(tr("Unknown error encountered while saving."));
}
-void CStudioApp::OnProjectVariableFail(const Q3DStudio::CString &inMessage)
+void CStudioApp::OnErrorFail(const QString &inText)
{
- m_dialogs->DisplayEnvironmentVariablesError(inMessage);
-}
-
-void CStudioApp::OnErrorFail(const Q3DStudio::CString &inText)
-{
- qCCritical(qt3ds::INTERNAL_ERROR) << inText.GetCharStar();
- m_dialogs->DisplayMessageBox(tr("Qt 3D Studio"), inText.toQString(),
- Qt3DSMessageBox::ICON_ERROR, false);
+ qCCritical(qt3ds::INTERNAL_ERROR) << inText;
+ m_dialogs->DisplayMessageBox(tr("Qt 3D Studio"), inText, Qt3DSMessageBox::ICON_ERROR, false);
}
-void CStudioApp::OnRefreshResourceFail(const Q3DStudio::CString &inResourceName,
- const Q3DStudio::CString &inDescription)
+void CStudioApp::OnRefreshResourceFail(const QString &inResourceName, const QString &inDescription)
{
qCCritical(qt3ds::INTERNAL_ERROR) << "Failed to refresh resource: "
- << inResourceName.GetCharStar();
- qCCritical(qt3ds::INTERNAL_ERROR) << inDescription.GetCharStar();
+ << inResourceName;
+ qCCritical(qt3ds::INTERNAL_ERROR) << inDescription;
m_dialogs->DisplayRefreshResourceFailed(inResourceName, inDescription);
}
@@ -1981,7 +1965,7 @@ void CStudioApp::OnNewPresentation()
m_core->GetDoc()->GetStudioSystem()->GetAnimationSystem()->SetAutoKeyframe(
CStudioPreferences::IsAutosetKeyframesOn());
qCInfo(qt3ds::TRACE_INFO) << "New Presentation: "
- << m_core->GetDoc()->GetDocumentPath().GetAbsolutePath().GetCharStar();
+ << m_core->GetDoc()->GetDocumentPath();
}
void CStudioApp::OnPresentationModifiedExternally()
@@ -1991,7 +1975,7 @@ void CStudioApp::OnPresentationModifiedExternally()
tr("This project has changed on disk. Do you want to reload it?"),
Qt3DSMessageBox::ICON_WARNING);
if (theUserChoice == IDYES) {
- Qt3DSFile theCurrentDoc = m_core->GetDoc()->GetDocumentPath();
+ QString theCurrentDoc = m_core->GetDoc()->GetDocumentPath();
OnLoadDocument(theCurrentDoc);
}
}
@@ -2008,7 +1992,7 @@ QString CStudioApp::getRenderableId(const QString &filePath) const
if (fi.isAbsolute()) {
renderablePath = filePath.mid(index);
} else {
- QFileInfo presFile(m_core->GetDoc()->GetDocumentPath().GetAbsolutePath().toQString());
+ QFileInfo presFile(m_core->GetDoc()->GetDocumentPath());
QDir presDir(presFile.absoluteDir());
QString checkFile = QDir::cleanPath(presDir.absoluteFilePath(filePath));
if (!QFileInfo(checkFile).exists()) {
diff --git a/src/Authoring/Studio/Application/StudioApp.h b/src/Authoring/Studio/Application/StudioApp.h
index 0af9bcdb..44187995 100644
--- a/src/Authoring/Studio/Application/StudioApp.h
+++ b/src/Authoring/Studio/Application/StudioApp.h
@@ -28,16 +28,13 @@
****************************************************************************/
#ifndef INCLUDED_STUDIO_APP_H
-#define INCLUDED_STUDIO_APP_H 1
-
-#pragma once
+#define INCLUDED_STUDIO_APP_H
#include "StudioObjectTypes.h"
#include "Qt3DSImportComposerTypes.h"
#include "Qt3DSDMComposerTypeDefinitions.h"
#include "DispatchListeners.h"
#include "Qt3DSDMHandles.h"
-#include "Qt3DSFileTools.h"
#include <QtWidgets/qapplication.h>
namespace Q3DStudio {
@@ -191,8 +188,8 @@ public:
void PlaybackRewind();
bool IsPlaying();
void OnRevert();
- bool CanRevert();
- void OnFileOpenRecent(const Qt3DSFile &inDocument);
+ bool CanRevert() const;
+ void OnFileOpenRecent(const QString &inDocument);
bool PerformSavePrompt();
void PlaybackStop();
bool isPlaybackPreviewOn() const;
@@ -207,8 +204,8 @@ public:
bool OnSave(bool autosave = false);
bool OnSaveAs();
bool OnSaveCopy();
- bool OnLoadDocument(const Qt3DSFile &inDocument, bool inShowStartupDialogOnError = true);
- void OnLoadDocumentCatcher(const Qt3DSFile &inLocation);
+ bool OnLoadDocument(const QString &inDocument, bool inShowStartupDialogOnError = true);
+ void OnLoadDocumentCatcher(const QString &inLocation);
void OnFileOpen();
QString OnProjectNew();
void OnFileNew();
@@ -231,20 +228,19 @@ public:
void OnAsynchronousCommand(CCmd *inCmd) override;
// CAppStatusListener
- void OnDisplayAppStatus(Q3DStudio::CString &inStatusMsg) override;
- void OnProgressBegin(const Q3DStudio::CString &inActionText,
- const Q3DStudio::CString &inAdditionalText) override;
+ void OnDisplayAppStatus(const QString &inStatusMsg) override;
+ void OnProgressBegin(const QString &inActionText,
+ const QString &inAdditionalText) override;
void OnProgressEnd() override;
// CFailListener
void OnAssetDeleteFail() override;
void OnPasteFail() override;
- void OnBuildconfigurationFileParseFail(const Q3DStudio::CString &inMessage) override;
+ void OnBuildconfigurationFileParseFail(const QString &inMessage) override;
void OnSaveFail(bool inKnownError) override;
- void OnProjectVariableFail(const Q3DStudio::CString &inMessage) override;
- void OnErrorFail(const Q3DStudio::CString &inText) override;
- void OnRefreshResourceFail(const Q3DStudio::CString &inResourceName,
- const Q3DStudio::CString &inDescription) override;
+ void OnErrorFail(const QString &inText) override;
+ void OnRefreshResourceFail(const QString &inResourceName,
+ const QString &inDescription) override;
void OnUndefinedDatainputsFail(
const QMultiMap<QString,
QPair<qt3dsdm::Qt3DSDMInstanceHandle,
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp
index 91e2186f..280cca70 100644
--- a/src/Authoring/Studio/MainFrm.cpp
+++ b/src/Authoring/Studio/MainFrm.cpp
@@ -113,7 +113,7 @@ CMainFrame::CMainFrame()
connect(m_ui->actionData_Inputs, &QAction::triggered, this, &CMainFrame::OnFileDataInputs);
connect(m_ui->action_Connect_to_Device, &QAction::triggered, this,
&CMainFrame::OnFileConnectToDevice);
- m_recentItems.reset(new CRecentItems(m_ui->menuRecent_Projects, 0));
+ m_recentItems.reset(new CRecentItems(m_ui->menuRecent_Projects));
connect(m_recentItems.data(), &CRecentItems::openRecent, this, &CMainFrame::OnFileOpenRecent);
connect(m_ui->action_Exit, &QAction::triggered, this, &CMainFrame::close);
@@ -355,11 +355,11 @@ void CMainFrame::OnCreate()
CDialogs *theDialogs = g_StudioApp.GetDialogs();
// this must NOT be in 'command line' mode
if (theDialogs) {
- Q3DStudio::CString theMostRecentOpen;
+ QString theMostRecentOpen;
if (m_recentItems && m_recentItems->GetItemCount() > 0)
- theMostRecentOpen = m_recentItems->GetItem(0).GetPath();
- if (theMostRecentOpen.IsEmpty()) // default to exe
- theMostRecentOpen = Qt3DSFile::GetApplicationDirectory().GetPath();
+ theMostRecentOpen = m_recentItems->GetItem(0);
+ if (theMostRecentOpen.isEmpty()) // default to exe
+ theMostRecentOpen = Qt3DSFile::GetApplicationDirectory();
theDialogs->ResetSettings(theMostRecentOpen);
}
@@ -1020,8 +1020,7 @@ void CMainFrame::OnPlaybackPreview(const QString &viewerExeName, bool remote)
{
if (remote && m_remoteDeploymentSender->isConnected()) {
g_StudioApp.GetCore()->GetDispatch()->FireOnProgressBegin(
- Q3DStudio::CString::fromQString(QObject::tr("Deploying to remote device...")),
- "");
+ QObject::tr("Deploying to remote device..."), {});
CPreviewHelper::OnDeploy(*m_remoteDeploymentSender);
g_StudioApp.GetCore()->GetDispatch()->FireOnProgressEnd();
} else {
@@ -1775,15 +1774,13 @@ void CMainFrame::OnFileConnectToDevice()
{
if (m_remoteDeploymentSender->isConnected()) {
g_StudioApp.GetCore()->GetDispatch()->FireOnProgressBegin(
- Q3DStudio::CString::fromQString(
- QObject::tr("Disconnecting from remote device...")), "");
+ QObject::tr("Disconnecting from remote device..."), {});
m_remoteDeploymentSender->disconnect();
} else {
QPair<QString, int> info = m_remoteDeploymentSender->initConnection();
if (!info.first.isEmpty()) {
g_StudioApp.GetCore()->GetDispatch()->FireOnProgressBegin(
- Q3DStudio::CString::fromQString(
- QObject::tr("Connecting to remote device...")), "");
+ QObject::tr("Connecting to remote device..."), {});
m_remoteDeploymentSender->connect(info);
} else {
m_ui->action_Connect_to_Device->setChecked(false);
@@ -1813,7 +1810,7 @@ void CMainFrame::RecheckSizingMode()
/**
* Callback when a Core is opened or fails to open.
*/
-void CMainFrame::OnOpenDocument(const Qt3DSFile &inFilename, bool inSucceeded)
+void CMainFrame::OnOpenDocument(const QString &inFilename, bool inSucceeded)
{
if (inSucceeded)
m_recentItems->AddRecentItem(inFilename);
@@ -1825,7 +1822,7 @@ void CMainFrame::OnOpenDocument(const Qt3DSFile &inFilename, bool inSucceeded)
/**
* Callback when a Core is saved or fails to save.
*/
-void CMainFrame::OnSaveDocument(const Qt3DSFile &inFilename, bool inSucceeded, bool inSaveCopy)
+void CMainFrame::OnSaveDocument(const QString &inFilename, bool inSucceeded, bool inSaveCopy)
{
if (!inSaveCopy)
OnOpenDocument(inFilename, inSucceeded);
@@ -1835,18 +1832,19 @@ void CMainFrame::OnSaveDocument(const Qt3DSFile &inFilename, bool inSucceeded, b
/**
* Callback for when a the doc gets a new path
*/
-void CMainFrame::OnDocumentPathChanged(const Qt3DSFile &inNewPath)
+void CMainFrame::OnDocumentPathChanged(const QString &inNewPath)
{
- QString theTitle = inNewPath.GetName().toQString();
+ QFileInfo info(inNewPath);
+ QString theTitle = info.fileName();
if (theTitle.isEmpty())
theTitle = QObject::tr("Untitled");
- theTitle = theTitle + " - " + QObject::tr("Qt 3D Studio");
+ theTitle.append(QStringLiteral(" - ") + QObject::tr("Qt 3D Studio"));
// TODO: Move this whole pile to the studio app
setWindowTitle(theTitle);
- if (inNewPath.Exists())
+ if (info.exists())
m_recentItems->AddRecentItem(inNewPath);
}
@@ -1972,8 +1970,7 @@ void CMainFrame::handleGeometryAndState(bool save)
void CMainFrame::handleRestart()
{
- QStringList presentationFile = QStringList(g_StudioApp.GetCore()->GetDoc()
- ->GetDocumentPath().GetAbsolutePath().toQString());
+ QStringList presentationFile = QStringList(g_StudioApp.GetCore()->GetDoc()->GetDocumentPath());
close();
QProcess::startDetached(qApp->arguments()[0], presentationFile);
}
diff --git a/src/Authoring/Studio/MainFrm.h b/src/Authoring/Studio/MainFrm.h
index b9e8dcf8..a51b4620 100644
--- a/src/Authoring/Studio/MainFrm.h
+++ b/src/Authoring/Studio/MainFrm.h
@@ -84,9 +84,9 @@ public:
void OnClosingPresentation() override;
// CFileOpenListener
- void OnOpenDocument(const Qt3DSFile &inFilename, bool inSucceeded) override;
- void OnSaveDocument(const Qt3DSFile &inFilename, bool inSucceeded, bool inSaveCopy) override;
- void OnDocumentPathChanged(const Qt3DSFile &inNewPath) override;
+ void OnOpenDocument(const QString &inFilename, bool inSucceeded) override;
+ void OnSaveDocument(const QString &inFilename, bool inSucceeded, bool inSaveCopy) override;
+ void OnDocumentPathChanged(const QString &inNewPath) override;
void RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler, QWidget *actionParent);
void RecheckSizingMode();
diff --git a/src/Authoring/Studio/Palettes/Inspector/GuideInspectable.cpp b/src/Authoring/Studio/Palettes/Inspector/GuideInspectable.cpp
index 82d14319..01b0f25d 100644
--- a/src/Authoring/Studio/Palettes/Inspector/GuideInspectable.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/GuideInspectable.cpp
@@ -309,7 +309,7 @@ qt3dsdm::SValue SGuideInspectableImpl::GetWidth()
Q3DStudio::IDocumentEditor &SGuideInspectableImpl::Editor()
{
- return m_Editor.EnsureEditor(L"Set Property", __FILE__, __LINE__);
+ return m_Editor.EnsureEditor(QObject::tr("Set Property"), __FILE__, __LINE__);
}
void SGuideInspectableImpl::Commit()
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 3e884694..1f5a7d0c 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -362,8 +362,7 @@ void InspectorControlModel::setMatDatas(std::vector<Q3DStudio::CFilePath> &matDa
if (values.contains(QStringLiteral("presentation"))
&& values.contains(QStringLiteral("path"))
&& values.contains(QStringLiteral("filename"))) {
- if (values[QStringLiteral("presentation")]
- == doc->GetDocumentPath().GetAbsolutePath().toQString()) {
+ if (values[QStringLiteral("presentation")] == doc->GetDocumentPath()) {
if (!QFileInfo(values["path"]).exists()) {
const auto instance = sceneEditor->getMaterial(
Q3DStudio::CString::fromQString(
@@ -1554,7 +1553,7 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV
Q3DStudio::IStudioRenderer &theRenderer(g_StudioApp.getRenderer());
theRenderer.MakeContextCurrent();
- m_UpdatableEditor.EnsureEditor(L"Set Property", __FILE__, __LINE__)
+ m_UpdatableEditor.EnsureEditor(QObject::tr("Set Property"), __FILE__, __LINE__)
.SetInstancePropertyValue(instance, handle, v);
theRenderer.ReleaseContext();
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 7e93f2d9..153e2447 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -393,7 +393,7 @@ void InspectorControlView::showContextMenu(int x, int y, int handle, int instanc
void InspectorControlView::toggleMasterLink()
{
Q3DStudio::ScopedDocumentEditor editor(*g_StudioApp.GetCore()->GetDoc(),
- L"Link Property", __FILE__, __LINE__);
+ QObject::tr("Link Property"), __FILE__, __LINE__);
bool wasLinked = editor->IsPropertyLinked(m_instance, m_handle);
if (wasLinked)
@@ -650,10 +650,10 @@ bool InspectorControlView::toolTipsEnabled()
QString InspectorControlView::convertPathToProjectRoot(const QString &presentationPath)
{
QDir projDir(g_StudioApp.GetCore()->getProjectFile().getProjectPath());
- QFileInfo presentationFile(g_StudioApp.GetCore()->GetDoc()->GetDocumentPath()
- .GetAbsolutePath().toQString());
+ QFileInfo presentationFile(g_StudioApp.GetCore()->GetDoc()->GetDocumentPath());
QDir presentationDir(presentationFile.absolutePath());
QString absPath = presentationDir.absoluteFilePath(presentationPath);
+
return projDir.relativeFilePath(absPath);
}
diff --git a/src/Authoring/Studio/Palettes/Progress/ProgressView.cpp b/src/Authoring/Studio/Palettes/Progress/ProgressView.cpp
index a5ea681b..e6f57687 100644
--- a/src/Authoring/Studio/Palettes/Progress/ProgressView.cpp
+++ b/src/Authoring/Studio/Palettes/Progress/ProgressView.cpp
@@ -54,12 +54,12 @@ CProgressView::~CProgressView()
delete m_ui;
}
-void CProgressView::SetActionText(const Q3DStudio::CString &inActionText)
+void CProgressView::SetActionText(const QString &inActionText)
{
- m_ui->progressActionText->setText(inActionText.toQString());
+ m_ui->progressActionText->setText(inActionText);
}
-void CProgressView::SetAdditionalText(const Q3DStudio::CString &inAdditionalText)
+void CProgressView::SetAdditionalText(const QString &inAdditionalText)
{
- m_ui->progressAdditionalText->setText(inAdditionalText.toQString());
+ m_ui->progressAdditionalText->setText(inAdditionalText);
}
diff --git a/src/Authoring/Studio/Palettes/Progress/ProgressView.h b/src/Authoring/Studio/Palettes/Progress/ProgressView.h
index 5e3fe24c..384c72d7 100644
--- a/src/Authoring/Studio/Palettes/Progress/ProgressView.h
+++ b/src/Authoring/Studio/Palettes/Progress/ProgressView.h
@@ -55,8 +55,8 @@ public:
CProgressView(QWidget *parent = nullptr);
virtual ~CProgressView();
- void SetActionText(const Q3DStudio::CString &inActionText);
- void SetAdditionalText(const Q3DStudio::CString &inAdditionalText);
+ void SetActionText(const QString &inActionText);
+ void SetAdditionalText(const QString &inAdditionalText);
protected:
Ui::ProgressDlg *m_ui;
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp b/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
index 218dc8df..6d35cd09 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
+++ b/src/Authoring/Studio/Palettes/Project/ProjectFileSystemModel.cpp
@@ -180,9 +180,8 @@ void ProjectFileSystemModel::updateReferences()
// Add current presentation to renderables list
renderableList.insert(doc->getPresentationId());
subpresentationRecord.push_back(
- SubPresentationRecord(
- QString(), doc->getPresentationId(),
- projectDir.relativeFilePath(doc->GetDocumentPath().GetPath().toQString())));
+ SubPresentationRecord({}, doc->getPresentationId(),
+ projectDir.relativeFilePath(doc->GetDocumentPath())));
auto addReferencesPresentation = [this, doc, &projectPath](const Q3DStudio::CString &str) {
addPathsToReferences(projectPath, doc->GetResolvedPathToDoc(str).toQString());
@@ -995,8 +994,7 @@ void ProjectFileSystemModel::asyncUpdateReferences()
bool ProjectFileSystemModel::isCurrentPresentation(const QString &path) const
{
- return path == g_StudioApp.GetCore()->GetDoc()->GetDocumentPath().GetPath().toQString()
- .replace(QLatin1String("\\"), QLatin1String("/"));
+ return path == g_StudioApp.GetCore()->GetDoc()->GetDocumentPath();
}
bool ProjectFileSystemModel::isInitialPresentation(const QString &path) const
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectView.cpp b/src/Authoring/Studio/Palettes/Project/ProjectView.cpp
index 15f0e4f4..bb1cac97 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectView.cpp
+++ b/src/Authoring/Studio/Palettes/Project/ProjectView.cpp
@@ -55,8 +55,7 @@ ProjectView::ProjectView(const QSize &preferredSize, QWidget *parent) : QQuickWi
, m_ProjectModel(new ProjectFileSystemModel(this))
, m_preferredSize(preferredSize)
{
- const QString theApplicationPath =
- Qt3DSFile::GetApplicationDirectory().GetPath().toQString();
+ const QString theApplicationPath = Qt3DSFile::GetApplicationDirectory();
m_defaultBehaviorDir = theApplicationPath + QStringLiteral("/Content/Behavior Library");
m_defaultEffectDir = theApplicationPath + QStringLiteral("/Content/Effect Library");
@@ -215,13 +214,13 @@ void ProjectView::OnNewPresentation()
rebuild();
}
-void ProjectView::OnOpenDocument(const Qt3DSFile &inFilename, bool inSucceeded)
+void ProjectView::OnOpenDocument(const QString &inFilename, bool inSucceeded)
{
Q_UNUSED(inFilename)
Q_UNUSED(inSucceeded)
}
-void ProjectView::OnSaveDocument(const Qt3DSFile &inFilename, bool inSucceeded, bool inSaveCopy)
+void ProjectView::OnSaveDocument(const QString &inFilename, bool inSucceeded, bool inSaveCopy)
{
Q_UNUSED(inFilename)
Q_UNUSED(inSucceeded)
@@ -229,7 +228,7 @@ void ProjectView::OnSaveDocument(const Qt3DSFile &inFilename, bool inSucceeded,
m_ProjectModel->asyncUpdateReferences();
}
-void ProjectView::OnDocumentPathChanged(const Qt3DSFile &inNewPath)
+void ProjectView::OnDocumentPathChanged(const QString &inNewPath)
{
Q_UNUSED(inNewPath)
}
@@ -285,8 +284,7 @@ void ProjectView::openPresentation(int row)
{
if (g_StudioApp.PerformSavePrompt()) {
const QString path = m_ProjectModel->filePath(row);
- const Qt3DSFile file(Q3DStudio::CString::fromQString(path));
- g_StudioApp.OnLoadDocument(file);
+ g_StudioApp.OnLoadDocument(path);
}
}
diff --git a/src/Authoring/Studio/Palettes/Project/ProjectView.h b/src/Authoring/Studio/Palettes/Project/ProjectView.h
index fbd8ec10..96e170b5 100644
--- a/src/Authoring/Studio/Palettes/Project/ProjectView.h
+++ b/src/Authoring/Studio/Palettes/Project/ProjectView.h
@@ -98,9 +98,9 @@ public:
// CPresentationChangeListener
void OnNewPresentation() override;
// CFileOpenListener
- void OnOpenDocument(const Qt3DSFile &inFilename, bool inSucceeded) override;
- void OnSaveDocument(const Qt3DSFile &inFilename, bool inSucceeded, bool inSaveCopy) override;
- void OnDocumentPathChanged(const Qt3DSFile &inNewPath) override;
+ void OnOpenDocument(const QString &inFilename, bool inSucceeded) override;
+ void OnSaveDocument(const QString &inFilename, bool inSucceeded, bool inSaveCopy) override;
+ void OnDocumentPathChanged(const QString &inNewPath) override;
// IDataModelListener
void OnBeginDataModelNotifications() override;
void OnEndDataModelNotifications() override;
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp
index 6525cce9..a0c4ee99 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp
@@ -56,7 +56,7 @@ void COffsetKeyframesCommandHelper::SetCommandTime(qt3dsdm::Qt3DSDMKeyframeHandl
long inTime)
{
// The DataModel system will take care of merging these under the hood.
- ENSURE_EDITOR(L"Set Keyframe Time").SetKeyframeTime(inKeyframe, inTime);
+ ENSURE_EDITOR(QObject::tr("Set Keyframe Time")).SetKeyframeTime(inKeyframe, inTime);
}
// equivalent to commit (onmouseup)
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp
index 9581265f..f646415d 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp
@@ -39,8 +39,8 @@ bool CPathTimelineItemBinding::IsExternalizeable()
void CPathTimelineItemBinding::Externalize()
{
- Q3DStudio::ScopedDocumentEditor(*m_TransMgr->GetDoc(), L"Externalize Path Buffer", __FILE__,
- __LINE__)
+ Q3DStudio::ScopedDocumentEditor(*m_TransMgr->GetDoc(), QObject::tr("Externalize Path Buffer"),
+ __FILE__, __LINE__)
->ExternalizePath(GetInstance());
}
@@ -52,7 +52,7 @@ bool CPathTimelineItemBinding::IsInternalizeable()
void CPathTimelineItemBinding::Internalize()
{
- Q3DStudio::ScopedDocumentEditor(*m_TransMgr->GetDoc(), L"Internalize Path Buffer", __FILE__,
- __LINE__)
+ Q3DStudio::ScopedDocumentEditor(*m_TransMgr->GetDoc(), QObject::tr("Internalize Path Buffer"),
+ __FILE__, __LINE__)
->InternalizePath(GetInstance());
}
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
index e4c7ce78..7fa26eaa 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
@@ -195,7 +195,8 @@ void ToggleChildrenLock(Q3DStudio::ScopedDocumentEditor &scopedDocEditor,
void Qt3DSDMTimelineItemBinding::SetLocked(bool inLocked)
{
CDoc *theDoc = dynamic_cast<CDoc *>(g_StudioApp.GetCore()->GetDoc());
- Q3DStudio::ScopedDocumentEditor scopedDocEditor(*theDoc, L"SetLock", __FILE__, __LINE__);
+ Q3DStudio::ScopedDocumentEditor scopedDocEditor(*theDoc, QObject::tr("SetLock"), __FILE__,
+ __LINE__);
SDataModelSceneAsset sceneAsset = m_StudioSystem->GetClientDataModelBridge()->GetSceneAsset();
ToggleChildrenLock(scopedDocEditor, this, sceneAsset, inLocked);
@@ -767,8 +768,8 @@ void Qt3DSDMTimelineItemBinding::InsertKeyframe()
return;
TPropertyBindingMap::const_iterator theIter = m_PropertyBindingMap.begin();
- ScopedDocumentEditor editor(*g_StudioApp.GetCore()->GetDoc(), L"Insert Keyframe", __FILE__,
- __LINE__);
+ ScopedDocumentEditor editor(*g_StudioApp.GetCore()->GetDoc(), QObject::tr("Insert Keyframe"),
+ __FILE__, __LINE__);
for (; theIter != m_PropertyBindingMap.end(); ++theIter)
editor->KeyframeProperty(m_DataHandle, theIter->first, false);
}
@@ -779,13 +780,10 @@ void Qt3DSDMTimelineItemBinding::DeleteAllChannelKeyframes()
return;
CDoc *theDoc = m_TransMgr->GetDoc();
- Q3DStudio::ScopedDocumentEditor editor(*theDoc, L"Delete Channel Keyframes", __FILE__,
- __LINE__);
- for (TPropertyBindingMap::iterator theIter = m_PropertyBindingMap.begin(),
- theEnd = m_PropertyBindingMap.end();
- theIter != theEnd; ++theIter) {
- theIter->second->DeleteAllKeys();
- }
+ Q3DStudio::ScopedDocumentEditor editor(*theDoc, QObject::tr("Delete Channel Keyframes"),
+ __FILE__, __LINE__);
+ for (auto &kv : m_PropertyBindingMap)
+ kv.second->DeleteAllKeys();
}
IKeyframe *Qt3DSDMTimelineItemBinding::GetKeyframeByTime(long inTime) const
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
index e241913d..73a7bb7d 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
@@ -232,7 +232,8 @@ void Qt3DSDMTimelineItemProperty::DeleteAllKeys()
using namespace Q3DStudio;
- ScopedDocumentEditor editor(*m_TransMgr->GetDoc(), L"Delete All Keyframes", __FILE__, __LINE__);
+ ScopedDocumentEditor editor(*m_TransMgr->GetDoc(), QObject::tr("Delete All Keyframes"),
+ __FILE__, __LINE__);
for (size_t idx = 0, end = m_AnimationHandles.size(); idx < end; ++idx)
editor->DeleteAllKeyframes(m_AnimationHandles[idx]);
}
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
index a4f27f6e..8c76046c 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
@@ -174,7 +174,7 @@ void Qt3DSDMTimelineTimebar::OnBeginDrag()
void Qt3DSDMTimelineTimebar::OffsetTime(long inDiff)
{
if (m_DataHandle.Valid()) {
- ENSURE_EDITOR(L"Time Bar Move").OffsetTimeRange(m_DataHandle, inDiff);
+ ENSURE_EDITOR(QObject::tr("Time Bar Move")).OffsetTimeRange(m_DataHandle, inDiff);
m_TimelineTranslationManager->GetDoc()
->GetCore()
->GetDispatch()
@@ -185,7 +185,8 @@ void Qt3DSDMTimelineTimebar::OffsetTime(long inDiff)
void Qt3DSDMTimelineTimebar::ChangeTime(long inTime, bool inSetStart)
{
if (m_DataHandle.Valid()) {
- ENSURE_EDITOR(L"Time Bar Resize").ResizeTimeRange(m_DataHandle, inTime, inSetStart);
+ ENSURE_EDITOR(QObject::tr("Time Bar Resize")).ResizeTimeRange(m_DataHandle, inTime,
+ inSetStart);
m_TimelineTranslationManager->GetDoc()
->GetCore()
->GetDispatch()
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
index 13908be2..9dd937d5 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
@@ -554,7 +554,7 @@ void KeyframeManager::SetKeyframeInterpolation()
if (g_StudioApp.GetDialogs()->PromptForKeyframeInterpolation(theEaseIn, theEaseOut)) {
// Note: Having "editor" variable here is important as its destructor
// creates proper transaction
- Q3DStudio::ScopedDocumentEditor editor(*theDoc, L"Set Keyframe Interpolation",
+ Q3DStudio::ScopedDocumentEditor editor(*theDoc, QObject::tr("Set Keyframe Interpolation"),
__FILE__, __LINE__);
for (Keyframe *keyframe : qAsConst(m_selectedKeyframes)) {
Qt3DSDMTimelineKeyframe *theTimelineKeyframe = keyframe->binding;
@@ -586,7 +586,7 @@ void KeyframeManager::SetChangedKeyframes()
qt3dsdm::Qt3DSDMInstanceHandle selectedInstance = theDoc->GetSelectedInstance();
if (selectedInstance.Valid()) {
using namespace Q3DStudio;
- Q3DStudio::ScopedDocumentEditor editor(*theDoc, L"Set Changed Keyframes",
+ Q3DStudio::ScopedDocumentEditor editor(*theDoc, QObject::tr("Set Changed Keyframes"),
__FILE__, __LINE__);
CStudioSystem *theStudioSystem = theDoc->GetStudioSystem();
// Get all animated properties.
diff --git a/src/Authoring/Studio/PreviewHelper.cpp b/src/Authoring/Studio/PreviewHelper.cpp
index 852bb2a7..18bc6223 100644
--- a/src/Authoring/Studio/PreviewHelper.cpp
+++ b/src/Authoring/Studio/PreviewHelper.cpp
@@ -35,7 +35,6 @@
#include "Doc.h"
#include "StudioPreferences.h"
#include "StudioProjectSettings.h"
-#include "StudioProjectVariables.h"
#include "Core.h"
#include "Qt3DSFileTools.h"
@@ -100,7 +99,7 @@ void CPreviewHelper::PreviewViaConfig(Q3DStudio::CBuildConfiguration *inSelected
QString CPreviewHelper::getViewerFilePath(const QString &exeName)
{
using namespace Q3DStudio;
- CFilePath currentPath(Qt3DSFile::GetApplicationDirectory().GetAbsolutePath());
+ CFilePath currentPath(Qt3DSFile::GetApplicationDirectory());
CFilePath viewerDir(QApplication::applicationDirPath());
QString viewerFile;
@@ -159,7 +158,7 @@ void CPreviewHelper::cleanupProcess(QProcess *p, QString *docPath)
p->disconnect();
if (docPath->endsWith(QLatin1String("_@preview@.uia"))) {
QString uipPreviewPath = g_StudioApp.GetCore()->GetDoc()->GetDocumentPath()
- .GetAbsolutePath().toQString().replace(".uip", "_@preview@.uip");
+ .replace(QLatin1String(".uip"), QLatin1String("_@preview@.uip"));
QFile(uipPreviewPath).remove(); // remove uip preview (if exists)
QFile(*docPath).remove(); // remove uia preview
} else if (docPath->endsWith(QLatin1String("_@preview@.uip"))) {
@@ -215,94 +214,3 @@ void CPreviewHelper::DoPreviewViaConfig(Q3DStudio::CBuildConfiguration * /*inSel
}
}
}
-
-bool CPreviewHelper::viewerExists(const QString &exeName)
-{
- return QFileInfo(getViewerFilePath(exeName)).exists();
-}
-
-//=============================================================================
-/**
- * Interpret the string by resolving the variables.
- * @param inSourceString String to be interpreted
- */
-Q3DStudio::CString CPreviewHelper::InterpretString(Q3DStudio::CBuildConfiguration *inSelectedConfig,
- const Q3DStudio::CString &inDocumentFile,
- const Q3DStudio::CString &inSourceString)
-{
- Q3DStudio::CString theReturnString;
- long theStart = 0; // start index of string
- long theBeginIndex = 0; // index of '%'
- long theEndIndex = 0; // index of '%'
- while (Q3DStudio::CString::ENDOFSTRING != theEndIndex) {
- theBeginIndex = inSourceString.Find('%', theStart);
- if (Q3DStudio::CString::ENDOFSTRING != theBeginIndex) {
- theReturnString += inSourceString.Extract(theStart, theBeginIndex - theStart);
- // find the corresponding '%'
- theEndIndex = inSourceString.Find('%', theBeginIndex + 1);
- if (Q3DStudio::CString::ENDOFSTRING != theEndIndex) {
- // first, resolve the variable by the toolbar selection
- Q3DStudio::CString theVariable =
- inSourceString.Extract(theBeginIndex + 1, theEndIndex - theBeginIndex - 1);
- Q3DStudio::CString theResolvedVariable;
- bool theHasResolved = ResolveVariable(inSelectedConfig, inDocumentFile, theVariable,
- theResolvedVariable);
-
- if (theHasResolved) {
- theReturnString += theResolvedVariable;
- } else {
- theReturnString += "_NULL_";
- }
- theStart = theEndIndex + 1;
- } else
- theReturnString += inSourceString.Extract(theBeginIndex);
- } else {
- theEndIndex = theBeginIndex;
- theReturnString += inSourceString.Extract(theStart);
- }
- }
-
- return theReturnString;
-}
-
-//==============================================================================
-/**
- * Resolves the passed in variable and write out the resolved value if it exists
- * in the current selected build configuration.
- * @param inVariable the environment to be resolved
- * @param outValue the string to receive the resolved value
- * @return true if the variable exists, else false
- */
-//==============================================================================
-bool CPreviewHelper::ResolveVariable(Q3DStudio::CBuildConfiguration *inSelectedConfig,
- const Q3DStudio::CString &inDocumentFile,
- const Q3DStudio::CString &inVariable,
- Q3DStudio::CString &outValue)
-{
- Q3DStudio::CString theReturnStr;
- bool theHasResolved = false;
-
- // Handle special variable
- if (inVariable == "BUILDFILE") {
- if (inSelectedConfig) {
- theReturnStr = inSelectedConfig->GetPath();
- theHasResolved = true;
- }
- } else if (inVariable == "UIPFILE") {
- theReturnStr = inDocumentFile;
- theHasResolved = true;
- }
-
- if (!theHasResolved) {
- Q3DStudio::CString theValue = CStudioPreferences::GetPreviewProperty(inVariable);
- if (theValue != "") {
- theReturnStr = theValue;
- theHasResolved = true;
- }
- }
-
- if (theHasResolved)
- outValue = InterpretString(inSelectedConfig, inDocumentFile, theReturnStr);
-
- return theHasResolved;
-}
diff --git a/src/Authoring/Studio/PreviewHelper.h b/src/Authoring/Studio/PreviewHelper.h
index 19d23cb0..0424da91 100644
--- a/src/Authoring/Studio/PreviewHelper.h
+++ b/src/Authoring/Studio/PreviewHelper.h
@@ -72,15 +72,8 @@ public:
const QString &inDocumentFile,
EExecMode inMode, const QString &viewerExeName,
RemoteDeploymentSender *project = 0);
- static bool viewerExists(const QString &exeName);
protected:
- static Q3DStudio::CString InterpretString(Q3DStudio::CBuildConfiguration *inSelectedConfig,
- const Q3DStudio::CString &inDocumentFile,
- const Q3DStudio::CString &inSourceString);
- static bool ResolveVariable(Q3DStudio::CBuildConfiguration *inSelectedConfig,
- const Q3DStudio::CString &inDocumentFile,
- const Q3DStudio::CString &inVariable, Q3DStudio::CString &outValue);
static QString getViewerFilePath(const QString &exeName);
static void cleanupProcess(QProcess *p, QString *docPath);
};
diff --git a/src/Authoring/Studio/Render/StudioRenderer.cpp b/src/Authoring/Studio/Render/StudioRenderer.cpp
index 1f78f2bc..61af4114 100644
--- a/src/Authoring/Studio/Render/StudioRenderer.cpp
+++ b/src/Authoring/Studio/Render/StudioRenderer.cpp
@@ -783,7 +783,7 @@ struct SRendererImpl : public IStudioRenderer,
m_Translation->PickRulers(inPoint);
if (pickResult.hasValue()) {
Q3DStudio::IDocumentEditor &docEditor(
- m_UpdatableEditor.EnsureEditor(L"Create Guide",
+ m_UpdatableEditor.EnsureEditor(QObject::tr("Create Guide"),
__FILE__, __LINE__));
Qt3DSDMGuideHandle newGuide = docEditor.CreateGuide(*pickResult);
m_PickResult = SStudioPickValue(newGuide);
diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
index c214dfea..81d0d736 100644
--- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
+++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
@@ -3812,7 +3812,8 @@ void STranslation::PerformGuideDrag(Qt3DSDMGuideHandle inGuide, CPt inPoint,
break;
break;
}
- inEditor.EnsureEditor(L"Drag Guide", __FILE__, __LINE__).UpdateGuide(inGuide, theInfo);
+ inEditor.EnsureEditor(QObject::tr("Drag Guide"), __FILE__, __LINE__).UpdateGuide(inGuide,
+ theInfo);
inEditor.FireImmediateRefresh(qt3dsdm::Qt3DSDMInstanceHandle());
}
@@ -3835,7 +3836,7 @@ void STranslation::CheckGuideInPresentationRect(Qt3DSDMGuideHandle inGuide,
}
if (!inPresentation)
- inEditor.EnsureEditor(L"Delete Guide", __FILE__, __LINE__).DeleteGuide(inGuide);
+ inEditor.EnsureEditor(QObject::tr("Delete Guide"), __FILE__, __LINE__).DeleteGuide(inGuide);
}
void STranslation::PerformPathDrag(qt3ds::studio::SPathPick &inPathPick, CPt inOriginalCoords,
@@ -3910,8 +3911,8 @@ void STranslation::PerformPathDrag(qt3ds::studio::SPathPick &inPathPick, CPt inO
}
theCurrentValue[0] += theDiff.x;
theCurrentValue[1] += theDiff.y;
- Q3DStudio::IDocumentEditor &theEditor =
- inEditor.EnsureEditor(L"Anchor Point Drag", __FILE__, __LINE__);
+ Q3DStudio::IDocumentEditor &theEditor = inEditor.EnsureEditor(
+ QObject::tr("Anchor Point Drag"), __FILE__, __LINE__);
switch (inPathPick.m_Property) {
case SPathPick::Anchor:
theEditor.SetInstancePropertyValue(theAnchorHandle, thePosProperty,
diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.h b/src/Authoring/Studio/Render/StudioRendererTranslation.h
index 9bace2e9..c59c5480 100644
--- a/src/Authoring/Studio/Render/StudioRendererTranslation.h
+++ b/src/Authoring/Studio/Render/StudioRendererTranslation.h
@@ -555,7 +555,7 @@ namespace studio {
void SetPosition(const QT3DSVec3 &inPosition, CUpdateableDocumentEditor &inEditor)
{
- inEditor.EnsureEditor(L"Set Position", __FILE__, __LINE__)
+ inEditor.EnsureEditor(QObject::tr("Set Position"), __FILE__, __LINE__)
.SetInstancePropertyValue(m_Doc.GetSelectedInstance(),
m_ObjectDefinitions.m_Node.m_Position,
ToDataModel(inPosition));
@@ -563,7 +563,7 @@ namespace studio {
}
void SetRotation(const QT3DSVec3 &inRotation, CUpdateableDocumentEditor &inEditor)
{
- inEditor.EnsureEditor(L"Set Rotation", __FILE__, __LINE__)
+ inEditor.EnsureEditor(QObject::tr("Set Rotation"), __FILE__, __LINE__)
.SetInstancePropertyValue(m_Doc.GetSelectedInstance(),
m_ObjectDefinitions.m_Node.m_Rotation,
ToDataModelRotation(inRotation));
@@ -571,7 +571,7 @@ namespace studio {
}
void SetScale(const QT3DSVec3 &inScale, CUpdateableDocumentEditor &inEditor)
{
- inEditor.EnsureEditor(L"Set Scale", __FILE__, __LINE__)
+ inEditor.EnsureEditor(QObject::tr("Set Scale"), __FILE__, __LINE__)
.SetInstancePropertyValue(m_Doc.GetSelectedInstance(),
m_ObjectDefinitions.m_Node.m_Scale, ToDataModel(inScale));
inEditor.FireImmediateRefresh(m_Doc.GetSelectedInstance());
diff --git a/src/Authoring/Studio/UI/RecentItems.cpp b/src/Authoring/Studio/UI/RecentItems.cpp
index ef6546f4..d0983f32 100644
--- a/src/Authoring/Studio/UI/RecentItems.cpp
+++ b/src/Authoring/Studio/UI/RecentItems.cpp
@@ -27,26 +27,17 @@
**
****************************************************************************/
-#include "Qt3DSCommonPrecompile.h"
-
#include "RecentItems.h"
-#include "Preferences.h"
+#include "StudioPreferences.h"
#include <QtWidgets/qmenu.h>
+#include <QtCore/qfileinfo.h>
-const Q3DStudio::CString CRecentItems::RECENTITEM_KEY = "RecentItem";
-const Q3DStudio::CString CRecentItems::RECENTIMPORT_KEY = "RecentImport";
-const Q3DStudio::CString CRecentItems::RECENTITEM_VALID = "RecentValid";
+const int CRecentItems::MAX_ITEMS = 10; // maximum allowed number of recent items
-CRecentItems::CRecentItems(QMenu *inMenuID, long inCommandID, Q3DStudio::CString inPreferenceKey)
+CRecentItems::CRecentItems(QMenu *inMenuID)
{
- Q_UNUSED(inCommandID)
-
m_Menu = inMenuID;
- m_ValidItems = 10;
- m_PreferenceKey = inPreferenceKey;
-
- connect(m_Menu, &QMenu::aboutToShow, this, &CRecentItems::handleAboutToShow);
ReconstructList();
}
@@ -55,86 +46,67 @@ CRecentItems::~CRecentItems()
{
}
-void CRecentItems::AddRecentItem(const Qt3DSFile &inItem)
+void CRecentItems::AddRecentItem(const QString &inItem)
{
- RemoveRecentItem(inItem);
+ RemoveRecentItem(inItem, false);
m_RecentItems.insert(m_RecentItems.begin(), inItem);
- while (m_RecentItems.size() > 10)
+ while (m_RecentItems.size() > MAX_ITEMS)
m_RecentItems.pop_back();
RebuildList();
}
-void CRecentItems::RemoveRecentItem(const Qt3DSFile &inItem)
+void CRecentItems::RemoveRecentItem(const QString &inItem, bool rebuild)
{
- TFileList::iterator thePos = m_RecentItems.begin();
+ auto thePos = m_RecentItems.begin();
for (; thePos != m_RecentItems.end(); ++thePos) {
- if ((*thePos) == inItem) {
+ if (*thePos == inItem) {
m_RecentItems.erase(thePos);
break;
}
}
- RebuildList();
+ if (rebuild)
+ RebuildList();
}
+// load the recent items from the preferences file to m_RecentItems
void CRecentItems::ReconstructList()
{
- ClearMenu();
+ m_Menu->clear();
m_RecentItems.clear();
- CPreferences thePrefs = CPreferences::GetUserPreferences();
+ int numRecentItems = CStudioPreferences::getNumRecentItems();
+ if (numRecentItems > MAX_ITEMS)
+ numRecentItems = MAX_ITEMS;
- m_ValidItems = thePrefs.GetLongValue(RECENTITEM_VALID, m_ValidItems);
-
- for (long theIndex = 0; theIndex < (m_ValidItems > 10 ? 10 : m_ValidItems); ++theIndex) {
- Q3DStudio::CString theKey;
- theKey.Format(_LSTR("%ls%d"), static_cast<const wchar_t *>(m_PreferenceKey), theIndex);
-
- Q3DStudio::CString theFilename = thePrefs.GetStringValue(theKey, "");
- if (theFilename != "") {
- Qt3DSFile theFile(theFilename);
- if (theFile.Exists())
- m_RecentItems.push_back(theFile);
- }
+ for (int i = 0; i < numRecentItems; ++i) {
+ QString theFile = CStudioPreferences::getRecentItem(i);
+ if (!theFile.isEmpty() && QFileInfo(theFile).exists())
+ m_RecentItems.push_back(theFile);
}
}
+// save the recent items from m_RecentItems to the preferences file. Also recreate the menu.
void CRecentItems::RebuildList()
{
- ClearMenu();
-
- CPreferences thePrefs = CPreferences::GetUserPreferences();
- thePrefs.SetLongValue(RECENTITEM_VALID, GetItemCount());
- TFileList::iterator thePos = m_RecentItems.begin();
- for (long theIndex = 0; thePos != m_RecentItems.end(); ++thePos, ++theIndex) {
- Qt3DSFile theFile = *thePos;
- if (theFile.Exists()) {
- QAction *act = m_Menu->addAction(theFile.GetName().toQString(),
- this, &CRecentItems::onTriggerRecent);
- act->setData(static_cast<int>(theIndex));
-
- Q3DStudio::CString theKey;
- theKey.Format(_LSTR("%ls%d"), static_cast<const wchar_t *>(m_PreferenceKey), theIndex);
-
- thePrefs.SetStringValue(theKey, (*thePos).GetAbsolutePath());
- }
- }
-}
+ m_Menu->clear();
-void CRecentItems::handleAboutToShow()
-{
- RebuildList();
-}
+ CStudioPreferences::setNumRecentItems(GetItemCount());
-void CRecentItems::ClearMenu()
-{
- m_Menu->clear();
+ for (int i = 0; i < m_RecentItems.size(); ++i) {
+ const QString &item_i = m_RecentItems.at(i);
+ if (QFileInfo(item_i).exists()) {
+ QAction *act = m_Menu->addAction(item_i, this, &CRecentItems::onTriggerRecent);
+ act->setData(i);
+ CStudioPreferences::setRecentItem(i, item_i);
+ }
+ }
}
-Qt3DSFile CRecentItems::GetItem(long inIndex)
+QString CRecentItems::GetItem(long inIndex) const
{
return m_RecentItems.at(inIndex);
}
diff --git a/src/Authoring/Studio/UI/RecentItems.h b/src/Authoring/Studio/UI/RecentItems.h
index db4d62f5..9557353f 100644
--- a/src/Authoring/Studio/UI/RecentItems.h
+++ b/src/Authoring/Studio/UI/RecentItems.h
@@ -33,53 +33,36 @@
#pragma once
#include <QObject>
-
-#include "Qt3DSString.h"
-#include "Qt3DSFile.h"
-
#include <vector>
-class Qt3DSFile;
-
QT_FORWARD_DECLARE_CLASS(QMenu)
class CRecentItems : public QObject
{
Q_OBJECT
- typedef std::vector<Qt3DSFile> TFileList;
-
public:
- static const Q3DStudio::CString RECENTITEM_KEY;
- static const Q3DStudio::CString RECENTIMPORT_KEY;
- static const Q3DStudio::CString RECENTITEM_VALID;
+ static const int MAX_ITEMS;
Q_SIGNALS:
void openRecent(int index);
public:
- CRecentItems(QMenu *inMenu, long inCommandID,
- Q3DStudio::CString inPreferenceKey = RECENTITEM_KEY);
+ CRecentItems(QMenu *inMenu);
virtual ~CRecentItems();
- void AddRecentItem(const Qt3DSFile &inItem);
- void RemoveRecentItem(const Qt3DSFile &inItem);
+ void AddRecentItem(const QString &inItem);
+ void RemoveRecentItem(const QString &inItem, bool rebuild = true);
- Qt3DSFile GetItem(long inIndex);
+ QString GetItem(long inIndex) const;
long GetItemCount() const { return (long)m_RecentItems.size(); }
protected:
- void ClearMenu();
void ReconstructList();
void RebuildList();
- void SaveRecentList();
- void handleAboutToShow();
- TFileList m_RecentItems;
+ std::vector<QString> m_RecentItems;
- long m_CommandID;
- long m_ValidItems;
QMenu *m_Menu;
- Q3DStudio::CString m_PreferenceKey;
private Q_SLOTS:
void onTriggerRecent();
diff --git a/src/Authoring/Studio/UI/StartupDlg.cpp b/src/Authoring/Studio/UI/StartupDlg.cpp
index 53ccd6f7..c5cc4c47 100644
--- a/src/Authoring/Studio/UI/StartupDlg.cpp
+++ b/src/Authoring/Studio/UI/StartupDlg.cpp
@@ -44,7 +44,6 @@
CStartupDlg::CStartupDlg(QWidget *pParent)
: QDialog(pParent, Qt::MSWindowsFixedSizeDialogHint)
, m_Choice(EStartupChoice_Invalid)
- , m_RecentDocSelected("")
, m_ui(new Ui::StartupDlg)
, m_palette(nullptr)
{
@@ -97,8 +96,7 @@ void CStartupDlg::OnInitDialog()
connect(m_ui->openDocument, &ClickableLabel::clicked, this, &CStartupDlg::OnOpenDocClicked);
// Load the product version
- m_ProductVersionStr = QStringLiteral("Qt 3D Studio v")
- + CStudioPreferences::GetVersionString().toQString();
+ m_ProductVersionStr = QStringLiteral("Qt 3D Studio v") + CStudioPreferences::GetVersionString();
m_ui->versionStr->setText(m_ProductVersionStr);
// Populate the recent document list
@@ -111,10 +109,9 @@ void CStartupDlg::OnInitDialog()
if (m_RecentDocs.size() > theIndex) {
// Set the name
- recent->setText(m_RecentDocs[theIndex].GetName().toQString());
+ recent->setText(QFileInfo(m_RecentDocs[theIndex]).fileName());
// Set path and date to tooltip
- QFileInfo thePath(m_RecentDocs[theIndex].GetAbsolutePath().toQString());
- QString toolTip = thePath.absoluteDir().path();
+ QString toolTip = m_RecentDocs[theIndex];
toolTip.append(QStringLiteral("\n"));
toolTip.append(GetFileTimeReadable(m_RecentDocs[theIndex]));
recent->setToolTip(toolTip);
@@ -125,7 +122,7 @@ void CStartupDlg::OnInitDialog()
}
}
-void CStartupDlg::AddRecentItem(const Qt3DSFile &inRecentItem)
+void CStartupDlg::AddRecentItem(const QString &inRecentItem)
{
m_RecentDocs.push_back(inRecentItem);
}
@@ -135,7 +132,7 @@ CStartupDlg::EStartupChoice CStartupDlg::GetChoice()
return m_Choice;
}
-Qt3DSFile CStartupDlg::GetRecentDoc() const
+QString CStartupDlg::GetRecentDoc() const
{
return m_RecentDocSelected;
}
diff --git a/src/Authoring/Studio/UI/StartupDlg.h b/src/Authoring/Studio/UI/StartupDlg.h
index bab905c2..ceb38e7b 100644
--- a/src/Authoring/Studio/UI/StartupDlg.h
+++ b/src/Authoring/Studio/UI/StartupDlg.h
@@ -99,14 +99,14 @@ private:
EStartupChoice m_Choice = EStartupChoice_Invalid;
// Recent Docs
- std::vector<Qt3DSFile> m_RecentDocs;
- Qt3DSFile m_RecentDocSelected;
+ std::vector<QString> m_RecentDocs;
+ QString m_RecentDocSelected = {};
public:
void OnInitDialog();
- void AddRecentItem(const Qt3DSFile &inRecentItem);
+ void AddRecentItem(const QString &inRecentItem);
EStartupChoice GetChoice();
- Qt3DSFile GetRecentDoc() const;
+ QString GetRecentDoc() const;
private:
QScopedPointer<Ui::StartupDlg> m_ui;
diff --git a/src/Authoring/Studio/Workspace/Dialogs.cpp b/src/Authoring/Studio/Workspace/Dialogs.cpp
index 1b2b374e..e1737fb4 100644
--- a/src/Authoring/Studio/Workspace/Dialogs.cpp
+++ b/src/Authoring/Studio/Workspace/Dialogs.cpp
@@ -299,15 +299,15 @@ Qt3DSFile CDialogs::GetExportChoice(const Q3DStudio::CString &, const Q3DStudio:
/**
* Notify that we are unable to refresh the resource.
*/
-void CDialogs::DisplayRefreshResourceFailed(const Q3DStudio::CString &inResourceName,
- const Q3DStudio::CString &inDescription)
+void CDialogs::DisplayRefreshResourceFailed(const QString &inResourceName,
+ const QString &inDescription)
{
QString theTitle = QObject::tr("Refresh File Error");
QString theText = QObject::tr("Studio was unable to refresh the resource '%1'.\n")
- .arg(inResourceName.toQString());
+ .arg(inResourceName);
- if (!inDescription.IsEmpty())
- theText += inDescription.toQString();
+ if (!inDescription.isEmpty())
+ theText += inDescription;
if (m_ShowGUI) {
Qt3DSMessageBox::Show(theTitle, theText, Qt3DSMessageBox::ICON_WARNING, false,
@@ -498,8 +498,7 @@ QList<QUrl> CDialogs::SelectAssets(QString &outPath,
files = fd.selectedUrls();
QString newOutPath = fd.directory().absolutePath();
QString contentPath = QDir::fromNativeSeparators(
- Qt3DSFile::GetApplicationDirectory().GetPath().toQString()
- + QStringLiteral("/Content"));
+ Qt3DSFile::GetApplicationDirectory() + QStringLiteral("/Content"));
if (assetType != Q3DStudio::DocumentEditorFileType::Unknown
|| (assetType == Q3DStudio::DocumentEditorFileType::Unknown
@@ -527,20 +526,20 @@ QString CDialogs::defaultDirForUrl(const QUrl &url)
return defaultDir;
}
-//==============================================================================
/**
- * Notify the user that the presentation we tried to load has failed.
- * @param inPresentation The AKFile that we failed to load.
+ * Notify the user that the presentation we tried to load has failed.
+ * @param loadFileInfo QFileInfo for the failing file
+ * @param errrorText error message
*/
-void CDialogs::DisplayLoadingPresentationFailed(const Qt3DSFile &inPresentation,
- const QString &inErrorText)
+void CDialogs::DisplayLoadingPresentationFailed(const QFileInfo &loadFileInfo,
+ const QString &errorText)
{
- QString theErrorMessage = inPresentation.GetName().toQString();
+ QString theErrorMessage = loadFileInfo.fileName();
- if (inErrorText.isEmpty())
+ if (errorText.isEmpty())
theErrorMessage += QObject::tr(" failed to load.");
else
- theErrorMessage += inErrorText;
+ theErrorMessage += errorText;
QString theErrorTitle = QObject::tr("Open File Error");
@@ -1020,17 +1019,14 @@ CDialogs::ESavePromptResult CDialogs::PromptForSave()
*/
QString CDialogs::GetSaveAsChoice(const QString &inDialogTitle, bool isProject)
{
- QFileInfo theFile;
- QString theFileExt;
QString projPath(QDir::cleanPath(g_StudioApp.GetCore()->getProjectFile().getProjectPath()));
- QString theFilename
- = g_StudioApp.GetCore()->GetDoc()->GetDocumentPath().GetAbsolutePath().toQString();
+ QString theFilename = g_StudioApp.GetCore()->GetDoc()->GetDocumentPath();
if (theFilename.isEmpty() || isProject)
theFilename = QObject::tr("Untitled");
- theFileExt = QStringLiteral(".uip");
+ QString theFileExt = QStringLiteral(".uip");
QFileDialog theFileDlg;
theFileDlg.setOption(QFileDialog::DontConfirmOverwrite);
@@ -1063,7 +1059,7 @@ QString CDialogs::GetSaveAsChoice(const QString &inDialogTitle, bool isProject)
}
bool theShowDialog = true;
-
+ QString theFile = {};
while (theShowDialog && theFileDlg.exec()) {
theShowDialog = false;
QString selectedName = theFileDlg.selectedFiles().front();
@@ -1081,15 +1077,15 @@ QString CDialogs::GetSaveAsChoice(const QString &inDialogTitle, bool isProject)
selectedName = projPath + QStringLiteral("/presentations/") + fi.fileName();
}
- theFile = QFileInfo(selectedName);
-
- m_LastSaveFile = theFile.absoluteFilePath();
+ theFile = selectedName;
+ m_LastSaveFile = selectedName;
// New directory is only created when creating a new project. When doing a "save as"
// or "save copy", a new directory is not created.
if (isProject) {
Q3DStudio::CFilePath theFinalDir;
Q3DStudio::CFilePath theFinalDoc;
- g_StudioApp.GetCore()->GetCreateDirectoryFileName(theFile, theFinalDir, theFinalDoc);
+ g_StudioApp.GetCore()->GetCreateDirectoryFileName(selectedName,
+ theFinalDir, theFinalDoc);
// Update last save file to final doc
m_LastSaveFile = theFinalDoc.absoluteFilePath();
@@ -1103,7 +1099,7 @@ QString CDialogs::GetSaveAsChoice(const QString &inDialogTitle, bool isProject)
auto result = QMessageBox::question(nullptr, theTitle, theString);
if (result != QMessageBox::Yes) {
// Reset the file and show the file dialog again
- theFile = QFileInfo();
+ theFile.clear();
theShowDialog = true;
continue;
}
@@ -1111,7 +1107,7 @@ QString CDialogs::GetSaveAsChoice(const QString &inDialogTitle, bool isProject)
}
}
- return theFile.absoluteFilePath();
+ return theFile;
}
//==============================================================================
@@ -1191,8 +1187,8 @@ bool CDialogs::ConfirmRevert()
* @param inActionText text to be displayed as the action
* @param inAdditionalText additional text, for example a file name
*/
-void CDialogs::DisplayProgressScreen(const Q3DStudio::CString &inActionText,
- const Q3DStudio::CString &inAdditionalText)
+void CDialogs::DisplayProgressScreen(const QString &inActionText,
+ const QString &inAdditionalText)
{
if (m_ShowGUI && !m_ProgressPalette) {
m_ProgressPalette = new CProgressView(g_StudioApp.m_pMainWnd);
@@ -1245,12 +1241,12 @@ void CDialogs::DisplayEnvironmentVariablesError(const Q3DStudio::CString &inErro
* @param inCurrentDocPath the current document path, if any. Application directory if
*there is none.
*/
-void CDialogs::ResetSettings(const Q3DStudio::CString &inCurrentDocPath)
+void CDialogs::ResetSettings(const QString &inCurrentDocPath)
{
// Initialize the default dir/paths to the current document path if specified, otherwise leave
// everything as it is.
- if (!inCurrentDocPath.IsEmpty())
- m_LastSaveFile = inCurrentDocPath.toQString();
+ if (!inCurrentDocPath.isEmpty())
+ m_LastSaveFile = inCurrentDocPath;
}
bool CDialogs::DisplayResetKeyframeValuesDlg()
diff --git a/src/Authoring/Studio/Workspace/Dialogs.h b/src/Authoring/Studio/Workspace/Dialogs.h
index d5a85bf0..f1e93ef6 100644
--- a/src/Authoring/Studio/Workspace/Dialogs.h
+++ b/src/Authoring/Studio/Workspace/Dialogs.h
@@ -70,8 +70,7 @@ public:
virtual ~CDialogs();
void DisplayAssetDeleteFailed();
- void DisplayRefreshResourceFailed(const Q3DStudio::CString &inResourceName,
- const Q3DStudio::CString &inDescription);
+ void DisplayRefreshResourceFailed(const QString &inResourceName, const QString &inDescription);
QString ConfirmRefreshModelFile(const QString &inOriginalPath);
QList<QUrl> SelectAssets(QString &outPath, Q3DStudio::DocumentEditorFileType::Enum assetType);
@@ -134,10 +133,8 @@ public:
QString GetNewDocumentChoice(const QString &inInitialDirectory = {}, bool isProject = true);
QString GetFileOpenChoice(const QString &inInitialDirectory = {});
- void DisplayImportFailed(const QUrl &inURL, const QString &inDescription,
- bool inWarningsOnly);
- void DisplayLoadingPresentationFailed(const Qt3DSFile &inPresentation,
- const QString &inErrorText);
+ void DisplayImportFailed(const QUrl &inURL, const QString &inDescription, bool inWarningsOnly);
+ void DisplayLoadingPresentationFailed(const QFileInfo &loadFileInfo, const QString &errorText);
void DisplaySavingPresentationFailed();
void DisplaySaveReadOnlyFailed(const QString &inSavedLocation);
void DisplayObjectRenamed(const QString &origName, const QString &newName, bool async = false);
@@ -156,13 +153,13 @@ public:
bool ConfirmRevert();
- void DisplayProgressScreen(const Q3DStudio::CString &inActionText,
- const Q3DStudio::CString &inAdditionalText);
+ void DisplayProgressScreen(const QString &inActionText,
+ const QString &inAdditionalText);
void DestroyProgressScreen();
void DisplayEnvironmentVariablesError(const Q3DStudio::CString &inErrorMessage);
- void ResetSettings(const Q3DStudio::CString &inCurrentDocPath = "");
+ void ResetSettings(const QString &inCurrentDocPath = {});
bool DisplayResetKeyframeValuesDlg();
void DisplayPasteFailed();