mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Remove getPaths() usage from Args
This commit is contained in:
parent
1bf40b70a0
commit
8928f59db9
4 changed files with 12 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/Args.hpp"
|
#include "common/Args.hpp"
|
||||||
|
#include "singletons/Paths.hpp"
|
||||||
|
|
||||||
namespace chatterino::mock {
|
namespace chatterino::mock {
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ QStringList extractCommandLine(
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
Args::Args(const QApplication &app)
|
Args::Args(const QApplication &app, const Paths &paths)
|
||||||
{
|
{
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription("Chatterino 2 Client for Twitch Chat");
|
parser.setApplicationDescription("Chatterino 2 Client for Twitch Chat");
|
||||||
|
@ -132,7 +132,7 @@ Args::Args(const QApplication &app)
|
||||||
|
|
||||||
if (parser.isSet(channelLayout))
|
if (parser.isSet(channelLayout))
|
||||||
{
|
{
|
||||||
this->applyCustomChannelLayout(parser.value(channelLayout));
|
this->applyCustomChannelLayout(parser.value(channelLayout), paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->verbose = parser.isSet(verboseOption);
|
this->verbose = parser.isSet(verboseOption);
|
||||||
|
@ -175,7 +175,7 @@ QStringList Args::currentArguments() const
|
||||||
return this->currentArguments_;
|
return this->currentArguments_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Args::applyCustomChannelLayout(const QString &argValue)
|
void Args::applyCustomChannelLayout(const QString &argValue, const Paths &paths)
|
||||||
{
|
{
|
||||||
WindowLayout layout;
|
WindowLayout layout;
|
||||||
WindowDescriptor window;
|
WindowDescriptor window;
|
||||||
|
@ -187,10 +187,9 @@ void Args::applyCustomChannelLayout(const QString &argValue)
|
||||||
window.type_ = WindowType::Main;
|
window.type_ = WindowType::Main;
|
||||||
|
|
||||||
// Load main window layout from config file so we can use the same geometry
|
// Load main window layout from config file so we can use the same geometry
|
||||||
const QRect configMainLayout = [] {
|
const QRect configMainLayout = [paths] {
|
||||||
const QString windowLayoutFile =
|
const QString windowLayoutFile = combinePath(
|
||||||
combinePath(getPaths()->settingsDirectory,
|
paths.settingsDirectory, WindowManager::WINDOW_LAYOUT_FILENAME);
|
||||||
WindowManager::WINDOW_LAYOUT_FILENAME);
|
|
||||||
|
|
||||||
const WindowLayout configLayout =
|
const WindowLayout configLayout =
|
||||||
WindowLayout::loadFromFile(windowLayoutFile);
|
WindowLayout::loadFromFile(windowLayoutFile);
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
class Paths;
|
||||||
|
|
||||||
/// Command line arguments passed to Chatterino.
|
/// Command line arguments passed to Chatterino.
|
||||||
///
|
///
|
||||||
/// All accepted arguments:
|
/// All accepted arguments:
|
||||||
|
@ -31,7 +33,7 @@ class Args
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Args() = default;
|
Args() = default;
|
||||||
Args(const QApplication &app);
|
Args(const QApplication &app, const Paths &paths);
|
||||||
|
|
||||||
bool printVersion{};
|
bool printVersion{};
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ public:
|
||||||
QStringList currentArguments() const;
|
QStringList currentArguments() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void applyCustomChannelLayout(const QString &argValue);
|
void applyCustomChannelLayout(const QString &argValue, const Paths &paths);
|
||||||
|
|
||||||
QStringList currentArguments_;
|
QStringList currentArguments_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,7 @@ int main(int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Args args(a);
|
const Args args(a, *paths);
|
||||||
|
|
||||||
#ifdef CHATTERINO_WITH_CRASHPAD
|
#ifdef CHATTERINO_WITH_CRASHPAD
|
||||||
const auto crashpadHandler = installCrashHandler(args);
|
const auto crashpadHandler = installCrashHandler(args);
|
||||||
|
|
Loading…
Reference in a new issue