Remove UUID from history path and move .cache to AppData/Roaming for Windows

This commit is contained in:
Yuriy Puchkov
2020-08-03 15:05:20 +03:00
parent 434ee50b12
commit cc0175487c
3 changed files with 5 additions and 16 deletions

View File

@@ -20,7 +20,6 @@
#include <QFile>
#include <QDir>
#include <QCoreApplication>
#include <QUuid>
ConfigHandler::ConfigHandler(){
m_settings.setDefaultFormat(QSettings::IniFormat);
@@ -373,18 +372,6 @@ QString ConfigHandler::configFilePath() const {
return m_settings.fileName();
}
const QString ConfigHandler::userUuid() {
QString userUuid;
if (m_settings.contains(QStringLiteral("userUuid"))) {
userUuid = m_settings.value(QStringLiteral("userUuid")).toString();
} else {
userUuid = QUuid::createUuid().toString();
userUuid = userUuid.replace("{", "").replace("}", "");
m_settings.setValue(QStringLiteral("userUuid"), userUuid);
}
return userUuid;
}
bool ConfigHandler::normalizeButtons(QVector<int> &buttons) {
auto listTypes = CaptureButton::getIterableButtonTypes();
QVector<int> listTypesInt;

View File

@@ -81,7 +81,6 @@ public:
void setAllTheButtons();
QString configFilePath() const;
const QString userUuid();
private:
QSettings m_settings;

View File

@@ -9,8 +9,11 @@ History::History()
{
// Get cache history path
ConfigHandler config;
QString userUuid = config.userUuid();
m_historyPath = QDir::homePath() + "/.cache/flameshot/history/"+ userUuid + "/";
#ifdef Q_OS_WIN
m_historyPath = QDir::homePath() + "/AppData/Roaming/flameshot/history/";
#else
m_historyPath = QDir::homePath() + "/.cache/flameshot/history/";
#endif
// Check if directory for history exists and create if doesn't
QDir dir = QDir(m_historyPath);