Chris@1845: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1845: Chris@1845: /* Chris@1845: Sonic Visualiser Chris@1845: An audio file viewer and annotation editor. Chris@1845: Centre for Digital Music, Queen Mary, University of London. Chris@1845: Chris@1845: This program is free software; you can redistribute it and/or Chris@1845: modify it under the terms of the GNU General Public License as Chris@1845: published by the Free Software Foundation; either version 2 of the Chris@1845: License, or (at your option) any later version. See the file Chris@1845: COPYING included with this distribution for more information. Chris@1845: */ Chris@1845: Chris@1845: #ifndef SV_PROVIDER_H Chris@1845: #define SV_PROVIDER_H Chris@1845: Chris@1845: #include Chris@1845: Chris@1845: #include Chris@1845: Chris@1845: struct Provider Chris@1845: { Chris@1845: QString infoUrl; Chris@1845: QString downloadUrl; Chris@1845: Chris@1845: enum DownloadType { Chris@1845: DownloadSourceCode, Chris@1845: DownloadWindows, Chris@1845: DownloadMac, Chris@1845: DownloadLinux32, Chris@1845: DownloadLinux64, Chris@1845: DownloadOther Chris@1845: }; Chris@1845: std::set downloadTypes; Chris@1845: Chris@1845: std::map foundInPacks; // pack name -> pack url Chris@1845: Chris@1845: bool hasSourceDownload() const { Chris@1845: return downloadTypes.find(DownloadSourceCode) != downloadTypes.end(); Chris@1845: } Chris@1845: Chris@1845: bool hasDownloadForThisPlatform() const { Chris@1845: #ifdef Q_OS_WIN32 Chris@1845: return downloadTypes.find(DownloadWindows) != downloadTypes.end(); Chris@1845: #endif Chris@1845: #ifdef Q_OS_MAC Chris@1845: return downloadTypes.find(DownloadMac) != downloadTypes.end(); Chris@1845: #endif Chris@1845: #ifdef Q_OS_LINUX Chris@1845: if (sizeof(void *) == 8) { Chris@1845: return downloadTypes.find(DownloadLinux64) != downloadTypes.end(); Chris@1845: } else { Chris@1845: return downloadTypes.find(DownloadLinux32) != downloadTypes.end(); Chris@1845: } Chris@1845: #endif Chris@1845: return false; Chris@1845: } Chris@1845: Chris@1846: static QString thisPlatformName() { Chris@1846: #ifdef Q_OS_WIN32 Chris@1846: return QObject::tr("Windows"); Chris@1846: #endif Chris@1846: #ifdef Q_OS_MAC Chris@1846: return QObject::tr("Mac"); Chris@1846: #endif Chris@1846: #ifdef Q_OS_LINUX Chris@1846: if (sizeof(void *) == 8) { Chris@1846: return QObject::tr("64-bit Linux"); Chris@1846: } else { Chris@1846: return QObject::tr("32-bit Linux"); Chris@1846: } Chris@1846: #endif Chris@1846: return "(unknown)"; Chris@1846: } Chris@1846: Chris@1845: bool operator==(const Provider &other) { Chris@1845: return Chris@1845: other.infoUrl == infoUrl && Chris@1845: other.downloadUrl == downloadUrl && Chris@1845: other.downloadTypes == downloadTypes && Chris@1845: other.foundInPacks == foundInPacks; Chris@1845: } Chris@1845: bool operator!=(const Provider &other) { Chris@1845: return !operator==(other); Chris@1845: } Chris@1845: }; Chris@1845: Chris@1845: #endif