1 //============================================================================= 2 // MuseScore 3 // Music Composition & Notation 4 // 5 // Copyright (C) 2014 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 __TEMPLATEBROWSER_H__ 14 #define __TEMPLATEBROWSER_H__ 15 16 #include "ui_templateBrowser.h" 17 #include "scoreInfo.h" 18 19 class QTreeWidgetItem; 20 21 namespace Ms { 22 23 class TemplateItem; 24 class TemplateCategory; 25 26 //--------------------------------------------------------- 27 // TemplateBrowser 28 //--------------------------------------------------------- 29 30 class TemplateBrowser : public QWidget, public Ui::TemplateBrowser 31 { 32 Q_OBJECT 33 34 bool _stripNumbers { false }; // remove number prefix from filenames 35 bool _showPreview { true }; // show preview of templates 36 bool _showCustomCategory { false }; // show a custom category for user's own templates 37 38 TemplateItem* genTemplateItem(QTreeWidgetItem*, const QFileInfo&); 39 40 private slots: 41 void scoreClicked(); 42 void handleItemActivated(QTreeWidgetItem* item); 43 44 signals: 45 void leave(); 46 void scoreSelected(QString); 47 void scoreActivated(QString path); 48 49 public: 50 TemplateBrowser(QWidget* parent = 0); 51 void setScores(QFileInfoList&); setStripNumbers(bool val)52 void setStripNumbers(bool val) { _stripNumbers = val; } 53 void filter(const QString&); 54 }; 55 } 56 57 #endif 58