Warning, file /utilities/krename/src/tokenhelpdialog.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /*************************************************************************** 0002 tokenhelpdialog.h - description 0003 ------------------- 0004 begin : Mon Jul 30 2007 0005 copyright : (C) 2007 by Dominik Seichter 0006 email : domseichter@web.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef TOKEN_HELP_DIALOG_H 0019 #define TOKEN_HELP_DIALOG_H 0020 0021 #include <QDialog> 0022 0023 #include "ui_tokenhelpwidget.h" 0024 #include <KTreeWidgetSearchLineWidget> 0025 0026 class QLineEdit; 0027 class QTreeWidgetItem; 0028 0029 class BatchRenamer; 0030 class KRenameModel; 0031 class KRenameUnformattedWrappedModel; 0032 0033 class TokenHelpDialog : public QDialog 0034 { 0035 Q_OBJECT 0036 public: 0037 TokenHelpDialog(KRenameModel *model, BatchRenamer *renamer, 0038 QLineEdit *edit, QWidget *parent = nullptr); 0039 0040 ~TokenHelpDialog(); 0041 0042 /** Adds a category to the help dialog. 0043 * The category will be added and all its commands will also be added to the "All" category. 0044 * 0045 * \param headline headline of the category 0046 * \param commands list of all tokens 0047 * \param icon icon of the category 0048 * \param first if true make sure that this is the first category (after all) and is selected by 0049 * default. 0050 */ 0051 void add(const QString &headline, const QStringList &commands, const QPixmap &icon, bool first = false); 0052 0053 /** 0054 * Retrieve the separator between token and help 0055 * \returns the token separator 0056 */ 0057 static const QString getTokenSeparator(); 0058 0059 public Q_SLOTS: 0060 int exec(); 0061 0062 private Q_SLOTS: 0063 void slotInsert(); 0064 0065 void slotCategoryChanged(QTreeWidgetItem *item); 0066 void saveConfig(); 0067 0068 void slotEnableControls(); 0069 void slotPreviewClicked(bool bPreview); 0070 void slotUpdatePreview(); 0071 0072 private: 0073 void loadConfig(); 0074 0075 /** 0076 * Select a category by its name. 0077 * \param category user visible name of a category 0078 */ 0079 void selectCategory(const QString &category); 0080 0081 /** 0082 * Add all tokens stored in the list 0083 * m_recent to the list of tokens and to categories. 0084 */ 0085 void addRecentTokens(); 0086 0087 /** 0088 * Add a token to the list of recent tokens. 0089 * \param token the token itself 0090 * \param help the help string for the token 0091 */ 0092 void addToRecentTokens(const QString &token, const QString &help); 0093 0094 private: 0095 KRenameUnformattedWrappedModel *m_model; 0096 0097 Ui::TokenHelpWidget m_widget; 0098 0099 QLineEdit *m_edit; 0100 BatchRenamer *m_renamer; 0101 0102 QMap<QString, QStringList> m_map; 0103 0104 QString m_first; 0105 0106 QString m_lastSelected; 0107 QStringList m_recent; 0108 0109 static const int S_MAX_RECENT; ///< Maximum number of recent tokens 0110 }; 0111 0112 #endif // TOKEN_HELP_DIALOG_H