fix compilation on macos maybe

This commit is contained in:
fourtf 2019-09-18 15:12:23 +02:00
parent 3c5d8a1761
commit 4bb0b79348

View file

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