changed application data path from %appdata%/chatterino to

%appdata%/chatterino2
This commit is contained in:
fourtf 2017-04-13 18:51:46 +02:00
parent 138466035f
commit 11fed12be1
9 changed files with 221 additions and 183 deletions

30
appdatapath.cpp Normal file
View 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
View 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

View file

@ -27,7 +27,7 @@ Channel::Channel(const QString &channel)
, _subLink("https://www.twitch.tv/" + _name + "/subscribe?ref=in_chat_subscriber_link") , _subLink("https://www.twitch.tv/" + _name + "/subscribe?ref=in_chat_subscriber_link")
, _channelLink("https://twitch.tv/" + _name) , _channelLink("https://twitch.tv/" + _name)
, _popoutPlayerLink("https://player.twitch.tv/?channel=" + _name) , _popoutPlayerLink("https://player.twitch.tv/?channel=" + _name)
//, _loggingChannel(logging::get(_name)) // , _loggingChannel(logging::get(_name))
{ {
reloadChannelEmotes(); reloadChannelEmotes();
} }

View file

@ -1,160 +1,162 @@
#------------------------------------------------- #-------------------------------------------------
# #
# Project created by QtCreator 2016-12-28T18:23:35 # Project created by QtCreator 2016-12-28T18:23:35
# #
#------------------------------------------------- #-------------------------------------------------
QT += core gui network QT += core gui network
CONFIG += communi CONFIG += communi
COMMUNI += core model util COMMUNI += core model util
CONFIG += c++14 CONFIG += c++14
include(lib/libcommuni/src/src.pri) include(lib/libcommuni/src/src.pri)
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = chatterino TARGET = chatterino
TEMPLATE = app TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += IRC_NAMESPACE=Communi DEFINES += IRC_NAMESPACE=Communi
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\ SOURCES += main.cpp\
channel.cpp \ channel.cpp \
colorscheme.cpp \ colorscheme.cpp \
emojis.cpp \ emojis.cpp \
ircmanager.cpp \ ircmanager.cpp \
messages/lazyloadedimage.cpp \ messages/lazyloadedimage.cpp \
messages/link.cpp \ messages/link.cpp \
messages/message.cpp \ messages/message.cpp \
messages/word.cpp \ messages/word.cpp \
messages/wordpart.cpp \ messages/wordpart.cpp \
resources.cpp \ resources.cpp \
widgets/chatwidget.cpp \ widgets/chatwidget.cpp \
widgets/chatwidgetheader.cpp \ widgets/chatwidgetheader.cpp \
widgets/chatwidgetheaderbutton.cpp \ widgets/chatwidgetheaderbutton.cpp \
widgets/chatwidgetinput.cpp \ widgets/chatwidgetinput.cpp \
widgets/chatwidgetview.cpp \ widgets/chatwidgetview.cpp \
widgets/mainwindow.cpp \ widgets/mainwindow.cpp \
widgets/notebook.cpp \ widgets/notebook.cpp \
widgets/notebookbutton.cpp \ widgets/notebookbutton.cpp \
widgets/notebookpage.cpp \ widgets/notebookpage.cpp \
widgets/notebookpagedroppreview.cpp \ widgets/notebookpagedroppreview.cpp \
widgets/notebooktab.cpp \ widgets/notebooktab.cpp \
widgets/scrollbar.cpp \ widgets/scrollbar.cpp \
widgets/scrollbarhighlight.cpp \ widgets/scrollbarhighlight.cpp \
widgets/settingsdialog.cpp \ widgets/settingsdialog.cpp \
widgets/settingsdialogtab.cpp \ widgets/settingsdialogtab.cpp \
widgets/textinputdialog.cpp \ widgets/textinputdialog.cpp \
messages/messageref.cpp \ messages/messageref.cpp \
logging/loggingmanager.cpp \ logging/loggingmanager.cpp \
logging/loggingchannel.cpp \ logging/loggingchannel.cpp \
windowmanager.cpp \ windowmanager.cpp \
channelmanager.cpp \ channelmanager.cpp \
fontmanager.cpp \ fontmanager.cpp \
settingsmanager.cpp \ settingsmanager.cpp \
emotemanager.cpp \ emotemanager.cpp \
usermanager.cpp \ usermanager.cpp \
twitch/twitchuser.cpp \ twitch/twitchuser.cpp \
messages/messagebuilder.cpp \ messages/messagebuilder.cpp \
twitch/twitchmessagebuilder.cpp \ twitch/twitchmessagebuilder.cpp \
ircuser2.cpp \ ircuser2.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 += \
asyncexec.h \ HEADERS += \
channel.h \ asyncexec.h \
colorscheme.h \ channel.h \
common.h \ colorscheme.h \
concurrentmap.h \ common.h \
emojis.h \ concurrentmap.h \
ircmanager.h \ emojis.h \
messages/lazyloadedimage.h \ ircmanager.h \
messages/link.h \ messages/lazyloadedimage.h \
messages/message.h \ messages/link.h \
messages/word.h \ messages/message.h \
messages/wordpart.h \ messages/word.h \
resources.h \ messages/wordpart.h \
setting.h \ resources.h \
twitch/emotevalue.h \ setting.h \
widgets/chatwidget.h \ twitch/emotevalue.h \
widgets/chatwidgetheader.h \ widgets/chatwidget.h \
widgets/chatwidgetheaderbutton.h \ widgets/chatwidgetheader.h \
widgets/chatwidgetinput.h \ widgets/chatwidgetheaderbutton.h \
widgets/chatwidgetview.h \ widgets/chatwidgetinput.h \
widgets/mainwindow.h \ widgets/chatwidgetview.h \
widgets/notebook.h \ widgets/mainwindow.h \
widgets/notebookbutton.h \ widgets/notebook.h \
widgets/notebookpage.h \ widgets/notebookbutton.h \
widgets/notebookpagedroppreview.h \ widgets/notebookpage.h \
widgets/notebooktab.h \ widgets/notebookpagedroppreview.h \
widgets/scrollbar.h \ widgets/notebooktab.h \
widgets/scrollbarhighlight.h \ widgets/scrollbar.h \
widgets/settingsdialog.h \ widgets/scrollbarhighlight.h \
widgets/settingsdialogtab.h \ widgets/settingsdialog.h \
widgets/signallabel.h \ widgets/settingsdialogtab.h \
widgets/textinputdialog.h \ widgets/signallabel.h \
widgets/resizingtextedit.h \ widgets/textinputdialog.h \
settingssnapshot.h \ widgets/resizingtextedit.h \
messages/limitedqueue.h \ settingssnapshot.h \
messages/limitedqueuesnapshot.h \ messages/limitedqueue.h \
messages/messageref.h \ messages/limitedqueuesnapshot.h \
logging/loggingmanager.h \ messages/messageref.h \
logging/loggingchannel.h \ logging/loggingmanager.h \
channelmanager.h \ logging/loggingchannel.h \
windowmanager.h \ channelmanager.h \
settingsmanager.h \ windowmanager.h \
fontmanager.h \ settingsmanager.h \
emotemanager.h \ fontmanager.h \
util/urlfetch.h \ emotemanager.h \
usermanager.h \ util/urlfetch.h \
twitch/twitchuser.h \ usermanager.h \
messages/messageparseargs.h \ twitch/twitchuser.h \
messages/messagebuilder.h \ messages/messageparseargs.h \
twitch/twitchmessagebuilder.h \ messages/messagebuilder.h \
ircuser2.h \ twitch/twitchmessagebuilder.h \
twitch/twitchparsemessage.h \ ircuser2.h \
widgets/fancybutton.h \ twitch/twitchparsemessage.h \
widgets/titlebar.h \ widgets/fancybutton.h \
widgets/userpopupwidget.h widgets/titlebar.h \
widgets/userpopupwidget.h \
PRECOMPILED_HEADER = appdatapath.h
RESOURCES += \ PRECOMPILED_HEADER =
resources.qrc
RESOURCES += \
DISTFILES += resources.qrc
# Include boost DISTFILES +=
win32 {
INCLUDEPATH += C:\local\boost\ # Include boost
} win32 {
INCLUDEPATH += C:\local\boost\
# Optional dependency on windows sdk 7.1 }
win32:exists(C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\Windows.h) {
LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" \ # Optional dependency on windows sdk 7.1
-ldwmapi \ win32:exists(C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\Windows.h) {
-lgdi32 LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" \
-ldwmapi \
SOURCES += platform/borderless/qwinwidget.cpp \ -lgdi32
platform/borderless/winnativewindow.cpp \
platform/borderless/widget.cpp SOURCES += platform/borderless/qwinwidget.cpp \
platform/borderless/winnativewindow.cpp \
HEADERS += platform/borderless/qwinwidget.h \ platform/borderless/widget.cpp
platform/borderless/winnativewindow.h \
platform/borderless/widget.h HEADERS += platform/borderless/qwinwidget.h \
platform/borderless/winnativewindow.h \
DEFINES += "USEWINSDK" platform/borderless/widget.h
}
DEFINES += "USEWINSDK"
macx { }
INCLUDEPATH += /usr/local/include
} macx {
INCLUDEPATH += /usr/local/include
FORMS += \ }
forms/userpopup.ui
FORMS += \
forms/userpopup.ui

View file

@ -1,3 +1,5 @@
#include <QString>
#ifndef COMMON_H #ifndef COMMON_H
#define COMMON_H #define COMMON_H

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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;
} }