File indexing completed on 2024-04-21 03:51:02
0001 /* 0002 options to enable/disable columns for the languages 0003 SPDX-FileCopyrightText: 2008 Javier goday <jgoday@gmail.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef VOCABULARYCOLUMNSDIALOG_H 0008 #define VOCABULARYCOLUMNSDIALOG_H 0009 0010 #include <QMap> 0011 0012 #include <QDialog> 0013 0014 class DocumentSettings; 0015 class QGridLayout; 0016 class QStandardItem; 0017 class QStandardItemModel; 0018 class QVBoxLayout; 0019 class KEduVocDocument; 0020 0021 namespace Editor 0022 { 0023 /** 0024 * Show options to enable/disable the columns for each language of the current document 0025 */ 0026 class VocabularyColumnsDialog : public QDialog 0027 { 0028 Q_OBJECT 0029 public: 0030 enum Roles { 0031 ColumnRole = 0x12, 0032 LanguageRole = 0x18, 0033 }; 0034 0035 VocabularyColumnsDialog(KEduVocDocument *doc, QWidget *parent); 0036 ~VocabularyColumnsDialog() override; 0037 0038 void accept() override; 0039 0040 private: 0041 /** 0042 * Initialize the gridlayout of the widget 0043 * with one treeview for each language showing the possible columns 0044 */ 0045 void createLanguagesLayout(); 0046 0047 /** 0048 * Adds a language to the main gridlayout 0049 */ 0050 void addLanguage(int language, QVBoxLayout *parent); 0051 0052 /** 0053 * Save the visible columns for each language in the document settings 0054 */ 0055 void saveVisibleColumns(); 0056 0057 DocumentSettings *m_settings{nullptr}; 0058 QGridLayout *m_box{nullptr}; 0059 KEduVocDocument *m_doc{nullptr}; 0060 QMap<int, QStandardItemModel *> m_models; 0061 }; 0062 } 0063 0064 #endif