Refactoring. Use QChar instead of QString where possible.

Point and comma.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-13 09:14:55 +03:00
parent 1e5ee0ab8b
commit e7ca9294cf
16 changed files with 48 additions and 48 deletions

View File

@ -117,7 +117,7 @@ void TapePreferencesPathPage::EditPath()
QDir directory(path); QDir directory(path);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path, const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
@ -127,7 +127,7 @@ void TapePreferencesPathPage::EditPath()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(path); QDir directory(path);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
DefaultPath(); DefaultPath();

View File

@ -413,7 +413,7 @@ void TMainWindow::OpenIndividual()
QDir directory(pathTo); QDir directory(pathTo);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
Open(pathTo, filter); Open(pathTo, filter);
@ -421,7 +421,7 @@ void TMainWindow::OpenIndividual()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(pathTo); QDir directory(pathTo);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
} }
@ -465,7 +465,7 @@ void TMainWindow::CreateFromExisting()
QDir directory(pathTo); QDir directory(pathTo);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter); const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter);
@ -485,7 +485,7 @@ void TMainWindow::CreateFromExisting()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(pathTo); QDir directory(pathTo);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
} }
@ -828,13 +828,13 @@ bool TMainWindow::FileSaveAs()
{ {
filters = tr("Individual measurements") + QLatin1String(" (*.vit)"); filters = tr("Individual measurements") + QLatin1String(" (*.vit)");
suffix = QLatin1String("vit"); suffix = QLatin1String("vit");
fName += QLatin1String(".") + suffix; fName += QChar('.') + suffix;
} }
else else
{ {
filters = tr("Multisize measurements") + QLatin1String(" (*.vst)"); filters = tr("Multisize measurements") + QLatin1String(" (*.vst)");
suffix = QLatin1String("vst"); suffix = QLatin1String("vst");
fName += QLatin1String(".") + suffix; fName += QChar('.') + suffix;
} }
QString dir; QString dir;
@ -859,7 +859,7 @@ bool TMainWindow::FileSaveAs()
QDir directory(dir); QDir directory(dir);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QLatin1String("/") + fName, filters); QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QLatin1String("/") + fName, filters);
@ -869,7 +869,7 @@ bool TMainWindow::FileSaveAs()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(dir); QDir directory(dir);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
}; };
@ -882,7 +882,7 @@ bool TMainWindow::FileSaveAs()
QFileInfo f( fileName ); QFileInfo f( fileName );
if (f.suffix().isEmpty() && f.suffix() != suffix) if (f.suffix().isEmpty() && f.suffix() != suffix)
{ {
fileName += QLatin1String(".") + suffix; fileName += QChar('.') + suffix;
} }
if (QFileInfo::exists(fileName)) if (QFileInfo::exists(fileName))
@ -986,7 +986,7 @@ void TMainWindow::ImportDataFromCSV()
QFileInfo f( fileName ); QFileInfo f( fileName );
if (f.suffix().isEmpty() && f.suffix() != suffix) if (f.suffix().isEmpty() && f.suffix() != suffix)
{ {
fileName += QLatin1String(".") + suffix; fileName += QChar('.') + suffix;
} }
DialogExportToCSV dialog(this); DialogExportToCSV dialog(this);

View File

@ -471,7 +471,7 @@ bool VApplication::CreateLogDir() const
QDir logDir(LogDirPath()); QDir logDir(LogDirPath());
if (logDir.exists() == false) if (logDir.exists() == false)
{ {
return logDir.mkpath("."); // Create directory for log if need return logDir.mkpath(QChar('.')); // Create directory for log if need
} }
return true; return true;
} }

View File

@ -142,7 +142,7 @@ void PreferencesPathPage::EditPath()
QDir directory(path); QDir directory(path);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path, const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
@ -157,7 +157,7 @@ void PreferencesPathPage::EditPath()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(path); QDir directory(path);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
DefaultPath(); DefaultPath();
return; return;
@ -169,7 +169,7 @@ void PreferencesPathPage::EditPath()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(path); QDir directory(path);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
} }

View File

@ -880,8 +880,8 @@ void DialogPatternProperties::SaveImage()
QByteArray byteArray; QByteArray byteArray;
byteArray.append(doc->GetImage().toUtf8()); byteArray.append(doc->GetImage().toUtf8());
QByteArray ba = QByteArray::fromBase64(byteArray); QByteArray ba = QByteArray::fromBase64(byteArray);
const QString extension = QLatin1String(".") + doc->GetImageExtension(); const QString extension = doc->GetImageExtension().prepend(QChar('.'));
QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")"); QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')');
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog , QFileDialog::DontUseNativeDialog

View File

@ -123,7 +123,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
QDir directory(dirPath); QDir directory(dirPath);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath, const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath,
@ -141,7 +141,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(dirPath); QDir directory(dirPath);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
}); });
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged); connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);

View File

@ -1675,7 +1675,7 @@ void MainWindow::LoadIndividual()
QDir directory(path); QDir directory(path);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
@ -1707,7 +1707,7 @@ void MainWindow::LoadIndividual()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(path); QDir directory(path);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
} }
@ -2764,7 +2764,7 @@ bool MainWindow::SaveAs()
QDir directory(dir); QDir directory(dir);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
@ -2780,7 +2780,7 @@ bool MainWindow::SaveAs()
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(dir); QDir directory(dir);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
}; };
@ -4932,7 +4932,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
QDir directory(dirPath); QDir directory(dirPath);
if (not directory.exists()) if (not directory.exists())
{ {
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(QChar('.'));
} }
QString mPath; QString mPath;
@ -4948,7 +4948,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir directory(dirPath); QDir directory(dirPath);
directory.rmpath("."); directory.rmpath(QChar('.'));
} }
return mPath; return mPath;

View File

@ -79,7 +79,7 @@ bool CreateLayoutPath(const QString &path)
dir.setPath(path); dir.setPath(path);
if (not dir.exists(path)) if (not dir.exists(path))
{ {
usedNotExistedDir = dir.mkpath("."); usedNotExistedDir = dir.mkpath(QChar('.'));
} }
return usedNotExistedDir; return usedNotExistedDir;
} }
@ -90,7 +90,7 @@ void RemoveLayoutPath(const QString &path, bool usedNotExistedDir)
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
QDir dir(path); QDir dir(path);
dir.rmpath("."); dir.rmpath(QChar('.'));
} }
} }
} }

View File

@ -1338,44 +1338,44 @@ QString VPattern::GetLabelBase(quint32 index) const
case 0: // de case 0: // de
{ {
const QString al = QStringLiteral("A,Ä,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Ö,P,Q,R,S,ß,T,U,Ü,V,W,X,Y,Z"); const QString al = QStringLiteral("A,Ä,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Ö,P,Q,R,S,ß,T,U,Ü,V,W,X,Y,Z");
alphabet = al.split(","); alphabet = al.split(QChar(','));
break; break;
} }
case 2: // fr case 2: // fr
{ {
const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"); const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
alphabet = al.split(","); alphabet = al.split(QChar(','));
break; break;
} }
case 3: // ru case 3: // ru
{ {
const QString al = QStringLiteral("А,Б,В,Г,Д,Е,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я"); const QString al = QStringLiteral("А,Б,В,Г,Д,Е,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я");
alphabet = al.split(","); alphabet = al.split(QChar(','));
break; break;
} }
case 4: // uk case 4: // uk
{ {
const QString al = QStringLiteral("А,Б,В,Г,Д,Е,Ж,З,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Є,Ю,Я"); const QString al = QStringLiteral("А,Б,В,Г,Д,Е,Ж,З,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Є,Ю,Я");
alphabet = al.split(","); alphabet = al.split(QChar(','));
break; break;
} }
case 5: // hr case 5: // hr
case 7: // bs case 7: // bs
{ {
const QString al = QStringLiteral("A,B,C,Č,Ć,D,Dž,Ð,E,F,G,H,I,J,K,L,Lj,M,N,Nj,O,P,R,S,Š,T,U,V,Z,Ž"); const QString al = QStringLiteral("A,B,C,Č,Ć,D,Dž,Ð,E,F,G,H,I,J,K,L,Lj,M,N,Nj,O,P,R,S,Š,T,U,V,Z,Ž");
alphabet = al.split(","); alphabet = al.split(QChar(','));
break; break;
} }
case 6: // sr case 6: // sr
{ {
const QString al = QStringLiteral("А,Б,В,Г,Д,Ђ,Е,Ж,З,И,Ј,К,Л,Љ,М,Н,Њ,О,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш"); const QString al = QStringLiteral("А,Б,В,Г,Д,Ђ,Е,Ж,З,И,Ј,К,Л,Љ,М,Н,Њ,О,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш");
alphabet = al.split(","); alphabet = al.split(QChar(','));
break; break;
} }
case 1: // en case 1: // en
default: // en default: // en
{ {
alphabet = def.split(","); alphabet = def.split(QChar(','));
break; break;
} }
} }

View File

@ -125,7 +125,7 @@ int VAbstractConverter::GetVersion(const QString &version)
{ {
ValidateVersion(version); ValidateVersion(version);
const QStringList ver = version.split("."); const QStringList ver = version.split(QChar('.'));
bool ok = false; bool ok = false;
const int major = ver.at(0).toInt(&ok); const int major = ver.at(0).toInt(&ok);

View File

@ -483,7 +483,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri
try try
{ {
QString parametr = GetParametrString(domElement, name, defValue); QString parametr = GetParametrString(domElement, name, defValue);
param = parametr.replace(",", ".").toDouble(&ok); param = parametr.replace(QChar(','), QChar('.')).toDouble(&ok);
if (ok == false) if (ok == false)
{ {
throw VExceptionConversionError(message, name); throw VExceptionConversionError(message, name);
@ -764,7 +764,7 @@ bool VDomDocument::SaveDocument(const QString &fileName, QString &error)
QString VDomDocument::Major() const QString VDomDocument::Major() const
{ {
QString version = UniqueTagText(TagVersion, "0.0.0"); QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split("."); QStringList v = version.split(QChar('.'));
return v.at(0); return v.at(0);
} }
@ -773,7 +773,7 @@ QString VDomDocument::Major() const
QString VDomDocument::Minor() const QString VDomDocument::Minor() const
{ {
QString version = UniqueTagText(TagVersion, "0.0.0"); QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split("."); QStringList v = version.split(QChar('.'));
return v.at(1); return v.at(1);
} }
@ -782,7 +782,7 @@ QString VDomDocument::Minor() const
QString VDomDocument::Patch() const QString VDomDocument::Patch() const
{ {
QString version = UniqueTagText(TagVersion, "0.0.0"); QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split("."); QStringList v = version.split(QChar('.'));
return v.at(2); return v.at(2);
} }

View File

@ -71,7 +71,7 @@ QString compilerString()
iccVersion = QLatin1String(__INTEL_COMPILER); iccVersion = QLatin1String(__INTEL_COMPILER);
} }
#ifdef __INTEL_COMPILER_UPDATE #ifdef __INTEL_COMPILER_UPDATE
return QLatin1String("Intel(R) C++ ") + iccVersion + QLatin1String(".") + QLatin1String(__INTEL_COMPILER_UPDATE) + return QLatin1String("Intel(R) C++ ") + iccVersion + QChar('.') + QLatin1String(__INTEL_COMPILER_UPDATE) +
QLatin1String(" build ") + QLatin1String(__INTEL_COMPILER_BUILD_DATE) + QLatin1String(" [") + QLatin1String(" build ") + QLatin1String(__INTEL_COMPILER_BUILD_DATE) + QLatin1String(" [") +
QLatin1String(iccCompact) + QLatin1String(" compatibility]"); QLatin1String(iccCompact) + QLatin1String(" compatibility]");
#else #else

View File

@ -213,7 +213,7 @@ QString PrepareStandardFiles(const QString &currentPath, const QString &standard
if ((currentPath == defPath || not currentPathDir.exists()) && standardPathDir.exists()) if ((currentPath == defPath || not currentPathDir.exists()) && standardPathDir.exists())
{ {
const QDir localdata (defPath); const QDir localdata (defPath);
if (localdata.mkpath(".")) if (localdata.mkpath(QChar('.')))
{ {
SymlinkCopyDirRecursive(standardPath, defPath, false); SymlinkCopyDirRecursive(standardPath, defPath, false);
} }
@ -885,7 +885,7 @@ double VCommonSettings::GetDefaultSeamAllowance()
{ {
qDebug()<< "Could not convert value"<<value(*settingPatternDefaultSeamAllowance, 0) qDebug()<< "Could not convert value"<<value(*settingPatternDefaultSeamAllowance, 0)
<< "to real. Return default value for default seam allowance is " << "to real. Return default value for default seam allowance is "
<< defaultValue << "."; << defaultValue << QChar('.');
val = defaultValue; val = defaultValue;
} }

View File

@ -129,7 +129,7 @@ VPE::VProperty* VPE::QVector3DProperty::clone(bool include_children, VProperty*
void VPE::QVector3DProperty::setValue(const QVariant &value) void VPE::QVector3DProperty::setValue(const QVariant &value)
{ {
QStringList tmpStrings = value.toString().split(","); QStringList tmpStrings = value.toString().split(QChar(','));
if (tmpStrings.count() == 3) if (tmpStrings.count() == 3)
{ {
setVector(tmpStrings[0].toDouble(), tmpStrings[1].toDouble(), tmpStrings[2].toDouble()); setVector(tmpStrings[0].toDouble(), tmpStrings[1].toDouble(), tmpStrings[2].toDouble());

View File

@ -104,7 +104,7 @@ QString VAbstractMainWindow::CSVFilePath()
{ {
const QString filters = tr("Comma-Separated Values") + QLatin1String(" (*.csv)"); const QString filters = tr("Comma-Separated Values") + QLatin1String(" (*.csv)");
const QString suffix("csv"); const QString suffix("csv");
const QString path = QDir::homePath() + QLatin1String("/") + tr("values") + QLatin1String(".") + suffix; const QString path = QDir::homePath() + QChar('/') + tr("values") + QChar('.') + suffix;
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
@ -120,7 +120,7 @@ QString VAbstractMainWindow::CSVFilePath()
QFileInfo f( fileName ); QFileInfo f( fileName );
if (f.suffix().isEmpty() && f.suffix() != suffix) if (f.suffix().isEmpty() && f.suffix() != suffix)
{ {
fileName += QLatin1String(".") + suffix; fileName += QChar('.') + suffix;
} }
return fileName; return fileName;

View File

@ -96,8 +96,8 @@ void TST_ReadVal::TestInvalidData_data()
PrepareString(QString("1,0,00.5"), locale); PrepareString(QString("1,0,00.5"), locale);
PrepareString(QString("1,,000.5"), locale); PrepareString(QString("1,,000.5"), locale);
PrepareString(QString(",5"), locale); PrepareString(QString(",5"), locale);
PrepareString(QString(","), locale); PrepareString(QChar(','), locale);
PrepareString(QString("."), locale); PrepareString(QChar('.'), locale);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------