File indexing completed on 2024-04-28 16:31:52
0001 /*************************************************************************** 0002 Copyright (C) 2003-2009 Robby Stephenson <robby@periapsis.org> 0003 ***************************************************************************/ 0004 0005 /*************************************************************************** 0006 * * 0007 * This program is free software; you can redistribute it and/or * 0008 * modify it under the terms of the GNU General Public License as * 0009 * published by the Free Software Foundation; either version 2 of * 0010 * the License or (at your option) version 3 or any later version * 0011 * accepted by the membership of KDE e.V. (or its successor approved * 0012 * by the membership of KDE e.V.), which shall act as a proxy * 0013 * defined in Section 14 of version 3 of the license. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0022 * * 0023 ***************************************************************************/ 0024 0025 #ifndef TELLICO_COLLECTIONFIELDSDIALOG_H 0026 #define TELLICO_COLLECTIONFIELDSDIALOG_H 0027 0028 #include "datavectors.h" 0029 0030 #include <QDialog> 0031 0032 class KComboBox; 0033 0034 class QPushButton; 0035 class QLineEdit; 0036 class QListWidget; 0037 class QRadioButton; 0038 class QCheckBox; 0039 class QDialogButtonBox; 0040 0041 namespace Tellico { 0042 namespace Data { 0043 class Collection; 0044 } 0045 namespace GUI { 0046 class ComboBox; 0047 } 0048 0049 class FieldListItem; 0050 0051 /** 0052 * @author Robby Stephenson 0053 */ 0054 class CollectionFieldsDialog : public QDialog { 0055 Q_OBJECT 0056 0057 public: 0058 /** 0059 * The constructor sets up the dialog. 0060 * 0061 * @param coll A pointer to the collection parent of all the attributes 0062 * @param parent A pointer to the parent widget 0063 */ 0064 CollectionFieldsDialog(Data::CollPtr coll, QWidget* parent); 0065 ~CollectionFieldsDialog(); 0066 0067 void setNotifyKernel(bool notify); 0068 0069 Q_SIGNALS: 0070 void signalCollectionModified(); 0071 0072 protected Q_SLOTS: 0073 void slotOk(); 0074 void slotApply(); 0075 void slotDefault(); 0076 void slotHelp(); 0077 0078 private Q_SLOTS: 0079 void slotNew(); 0080 void slotDelete(); 0081 void slotMoveUp(); 0082 void slotMoveDown(); 0083 void slotTypeChanged(const QString& type); 0084 void slotHighlightedChanged(int index); 0085 void slotModified(); 0086 bool slotShowExtendedProperties(); 0087 void slotSelectInitial(); 0088 void slotDerivedChecked(bool checked); 0089 void resetToCurrent(); 0090 0091 private: 0092 void applyChanges(); 0093 void updateField(); 0094 void updateTitle(const QString& title); 0095 bool checkValues(); 0096 FieldListItem* findItem(Data::FieldPtr field); 0097 QStringList newTypesAllowed(int type); 0098 void populate(Data::FieldPtr field); 0099 0100 Data::CollPtr m_coll; 0101 Data::CollPtr m_defaultCollection; 0102 Data::FieldList m_copiedFields; 0103 Data::FieldList m_newFields; 0104 Data::FieldPtr m_currentField; 0105 bool m_modified; 0106 bool m_updatingValues; 0107 bool m_reordered; 0108 int m_oldIndex; 0109 enum NotifyMode { NotifyKernel, NoNotification }; 0110 NotifyMode m_notifyMode; 0111 0112 QListWidget* m_fieldsWidget; 0113 QPushButton* m_btnNew; 0114 QPushButton* m_btnDelete; 0115 QPushButton* m_btnUp; 0116 QPushButton* m_btnDown; 0117 0118 QLineEdit* m_titleEdit; 0119 KComboBox* m_typeCombo; 0120 KComboBox* m_catCombo; 0121 QLineEdit* m_descEdit; 0122 QLineEdit* m_derivedEdit; 0123 QLineEdit* m_defaultEdit; 0124 QCheckBox* m_derived; 0125 QLineEdit* m_allowEdit; 0126 QPushButton* m_btnExtended; 0127 0128 GUI::ComboBox* m_formatCombo; 0129 QCheckBox* m_complete; 0130 QCheckBox* m_multiple; 0131 QCheckBox* m_grouped; 0132 QDialogButtonBox* m_buttonBox; 0133 }; 0134 0135 } // end namespace 0136 #endif