Provider.h
Go to the documentation of this file.
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 {
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 
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  static QString thisPlatformName() {
61 #ifdef Q_OS_WIN32
62  return QObject::tr("Windows");
63 #endif
64 #ifdef Q_OS_MAC
65  return QObject::tr("Mac");
66 #endif
67 #ifdef Q_OS_LINUX
68  if (sizeof(void *) == 8) {
69  return QObject::tr("64-bit Linux");
70  } else {
71  return QObject::tr("32-bit Linux");
72  }
73 #endif
74  return "(unknown)";
75  }
76 
77  bool operator==(const Provider &other) {
78  return
79  other.infoUrl == infoUrl &&
80  other.downloadUrl == downloadUrl &&
81  other.downloadTypes == downloadTypes &&
82  other.foundInPacks == foundInPacks;
83  }
84  bool operator!=(const Provider &other) {
85  return !operator==(other);
86  }
87 };
88 
89 #endif
static QString thisPlatformName()
Definition: Provider.h:60
DownloadType
Definition: Provider.h:27
std::map< QString, QString > foundInPacks
Definition: Provider.h:37
bool hasSourceDownload() const
Definition: Provider.h:39
std::set< DownloadType > downloadTypes
Definition: Provider.h:35
QString downloadUrl
Definition: Provider.h:25
bool operator==(const Provider &other)
Definition: Provider.h:77
bool hasDownloadForThisPlatform() const
Definition: Provider.h:43
QString infoUrl
Definition: Provider.h:24
bool operator!=(const Provider &other)
Definition: Provider.h:84