00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef CustomActionDialog_H
00030 #define CustomActionDialog_H
00031
00032 #include <QDialog>
00033 #include <QXmlDefaultHandler>
00034
00035 class QGroupBox;
00036 class QPushButton;
00037 class QRadioButton;
00038 class QComboBox;
00039 class QListWidget;
00040 class QLineEdit;
00041 class QMenu;
00042 class QToolBar;
00043
00044 class CustomActionDialog : public QDialog
00045 {
00046 Q_OBJECT
00047
00048 public:
00050
00054 CustomActionDialog( QWidget* parent, Qt::WFlags fl = 0 );
00055
00056 private slots:
00057 void chooseIcon();
00058 void chooseFile();
00059 void chooseFolder();
00060 QAction* addAction();
00061 void removeAction();
00062 void setCurrentAction(int);
00063 void saveCurrentAction();
00064
00065 private:
00066 void init();
00067 void updateDisplayList();
00068 QAction* actionAt(int row);
00069 void saveAction(QAction *action);
00070 void customizeAction(QAction *action);
00071 bool validUserInput();
00072 QStringList d_app_shortcut_keys;
00073
00074 QList<QMenu *> d_menus;
00075 QList<QToolBar *> d_app_toolbars;
00076
00077 QListWidget *itemsList;
00078 QPushButton *buttonCancel, *buttonAdd, *buttonRemove, *buttonSave;
00079 QPushButton *folderBtn, *fileBtn, *iconBtn;
00080 QLineEdit *folderBox, *fileBox, *iconBox, *textBox, *toolTipBox, *shortcutBox;
00081 QRadioButton *menuBtn, *toolBarBtn;
00082 QComboBox *menuBox, *toolBarBox;
00083 };
00084
00085 class CustomActionHandler : public QXmlDefaultHandler
00086 {
00087 public:
00088 CustomActionHandler(QAction *action);
00089
00090 bool startElement(const QString &namespaceURI, const QString &localName,
00091 const QString &qName, const QXmlAttributes &attributes);
00092 bool endElement(const QString &namespaceURI, const QString &localName,
00093 const QString &qName);
00094 bool characters(const QString &str){currentText += str; return true;};
00095 bool fatalError(const QXmlParseException &){return false;};
00096 QString errorString() const {return errorStr;};
00097 QString parentName(){return d_widget_name;};
00098
00099 private:
00100 bool metFitTag;
00101 QString currentText;
00102 QString errorStr;
00103 QString filePath;
00104 QString d_widget_name;
00105 QAction *d_action;
00106 };
00107 #endif