mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
changed application data path from %appdata%/chatterino to
%appdata%/chatterino2
This commit is contained in:
parent
138466035f
commit
11fed12be1
30
appdatapath.cpp
Normal file
30
appdatapath.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include "appdatapath.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
QString Path::appdataPath;
|
||||||
|
std::mutex Path::appdataPathMutex;
|
||||||
|
|
||||||
|
const QString &Path::getAppdataPath()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(appdataPathMutex);
|
||||||
|
|
||||||
|
if (appdataPath.isEmpty()) {
|
||||||
|
#ifdef PORTABLE
|
||||||
|
QString path = QCoreApplication::applicationDirPath();
|
||||||
|
#else
|
||||||
|
QString path =
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/Chatterino2/";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QDir(QDir::root()).mkdir(path);
|
||||||
|
|
||||||
|
appdataPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "memes: " << appdataPath;
|
||||||
|
|
||||||
|
return appdataPath;
|
||||||
|
}
|
18
appdatapath.h
Normal file
18
appdatapath.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef APPDATAPATH_H
|
||||||
|
#define APPDATAPATH_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <atomic>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
class Path
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const QString &getAppdataPath();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static QString appdataPath;
|
||||||
|
static std::mutex appdataPathMutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // APPDATAPATH_H
|
|
@ -64,7 +64,8 @@ SOURCES += main.cpp\
|
||||||
twitch/twitchparsemessage.cpp \
|
twitch/twitchparsemessage.cpp \
|
||||||
widgets/fancybutton.cpp \
|
widgets/fancybutton.cpp \
|
||||||
widgets/titlebar.cpp \
|
widgets/titlebar.cpp \
|
||||||
widgets/userpopupwidget.cpp
|
widgets/userpopupwidget.cpp \
|
||||||
|
appdatapath.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
asyncexec.h \
|
asyncexec.h \
|
||||||
|
@ -121,7 +122,8 @@ HEADERS += \
|
||||||
twitch/twitchparsemessage.h \
|
twitch/twitchparsemessage.h \
|
||||||
widgets/fancybutton.h \
|
widgets/fancybutton.h \
|
||||||
widgets/titlebar.h \
|
widgets/titlebar.h \
|
||||||
widgets/userpopupwidget.h
|
widgets/userpopupwidget.h \
|
||||||
|
appdatapath.h
|
||||||
|
|
||||||
PRECOMPILED_HEADER =
|
PRECOMPILED_HEADER =
|
||||||
|
|
||||||
|
|
2
common.h
2
common.h
|
@ -1,3 +1,5 @@
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#ifndef COMMON_H
|
#ifndef COMMON_H
|
||||||
#define COMMON_H
|
#define COMMON_H
|
||||||
|
|
||||||
|
|
6
main.cpp
6
main.cpp
|
@ -1,5 +1,6 @@
|
||||||
#include "channelmanager.h"
|
#include "channelmanager.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
#include "common.h"
|
||||||
#include "emojis.h"
|
#include "emojis.h"
|
||||||
#include "emotemanager.h"
|
#include "emotemanager.h"
|
||||||
#include "ircmanager.h"
|
#include "ircmanager.h"
|
||||||
|
@ -11,13 +12,14 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <boost/signals2.hpp>
|
#include <boost/signals2.hpp>
|
||||||
|
|
||||||
using namespace chatterino;
|
using namespace chatterino;
|
||||||
using namespace chatterino::widgets;
|
using namespace chatterino::widgets;
|
||||||
|
|
||||||
int
|
int main(int argc, char *argv[])
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "settingsmanager.h"
|
#include "settingsmanager.h"
|
||||||
|
#include "appdatapath.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -11,10 +12,7 @@ namespace chatterino {
|
||||||
SettingsManager SettingsManager::instance;
|
SettingsManager SettingsManager::instance;
|
||||||
|
|
||||||
SettingsManager::SettingsManager()
|
SettingsManager::SettingsManager()
|
||||||
: _settings(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
|
: _settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat)
|
||||||
"/Chatterino/newsettings.ini",
|
|
||||||
QSettings::IniFormat)
|
|
||||||
, _portable(false)
|
|
||||||
, _wordTypeMask(Word::Default)
|
, _wordTypeMask(Word::Default)
|
||||||
, theme(_settingsItems, "theme", "dark")
|
, theme(_settingsItems, "theme", "dark")
|
||||||
, themeHue(_settingsItems, "themeHue", 0)
|
, themeHue(_settingsItems, "themeHue", 0)
|
||||||
|
@ -87,16 +85,6 @@ bool SettingsManager::isIgnoredEmote(const QString &)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SettingsManager::getPortable()
|
|
||||||
{
|
|
||||||
return _portable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsManager::setPortable(bool value)
|
|
||||||
{
|
|
||||||
_portable = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSettings &SettingsManager::getQSettings()
|
QSettings &SettingsManager::getQSettings()
|
||||||
{
|
{
|
||||||
return _settings;
|
return _settings;
|
||||||
|
|
|
@ -52,8 +52,6 @@ public:
|
||||||
|
|
||||||
messages::Word::Type getWordTypeMask();
|
messages::Word::Type getWordTypeMask();
|
||||||
bool isIgnoredEmote(const QString &emote);
|
bool isIgnoredEmote(const QString &emote);
|
||||||
bool getPortable();
|
|
||||||
void setPortable(bool value);
|
|
||||||
QSettings &getQSettings();
|
QSettings &getQSettings();
|
||||||
SettingsSnapshot createSnapshot();
|
SettingsSnapshot createSnapshot();
|
||||||
|
|
||||||
|
@ -66,7 +64,6 @@ private:
|
||||||
// variables
|
// variables
|
||||||
QSettings _settings;
|
QSettings _settings;
|
||||||
std::vector<std::reference_wrapper<BaseSetting>> _settingsItems;
|
std::vector<std::reference_wrapper<BaseSetting>> _settingsItems;
|
||||||
bool _portable;
|
|
||||||
messages::Word::Type _wordTypeMask;
|
messages::Word::Type _wordTypeMask;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "windowmanager.h"
|
#include "windowmanager.h"
|
||||||
|
#include "appdatapath.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
@ -9,9 +10,7 @@ namespace chatterino {
|
||||||
|
|
||||||
static const std::string &getSettingsPath()
|
static const std::string &getSettingsPath()
|
||||||
{
|
{
|
||||||
static std::string path =
|
static std::string path = (Path::getAppdataPath() + "uilayout.json").toStdString();
|
||||||
(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/windows.json")
|
|
||||||
.toStdString();
|
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue