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,33 +101,34 @@ namespace {
if (!queue.empty()) if (!queue.empty())
{ {
std::visit( // we were gonna use std::visit here but macos is shit
Overloaded{
[](const SetJob &set) { auto &&item = queue.front();
qDebug() << "set"; if (item.index() == 0) // set job
auto job = {
new QKeychain::WritePasswordJob("chatterino"); auto set = std::get<SetJob>(item);
auto job = new QKeychain::WritePasswordJob("chatterino");
job->setAutoDelete(true); job->setAutoDelete(true);
job->setKey(set.name); job->setKey(set.name);
job->setTextData(set.credential); job->setTextData(set.credential);
QObject::connect(job, &QKeychain::Job::finished, qApp, QObject::connect(job, &QKeychain::Job::finished, qApp,
[](auto) { runNextJob(); }); [](auto) { runNextJob(); });
job->start(); job->start();
}, }
[](const EraseJob &erase) { else // erase job
qDebug() << "erase"; {
auto job = auto erase = std::get<EraseJob>(item);
new QKeychain::DeletePasswordJob("chatterino"); auto job = new QKeychain::DeletePasswordJob("chatterino");
job->setAutoDelete(true); job->setAutoDelete(true);
job->setKey(erase.name); job->setKey(erase.name);
QObject::connect(job, &QKeychain::Job::finished, qApp, QObject::connect(job, &QKeychain::Job::finished, qApp,
[](auto) { runNextJob(); }); [](auto) { runNextJob(); });
job->start(); job->start();
}}, }
queue.front()); }
queue.pop(); queue.pop();
} }
} } // namespace
static void queueJob(Job &&job) static void queueJob(Job &&job)
{ {
@ -139,7 +140,7 @@ namespace {
runNextJob(); runNextJob();
} }
} }
} // namespace } // namespace chatterino
Credentials &Credentials::getInstance() Credentials &Credentials::getInstance()
{ {