mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fix compilation on macos maybe
This commit is contained in:
parent
3c5d8a1761
commit
4bb0b79348
1 changed files with 36 additions and 35 deletions
|
@ -101,46 +101,47 @@ namespace {
|
||||||
|
|
||||||
if (!queue.empty())
|
if (!queue.empty())
|
||||||
{
|
{
|
||||||
std::visit(
|
// we were gonna use std::visit here but macos is shit
|
||||||
Overloaded{
|
|
||||||
[](const SetJob &set) {
|
|
||||||
qDebug() << "set";
|
|
||||||
auto job =
|
|
||||||
new QKeychain::WritePasswordJob("chatterino");
|
|
||||||
job->setAutoDelete(true);
|
|
||||||
job->setKey(set.name);
|
|
||||||
job->setTextData(set.credential);
|
|
||||||
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
|
||||||
[](auto) { runNextJob(); });
|
|
||||||
job->start();
|
|
||||||
},
|
|
||||||
[](const EraseJob &erase) {
|
|
||||||
qDebug() << "erase";
|
|
||||||
auto job =
|
|
||||||
new QKeychain::DeletePasswordJob("chatterino");
|
|
||||||
job->setAutoDelete(true);
|
|
||||||
job->setKey(erase.name);
|
|
||||||
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
|
||||||
[](auto) { runNextJob(); });
|
|
||||||
job->start();
|
|
||||||
}},
|
|
||||||
queue.front());
|
|
||||||
queue.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void queueJob(Job &&job)
|
auto &&item = queue.front();
|
||||||
{
|
if (item.index() == 0) // set job
|
||||||
auto &&queue = jobQueue();
|
{
|
||||||
|
auto set = std::get<SetJob>(item);
|
||||||
queue.push(std::move(job));
|
auto job = new QKeychain::WritePasswordJob("chatterino");
|
||||||
if (queue.size() == 1)
|
job->setAutoDelete(true);
|
||||||
{
|
job->setKey(set.name);
|
||||||
runNextJob();
|
job->setTextData(set.credential);
|
||||||
|
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
||||||
|
[](auto) { runNextJob(); });
|
||||||
|
job->start();
|
||||||
|
}
|
||||||
|
else // erase job
|
||||||
|
{
|
||||||
|
auto erase = std::get<EraseJob>(item);
|
||||||
|
auto job = new QKeychain::DeletePasswordJob("chatterino");
|
||||||
|
job->setAutoDelete(true);
|
||||||
|
job->setKey(erase.name);
|
||||||
|
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
||||||
|
[](auto) { runNextJob(); });
|
||||||
|
job->start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
queue.pop();
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
static void queueJob(Job &&job)
|
||||||
|
{
|
||||||
|
auto &&queue = jobQueue();
|
||||||
|
|
||||||
|
queue.push(std::move(job));
|
||||||
|
if (queue.size() == 1)
|
||||||
|
{
|
||||||
|
runNextJob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace chatterino
|
||||||
|
|
||||||
Credentials &Credentials::getInstance()
|
Credentials &Credentials::getInstance()
|
||||||
{
|
{
|
||||||
static Credentials creds;
|
static Credentials creds;
|
||||||
|
|
Loading…
Reference in a new issue