diff options
Diffstat (limited to 'src/Authoring/Studio/Utils/StudioUtils.cpp')
-rw-r--r-- | src/Authoring/Studio/Utils/StudioUtils.cpp | 98 |
1 files changed, 6 insertions, 92 deletions
diff --git a/src/Authoring/Studio/Utils/StudioUtils.cpp b/src/Authoring/Studio/Utils/StudioUtils.cpp index 98281e9c..b2c35963 100644 --- a/src/Authoring/Studio/Utils/StudioUtils.cpp +++ b/src/Authoring/Studio/Utils/StudioUtils.cpp @@ -32,6 +32,7 @@ #include "StudioPreferences.h" #include "StudioClipboard.h" #include "Pt.h" +#include "StudioUtils.h" #include <QtWidgets/qapplication.h> #include <QtWidgets/qdesktopwidget.h> @@ -40,116 +41,29 @@ #include <QtGui/qwindow.h> #include <QtCore/qurl.h> -//============================================================================== -/** - * FormatTimeString: Format a time string. - * @param inTimeMS Time in milliseconds. - * @return The formatted time string in MM:SS:MS format. - */ -Q3DStudio::CString FormatTimeString(long inTimeMS) -{ - BOOL theNegativeFlag = (inTimeMS < 0); - long theTimeMS = abs(inTimeMS); - Q3DStudio::CString theTimeString; - long theMM, theSS; - - // Format the time in MM:SS:MS format - - // Get the MM value - theMM = theTimeMS / 60000; - theTimeMS -= (theMM * 60000); - - // Get the SS value - theSS = theTimeMS / 1000; - theTimeMS -= (theSS * 1000); - - // Remainder is MS value - - // Format the string - theTimeString.Format(_LSTR("%d:%0.2d.%0.2d"), theMM, theSS, theTimeMS / 10); - - // If the original time was negative, append the "-" to the front of the time string. - if (theNegativeFlag) { - theTimeString.Insert(0, "-"); - } - - return theTimeString; -} - -//============================================================================== -/** - * Checks a string to determine if it is numeric. - * @param inString String to check for all numeric characters. - * @return TRUE if the string is numeric. - */ -bool IsNumericString(const Q3DStudio::CString &inString) -{ - Q3DStudio::CString theNumbers = "0123456789"; - long theLoop; - bool theNumericFlag = true; - - // Iterate through the entire string - for (theLoop = 0; theLoop < inString.Length() && theNumericFlag; theLoop++) { - // Check each character for being numeric - if (theNumbers.Find(inString.Extract(theLoop, 1)) == Q3DStudio::CString::ENDOFSTRING) - theNumericFlag = false; - } - - return theNumericFlag; -} - -long TimeToPos(long inTime, double inTimeRatio) -{ - return ::dtol(inTime * inTimeRatio) + CStudioPreferences::GUTTER_SIZE; -} - -long TimeToPos(double inTime, double inTimeRatio) -{ - return ::dtol(inTime * inTimeRatio) + CStudioPreferences::GUTTER_SIZE; -} - -long PosToTime(long inPos, double inTimeRatio) -{ - return ::dtol((inPos - CStudioPreferences::GUTTER_SIZE) / inTimeRatio); -} - -//============================================================================= -/** - * opens the url in the web browser - * - * @param inURL - * the URL to open - * - * @return void - */ -void ShowURLInBrowser(const Q3DStudio::CString &inURL) -{ - QDesktopServices::openUrl(QUrl(inURL.toQString())); -} - -QString resourcePath() +QString StudioUtils::resourcePath() { return QStringLiteral(":/res"); } -QString resourceImagePath() +QString StudioUtils::resourceImagePath() { return QStringLiteral(":/images/"); } -QString resourceImageUrl() +QString StudioUtils::resourceImageUrl() { return QStringLiteral("qrc:/images/"); } // Returns the qml import path required for binary installations -QString qmlImportPath() +QString StudioUtils::qmlImportPath() { QString extraImportPath(QStringLiteral("%1/qml")); return extraImportPath.arg(QApplication::applicationDirPath()); } -qreal devicePixelRatio() +qreal StudioUtils::devicePixelRatio() { qreal pixelRatio = 1.0; |