1 //============================================================================= 2 // MuseScore 3 // Music Composition & Notation 4 // 5 // Copyright (C) 2002-2013 Werner Schweer 6 // 7 // This program is free software; you can redistribute it and/or modify 8 // it under the terms of the GNU General Public License version 2 9 // as published by the Free Software Foundation and appearing in 10 // the file LICENCE.GPL 11 //============================================================================= 12 13 #ifndef RESOURCE_H 14 #define RESOURCE_H 15 16 #include "ui_resourceManager.h" 17 #include "downloadUtils.h" 18 19 namespace Ms { 20 21 class ResourceManager : public QDialog, public Ui::Resource 22 { 23 Q_OBJECT 24 25 virtual void hideEvent(QHideEvent*); 26 QByteArray txt; 27 void displayLanguages(); 28 void displayExtensions(); 29 bool verifyFile(QString path, QString hash); 30 bool verifyLanguageFile(QString filename, QString hash); 31 32 QPushButton* currentLanguageButton = nullptr; 33 34 public: 35 explicit ResourceManager(QWidget *parent = 0); 36 void selectLanguagesTab(); 37 void selectExtensionsTab(); 38 baseAddr()39 static inline QString baseAddr() { return "http://extensions.musescore.org/3.6/"; } 40 41 private: 42 QMap <QPushButton *, QString> languageButtonMap; // QPushButton -> filename 43 QMap <QPushButton *, QString> languageButtonHashMap;// QPushButton -> hash of the file 44 45 private slots: 46 void downloadLanguage(); 47 void downloadExtension(); 48 void uninstallExtension(); 49 }; 50 51 class ExtensionFileSize : public QTableWidgetItem 52 { 53 int _size; 54 55 public: 56 ExtensionFileSize(const int i); getSize()57 int getSize() const { return _size; } 58 bool operator<(const QTableWidgetItem& nextItem) const; 59 60 }; 61 62 class LanguageFileSize : public QTableWidgetItem 63 { 64 double _size; 65 66 public: 67 LanguageFileSize(const double d); getSize()68 double getSize() const { return _size; } 69 bool operator<(const QTableWidgetItem& nextItem) const; 70 71 }; 72 73 } 74 #endif // RESOURCE_H 75