Mercurial > hg > svcore
comparison plugin/Provider.h @ 1845:6f626cfdba51
Pull out Provider struct
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2020 18:45:47 +0100 |
parents | |
children | 37ffea1e50ec |
comparison
equal
deleted
inserted
replaced
1844:5b1b03c1d8d4 | 1845:6f626cfdba51 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #ifndef SV_PROVIDER_H | |
16 #define SV_PROVIDER_H | |
17 | |
18 #include <QString> | |
19 | |
20 #include <set> | |
21 | |
22 struct Provider | |
23 { | |
24 QString infoUrl; | |
25 QString downloadUrl; | |
26 | |
27 enum DownloadType { | |
28 DownloadSourceCode, | |
29 DownloadWindows, | |
30 DownloadMac, | |
31 DownloadLinux32, | |
32 DownloadLinux64, | |
33 DownloadOther | |
34 }; | |
35 std::set<DownloadType> downloadTypes; | |
36 | |
37 std::map<QString, QString> foundInPacks; // pack name -> pack url | |
38 | |
39 bool hasSourceDownload() const { | |
40 return downloadTypes.find(DownloadSourceCode) != downloadTypes.end(); | |
41 } | |
42 | |
43 bool hasDownloadForThisPlatform() const { | |
44 #ifdef Q_OS_WIN32 | |
45 return downloadTypes.find(DownloadWindows) != downloadTypes.end(); | |
46 #endif | |
47 #ifdef Q_OS_MAC | |
48 return downloadTypes.find(DownloadMac) != downloadTypes.end(); | |
49 #endif | |
50 #ifdef Q_OS_LINUX | |
51 if (sizeof(void *) == 8) { | |
52 return downloadTypes.find(DownloadLinux64) != downloadTypes.end(); | |
53 } else { | |
54 return downloadTypes.find(DownloadLinux32) != downloadTypes.end(); | |
55 } | |
56 #endif | |
57 return false; | |
58 } | |
59 | |
60 bool operator==(const Provider &other) { | |
61 return | |
62 other.infoUrl == infoUrl && | |
63 other.downloadUrl == downloadUrl && | |
64 other.downloadTypes == downloadTypes && | |
65 other.foundInPacks == foundInPacks; | |
66 } | |
67 bool operator!=(const Provider &other) { | |
68 return !operator==(other); | |
69 } | |
70 }; | |
71 | |
72 #endif |