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")
, _channelLink("https://twitch.tv/" + _name)
, _popoutPlayerLink("https://player.twitch.tv/?channel=" + _name)
//, _loggingChannel(logging::get(_name))
// , _loggingChannel(logging::get(_name))
{
reloadChannelEmotes();
}

View file

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

View file

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

View file

@ -1,5 +1,6 @@
#include "channelmanager.h"
#include "colorscheme.h"
#include "common.h"
#include "emojis.h"
#include "emotemanager.h"
#include "ircmanager.h"
@ -11,13 +12,14 @@
#include <QApplication>
#include <QClipboard>
#include <QDir>
#include <QStandardPaths>
#include <boost/signals2.hpp>
using namespace chatterino;
using namespace chatterino::widgets;
int
main(int argc, char *argv[])
int main(int argc, char *argv[])
{
QApplication a(argc, argv);

View file

@ -1,4 +1,5 @@
#include "settingsmanager.h"
#include "appdatapath.h"
#include <QDebug>
#include <QDir>
@ -11,10 +12,7 @@ namespace chatterino {
SettingsManager SettingsManager::instance;
SettingsManager::SettingsManager()
: _settings(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
"/Chatterino/newsettings.ini",
QSettings::IniFormat)
, _portable(false)
: _settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat)
, _wordTypeMask(Word::Default)
, theme(_settingsItems, "theme", "dark")
, themeHue(_settingsItems, "themeHue", 0)
@ -87,16 +85,6 @@ bool SettingsManager::isIgnoredEmote(const QString &)
return false;
}
bool SettingsManager::getPortable()
{
return _portable;
}
void SettingsManager::setPortable(bool value)
{
_portable = value;
}
QSettings &SettingsManager::getQSettings()
{
return _settings;

View file

@ -52,8 +52,6 @@ public:
messages::Word::Type getWordTypeMask();
bool isIgnoredEmote(const QString &emote);
bool getPortable();
void setPortable(bool value);
QSettings &getQSettings();
SettingsSnapshot createSnapshot();
@ -66,7 +64,6 @@ private:
// variables
QSettings _settings;
std::vector<std::reference_wrapper<BaseSetting>> _settingsItems;
bool _portable;
messages::Word::Type _wordTypeMask;
// methods

View file

@ -1,4 +1,5 @@
#include "windowmanager.h"
#include "appdatapath.h"
#include <QDebug>
#include <QStandardPaths>
@ -9,9 +10,7 @@ namespace chatterino {
static const std::string &getSettingsPath()
{
static std::string path =
(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/windows.json")
.toStdString();
static std::string path = (Path::getAppdataPath() + "uilayout.json").toStdString();
return path;
}