1 /************************************************************************ 2 ** 3 ** Copyright (C) 2021 Kevin B. Hendricks, Stratford, Ontario Canada 4 ** Copyright (C) 2012 Dave Heiland 5 ** Copyright (C) 2012 John Schember <john@nachtimwald.com> 6 ** 7 ** This file is part of Sigil. 8 ** 9 ** Sigil is free software: you can redistribute it and/or modify 10 ** it under the terms of the GNU General Public License as published by 11 ** the Free Software Foundation, either version 3 of the License, or 12 ** (at your option) any later version. 13 ** 14 ** Sigil is distributed in the hope that it will be useful, 15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ** GNU General Public License for more details. 18 ** 19 ** You should have received a copy of the GNU General Public License 20 ** along with Sigil. If not, see <http://www.gnu.org/licenses/>. 21 ** 22 *************************************************************************/ 23 24 #pragma once 25 #ifndef LINKJAVASCRIPTS_H 26 #define LINKJAVASCRIPTS_H 27 28 #include <QtCore/QList> 29 #include <QtCore/QStringList> 30 #include <QtWidgets/QDialog> 31 #include <QtGui/QStandardItemModel> 32 33 #include "ui_LinkJavascripts.h" 34 35 class LinkJavascripts : public QDialog 36 { 37 Q_OBJECT 38 39 public: 40 41 // Constructor; 42 // The first parameter is the list of included/excluded stylesheets 43 LinkJavascripts(QList<std::pair<QString, bool>> stylesheet_map, QWidget *parent = 0); 44 45 QStringList GetJavascripts(); 46 47 private slots: 48 49 // Writes all the stored dialog settings 50 void WriteSettings(); 51 52 void MoveUp(); 53 void MoveDown(); 54 void UpdateJavascripts(); 55 56 private: 57 58 // Updates the display of the tree view (resizes columns etc.) 59 void UpdateTreeViewDisplay(); 60 61 // Creates the model that is displayed in the tree view 62 void CreateJavascriptsModel(); 63 64 // Inserts the specified stylesheet into the model 65 void InsertJavascriptIntoModel(std::pair<QString, bool> stylesheet); 66 67 // Reads all the stored dialog settings like window position, size, etc. 68 void ReadSettings(); 69 70 void ConnectSignalsToSlots(); 71 72 73 /////////////////////////////// 74 // PRIVATE MEMBER VARIABLES 75 /////////////////////////////// 76 77 // The model displayed and edited in the tree view 78 QStandardItemModel m_JavascriptsModel; 79 80 // The list of javascripts to include/exclude 81 QList<std::pair<QString, bool>> m_JavascriptsMap; 82 83 // The new list of javascripts to include 84 QStringList m_Javascripts; 85 86 // Holds all the widgets Qt Designer created for us 87 Ui::LinkJavascripts ui; 88 }; 89 90 91 #endif // LINKJAVASCRIPTS_H 92