File indexing completed on 2024-12-08 06:28:22
0001 /* 0002 This file is part of Kiten, a KDE Japanese Reference Tool 0003 SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KITEN_DICTIONARYPREFERENCEDIALOG_H 0009 #define KITEN_DICTIONARYPREFERENCEDIALOG_H 0010 0011 #include <QWidget> 0012 0013 #include "kiten_export.h" 0014 0015 /** 0016 * @short This abstract base class specifies the interface for dictionary 0017 * preference dialogs in user applications. The DictionaryManager class can be 0018 * asked for a list of these objects for the current session, and the appropriate 0019 * signal/slot connections can be made to handle dictionary preferences transparently 0020 * to the user application. 0021 * 0022 * One annoying caveat is that the user application still has to add preference elements 0023 * to it's own kcfg file, or the preference code will crash when trying to work with it. 0024 * Sadly, at the moment the only way to figure out what needs to be added to the kcfg is 0025 * to read the code, or the kiten.kcfg implementation. 0026 * 0027 * @author Joseph Kerian \<jkerian@gmail.com\> 0028 */ 0029 class KITEN_EXPORT DictionaryPreferenceDialog : public QWidget 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 /** 0035 * Basic constructor. Used by internal classes only. Implement if you are 0036 * adding your own dictionary type. 0037 * 0038 * @param parent the parent widget, as per normal Qt Widget handling 0039 * @param name the name of your widget, as understood by the preference code 0040 */ 0041 DictionaryPreferenceDialog(QWidget *parent, const QString &name); 0042 /** 0043 * Basic destructor 0044 */ 0045 ~DictionaryPreferenceDialog() override = default; 0046 /** 0047 * Get the dictionary type name associated with this dialog 0048 */ 0049 QString name() const; 0050 0051 public Q_SLOTS: 0052 /** 0053 * Connect the signal of your preferences dialog to this updateWidgets slot, to handle reading 0054 * preference settings cleanly. You can also call this slot directly from your own updateWidgets slot. 0055 */ 0056 virtual void updateWidgets() = 0; 0057 /** 0058 * Connect the signal of your preferences dialog to this updateWidgetsDefault slot, to handle setting 0059 * preference settings back to their default settings easily. 0060 */ 0061 virtual void updateWidgetsDefault() = 0; 0062 /** 0063 * Connect the signal of your preferences dialog to this updateSettings slot, to handle saving 0064 * user's preference information. 0065 */ 0066 virtual void updateSettings() = 0; 0067 0068 Q_SIGNALS: 0069 /** 0070 * When the user edits something on this preference page, this signal should be emitted 0071 */ 0072 void widgetChanged(); 0073 0074 protected: 0075 /** 0076 * A place to store the name, passed in the constructor 0077 */ 0078 QString m_name; 0079 }; 0080 0081 #endif