annotate plugin/Provider.h @ 1879:652c5360e682

Ensure transforms are populated before instantiateDefaultPluginFor runs - otherwise if we have prior knowledge of a transform id, we can find ourselves trying to instantiate it before the plugin factory has heard of it and e.g. knows which server to use
author Chris Cannam
date Thu, 25 Jun 2020 12:20:06 +0100
parents 37ffea1e50ec
children
rev   line source
Chris@1845 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1845 2
Chris@1845 3 /*
Chris@1845 4 Sonic Visualiser
Chris@1845 5 An audio file viewer and annotation editor.
Chris@1845 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1845 7
Chris@1845 8 This program is free software; you can redistribute it and/or
Chris@1845 9 modify it under the terms of the GNU General Public License as
Chris@1845 10 published by the Free Software Foundation; either version 2 of the
Chris@1845 11 License, or (at your option) any later version. See the file
Chris@1845 12 COPYING included with this distribution for more information.
Chris@1845 13 */
Chris@1845 14
Chris@1845 15 #ifndef SV_PROVIDER_H
Chris@1845 16 #define SV_PROVIDER_H
Chris@1845 17
Chris@1845 18 #include <QString>
Chris@1845 19
Chris@1845 20 #include <set>
Chris@1845 21
Chris@1845 22 struct Provider
Chris@1845 23 {
Chris@1845 24 QString infoUrl;
Chris@1845 25 QString downloadUrl;
Chris@1845 26
Chris@1845 27 enum DownloadType {
Chris@1845 28 DownloadSourceCode,
Chris@1845 29 DownloadWindows,
Chris@1845 30 DownloadMac,
Chris@1845 31 DownloadLinux32,
Chris@1845 32 DownloadLinux64,
Chris@1845 33 DownloadOther
Chris@1845 34 };
Chris@1845 35 std::set<DownloadType> downloadTypes;
Chris@1845 36
Chris@1845 37 std::map<QString, QString> foundInPacks; // pack name -> pack url
Chris@1845 38
Chris@1845 39 bool hasSourceDownload() const {
Chris@1845 40 return downloadTypes.find(DownloadSourceCode) != downloadTypes.end();
Chris@1845 41 }
Chris@1845 42
Chris@1845 43 bool hasDownloadForThisPlatform() const {
Chris@1845 44 #ifdef Q_OS_WIN32
Chris@1845 45 return downloadTypes.find(DownloadWindows) != downloadTypes.end();
Chris@1845 46 #endif
Chris@1845 47 #ifdef Q_OS_MAC
Chris@1845 48 return downloadTypes.find(DownloadMac) != downloadTypes.end();
Chris@1845 49 #endif
Chris@1845 50 #ifdef Q_OS_LINUX
Chris@1845 51 if (sizeof(void *) == 8) {
Chris@1845 52 return downloadTypes.find(DownloadLinux64) != downloadTypes.end();
Chris@1845 53 } else {
Chris@1845 54 return downloadTypes.find(DownloadLinux32) != downloadTypes.end();
Chris@1845 55 }
Chris@1845 56 #endif
Chris@1845 57 return false;
Chris@1845 58 }
Chris@1845 59
Chris@1846 60 static QString thisPlatformName() {
Chris@1846 61 #ifdef Q_OS_WIN32
Chris@1846 62 return QObject::tr("Windows");
Chris@1846 63 #endif
Chris@1846 64 #ifdef Q_OS_MAC
Chris@1846 65 return QObject::tr("Mac");
Chris@1846 66 #endif
Chris@1846 67 #ifdef Q_OS_LINUX
Chris@1846 68 if (sizeof(void *) == 8) {
Chris@1846 69 return QObject::tr("64-bit Linux");
Chris@1846 70 } else {
Chris@1846 71 return QObject::tr("32-bit Linux");
Chris@1846 72 }
Chris@1846 73 #endif
Chris@1846 74 return "(unknown)";
Chris@1846 75 }
Chris@1846 76
Chris@1845 77 bool operator==(const Provider &other) {
Chris@1845 78 return
Chris@1845 79 other.infoUrl == infoUrl &&
Chris@1845 80 other.downloadUrl == downloadUrl &&
Chris@1845 81 other.downloadTypes == downloadTypes &&
Chris@1845 82 other.foundInPacks == foundInPacks;
Chris@1845 83 }
Chris@1845 84 bool operator!=(const Provider &other) {
Chris@1845 85 return !operator==(other);
Chris@1845 86 }
Chris@1845 87 };
Chris@1845 88
Chris@1845 89 #endif