mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
filenames and paths processing little fix
This commit is contained in:
parent
90d426e347
commit
7fe938a7ca
4
core.cpp
4
core.cpp
|
@ -811,7 +811,7 @@ void Core::checkConnection()
|
||||||
|
|
||||||
void Core::loadConfiguration()
|
void Core::loadConfiguration()
|
||||||
{
|
{
|
||||||
QString path = Settings::getSettingsDirPath() + '/' + CONFIG_FILE_NAME;
|
QString path = QDir(Settings::getSettingsDirPath()).filePath(CONFIG_FILE_NAME);
|
||||||
|
|
||||||
QFile configurationFile(path);
|
QFile configurationFile(path);
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ void Core::saveConfiguration()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
path += '/' + CONFIG_FILE_NAME;
|
path = directory.filePath(CONFIG_FILE_NAME);
|
||||||
QSaveFile configurationFile(path);
|
QSaveFile configurationFile(path);
|
||||||
if (!configurationFile.open(QIODevice::WriteOnly)) {
|
if (!configurationFile.open(QIODevice::WriteOnly)) {
|
||||||
qCritical() << "File " << path << " cannot be opened";
|
qCritical() << "File " << path << " cannot be opened";
|
||||||
|
|
|
@ -55,7 +55,7 @@ void Settings::load()
|
||||||
if (portableSettings.exists())
|
if (portableSettings.exists())
|
||||||
makeToxPortable=true;
|
makeToxPortable=true;
|
||||||
|
|
||||||
QString filePath = getSettingsDirPath() + '/' + FILENAME;
|
QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME);
|
||||||
|
|
||||||
//if no settings file exist -- use the default one
|
//if no settings file exist -- use the default one
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
|
@ -125,7 +125,7 @@ void Settings::load()
|
||||||
|
|
||||||
void Settings::save()
|
void Settings::save()
|
||||||
{
|
{
|
||||||
QString filePath = getSettingsDirPath() + '/' + FILENAME;
|
QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME);
|
||||||
save(filePath);
|
save(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ QString Settings::getSettingsDirPath()
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
||||||
#else
|
#else
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + '/' + "tox" + '/';
|
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QDir::separator() + "tox");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ QIcon SmileyPack::getAsIcon(const QString &key)
|
||||||
void SmileyPack::cacheSmiley(const QString &name)
|
void SmileyPack::cacheSmiley(const QString &name)
|
||||||
{
|
{
|
||||||
QSize size(16, 16); // TODO: adapt to text size
|
QSize size(16, 16); // TODO: adapt to text size
|
||||||
QString filename = path % '/' % name;
|
QString filename = QDir(path).filePath(name);
|
||||||
QImage img(filename);
|
QImage img(filename);
|
||||||
|
|
||||||
if (!img.isNull())
|
if (!img.isNull())
|
||||||
|
|
|
@ -278,7 +278,7 @@ void FileTransfertWidget::acceptRecvRequest()
|
||||||
QString path;
|
QString path;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
path = QFileDialog::getSaveFileName(this,tr("Save a file","Title of the file saving dialog"),QDir::currentPath()+'/'+filename->text());
|
path = QFileDialog::getSaveFileName(this, tr("Save a file","Title of the file saving dialog"), QDir::current().filePath(filename->text()));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user