Mercurial > minori
diff src/services/services.cc @ 81:9b2b41f83a5e
boring: mass rename to cc
because this is a very unix-y project, it makes more sense to use the
'cc' extension
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 23 Oct 2023 12:07:27 -0400 |
parents | src/services/services.cpp@3d2decf093bb |
children | 80f49f623d30 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/services/services.cc Mon Oct 23 12:07:27 2023 -0400 @@ -0,0 +1,42 @@ +#include "services/services.h" +#include "core/session.h" +#include "gui/dialog/settings.h" +#include "services/anilist.h" +#include <QMessageBox> + +namespace Services { + +void Synchronize() { + switch (session.config.service) { + case Anime::Services::ANILIST: AniList::GetAnimeList(); break; + default: { + QMessageBox msg; + msg.setInformativeText("It seems you haven't yet selected a service to use."); + msg.setText("Would you like to select one now?"); + msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msg.setDefaultButton(QMessageBox::Yes); + int ret = msg.exec(); + if (ret == QMessageBox::Yes) { + SettingsDialog dialog; + dialog.exec(); + } + break; + } + } +} + +void UpdateAnimeEntry(int id) { + switch (session.config.service) { + case Anime::Services::ANILIST: AniList::UpdateAnimeEntry(id); break; + default: break; + } +} + +bool Authorize() { + switch (session.config.service) { + case Anime::Services::ANILIST: return AniList::AuthorizeUser(); + default: return true; + } +} + +}; // namespace Services