mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-23 16:23:55 +02:00
misc: use QDir for getting a temporary directory
Gitlab: #692 Change-Id: I2f45476c3e5ee4d35ec39c17f923117769c5b652
This commit is contained in:
parent
9f1053902d
commit
4e4c98e232
4 changed files with 7 additions and 25 deletions
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include "appsettingsmanager.h"
|
#include "appsettingsmanager.h"
|
||||||
#include "qtutils.h"
|
#include "qtutils.h"
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
#include <api/datatransfermodel.h>
|
#include <api/datatransfermodel.h>
|
||||||
|
|
||||||
|
@ -39,6 +38,7 @@
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
|
MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
|
||||||
PreviewEngine* previewEngine,
|
PreviewEngine* previewEngine,
|
||||||
|
@ -232,8 +232,8 @@ MessagesAdapter::onPaste()
|
||||||
auto img_name_hash
|
auto img_name_hash
|
||||||
= QCryptographicHash::hash(QString::number(pixmap.cacheKey()).toLocal8Bit(),
|
= QCryptographicHash::hash(QString::number(pixmap.cacheKey()).toLocal8Bit(),
|
||||||
QCryptographicHash::Sha1);
|
QCryptographicHash::Sha1);
|
||||||
QString fileName = "\\img_" + QString(img_name_hash.toHex()) + ".png";
|
QString fileName = "img_" + QString(img_name_hash.toHex()) + ".png";
|
||||||
QString path = QString(Utils::WinGetEnv("TEMP")) + fileName;
|
QString path = QDir::temp().filePath(fileName);
|
||||||
|
|
||||||
if (!pixmap.save(path, "PNG")) {
|
if (!pixmap.save(path, "PNG")) {
|
||||||
qDebug().noquote() << "Errors during QPixmap save"
|
qDebug().noquote() << "Errors during QPixmap save"
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
#include "updatemanager.h"
|
#include "updatemanager.h"
|
||||||
|
|
||||||
#include "lrcinstance.h"
|
#include "lrcinstance.h"
|
||||||
#include "utils.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
static constexpr bool isBeta = true;
|
static constexpr bool isBeta = true;
|
||||||
|
@ -45,7 +45,7 @@ struct UpdateManager::Impl : public QObject
|
||||||
, parent_(parent)
|
, parent_(parent)
|
||||||
, lrcInstance_(instance)
|
, lrcInstance_(instance)
|
||||||
, baseUrlString_(url.isEmpty() ? downloadUrl : url)
|
, baseUrlString_(url.isEmpty() ? downloadUrl : url)
|
||||||
, tempPath_(Utils::WinGetEnv("TEMP"))
|
, tempPath_(QDir::tempPath())
|
||||||
, updateTimer_(new QTimer(this))
|
, updateTimer_(new QTimer(this))
|
||||||
{
|
{
|
||||||
connect(updateTimer_, &QTimer::timeout, [this] {
|
connect(updateTimer_, &QTimer::timeout, [this] {
|
||||||
|
@ -148,8 +148,8 @@ struct UpdateManager::Impl : public QObject
|
||||||
|
|
||||||
void cleanUpdateFiles()
|
void cleanUpdateFiles()
|
||||||
{
|
{
|
||||||
// Delete all logs and msi in the %TEMP% directory before launching.
|
// Delete all logs and msi in the temporary directory before launching.
|
||||||
QString dir = QString(Utils::WinGetEnv("TEMP"));
|
QString dir = QDir::tempPath();
|
||||||
QDir log_dir(dir, {"jami*.log"});
|
QDir log_dir(dir, {"jami*.log"});
|
||||||
for (const QString& filename : log_dir.entryList()) {
|
for (const QString& filename : log_dir.entryList()) {
|
||||||
log_dir.remove(filename);
|
log_dir.remove(filename);
|
||||||
|
|
|
@ -213,23 +213,6 @@ Utils::CheckStartupLink(const std::wstring& wstrAppName)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
|
||||||
Utils::WinGetEnv(const char* name)
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
const DWORD buffSize = 65535;
|
|
||||||
static char buffer[buffSize];
|
|
||||||
if (GetEnvironmentVariableA(name, buffer, buffSize)) {
|
|
||||||
return buffer;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
Q_UNUSED(name)
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Utils::removeOldVersions()
|
Utils::removeOldVersions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,6 @@ bool CreateStartupLink(const std::wstring& wstrAppName);
|
||||||
void DeleteStartupLink(const std::wstring& wstrAppName);
|
void DeleteStartupLink(const std::wstring& wstrAppName);
|
||||||
bool CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink);
|
bool CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink);
|
||||||
bool CheckStartupLink(const std::wstring& wstrAppName);
|
bool CheckStartupLink(const std::wstring& wstrAppName);
|
||||||
const char* WinGetEnv(const char* name);
|
|
||||||
QString GetRingtonePath();
|
QString GetRingtonePath();
|
||||||
QString GenGUID();
|
QString GenGUID();
|
||||||
QString GetISODate();
|
QString GetISODate();
|
||||||
|
|
Loading…
Add table
Reference in a new issue